/* RSM look: deep navy with ember orange. All brand values live in :root, so matching
   joinrsm.com exactly later means editing only this block (and --font). */
:root {
  color-scheme: dark;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --bg: #050912;            /* page navy (the site's theme color) */
  --sidebar: #070d1a;
  --surface: #0d1526;
  --surface-2: #131d33;
  --field: #09111f;
  --ink: #eef2fa;
  --muted: #8e9bb4;
  --line: #1d2942;

  --brand: #ff6a2b;         /* ember orange */
  --brand-hover: #ff8450;
  --brand-ink: #050912;     /* text on ember buttons */
  --accent: #ff6a2b;

  --danger: #ff6b5e;
  --ok: #3cbe78;
  --lead: #5f86d9;
  --prospect: #e5a935;
  --customer: #2fa766;
  --dead: #6f778c;

  --radius: 12px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(900px 480px at 88% -8%, rgba(255, 106, 43, 0.10), transparent 62%),
    radial-gradient(700px 400px at -5% 105%, rgba(95, 134, 217, 0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
a:hover { color: var(--brand-hover); }
h1, h2, h3 { letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 10px; }
h3 { font-size: 14px; font-weight: 700; margin: 0 0 6px; }

/* ---- layout ---- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  color: var(--ink);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .logo { font-weight: 800; font-size: 20px; letter-spacing: 0.12em; padding: 4px 12px 18px; color: var(--brand); }
.sidebar .logo small { display: block; font-size: 11px; letter-spacing: 0.14em; color: var(--muted); font-weight: 600; margin-top: 2px; }
.sidebar a {
  color: var(--muted);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  border-left: 3px solid transparent;
  font-weight: 500;
}
.sidebar a:hover { background: rgba(255, 255, 255, 0.05); color: var(--ink); }
.sidebar a.active { background: rgba(255, 106, 43, 0.12); color: var(--ink); border-left-color: var(--brand); font-weight: 600; }
.sidebar .spacer { flex: 1; }
.sidebar .who { font-size: 13px; padding: 8px 12px; color: var(--muted); }
.sidebar button.linklike { color: var(--muted); padding: 8px 12px; text-align: left; text-decoration: none; }
.sidebar button.linklike:hover { color: var(--ink); }

main { padding: 28px 32px 56px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .grow { flex: 1; }

/* ---- controls ---- */
button, .btn {
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  padding: 8px 15px;
  border-radius: 9px;
  text-decoration: none;
  display: inline-block;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
button:hover { border-color: var(--brand); }
button:active { transform: translateY(1px); }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 700; }
button.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
button.danger { color: var(--danger); }
button.small { padding: 4px 10px; font-size: 13px; }
button.linklike { background: none; border: none; padding: 0; color: var(--brand); text-decoration: underline; }
button:disabled { opacity: 0.5; cursor: default; }

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: #566480; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 106, 43, 0.22); }
button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.field { margin-bottom: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.search { max-width: 280px; }

/* ---- surfaces ---- */
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 40%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.stack > * + * { margin-top: 16px; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; }
.empty { color: var(--muted); padding: 16px 0; text-align: center; }
code { background: rgba(255, 255, 255, 0.07); padding: 1px 6px; border-radius: 5px; font-size: 0.92em; }

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--muted);
  white-space: nowrap;
}
.badge.lead { background: var(--lead); }
.badge.prospect { background: var(--prospect); color: #1a1405; }
.badge.customer { background: var(--customer); }
.badge.dead { background: var(--dead); }
.badge.high { background: var(--brand); color: var(--brand-ink); }
.badge.low { background: var(--dead); }
.badge.soft { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500; }

/* ---- stat tiles ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
a.stat:hover { border-color: var(--brand); }
.stat .n { font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.stat .l { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---- boards ---- */
.board { display: grid; gap: 14px; align-items: start; }
.board.four { grid-template-columns: repeat(4, minmax(230px, 1fr)); overflow-x: auto; }
.board.three { grid-template-columns: repeat(3, minmax(260px, 1fr)); overflow-x: auto; }
.column {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 200px;
}
.column.over { border-color: var(--brand); background: rgba(255, 106, 43, 0.06); }
.column h3 { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 8px; }
.tile {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 8px;
  cursor: grab;
}
.tile:hover { border-color: var(--brand); }
.tile .title { font-weight: 600; display: block; color: var(--ink); text-decoration: none; }
.tile .meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.tile .badges { margin-top: 7px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- tables / lists ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(255, 255, 255, 0.04); }
.table-wrap { overflow-x: auto; }

.detail-grid { display: grid; grid-template-columns: minmax(280px, 390px) 1fr; gap: 18px; align-items: start; }
dl.kv { margin: 0; display: grid; grid-template-columns: 110px 1fr; gap: 7px 10px; }
dl.kv dt { color: var(--muted); font-size: 13px; }
dl.kv dd { margin: 0; word-break: break-word; }

.stage-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.stage-picker button.on { color: #fff; border-color: transparent; font-weight: 700; }
.stage-picker button.on.lead { background: var(--lead); }
.stage-picker button.on.prospect { background: var(--prospect); color: #1a1405; }
.stage-picker button.on.customer { background: var(--customer); }
.stage-picker button.on.dead { background: var(--dead); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: none; }
.timeline .when { font-size: 12px; color: var(--muted); }
.timeline .body { white-space: pre-wrap; word-break: break-word; }

.contact { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: start; }
.contact:last-child { border-bottom: none; }
.contact .grow { flex: 1; min-width: 0; }

/* ---- conversation thread ---- */
.thread-box { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.thread-box textarea { margin-top: 8px; min-height: 64px; }
.msg { padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); margin-bottom: 7px; }
.msg.customer { background: rgba(255, 106, 43, 0.10); border: 1px solid rgba(255, 106, 43, 0.25); }
.msg.internal { background: transparent; border: 1px dashed var(--line); }
.msg-head { font-size: 13px; }
.msg-body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.reply-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.check { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; }

/* ---- modal + toast ---- */
.overlay {
  position: fixed; inset: 0; background: rgba(2, 5, 12, 0.72); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; overflow-y: auto; z-index: 50;
}
.modal {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 14px; width: 100%; max-width: 540px; padding: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}
.modal h2 { font-size: 19px; margin-bottom: 14px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--brand-ink); padding: 11px 20px; border-radius: 10px; font-weight: 600;
  opacity: 0; transition: all 0.2s; pointer-events: none; z-index: 100; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); color: #1a0705; }

/* ---- auth screen ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: 100%; max-width: 390px; padding: 28px; }
.auth h1 { margin-bottom: 4px; }
.brand-mark { font-weight: 800; letter-spacing: 0.16em; color: var(--brand); font-size: 15px; margin-bottom: 10px; }
.error-text { color: var(--danger); font-size: 14px; margin: 8px 0 0; min-height: 20px; }

pre.code { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); padding: 14px; border-radius: 10px; overflow-x: auto; font-size: 13px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar .logo { padding: 4px 10px; }
  .sidebar .logo small { display: none; }
  .sidebar a { border-left: none; }
  .sidebar .spacer { display: none; }
  main { padding: 18px 16px 40px; }
  .detail-grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
}

/* ---- website analytics (portal + staff preview) ---- */
.an-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.range-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.range-switch button { border: none; border-radius: 0; background: transparent; padding: 6px 13px; font-size: 13px; color: var(--muted); }
.range-switch button + button { border-left: 1px solid var(--line); }
.range-switch button.on { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi-l { font-size: 13px; color: var(--muted); }
.kpi-v { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin: 2px 0; }
.kpi-d { font-size: 13px; }
.delta { font-weight: 700; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--muted); font-weight: 500; }
.an-sub { margin: 18px 0 8px; }
.an-card { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.an-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.an-grid .an-card { margin-bottom: 0; }
svg.trend { width: 100%; height: 150px; display: block; }
.trend-line { stroke: var(--brand); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.trend-area { fill: rgba(255, 106, 43, 0.14); }
.trend-t { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin-bottom: 9px; font-size: 14px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-val { font-weight: 600; white-space: nowrap; }
.bar { grid-column: 1 / -1; height: 5px; background: rgba(255, 255, 255, 0.06); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

.modal-wide { max-width: 900px; }
.check-group { margin-bottom: 10px; }
.check-group-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 6px 0 4px; font-weight: 600; }
.check-group .check { padding: 3px 0; color: var(--ink); font-size: 14px; }

/* onboarding card */
.ob-bar { height: 8px; background: rgba(141,154,179,.18); border-radius: 999px; overflow: hidden; }
.ob-bar span { display: block; height: 100%; background: var(--brand, #ff6a2b); border-radius: 999px; }
.ob-bar.big { height: 10px; margin-top: 10px; }
.ob-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.ob-steps { display: grid; gap: 12px; margin-top: 16px; }
.ob-step { display: flex; gap: 16px; align-items: flex-start; }
.ob-mark { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  border: 1px solid var(--line); color: var(--muted); }
.ob-step.done .ob-mark { background: rgba(60,190,120,.18); border-color: transparent; color: #3cbe78; }
.ob-step.skipped .ob-mark { opacity: .6; }
.ob-body { flex: 1; min-width: 0; }
.ob-title { font-weight: 600; margin-bottom: 2px; }
.ob-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.ob-finish { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 20px 0 40px; }

.stat .sub { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.35; }
a.button { display: inline-block; padding: 9px 16px; border-radius: 8px; text-decoration: none; font-weight: 600; }
a.button.primary { background: var(--brand); color: var(--brand-ink); }

.comm-btns { display: inline-flex; gap: 6px; vertical-align: middle; margin-left: 6px; }
.history .body { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
button.badge { cursor: pointer; border: 1px solid transparent; font: inherit; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
button.badge.outcome { background: rgba(141,154,179,.18); color: var(--muted); }
button.badge.outcome.good { background: rgba(60,190,120,.18); color: #3cbe78; }

/* RSM Enterprises logo (pale lettering, made for the dark background) */
.sidebar .logo { padding: 2px 12px 18px; }
.sidebar .logo img { display: block; width: 156px; height: auto; }
.sidebar .logo small { margin-top: 6px; }
.brand-logo { display: block; width: 190px; height: auto; margin: 0 auto 14px; }
.brand-img { display: block; height: 40px; width: auto; }

/* Rocky, the RSM fox: kept small and quiet */
.empty::before { content: ''; display: block; width: 38px; height: 38px; margin: 0 auto 8px; background: url(/rocky.svg) center / contain no-repeat; opacity: 0.9; }
.sidebar .rocky { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: var(--muted); font-size: 12px; }
.sidebar .rocky img { width: 22px; height: 22px; }
.badge.waiting { background: rgba(255, 196, 61, 0.16); color: #ffc43d; border: 1px solid rgba(255, 196, 61, 0.35); }
.cal-card { padding: 0; overflow: hidden; }
.cal-frame { width: 100%; height: 72vh; min-height: 520px; border: 0; background: #fff; display: block; }

.auth .rocky-hero { display: block; width: 72px; height: 72px; margin: 14px auto 6px; }
.auth h1 { text-align: center; }
.auth .muted { text-align: center; }
.pay-table td, .pay-table th { white-space: nowrap; }
.pay-table td:nth-child(2) { white-space: normal; width: 100%; }
