/* Emily Morse Coaching brand: mocha, gold, black and white; Anton headings, Roboto text. */
:root {
  --bg: #f8f4f0;
  --surface: #ffffff;
  --surface-2: #f2ebe5;
  --border: #e6dcd3;
  --text: #1c1512;
  --muted: #7d6b60;
  --brand: #83543e;
  --brand-strong: #6a4130;
  --brand-soft: #f2e7df;
  --gold: #d4a15f;
  --gold-soft: #f8eedf;
  --black: #0d0d0d;
  --ok: #2f7d5b;
  --ok-soft: #e2f2ea;
  --warn: #9a6512;
  --warn-soft: #fbefd8;
  --danger: #b43c3c;
  --danger-soft: #f8e2e2;
  --info: #3c5a96;
  --info-soft: #e7edf8;
  --wa: #1f9d55;
  --shadow: 0 1px 2px rgba(60, 35, 20, .05), 0 6px 18px rgba(60, 35, 20, .06);
  --radius: 14px;
  --font-body: 'Roboto', system-ui, -apple-system, sans-serif;
  --font-display: 'Anton', Impact, 'Arial Narrow', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 400; }
h1 { font-family: var(--font-display); font-size: 32px; letter-spacing: .01em; text-transform: uppercase; line-height: 1.1; }
h2 { font-family: var(--font-display); font-size: 19px; letter-spacing: .02em; text-transform: uppercase; }
h3 { font-size: 15px; font-weight: 500; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.error { color: var(--danger); margin: 8px 0 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
pre.msg { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border-radius: 10px; padding: 12px; margin: 0; font: inherit; }

/* Buttons & inputs */
.btn { font: inherit; font-weight: 500; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 16px; border-radius: 999px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--black); border-color: var(--black); color: #fff; letter-spacing: .02em; }
.btn.primary:hover { background: #2b2b2b; }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.brand:hover { background: var(--brand-strong); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.wa:hover { background: #17834a; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
label.check input { width: auto; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #8a5a43, #6a4130); }
.login-card { background: var(--surface); padding: 36px; border-radius: 18px; box-shadow: var(--shadow); width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-card label { text-align: left; }
.login-card .logo { width: 84px; margin: 0 auto; filter: drop-shadow(0 1px 0 rgba(0,0,0,.15)); background: var(--brand); border-radius: 50%; padding: 6px; }

/* Shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--brand); color: #fff; padding: 18px 12px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 6px; }
.brand img { width: 46px; height: 46px; object-fit: contain; }
.brand strong { display: block; font-family: var(--font-display); font-weight: 400; font-size: 17px; letter-spacing: .03em; text-transform: uppercase; line-height: 1.1; }
.brand span { display: block; font-size: 12px; color: rgba(255,255,255,.75); }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
nav a { color: rgba(255,255,255,.88); padding: 8px 12px; border-radius: 10px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; color: #fff; }
nav a.active { background: #fff; color: var(--brand-strong); }
nav .count { background: var(--gold); color: var(--black); border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.who { border-top: 1px solid rgba(255,255,255,.2); padding: 12px 6px 0; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.who .btn { margin-left: auto; color: #fff; border-color: rgba(255,255,255,.4); background: transparent; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; gap: 12px; align-items: center; padding: 12px 28px; border-bottom: 1px solid var(--border); background: var(--bg);
  position: sticky; top: 0; z-index: 5; }
.topbar input[type=search] { max-width: 420px; border-radius: 999px; }
.topbar .clock { margin-left: auto; color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; }
#menu-toggle { display: none; }
.search-results { position: absolute; top: 54px; left: 28px; width: min(420px, calc(100% - 32px)); background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.search-results a { display: flex; justify-content: space-between; padding: 10px 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover { background: var(--surface-2); text-decoration: none; }
#view { padding: 26px 28px 60px; max-width: 1320px; width: 100%; outline: none; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.demo-banner { background: var(--gold-soft); border: 1px solid #ecd7b4; color: #6b4a1a; padding: 8px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }

/* Cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card > header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card > header > .btn, .card > header > a { margin-left: auto; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.stat .label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-family: var(--font-display); font-size: 30px; margin-top: 4px; line-height: 1.15; }
.stat .value.sm { font-size: 22px; }
.stat .sub { color: var(--muted); font-size: 12px; }
.stat.alert { border-color: #efc4c4; background: #fffafa; }
.empty { color: var(--muted); padding: 12px 0; text-align: center; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 500; }
.list .meta { color: var(--muted); font-size: 12px; }
.datebox { width: 48px; text-align: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand-strong); padding: 4px 0; flex-shrink: 0; }
.datebox b { display: block; font-size: 18px; font-family: var(--font-display); font-weight: 400; line-height: 1.1; }
.datebox span { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
tbody tr[data-href], tbody tr.click { cursor: pointer; }
tbody tr[data-href]:hover, tbody tr.click:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.lead { background: var(--info-soft); color: var(--info); }
.badge.discovery { background: #efe6fa; color: #6a42a6; }
.badge.proposal, .badge.link_sent, .badge.pending, .badge.scheduled, .badge.with_lauren { background: var(--warn-soft); color: var(--warn); }
.badge.client, .badge.active, .badge.paid, .badge.completed, .badge.sent, .badge.done, .badge.due { background: var(--ok-soft); color: var(--ok); }
.badge.paused { background: var(--surface-2); color: var(--muted); }
.badge.alumni { background: var(--brand-soft); color: var(--brand-strong); }
.badge.lost, .badge.failed, .badge.cancelled, .badge.no-show, .badge.high, .badge.not_eligible { background: var(--danger-soft); color: var(--danger); }
.badge.gold { background: var(--gold-soft); color: #8a5d1f; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 11px; background: var(--surface-2); color: var(--muted); margin: 1px 2px 1px 0; }
.overdue-text { color: var(--danger); font-weight: 500; }
.ok-text { color: var(--ok); font-weight: 500; }

/* Filters */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.chip { border: 1px solid var(--border); background: var(--surface); padding: 5px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; color: var(--text); }
.chip.active { background: var(--black); border-color: var(--black); color: #fff; }
.chip .n { opacity: .65; margin-left: 4px; }

/* Pipeline */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.column { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 300px; display: flex; flex-direction: column; gap: 8px; }
.column.drop { outline: 2px dashed var(--brand); outline-offset: -2px; }
.column > header { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 6px; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.deal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; cursor: grab; box-shadow: var(--shadow); }
.deal.dragging { opacity: .4; }
.deal .name { font-weight: 500; }
.deal .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Profile */
.profile { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 22px; flex-shrink: 0; }
.avatar.sm { width: 34px; height: 34px; font-size: 14px; }
.fields { display: grid; grid-template-columns: 112px 1fr; gap: 8px 12px; margin: 14px 0 0; }
.fields dt { color: var(--muted); font-size: 12px; padding-top: 1px; }
.fields dd { margin: 0; word-break: break-word; white-space: pre-wrap; }
.side-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.demo-box { margin-top: 16px; padding: 12px; border: 1px dashed #e2c89f; border-radius: 12px; background: var(--gold-soft); }
.demo-box .small { color: #6b4a1a; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs button { font: inherit; font-weight: 500; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--black); border-color: var(--gold); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0 10px 18px; border-left: 2px solid var(--border); position: relative; margin-left: 6px; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline li.k-stage::before, .timeline li.k-payment::before { background: var(--gold); }
.timeline li.k-email::before { background: var(--info); }
.timeline .body { white-space: pre-wrap; word-break: break-word; }
.note-box { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.note-box .row select { width: auto; }
.brief section { margin-bottom: 14px; }
.brief h3 { margin-bottom: 4px; }
.flags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

/* Check-in week strip */
.week { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.week button { font: inherit; text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 10px 14px; cursor: pointer; }
.week button.active { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); }
.week .d { font-family: var(--font-display); text-transform: uppercase; font-size: 16px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; background: var(--gold); border-radius: 999px; }

/* Modal */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(640px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(30, 18, 10, .5); }
dialog form > header { display: flex; align-items: center; padding: 18px 20px 0; }
dialog form > header .icon-btn { margin-left: auto; }
dialog footer { display: flex; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
dialog .error { padding: 0 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px 20px; max-height: 68vh; overflow-y: auto; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .hint { grid-column: 1 / -1; color: var(--muted); font-size: 12px; margin: -4px 0 0; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--black); color: #fff; padding: 10px 18px;
  border-radius: 999px; box-shadow: var(--shadow); z-index: 100; font-weight: 500; }

@media (max-width: 960px) { .profile { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  #menu-toggle { display: block; }
  .topbar { padding: 10px 16px; }
  .topbar .clock { display: none; }
  .search-results { left: 16px; }
  #view { padding: 16px 16px 60px; }
  .grid.two { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .week { grid-template-columns: 1fr; }
  h1 { font-size: 26px; }
  .hide-sm { display: none; }
}

/* Green / amber / red client status */
.rag { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--border); vertical-align: middle; flex-shrink: 0; }
.rag.green { background: #2f9e5b; }
.rag.amber { background: #e3a21a; }
.rag.red { background: #d04545; }
.rag.lg { width: 16px; height: 16px; }
.rag-pick { display: flex; gap: 8px; }
.rag-pick label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid var(--border); border-radius: 12px; padding: 10px; cursor: pointer; color: var(--text); font-weight: 500; }
.rag-pick input { display: none; }
.rag-pick label:has(input:checked) { border-color: var(--black); background: var(--surface-2); }
.history { display: flex; gap: 4px; align-items: center; }
.lastnote { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; font-size: 13px; }

/* Emily's week (availability for booking calls) */
.wk { display: grid; grid-template-columns: 64px repeat(7, minmax(92px, 1fr)); overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.wk .head { position: sticky; top: 0; background: var(--surface); padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: center; font-size: 12px; font-weight: 700; }
.wk .head.today { color: var(--brand-strong); }
.wk .hours { position: relative; border-right: 1px solid var(--border); }
.wk .hours div { position: absolute; right: 6px; font-size: 10px; color: var(--muted); transform: translateY(-6px); text-align: right; line-height: 1.1; }
.wk .col { position: relative; border-right: 1px solid var(--border); cursor: copy; background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface) 6px 12px); }
.wk .col:last-child { border-right: 0; }
.wk .open { position: absolute; left: 0; right: 0; background: #fff; }
.wk .line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); }
.wk .blk { position: absolute; left: 3px; right: 3px; border-radius: 6px; font-size: 11px; padding: 2px 5px; overflow: hidden; cursor: default; }
.wk .blk.busy { background: #c9bdb5; color: #3b2d25; }
.wk .blk.call { background: var(--brand); color: #fff; cursor: pointer; }
.wk .now { position: absolute; left: 0; right: 0; border-top: 2px solid #d04545; }

/* Booking page transformation photos (Settings) */
.results-edit { display: grid; gap: 10px; }
.result-row { display: grid; grid-template-columns: 84px 1fr auto; gap: 12px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.result-row img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; background: var(--bg, #f4efe9); }
.result-fields { display: grid; gap: 6px; }
.result-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 600px) { .result-row { grid-template-columns: 64px 1fr; } .result-row img { width: 64px; height: 64px; } .result-actions { grid-column: 1 / -1; } }
