/* WA Follow Up — light ledger. No dark mode. */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --paper: #F3EDE1;
  --paper-2: #EBE3D4;
  --sheet: #FFFbf5;
  --ink: #1A2A22;
  --ink-soft: #3E5248;
  --line: #D4CBB8;
  --line-strong: #B9AE97;
  --forest: #1F5C3A;
  --forest-hover: #16462C;
  --forest-tint: #E4F0E6;
  --mango: #C24E0E;
  --mango-hover: #9E3E09;
  --mango-tint: #FDE7D4;
  --brick: #9B2C2C;
  --brick-hover: #7A1F1F;
  --brick-tint: #F8DCDC;
  --gold: #8A6A12;
  --gold-tint: #F6E9B8;
  --shadow: 0 1px 0 rgba(26,42,34,0.04), 0 8px 24px rgba(26,42,34,0.08);
  --shadow-lg: 0 2px 4px rgba(26,42,34,0.06), 0 16px 40px rgba(26,42,34,0.12);
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 18px;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --font: "Figtree", "Segoe UI", system-ui, sans-serif;
  --serif: "Literata", "Georgia", serif;
  --tap: 48px;
  --header-h: 60px;
  --nav-h: 64px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    transparent,
    transparent 27px,
    rgba(26,42,34,0.035) 28px
  );
  mask-image: linear-gradient(180deg, transparent, #000 80px);
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

::selection { background: var(--forest-tint); color: var(--ink); }
:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 2px;
}

