/* ============================================================
   Whatcha Internal Dashboard — styling
   Brand tokens carried over 1:1 from whatchadrinking.com
   ============================================================ */

@font-face {
  font-family: "FT Buck";
  src: url("../fonts/ft-buck-regular.woff2") format("woff2"),
       url("../fonts/ft-buck-regular.woff") format("woff");
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Bazook";
  src: url("../fonts/bazook-regular.woff2") format("woff2"),
       url("../fonts/bazook-regular.woff") format("woff");
  font-weight: normal; font-style: normal; font-display: swap;
}

:root {
  --font-display: "FT Buck", "Baloo 2", sans-serif;
  --font-ui: "Bazook", "Baloo 2", sans-serif;
  --font-body: "Nunito Sans", "Helvetica Neue", Arial, sans-serif;

  /* brand palette — exact codes from the site */
  --navy: #0526c5;
  --navy-deep: #041b8a;
  --sky: #75d0f7;
  --sky-pale: #e2f6fe;
  --teal: #27baad;
  --teal-pale: #dcf5f2;
  --coral: #f37847;
  --coral-deep: #d9622f;
  --yellow: #ffe808;
  --yellow-deep: #e6cf00;
  --red: #f47563;
  --cream: #fffaf0;
  --ink: #12123a;
  --sage: #c8dfb8;

  --radius: 20px;
  --radius-sm: 12px;
  --shadow-hard: 5px 5px 0 rgba(5, 38, 197, 0.9);
  --shadow-hard-sm: 3px 3px 0 rgba(5, 38, 197, 0.85);
  --shadow-soft: 0 14px 34px rgba(5, 38, 197, 0.12);

  --line: #e7e6f2;
  --muted: #6b6b86;
  --ok: #1f9d6b;
  --warn: #d98a1f;
  --danger: #d64545;

  --sidebar-w: 236px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--sky-pale);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-ui); letter-spacing: 0.02em; margin: 0; line-height: 1.15; }
a { color: var(--navy); }
button { font-family: var(--font-ui); cursor: pointer; }
input, select, textarea { font-family: var(--font-body); font-size: 15px; }

