/* ============================================================================
   Contechs Marketing Suite — shared design system
   Phase 1 of the dashboard overhaul. Every page links this file and renders
   the shared sidebar via /assets/nav.js.
   ============================================================================ */

:root {
  --bg:        #0a0a0e;
  --surface:   #14141b;
  --surface-2: #1d1d27;
  --surface-3: #262633;
  --border:    #2a2a38;
  --border-soft:#22222e;
  --text:      #ECEAE0;
  --text-dim:  #8b8a99;
  --text-faint:#5d5c6c;
  --gold:      #d4a843;
  --gold-soft: rgba(212,168,67,.12);
  --green:     #4caf7d;
  --red:       #e0625a;
  --blue:      #6b8dd6;
  --purple:    #afa9f6;
  --sidebar-w: 250px;
  --radius:    14px;
  --radius-sm: 10px;
  font-synthesis: none;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--gold-soft); }

/* ---- Layout ------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 0 32px; height: 64px;
  background: rgba(10,10,14,.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar h1 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.topbar .sub { font-size: 12px; color: var(--text-dim); margin-top: 1px; }

/* Phase 24 — fluid responsive content width.
 * Default: stretch up to 1900px so the dashboard fills wide / curved
 * monitors but stays legible.
 * Phase 24b — go bigger on ultrawide screens and scale base type. */
.content {
  padding: 28px 32px 64px;
  max-width: 1900px;
  width: 100%;
}
@media (min-width: 1800px) { .content { max-width: 2300px; padding: 36px 56px 80px; } }
@media (min-width: 2200px) { .content { max-width: 2700px; padding: 40px 72px 96px; } }
@media (min-width: 2800px) { .content { max-width: 3200px; padding: 48px 96px 112px; } }

/* Phase 24b / 27b — bump the global type scale.
 * Baseline raised, and the bigger-text breakpoint now kicks in at 1200px
 * (was 1600px) so normal laptops also get the larger sizing — users were
 * straining to read 10-13px text on /marketing-memory, /review etc. */
body { font-size: 16px; }
@media (min-width: 1200px) {
  body { font-size: 17px; line-height: 1.6; }
  .topbar { height: 72px; }
  .topbar h1 { font-size: 22px; }
  .topbar .sub { font-size: 14px; }
  .sb-link { font-size: 14.5px; padding: 11px 14px; }
  .sb-group-label { font-size: 11.5px; }
  .card { padding: 24px; }
  .card-title { font-size: 15px; }
  .card-sub { font-size: 14px; }
  .btn { font-size: 14.5px; padding: 11px 20px; }
  .btn-primary { font-size: 15px; }
  h1 { font-size: 22px; }
  h2 { font-size: 16px; }
  /* Phase 27b — common in-page small-text selectors used across many
   * pages (marketing-memory, performance, intelligence, review, etc).
   * Bumped 1-2 px so dense content lists actually read. */
  .lead         { font-size: 14.5px !important; line-height: 1.7 !important; }
  .item-title   { font-size: 14.5px !important; }
  .item-summary { font-size: 13.5px !important; line-height: 1.65 !important; }
  .item-meta    { font-size: 11.5px !important; }
  .badge        { font-size: 10.5px !important; padding: 3px 8px !important; }
  .panel .why   { font-size: 12.5px !important; }
  .panel h2     { font-size: 15px !important; }
  .empty        { font-size: 14px !important; }
  /* The "Human context" block on memory items + similar grouped meta. */
  .hctx                { font-size: 13.5px !important; line-height: 1.7 !important; padding: 11px 14px !important; }
  .hctx .hctx-title    { font-size: 11.5px !important; }
  .explainer-body      { font-size: 14px !important; line-height: 1.7 !important; }
}
@media (min-width: 1800px) {
  body { font-size: 18px; line-height: 1.65; }
  .topbar { height: 80px; padding: 0 56px; }
  .topbar h1 { font-size: 26px; }
  .topbar .sub { font-size: 15px; }
  .sb-link { font-size: 16px; padding: 13px 16px; }
  .sb-group-label { font-size: 12.5px; padding: 16px 14px 8px; }
  .card { padding: 28px; }
  .card-title { font-size: 17px; }
  .card-sub { font-size: 15px; }
  .btn { font-size: 16px; padding: 13px 22px; }
  h1 { font-size: 26px; }
  h2 { font-size: 18px; }
  .lead         { font-size: 16px !important; }
  .item-title   { font-size: 16px !important; }
  .item-summary { font-size: 15px !important; }
  .item-meta    { font-size: 13px !important; }
  .badge        { font-size: 11.5px !important; padding: 4px 9px !important; }
  .panel .why   { font-size: 13.5px !important; }
  .panel h2     { font-size: 17px !important; }
  .hctx                { font-size: 15px !important; padding: 14px 16px !important; }
  .hctx .hctx-title    { font-size: 12.5px !important; }
  .explainer-body      { font-size: 15.5px !important; }
}