a { color: var(--forest); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 {
  margin: 0 0 var(--s3);
  line-height: 1.2;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: clamp(1.2rem, 3vw, 1.5rem); }
h3 { font-size: 1.125rem; }
p { margin: 0 0 var(--s3); }

.container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 var(--s4);
}
.page {
  flex: 1;
  padding: calc(var(--header-h) + var(--s5)) 0 calc(var(--nav-h) + var(--s5));
}
.page-manage-content { padding: 0; max-width: none; }

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: 0 var(--s4);
  z-index: 100;
}
.header__mark {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-width: 0;
}
.header__mark a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: var(--s3); }
.header__logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--forest);
  color: var(--sheet);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.header__title {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 650;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header__actions { display: none; gap: var(--s2); }
@media (min-width: 720px) {
  .header__actions { display: flex; }
  .page { padding-bottom: var(--s7); }
}

/* ===== Bottom nav (mobile) ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--sheet);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.is-current { color: var(--forest); }
@media (min-width: 720px) {
  .bottom-nav { display: none; }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  height: var(--tap);
  min-width: var(--tap);
  padding: 0 var(--s4);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1;
  border: none;
  border-radius: var(--r);
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease, box-shadow 0.12s ease;
  text-decoration: none;
  white-space: nowrap;
  color: inherit;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--forest); outline-offset: 3px; }
.btn--primary { background: var(--forest); color: #fff; }
.btn--primary:hover { background: var(--forest-hover); }
.btn--secondary {
  background: var(--sheet);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn--secondary:hover { background: var(--paper-2); }
.btn--danger { background: var(--brick); color: #fff; }
.btn--danger:hover { background: var(--brick-hover); }
.btn--success { background: var(--mango); color: #fff; }
.btn--success:hover { background: var(--mango-hover); }
.btn--ghost { background: transparent; color: var(--ink-soft); }
.btn--ghost:hover { background: var(--paper-2); color: var(--ink); }
.btn--sm { height: 40px; padding: 0 var(--s3); font-size: 0.875rem; }
.btn--lg { height: 56px; padding: 0 var(--s5); font-size: 1.05rem; }
.btn--full { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ===== Inputs ===== */
.input-group { margin-bottom: var(--s4); }
.label {
  display: block;
  margin-bottom: var(--s2);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.input {
  width: 100%;
  height: var(--tap);
  padding: 0 var(--s4);
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--sheet);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input::placeholder { color: #8A958D; }
.input:hover { border-color: var(--ink-soft); }
.input:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px var(--forest-tint);
}
.input:disabled { opacity: 0.5; cursor: not-allowed; }
.helper-text { margin-top: var(--s2); font-size: 0.8125rem; color: var(--ink-soft); }
.error-text { margin-top: var(--s1); font-size: 0.8125rem; color: var(--brick); }
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%233E5248' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s3) center;
  padding-right: 40px;
}
textarea.input {
  height: auto;
  min-height: 120px;
  padding: var(--s3) var(--s4);
  resize: vertical;
  line-height: 1.55;
}

/* ===== Cards ===== */
.card {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: var(--s5);
}

/* ===== Flash ===== */
.flash {
  padding: var(--s3) var(--s4);
  border-radius: var(--r);
  margin-bottom: var(--s4);
  font-size: 0.9375rem;
  font-weight: 550;
}
.flash--success { background: var(--forest-tint); color: var(--forest-hover); border: 1px solid #9FCBAA; }
.flash--error { background: var(--brick-tint); color: var(--brick); border: 1px solid #E8A0A0; }
.flash--warning { background: var(--gold-tint); color: var(--gold); border: 1px solid #E2C56A; }
.flash--info { background: var(--forest-tint); color: var(--forest); border: 1px solid #9FCBAA; }

/* ===== Home ===== */
.home-hero {
  margin-bottom: var(--s5);
}
.home-hero h2 {
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  margin-bottom: var(--s2);
}
.home-hero p { color: var(--ink-soft); margin: 0; font-size: 1.02rem; }

.phone-stage {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: var(--s5);
  margin-bottom: var(--s4);
}
.phone-stage .input {
  height: 64px;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.action-stack { display: grid; gap: var(--s3); }
.action-stack .btn { height: 56px; font-size: 1.02rem; }

/* ===== Add Number ===== */
.add-number__header { margin-bottom: var(--s5); }
.add-number__header h2 { margin-bottom: var(--s2); }
.add-number__header p { color: var(--ink-soft); margin: 0; }

.add-number__steps {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--s2);
  margin-bottom: var(--s5);
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--ink-soft);
}
.step::before {
  content: "";
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--paper-2);
  border: 1.5px solid var(--line-strong);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.75rem;
}
.step--1::before { content: "1"; }
.step--2::before { content: "2"; }
.step--3::before { content: "3"; }
.step--active { color: var(--forest); }
.step--active::before { background: var(--forest); color: #fff; border-color: var(--forest); }
.step--done { color: var(--forest); }
.step--done::before { background: var(--forest-tint); color: var(--forest); border-color: var(--forest); content: "✓"; }

/* ===== Manage Content ===== */
.manage-layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  align-content: start;
  min-height: calc(100vh - var(--header-h));
  padding-top: var(--header-h);
}
@media (min-width: 900px) {
  .manage-layout {
    grid-template-columns: 280px 1fr;
    grid-template-rows: 1fr;
    align-content: stretch;
  }
  .page-manage-content { padding: 0; }
}

.sidebar {
  background: var(--sheet);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  max-height: 40vh;
}
@media (min-width: 900px) {
  .sidebar {
    max-height: none;
    height: calc(100vh - var(--header-h));
    position: sticky;
    top: var(--header-h);
    border-bottom: none;
    border-right: 1px solid var(--line);
  }
}
.sidebar__header { padding: var(--s4); border-bottom: 1px solid var(--line); }
.sidebar__title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
  font-family: var(--font);
}
.sidebar__list { flex: 1; overflow-y: auto; padding: var(--s3); }
.category-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3);
  border-radius: var(--r);
  cursor: pointer;
  margin-bottom: var(--s2);
  border: 1px solid transparent;
}
.category-item:hover { background: var(--paper); }
.category-item--active {
  background: var(--forest-tint);
  border-color: color-mix(in srgb, var(--forest) 25%, transparent);
}
.category-item__icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--forest);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  user-select: none;
}
.category-item__icon--empty {
  color: var(--ink-soft);
  opacity: 0.65;
}
.category-item--active .category-item__icon {
  background: var(--sheet);
  color: var(--forest);
}
.category-item--active .category-item__icon--empty {
  color: var(--ink-soft);
  opacity: 0.8;
}
.category-item__info { flex: 1; min-width: 0; }
.category-item__name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.category-item__count { font-size: 0.75rem; color: var(--ink-soft); }
.category-item__actions { display: flex; gap: 2px; }
.category-item__btn {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
}
.category-item__btn:hover { background: var(--paper); color: var(--ink); }
.category-item__btn--danger:hover { color: var(--brick); background: var(--brick-tint); }
.sidebar__footer { padding: var(--s4); border-top: 1px solid var(--line); }