.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 2px solid var(--navy); background: var(--yellow); color: var(--ink);
  padding: 9px 16px; border-radius: 999px; font-size: 14px; letter-spacing: 0.03em;
  text-decoration: none; box-shadow: var(--shadow-hard-sm);
  transition: transform .08s ease, box-shadow .08s ease; white-space: nowrap;
}
.btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 rgba(5,38,197,.9); }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 rgba(5,38,197,.9); }
.btn--primary { background: var(--navy); color: #fff; }
.btn--ghost { background: #fff; }
.btn--coral { background: var(--coral); color: #fff; }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Login gate ---------- */
.gate {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(117,208,247,.6), transparent 60%),
    linear-gradient(160deg, var(--navy), var(--navy-deep));
}
.gate__card {
  width: min(420px, 100%); background: var(--cream); border: 3px solid var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow-hard); padding: 34px 30px; text-align: center;
}
.gate__logo { width: 190px; max-width: 70%; margin: 0 auto 6px; display: block; }
.gate__badge {
  display: inline-block; font-family: var(--font-ui); font-size: 12px; letter-spacing: .12em;
  background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px; margin-bottom: 18px;
}
.gate h1 { font-size: 22px; margin-bottom: 4px; }
.gate p.sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.gate label { display: block; text-align: left; font-family: var(--font-ui); font-size: 12px; letter-spacing: .05em; margin: 12px 0 5px; }
.gate input {
  width: 100%; padding: 11px 13px; border: 2px solid var(--ink); border-radius: var(--radius-sm); background: #fff;
}
.gate .btn { width: 100%; justify-content: center; margin-top: 20px; }
.gate__msg { min-height: 18px; font-size: 13px; margin-top: 12px; }
.gate__msg.err { color: var(--danger); }
.gate__mode { margin-top: 18px; font-size: 12px; color: var(--muted); }
.gate__mode strong { color: var(--coral-deep); }

/* ---------- App layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--navy); color: #fff; padding: 18px 14px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.sidebar__brand img { width: 34px; height: 34px; }
.sidebar__brand span { font-family: var(--font-ui); font-size: 15px; letter-spacing: .04em; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px;
  color: #dfe4ff; text-decoration: none; font-family: var(--font-ui); font-size: 14px; letter-spacing: .03em;
  border: 2px solid transparent; cursor: pointer; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.09); color: #fff; }
.nav-item.active { background: var(--yellow); color: var(--ink); border-color: var(--ink); }
.nav-item .ico { width: 18px; text-align: center; font-size: 16px; }
.sidebar__exit { margin-bottom: 10px; padding-bottom: 14px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar__foot { margin-top: auto; font-size: 11px; color: rgba(255,255,255,.55); padding: 10px 8px; }
.sidebar__foot button { background: none; border: none; color: #cfe; font-size: 12px; text-decoration: underline; cursor: pointer; padding: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px var(--pad, 28px);
  background: var(--cream); border-bottom: 2px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar__title { font-family: var(--font-ui); font-size: 20px; letter-spacing: .02em; }
.topbar__spacer { flex: 1; }
.hamburger { display: none; background: none; border: 2px solid var(--ink); border-radius: 10px; padding: 5px 9px; font-size: 16px; }
.search {
  display: flex; align-items: center; gap: 6px; background: #fff; border: 2px solid var(--line);
  border-radius: 999px; padding: 6px 12px; min-width: 180px;
}
.search input { border: none; outline: none; width: 100%; }

.view { padding: 26px var(--pad, 28px) 60px; max-width: 1220px; width: 100%; }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px; margin-bottom: 20px; align-items: stretch; }
.kpi { display: flex; flex-direction: column; justify-content: center; }
.kpi {
  background: var(--cream); border: 2px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow-hard-sm); padding: 16px 18px;
}
.kpi__label { font-family: var(--font-ui); font-size: 12px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.kpi__value { font-family: var(--font-ui); font-size: 30px; margin: 6px 0 2px; }
.kpi__sub { font-size: 12px; color: var(--muted); }
.kpi__sub.up { color: var(--ok); }
.kpi__sub.down { color: var(--danger); }
.kpi--accent { background: var(--yellow); }
.kpi--teal { background: var(--teal-pale); }
.kpi--coral { background: #ffe6dc; }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--cream); border: 2px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow-hard-sm); padding: 18px 20px; margin-bottom: 20px;
}
.panel__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel__head h3 { font-size: 16px; }
.panel__head .spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; align-items: start; }
.grid-2 > .panel { margin-bottom: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
table.data th {
  text-align: left; font-family: var(--font-ui); font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); padding: 9px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none;
}
table.data th.no-sort { cursor: default; }
table.data th .arrow { font-size: 10px; opacity: .6; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:hover { background: rgba(117,208,247,.13); }
table.data tbody tr { cursor: default; }
table.data tr.clickable { cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.t-empty { text-align: center; color: var(--muted); padding: 30px; font-size: 14px; }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-ui); font-size: 11px; letter-spacing: .03em;
  padding: 3px 10px; border-radius: 999px; border: 1.5px solid var(--ink); background: #fff; white-space: nowrap;
}
.chip--active { background: var(--sage); }
.chip--lead { background: var(--yellow); }
.chip--prospect { background: var(--sky-pale); }
.chip--inactive { background: #eee; color: var(--muted); }
.chip--new { background: var(--coral); color: #fff; border-color: var(--coral-deep); }
.chip--exported { background: var(--teal-pale); }
.chip--sm { font-size: 10px; padding: 2px 8px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-family: var(--font-ui); font-size: 12px; letter-spacing: .04em; margin-bottom: 5px; color: var(--ink); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--navy); }
.field textarea { resize: vertical; min-height: 68px; }
.field--row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5,38,197,.35); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 20px; z-index: 100;
}
.modal {
  background: var(--cream); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow-hard);
  width: min(620px, 100%); max-height: 90vh; overflow-y: auto;
}
.modal__head { display: flex; align-items: center; padding: 18px 22px; border-bottom: 2px solid var(--line); position: sticky; top: 0; background: var(--cream); }
.modal__head h3 { font-size: 18px; }
.modal__close { margin-left: auto; background: none; border: 2px solid var(--ink); border-radius: 9px; width: 30px; height: 30px; font-size: 16px; }
.modal__body { padding: 20px 22px; }
.modal__foot { padding: 16px 22px; border-top: 2px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--cream); }

/* line-item editor */
.lineitems { display: flex; flex-direction: column; gap: 8px; }
.lineitem { display: grid; grid-template-columns: 1fr 84px 108px 32px; gap: 8px; align-items: center; }
.lineitem .li-total { font-family: var(--font-ui); text-align: right; font-variant-numeric: tabular-nums; }
.lineitem .li-del { background: none; border: 2px solid var(--line); border-radius: 8px; height: 34px; }
.li-head { display: grid; grid-template-columns: 1fr 84px 108px 32px; gap: 8px; font-size: 11px; color: var(--muted); font-family: var(--font-ui); letter-spacing: .04em; text-transform: uppercase; }

/* ---------- Charts ---------- */
.chart { width: 100%; }
.chart text { font-family: var(--font-body); }
.bar-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; }
.bar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 11px; height: 11px; border-radius: 3px; border: 1px solid var(--ink); display: inline-block; }

