:root {
  --navy: #0f1115;
  --navy-2: #1f232b;
  --navy-3: #0552c2;
  --gold: #086cfc;
  --gold-soft: #e9f1fe;
  --ink: #1b2230;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f6f6f4;
  --card: #ffffff;
  --green: #2f7d5b;
  --green-soft: #e5f3ec;
  --amber: #a86a12;
  --amber-soft: #fbf0dc;
  --red: #b3403a;
  --red-soft: #f9e6e4;
  --blue-soft: #e8eef8;
  --radius: 10px;
  --serif: "Archivo", -apple-system, sans-serif;
  --sans: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); font-size: 14px; color: var(--ink); background: var(--bg); line-height: 1.5; }
h1, h2, h3 { font-family: var(--serif); font-weight: 750; font-stretch: 110%; letter-spacing: -0.01em; margin: 0; color: var(--navy); }
h1 { font-size: 30px; }
h2 { font-size: 23px; }
h3 { font-size: 17px; }
a { color: var(--navy-3); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-brand { background: var(--navy); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-brand h1 { color: #fff; font-size: 44px; line-height: 1.1; max-width: 460px; }
.login-brand p { color: #c6cfdd; max-width: 420px; font-size: 15px; }
.brand-mark { display: flex; align-items: center; gap: 12px; }
.brand-mark .logo { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--gold); display: grid; place-items: center; font-family: var(--serif); font-size: 22px; color: var(--gold); }
.brand-mark .name { font-family: var(--serif); font-size: 20px; letter-spacing: .5px; }
.brand-mark .name small { display: block; font-family: var(--sans); font-size: 10.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); }
.login-form-wrap { display: grid; place-items: center; padding: 40px; }
.login-form { width: 100%; max-width: 360px; }
.login-form h2 { margin-bottom: 6px; }
.login-form .sub { color: var(--muted); margin: 0 0 24px; }
.demo-accounts { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 18px; }
.demo-accounts p { font-size: 12px; color: var(--muted); margin: 0 0 8px; text-transform: uppercase; letter-spacing: 1px; }
.demo-btn { display: flex; justify-content: space-between; width: 100%; padding: 9px 12px; margin-bottom: 6px; background: #fff; border: 1px solid var(--line); border-radius: 8px; text-align: left; }
.demo-btn:hover { border-color: var(--gold); }
.demo-btn span { color: var(--muted); font-size: 12px; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #c6cfdd; padding: 22px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand-mark { padding: 0 8px 22px; color: #fff; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-radius: 8px; color: #c6cfdd; text-decoration: none; }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a.active { background: var(--navy-2); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav .count { background: var(--gold); color: #fff; font-size: 11px; font-weight: 600; border-radius: 10px; padding: 0 7px; }
.sidebar-foot { border-top: 1px solid var(--navy-2); padding: 14px 8px 0; font-size: 13px; }
.sidebar-foot .who { color: #fff; font-weight: 500; }
.sidebar-foot button { background: none; border: none; color: var(--gold); padding: 0; margin-top: 4px; }
.main { padding: 32px 40px 60px; max-width: 1180px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- Components ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-family: var(--serif); font-size: 30px; font-stretch: 110%; color: var(--navy); font-weight: 600; line-height: 1.2; }
.stat .hint { font-size: 12.5px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--navy); background: var(--navy); color: #fff; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--navy-2); }
.btn.secondary { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--navy-3); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.danger { background: #fff; color: var(--red); border-color: var(--line); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; }
.link-btn { background: none; border: none; color: var(--navy-3); padding: 0; text-decoration: underline; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 500; margin-bottom: 5px; color: var(--ink); }
.field input, .field select, .field textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
.field textarea { min-height: 90px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.error { color: var(--red); font-size: 13px; margin: 0 0 12px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fafaf8; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; background: var(--blue-soft); color: var(--navy-3); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.gray { background: #eef0f3; color: var(--muted); }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold-soft); color: var(--navy); display: inline-grid; place-items: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.person { display: flex; align-items: center; gap: 10px; }
.person .meta { font-size: 12.5px; color: var(--muted); }

.progress { height: 8px; background: #eef0f3; border-radius: 5px; overflow: hidden; }
.progress > div { height: 100%; background: var(--gold); border-radius: 5px; }
.goal { padding: 16px 0; border-bottom: 1px solid var(--line); }
.goal:last-child { border-bottom: none; padding-bottom: 0; }
.goal:first-child { padding-top: 0; }
.goal-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.goal-title { font-weight: 600; }
.goal-pct { font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--navy); }
.check { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.check input { accent-color: var(--navy); width: 15px; height: 15px; }
.check.done span { color: var(--muted); text-decoration: line-through; }

.empty { color: var(--muted); text-align: center; padding: 26px 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }
.list-item:first-child { padding-top: 0; }
.date-chip { width: 52px; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 4px 0; flex-shrink: 0; }
.date-chip .m { font-size: 10.5px; text-transform: uppercase; color: var(--gold); font-weight: 600; letter-spacing: 1px; }
.date-chip .d { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--navy); line-height: 1; }
.row { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--navy); border-color: var(--gold); font-weight: 500; }

/* Messages */
.chat { display: grid; grid-template-columns: 280px 1fr; height: calc(100vh - 150px); min-height: 480px; padding: 0; overflow: hidden; }
.chat.single { grid-template-columns: 1fr; }
.threads { border-right: 1px solid var(--line); overflow-y: auto; }
.thread { display: flex; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.thread:hover { background: #fafaf8; }
.thread.active { background: var(--gold-soft); }
.thread .preview { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.thread .unread { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-left: auto; margin-top: 6px; flex-shrink: 0; }
.convo { display: flex; flex-direction: column; min-width: 0; }
.convo-head { padding: 14px 20px; border-bottom: 1px solid var(--line); }
.bubbles { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: #fcfcfb; }
.bubble { max-width: 70%; padding: 10px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line); white-space: pre-wrap; }
.bubble.mine { align-self: flex-end; background: var(--navy); color: #fff; border-color: var(--navy); }
.bubble .ts { display: block; font-size: 11px; opacity: .6; margin-top: 4px; }
.composer { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }

/* Invoice */
.invoice-doc { padding: 34px; }
.invoice-doc .inv-head { display: flex; justify-content: space-between; margin-bottom: 30px; }
.invoice-doc .totals { margin-left: auto; width: 260px; margin-top: 14px; }
.invoice-doc .totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.invoice-doc .totals .grand { border-top: 2px solid var(--navy); margin-top: 6px; padding-top: 8px; font-weight: 600; font-size: 16px; }
.line-item { display: grid; grid-template-columns: 1fr 70px 100px 32px; gap: 8px; margin-bottom: 8px; }
.line-item input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; width: 100%; }

/* Slots */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.slot { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 9px; text-align: center; }
.slot:hover { border-color: var(--gold); background: var(--gold-soft); }
.slot .d { font-size: 12px; color: var(--muted); }
.slot .t { font-weight: 600; color: var(--navy); }
.day-toggles { display: flex; gap: 6px; flex-wrap: wrap; }
.day-toggles label { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: flex; gap: 6px; align-items: center; }

/* Contract */
.contract-body { white-space: pre-wrap; background: #fcfcfb; border: 1px solid var(--line); border-radius: 8px; padding: 20px; max-height: 360px; overflow-y: auto; font-size: 13.5px; }
.signature { font-family: "Brush Script MT", "Snell Roundhand", cursive; font-size: 30px; color: var(--navy); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,35,59,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head button { background: none; border: none; font-size: 22px; color: var(--muted); line-height: 1; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.banner { background: var(--gold-soft); border: 1px solid #c9dcfd; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 32px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .main { padding: 24px 18px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .threads { max-height: 220px; border-right: none; border-bottom: 1px solid var(--line); }
}

@media print {
  body { background: #fff; }
  .shell, .toast { display: none !important; }
  .modal-backdrop { position: static; background: none; padding: 0; display: block; }
  .modal { box-shadow: none; max-height: none; max-width: none; }
  .modal-head button, .modal-foot { display: none; }
  .contract-body { max-height: none; border: none; }
}
td { white-space: nowrap; } td:first-child, .goal td, .modal td:first-child { white-space: normal; }

/* Brand additions */
.brand-logo { display: block; padding: 4px 8px 22px; }
.brand-logo img { width: 100%; max-width: 190px; filter: invert(1) hue-rotate(180deg) brightness(1.4); }
.login-brand .brand-logo img { max-width: 260px; }
.compass-bar { display: grid; grid-template-columns: repeat(4, 1fr); height: 4px; }
.compass-bar span:nth-child(1) { background: #d91c1c; } .compass-bar span:nth-child(2) { background: #17a307; }
.compass-bar span:nth-child(3) { background: #e8730a; } .compass-bar span:nth-child(4) { background: #086cfc; }
.back-to-site { color: #c6cfdd; text-decoration: none; font-size: 13px; }
.back-to-site:hover { color: #fff; }
.meet-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--green); text-decoration: none; }
.meet-link::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #c4c8cf; margin-right: 6px; }
.status-dot.on { background: var(--green); }
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.pkg-card ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.pkg-card .price { font-size: 26px; font-weight: 800; color: var(--navy); font-stretch: 110%; }
.prose-preview { font-family: "Source Serif 4", Georgia, serif; font-size: 16px; line-height: 1.65; }
.prose-preview h2 { font-size: 20px; margin: 18px 0 6px; }
.prose-preview blockquote { border-left: 3px solid var(--gold); margin: 12px 0; padding-left: 14px; }
.usage { font-size: 13px; color: var(--muted); }
code.inline { background: #eef0f3; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }
ol.steps { padding-left: 20px; margin: 0; } ol.steps li { margin-bottom: 6px; }

.badge { white-space: nowrap; }

/* Check-in assistant */
.assist { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line); background: #f8f9fb; }
.assist.error { background: #fef3f2; }
.assist.done { display: block; background: var(--gold-soft); }
.assist-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--navy-3); margin-bottom: 4px; }
.assist ul { margin: 0 0 10px; padding-left: 18px; font-size: 14px; }
.assist-redo { display: flex; gap: 8px; margin-bottom: 6px; }
.assist-redo input { flex: 1; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; }
.composer textarea.drafted { height: 120px; border-color: var(--gold); }
.spinner { display: inline-block; width: 12px; height: 12px; margin-right: 8px; border: 2px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.note-box { background: #f8f9fb; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--muted); }

/* Live sign-in */
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted, #666); font-size: 15px; }
.login-form .notice { background: #eef6ee; border: 1px solid #b9d9b9; color: #24502a; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.pw-login { margin-top: 14px; font-size: 14px; }
.pw-login summary { cursor: pointer; color: var(--muted, #666); margin-bottom: 10px; }