.content-area {
  padding: var(--s4);
  padding-bottom: calc(var(--nav-h) + var(--s5));
  overflow-y: auto;
}
@media (min-width: 720px) {
  .content-area {
    padding: var(--s5);
  }
}
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s4);
  flex-wrap: wrap;
}
@media (min-width: 720px) {
  .content-header {
    margin-bottom: var(--s5);
  }
}
.content-header__title { margin: 0; }
.content-tabs {
  display: flex;
  gap: var(--s1);
  margin-bottom: var(--s4);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 720px) {
  .content-tabs {
    margin-bottom: var(--s5);
  }
}
.tab-btn {
  padding: var(--s3) var(--s4);
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn--active { color: var(--forest); }
.tab-btn--active::after {
  content: "";
  position: absolute;
  left: var(--s4); right: var(--s4); bottom: -1px;
  height: 2px;
  background: var(--forest);
}
.tab-panel { display: none; }
.tab-panel--active { display: block; }

.followup-list,
.penawaran-list { display: flex; flex-direction: column; gap: var(--s3); }
.followup-item {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: var(--s4);
  align-items: start;
  padding: var(--s4);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.followup-item__day {
  font-family: var(--serif);
  font-weight: 650;
  color: var(--forest);
  font-size: 0.95rem;
}
.followup-item__message { font-size: 0.95rem; line-height: 1.6; white-space: pre-wrap; }
.followup-item__actions { display: flex; gap: var(--s2); }
@media (max-width: 640px) {
  .followup-item { grid-template-columns: 1fr; }
}
.followup-item--penawaran {
  grid-template-columns: 1fr auto;
}
@media (max-width: 640px) {
  .followup-item--penawaran { grid-template-columns: 1fr; }
}

.paid-message-card__label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: var(--s2);
  font-family: var(--font);
}

.empty-state {
  text-align: center;
  padding: var(--s7) var(--s4);
  color: var(--ink-soft);
}
.empty-state__icon {
  width: 48px; height: 48px;
  margin: 0 auto var(--s3);
  color: var(--line-strong);
}
.empty-state__title { margin-bottom: var(--s2); color: var(--ink); font-family: var(--serif); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,42,34,0.38);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
  z-index: 200;
  opacity: 0; visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}
.modal-overlay--open { opacity: 1; visibility: visible; }
.modal {
  background: var(--sheet);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 92vh;
  overflow: hidden;
  transform: translateY(16px);
  transition: transform 0.18s ease;
}
.modal-overlay--open .modal { transform: none; }
@media (min-width: 560px) {
  .modal-overlay { align-items: center; padding: var(--s4); }
  .modal { max-width: 480px; border-radius: var(--r-lg); }
}
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line);
}
.modal__title { margin: 0; font-size: 1.2rem; }
.modal__close {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: transparent; border: none;
  color: var(--ink-soft); cursor: pointer;
}
.modal__close:hover { background: var(--paper); color: var(--ink); }
.modal__body { padding: var(--s5); overflow-y: auto; max-height: 60vh; }
.modal__footer {
  display: flex; justify-content: flex-end; gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--line);
}

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  font-size: 0.75rem; font-weight: 650;
  border-radius: 999px;
}
.badge--active { background: var(--forest-tint); color: var(--forest); }
.badge--paid { background: var(--mango-tint); color: var(--mango); }
.badge--cancelled { background: var(--brick-tint); color: var(--brick); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.text-muted { color: var(--ink-soft); }
.mt-3 { margin-top: var(--s3); }
.mt-4 { margin-top: var(--s4); }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: fixed; inset: 0;
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
}
.loading-overlay--hidden { display: none; }