/* ---------- Leads & recommendations ---------- */
.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-bottom: 8px; }
.rec-card { display: flex; gap: 14px; background: var(--cream); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow-hard-sm); padding: 16px; }
.rec-card__score { flex: none; width: 62px; height: 62px; border-radius: 14px; border: 2px solid var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rec-card__num { font-family: var(--font-ui); font-size: 24px; line-height: 1; }
.rec-card__tier { font-family: var(--font-ui); font-size: 8px; letter-spacing: .08em; margin-top: 2px; }
.rec-high { background: var(--yellow); }
.rec-medium { background: var(--teal-pale); }
.rec-watch { background: #eee; color: var(--muted); }
.rec-card__body { min-width: 0; flex: 1; }
.rec-card__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.rec-card__head h3 { font-size: 15px; }
.rec-reasons { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.rec-reasons li { font-size: 13px; line-height: 1.4; }
.rec-factors { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rec-factor { font-family: var(--font-ui); font-size: 10px; letter-spacing: .03em; background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.rec-factor.neg { background: #ffe0e0; border-color: #f4b0b0; }
.top-stores { border-color: var(--ink); border-width: 2px; background: linear-gradient(160deg, var(--cream), #fff); }
.store-list { display: flex; flex-direction: column; gap: 10px; }
.store-tile { display: flex; align-items: center; gap: 12px; background: #fff; border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.store-tile:hover { border-color: var(--sky); }
.store-tile__rank { flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--navy); color: #fff; font-family: var(--font-ui); font-size: 13px; display: flex; align-items: center; justify-content: center; }
.store-tile__main { flex: 1; min-width: 0; }
.store-tile__name { font-family: var(--font-ui); font-size: 15px; }
.store-tile__name a { text-decoration: none; }
.store-tile__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; margin-top: 3px; }
.store-tile__sigs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.store-tile .btn { flex: none; }
.store-tile__act { flex: none; display: flex; flex-direction: column; gap: 6px; }
.store-tile__act .btn { justify-content: center; }
@media (max-width: 520px) { .store-tile { flex-wrap: wrap; } .store-tile__act { flex-direction: row; width: 100%; } .store-tile__act .btn { flex: 1; } }

.lead-filter-bar { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 8px 16px; margin-bottom: 18px; box-shadow: var(--shadow-hard-sm); }
.lead-filter-bar input { border: none; outline: none; flex: 1; min-width: 0; font-size: 15px; background: none; }
.lead-filter-clear { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 6px; }
.lead-filter-clear:hover { background: #eee; color: var(--ink); }
#lead-filter-count { font-size: 13px; white-space: nowrap; }
.outside-foot { margin: 14px 0 8px; }
.outside-foot > summary { cursor: pointer; font-family: var(--font-ui); font-size: 14px; color: var(--muted); }
.outside-foot > summary em { font-style: italic; }
.chip--high { background: var(--coral); color: #fff; border-color: var(--coral-deep); }
.chip--medium { background: var(--yellow); }
.chip--low { background: #eee; color: var(--muted); }
.lead-status { padding: 5px 8px; border: 2px solid var(--line); border-radius: 8px; background: #fff; font-family: var(--font-ui); font-size: 12px; }
.coverage-note { font-size: 12px; color: var(--muted); margin-top: 3px; }
.coverage-note.partial { color: var(--warn); }
@media (max-width: 520px) { .rec-grid { grid-template-columns: 1fr; } }

/* ---------- Account notes ---------- */
.note-add { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.note-add textarea {
  flex: 1; min-height: 52px; padding: 9px 11px; border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; resize: vertical; font-family: var(--font-body); font-size: 14px;
}
.note-add textarea:focus { outline: none; border-color: var(--navy); }
.note-add .btn { white-space: nowrap; margin-top: 2px; }
.note-log { display: flex; flex-direction: column; gap: 8px; }
.note-item { background: #fff; border: 1.5px solid var(--line); border-left: 4px solid var(--teal); border-radius: 10px; padding: 9px 12px; }
.note-item__meta { font-family: var(--font-ui); font-size: 11px; letter-spacing: .03em; color: var(--muted); display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.note-item__text { font-size: 14px; white-space: pre-wrap; }
.note-del { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1; padding: 2px 4px; border-radius: 6px; }
.note-del:hover { background: #ffe0e0; color: var(--danger); }
@media (max-width: 520px) { .note-add { flex-direction: column; } .note-add .btn { width: 100%; justify-content: center; } }

/* toast */
.toast-wrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-family: var(--font-ui);
  font-size: 13px; box-shadow: var(--shadow-soft); animation: toastIn .2s ease;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.section-title { font-family: var(--font-ui); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 26px 0 12px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state .big { font-size: 40px; margin-bottom: 8px; }

.quick-hero {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(120deg, var(--teal-pale), var(--sky-pale));
  border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow-hard-sm);
  padding: 16px 20px; margin-bottom: 20px;
}
.quick-hero__k { font-family: var(--font-ui); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.quick-hero__t { font-family: var(--font-ui); font-size: 18px; margin-top: 2px; }
.quick-hero .btn { margin-left: auto; }

.pill-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.pill-filter button {
  background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--muted);
}
.pill-filter button.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Mobile ---------- */
.scrim { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 60; width: 250px; transform: translateX(-100%);
    transition: transform .22s ease; height: 100dvh;
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }
  .hamburger { display: inline-flex; }
  .grid-2 { grid-template-columns: 1fr; }
  .search { display: none; }
  .topbar__title { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #new-sale-btn { flex: none; }
  :root { --pad: 16px; }
  .lineitem, .li-head { grid-template-columns: 1fr 64px 92px 30px; }
}
@media (max-width: 520px) {
  .field--row { grid-template-columns: 1fr; }
  .kpi__value { font-size: 26px; }
}