/* Phase 24 — mobile + tablet responsive ----------------------------------- */
@media (max-width: 900px) {
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; height: 56px; }
  .content { padding: 18px 16px 48px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 30px rgba(0,0,0,.5);
  }
  .sidebar.open { transform: translateX(0); }
  .sb-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: 1px solid var(--border-soft);
    border-radius: 8px; background: var(--surface); color: var(--text);
    cursor: pointer; margin-right: 10px;
  }
}
@media (min-width: 901px) { .sb-toggle { display: none; } }

/* ---- Sidebar ------------------------------------------------------------ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  overflow-y: auto;
  z-index: 60;
}
.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.sb-brand .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), #b8863a);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #1a1308; font-size: 15px; flex-shrink: 0;
}
.sb-brand .wordmark { font-size: 14px; font-weight: 800; letter-spacing: .14em; }
.sb-brand .tag { font-size: 9px; color: var(--text-dim); letter-spacing: .18em; text-transform: uppercase; }

.sb-nav { padding: 14px 12px; flex: 1; }
.sb-group { margin-bottom: 6px; }
.sb-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); padding: 14px 12px 6px;
}
.sb-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--text-dim);
  border-left: 2px solid transparent;
  transition: background .14s, color .14s;
}
.sb-link svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.8; }
.sb-link:hover { background: var(--surface-2); color: var(--text); }
.sb-link.active {
  background: var(--gold-soft); color: var(--gold);
  border-left-color: var(--gold);
}
.sb-foot {
  padding: 14px 20px; border-top: 1px solid var(--border-soft);
  font-size: 11px; color: var(--text-faint);
  display: flex; align-items: center; justify-content: space-between;
}
.sb-foot a:hover { color: var(--text-dim); }

/* ---- Cards -------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
}
.card-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.card-sub { font-size: 12px; color: var(--text-dim); line-height: 1.6; }

.grid { display: grid; gap: 14px; }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
/* Phase 24 — helpers used by exec dashboard + today + others to spread
 * card grids across wide screens. .grid2/3 collapse on mobile. */
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
.grid3 { display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr); }
.grid4 { display: grid; gap: 16px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) {
  .grid4 { grid-template-columns: repeat(2, 1fr); }
  .grid3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
}

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  transition: .14s;
}
.btn:hover { border-color: var(--text-dim); }
.btn-primary { background: var(--gold); border-color: var(--gold); color: #1a1308; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); border-color: transparent; background: transparent; }
.btn-danger:hover { background: rgba(224,98,90,.12); }
.btn-sm { padding: 5px 10px; font-size: 11px; }

/* ---- Forms -------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 11px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px;
}
input, select, textarea {
  width: 100%; padding: 9px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 13px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }

/* ---- Badges & misc ------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 6px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  background: var(--surface-3); color: var(--text-dim);
}
.badge-gold  { background: var(--gold-soft); color: var(--gold); }
.badge-green { background: rgba(76,175,125,.14); color: var(--green); }

.muted { color: var(--text-dim); }
.empty {
  text-align: center; color: var(--text-dim); font-size: 13px;
  padding: 48px 20px; border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--border);
  padding: 10px 18px; border-radius: 10px; font-size: 13px;
  z-index: 200; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
