:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --warning: #f5a623;
  --danger: #e24b4a;
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 0 78px;
  background: var(--bg-page);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 28px 22px 24px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  border-radius: 0 0 34px 34px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
}

.title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 27px;
  line-height: 1.25;
}

h2 {
  margin-bottom: 14px;
  font-size: 22px;
  line-height: 1.3;
}

.heading-sub {
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 700;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.content {
  padding: 22px 20px 26px;
}

.card {
  margin-bottom: 16px;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.section-label {
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 700;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 16px;
  outline: none;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--text-primary);
  background: #ffffff;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--text-primary);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
  font-weight: 700;
}

.button.primary {
  color: #ffffff;
  background: var(--text-primary);
  border-color: var(--text-primary);
}

.button.cta {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.18);
  font-size: 20px;
}

.button.secondary {
  color: var(--accent);
  background: var(--accent-light);
  border-color: #bfdbfe;
}

.button.inline {
  width: auto;
  min-height: 42px;
}

.button-row {
  display: flex;
  gap: 8px;
}

.send-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.choice-button,
.product-button {
  min-height: 54px;
  padding: 12px 14px;
  color: var(--text-secondary);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  font-weight: 800;
}

.choice-button.active,
.product-button.active {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.16);
}

.product-panel {
  padding: 16px;
  background: var(--accent-light);
  border: 1px solid #bfdbfe;
  border-radius: 20px;
}

.product-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.product-button {
  width: auto;
  min-width: 88px;
  min-height: 48px;
  color: var(--accent);
  border-color: #bfdbfe;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--border);
  border-radius: 18px;
}

.stat-item {
  padding: 13px 8px;
  text-align: center;
  background: #ffffff;
}

.stat-num {
  display: block;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  display: block;
  margin-top: 5px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
}

.record-card {
  position: relative;
  padding: 14px 14px 14px 18px;
}

.record-card::before {
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  content: "";
}

.record-card.missed::before {
  background: var(--danger);
}

.record-card.pending::before {
  background: var(--warning);
}

.record-card.done::before {
  background: #cccccc;
}

.record-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.customer-name {
  margin-bottom: 2px;
  font-size: 20px;
  font-weight: 800;
}

.meta {
  color: var(--text-secondary);
  font-size: 15px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  color: var(--text-primary);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.history-card {
  display: grid;
  grid-template-columns: 1fr 84px;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.history-main {
  min-width: 0;
  padding: 0;
  text-align: left;
  background: transparent;
  border: 0;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 26px;
  margin: 2px 0 4px;
  padding: 2px 9px;
  overflow: hidden;
  color: var(--accent);
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.follow-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 8px;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 900;
}

.follow-icon {
  width: 18px;
  height: 18px;
  margin-bottom: 3px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50% 50% 45% 45%;
}

.follow-icon::after {
  display: block;
  width: 6px;
  height: 2px;
  margin: 17px auto 0;
  background: currentColor;
  border-radius: 999px;
  content: "";
}

.message-preview {
  white-space: pre-wrap;
  word-break: keep-all;
  padding: 16px;
  color: rgba(255, 255, 255, 0.9);
  background: #0f172a;
  border-radius: 20px;
  font-size: 16px;
  line-height: 1.75;
}

.script-box {
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
  font-size: 17px;
  line-height: 1.8;
}

.quiet-bar {
  padding: 7px 10px;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
}

.empty {
  padding: 24px 10px;
  color: var(--text-secondary);
  text-align: center;
}

.bottom-tabs {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 520px;
  margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
  background: #ffffff;
  border-top: 1px solid var(--border);
}

.tab {
  min-height: 58px;
  color: #888888;
  background: #ffffff;
  border: 0;
  font-size: 15px;
  font-weight: 600;
}

.tab.active {
  color: var(--accent);
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 78px;
  left: 20px;
  z-index: 10;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 14px;
  color: #ffffff;
  text-align: center;
  background: #111111;
  border-radius: 999px;
  font-weight: 700;
}

@media (max-width: 390px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .stat-num {
    font-size: 24px;
  }
}
