/* Magos Media CI — dark canvas, white logo, Montserrat, tri-accent (blue/yellow/pink).
   Palette is locked per the CI manual; these are the only colours used.
     blue  #1C4DA1   yellow #F6BB30   pink #CF2C91   grey #AAAAAB
   Brand rule: copy is lowercase except acronyms (PO, NDA) and proper nouns. */
:root {
  --black:      #0e0e0e;   /* page canvas */
  --sidebar:    #000000;   /* formal white-on-black */
  --surface:    #161719;   /* cards / panels */
  --surface-2:  #1e2024;   /* inputs, raised */
  --line:       rgba(255,255,255,0.09);
  --line-strong:rgba(255,255,255,0.16);
  --ink:        #ffffff;
  --muted:      #aaaaab;   /* brand grey */

  --blue:  #1c4da1;  --blue-700:#173f85;  --blue-soft: rgba(28,77,161,0.18);  --blue-ink:#7aa2e6;
  --yellow:#f6bb30;  --yellow-700:#dca521; --yellow-soft:rgba(246,187,48,0.15); --yellow-ink:#f6bb30;
  --pink:  #cf2c91;  --pink-700:#b0237b;  --pink-soft: rgba(207,44,145,0.16);  --pink-ink:#e879c0;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,0.5), 0 6px 22px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--black);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-ink); }

/* ── Brand lockup (injected by renderBrand in api.js) ───────────────── */
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.brand-m { height: 30px; width: auto; display: block; }
.brand-word { font-weight: 300; letter-spacing: 0.14em; font-size: 14px; color: #fff; text-transform: lowercase; }

/* ── App shell ──────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex; flex-direction: column; gap: 3px;
}
.sidebar a {
  color: var(--muted); text-decoration: none; padding: 9px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500; display: block; text-transform: lowercase;
  transition: background .12s, color .12s;
}
.sidebar a:hover { background: rgba(255,255,255,0.05); color: #fff; }
.sidebar a.active { background: var(--blue); color: #fff; }
.sidebar .spacer { flex: 1; }
.sidebar .who { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 4px; }

.main { padding: 30px 36px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-head h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.01em; } /* not lowercased — may hold a proper noun */

/* ── Cards & stat grid ──────────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.06em; color: var(--muted); text-transform: lowercase; font-weight: 600; }
.card .stat { font-size: 30px; font-weight: 800; color: #fff; }
/* rotate the stat accent bar through the three brand colours */
.cards .card:nth-child(4n+1) { border-top: 2px solid var(--blue); }
.cards .card:nth-child(4n+2) { border-top: 2px solid var(--yellow); }
.cards .card:nth-child(4n+3) { border-top: 2px solid var(--pink); }
.cards .card:nth-child(4n)   { border-top: 2px solid var(--muted); }

/* ── Tables ─────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: rgba(255,255,255,0.02); color: var(--muted); text-transform: lowercase; font-size: 11px; letter-spacing: 0.05em; font-weight: 600; }
td { color: #e9eaec; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Badges (status, mapped within the brand palette) ───────────────── */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: lowercase; letter-spacing: .02em; }
.badge.signed, .badge.approved, .badge.paid     { background: var(--blue-soft);   color: var(--blue-ink); }
.badge.outstanding, .badge.overdue              { background: var(--pink-soft);   color: var(--pink-ink); }
.badge.sent                                     { background: var(--yellow-soft); color: var(--yellow-ink); }
.badge.draft, .badge.viewed,
.badge.contract, .badge.nda, .badge.quote,
.badge.onboarding, .badge.briefing,
.badge.statement, .badge.other                  { background: rgba(255,255,255,0.07); color: var(--muted); }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
  background: var(--blue); color: #fff; padding: 10px 16px; border-radius: 8px;
  font-family: inherit; font-weight: 600; font-size: 14px; text-transform: lowercase;
  transition: background .12s, transform .02s;
}
.btn:hover { background: var(--blue-700); }
.btn:active { transform: translateY(1px); }
/* the punchy primary CTA — brand yellow with near-black ink */
.btn.red { background: var(--yellow); color: #14110a; }
.btn.red:hover { background: var(--yellow-700); }
.btn.ghost { background: transparent; color: #fff; border: 1px solid var(--line-strong); }
.btn.ghost:hover { background: rgba(255,255,255,0.06); }
.caps { text-transform: uppercase; }   /* keep acronyms (PO, NDA) uppercase inside lowercase buttons */

/* ── Forms ──────────────────────────────────────────────────────────── */
input, select, textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; width: 100%;
  background: var(--surface-2); color: #fff;
}
input::placeholder, textarea::placeholder { color: #6f7174; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
select option { background: var(--surface-2); }
label { font-size: 13px; font-weight: 600; color: #fff; display: block; margin-bottom: 5px; }
.field { margin-bottom: 14px; }

/* ── Login ──────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background:
  radial-gradient(1200px 600px at 50% -10%, #1a1b1f 0%, var(--black) 60%); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 36px; width: 372px; box-shadow: var(--shadow); }
.login-card .brand { flex-direction: column; gap: 8px; align-items: center; margin-bottom: 6px; }
.login-card .brand-m { height: 56px; }
.login-card .brand-word { font-size: 16px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; text-align: center; text-transform: lowercase; }
.error { color: var(--pink-ink); font-size: 13px; margin-top: 10px; min-height: 18px; }
.muted { color: var(--muted); }
