/* AMP Dashboard — light working surface, crimson & gold brand */
:root {
  --brand: #af0c3a;
  --brand-dark: #8a0a2e;
  --brand-soft: #fbe9ee;
  --gold: #c8961b;
  --gold-soft: #fdf4dc;
  --ink: #0e1012;
  --ink-2: #16191c;
  --bg: #f4f4f2;
  --card: #ffffff;
  --line: #e3e3df;
  --text: #16191c;
  --muted: #62676d;
  --ok: #1d7a46;
  --ok-soft: #e3f4ea;
  --warn: #9a5b00;
  --warn-soft: #fdf0dc;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
  --font-display: "Oswald", "Arial Narrow", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .02em; font-weight: 600; margin: 0; line-height: 1.1; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- buttons & inputs ---------- */
.btn { font: 600 .9rem var(--font-body); border-radius: 8px; padding: 10px 16px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; white-space: nowrap; }
.btn:hover { border-color: #c9c9c4; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 6px 11px; min-height: 32px; font-size: .82rem; }
.btn-ok { background: var(--ok-soft); border-color: #bfe3cd; color: var(--ok); }
.link { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 6px 0; }
.icon-btn { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); width: 40px; height: 40px; }
label { display: grid; gap: 5px; font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
input, select, textarea { font: 400 1rem var(--font-body); text-transform: none; letter-spacing: 0; color: var(--text); background: #fff; border: 1px solid #d6d6d1; border-radius: 8px; padding: 10px 12px; width: 100%; min-height: 42px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(175,12,58,.25); border-color: var(--brand); }
.check { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text); font-size: .95rem; }
.check input { width: 18px; height: 18px; min-height: 0; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 50% 0%, rgba(175,12,58,.35), transparent 60%), var(--ink); }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 16px; padding: 32px 28px; display: grid; gap: 14px; text-align: center; }
.login-card label { text-align: left; }
.login-logo { width: 84px; height: 84px; margin: 0 auto; }
.error { color: var(--bad); background: var(--bad-soft); border-radius: 8px; padding: 9px 12px; margin: 0; font-size: .9rem; }

/* ---------- shell ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }
.sidebar { background: var(--ink); color: #fff; padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 0 8px; }
.brand img { width: 46px; height: 46px; }
.brand span { font-family: var(--font-display); font-size: 1.3rem; letter-spacing: .06em; line-height: 1; }
.brand small { display: block; font-size: .7rem; color: #a7a9ab; letter-spacing: .14em; margin-top: 3px; }
.nav { display: grid; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; color: #c9cbcd; padding: 11px 12px; border-radius: 8px; font-weight: 500; position: relative; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--brand); color: #fff; }
.nav svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.badge { margin-left: auto; background: #f2c230; color: #16191c; border-radius: 999px; font-size: .72rem; padding: 2px 7px; font-weight: 700; }
.main { min-width: 0; }
.demo-banner { background: var(--gold-soft); color: #6b4f00; border-bottom: 1px solid #f1dca6; padding: 9px 20px; font-size: .88rem; font-weight: 500; }
.view { padding: 26px 28px 60px; max-width: 1180px; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.view-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--ink); color: #a7a9ab; font-family: var(--font-display); letter-spacing: .1em; text-transform: uppercase; }

/* ---------- cards & lists ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--font-display); font-size: 1.9rem; line-height: 1; color: var(--text); }
.stat span { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat.alert b { color: var(--brand); }
.empty { color: var(--muted); padding: 14px 4px; font-size: .92rem; }
.list { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.row { color: inherit; }
a.row:hover { background: #fafaf8; }
.time { font-family: var(--font-display); font-size: 1.05rem; min-width: 64px; color: var(--text); }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.pill.scheduled { background: #eef0f3; color: #3f4650; }
.pill.done, .pill.active, .pill.booked { background: var(--ok-soft); color: var(--ok); }
.pill.no-show, .pill.owed { background: var(--bad-soft); color: var(--bad); }
.pill.cancelled, .pill.past, .pill.closed { background: #efefec; color: #74787d; }
.pill.new { background: var(--gold-soft); color: #7a5800; }
.pill.contacted { background: #e6eefb; color: #2556a8; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 320px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 8px 14px; font: 600 .85rem var(--font-body); color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--ink); color: #fff; }

/* clients table */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr { cursor: pointer; }
.table tbody tr:hover { background: #fafaf8; }
.table .name { font-weight: 600; }

/* ---------- client detail ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; margin-bottom: 12px; }
.client-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.client-head .meta { color: var(--muted); margin-top: 6px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.meter { height: 10px; border-radius: 999px; background: #ececea; overflow: hidden; margin: 8px 0 6px; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.big-num { font-family: var(--font-display); font-size: 2.2rem; line-height: 1; }
.test-row { display: grid; grid-template-columns: 1fr auto auto 90px; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.test-row:first-of-type { border-top: 0; }
.delta.good { color: var(--ok); font-weight: 600; }
.delta.bad { color: var(--bad); font-weight: 600; }
.spark { width: 90px; height: 28px; }
.ledger .amt { font-family: var(--font-display); font-size: 1.05rem; white-space: nowrap; }
.ledger .amt.pay { color: var(--ok); }

/* ---------- schedule ---------- */
.week-nav { display: flex; align-items: center; gap: 8px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 180px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; }
.day-head b { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .04em; }
.day-head span { color: var(--muted); font-size: .85rem; }
.sess { border-radius: 8px; padding: 8px 9px; background: #f6f6f4; border-left: 3px solid var(--brand); cursor: pointer; min-width: 0; }
.sess:hover { background: #efefec; }
.sess .t { font-weight: 700; font-size: .82rem; }
.sess .n { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess.done { border-left-color: var(--ok); }
.sess.no-show { border-left-color: var(--bad); }
.sess.cancelled { border-left-color: #b9bbbe; opacity: .65; }
.sess.cancelled .n { text-decoration: line-through; }
.add-slot { margin-top: auto; border: 1px dashed #cfcfca; background: none; border-radius: 8px; padding: 6px; color: var(--muted); font: 600 .8rem var(--font-body); cursor: pointer; }
.add-slot:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- inquiries ---------- */
.inq { display: grid; gap: 10px; }
.inq-card .msg { background: #f7f7f5; border-radius: 8px; padding: 10px 12px; margin: 10px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.inq-card .facts { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .88rem; }
.inq-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- dialog ---------- */
.dialog { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.dialog::backdrop { background: rgba(14,16,18,.55); }
.dialog-form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 20px; border-bottom: 1px solid var(--line); }
.dialog-body { padding: 18px 20px; overflow-y: auto; display: grid; gap: 14px; }
.dialog-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.dialog-foot .left { margin-right: auto; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fields .full { grid-column: 1 / -1; }
.fieldset-title { grid-column: 1 / -1; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .06em; color: var(--brand); font-size: .9rem; margin-top: 6px; }

code { background: #f0f0ee; padding: 1px 6px; border-radius: 4px; font-size: .85em; overflow-wrap: anywhere; }
.steps-list { margin: 6px 0 14px; padding-left: 20px; color: var(--muted); font-size: .92rem; }
.steps-list li { margin: 5px 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 500; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- phone ---------- */
@media (max-width: 1000px) {
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 20; flex-direction: row; }
  .brand { display: none; }
  .nav { grid-template-columns: repeat(6, 1fr); width: 100%; gap: 2px; }
  .nav a { flex-direction: column; gap: 3px; padding: 7px 0; font-size: .62rem; justify-content: center; }
  .nav .badge { position: absolute; top: 2px; right: 50%; margin-right: -22px; }
  .view { padding: 18px 16px 100px; }
  .row .title, .row .sub { white-space: normal; }
  .grid-2, .grid-3, .fields { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--line); padding: 10px 4px; }
  .table td { border: 0; padding: 2px 0; }
  .table td.hide-sm { display: none; }
  .test-row { grid-template-columns: 1fr auto; }
  .test-row .spark { display: none; }
  .dialog { width: 100vw; max-width: 100vw; max-height: 100vh; border-radius: 16px 16px 0 0; margin: auto 0 0; }
  .dialog-form { max-height: 92vh; }
}
