/* Franchise Portal — design system.

   Light by default, dark on request. The previous version tinted whole cards
   with seven different hues on a near-black background, which turned muddy the
   moment more than two were on screen. Colour now appears only in small,
   deliberate places: an icon chip, a price, a status dot. Everything else is
   neutral, and the layout does the work. */

:root {
  color-scheme: light;

  --bg:        #f3f5f8;
  --surface:   #ffffff;
  --surface-2: #f8fafc;
  --raised:    #ffffff;
  --border:    #dfe4eb;
  --border-2:  #c9d1db;

  --ink:       #0d1520;
  --ink-soft:  #4a5666;
  --ink-mute:  #7d8899;

  /* Domino's blue carries the interface: buttons, links, focus. Blue rather
     than red because red on every button reads as a warning all day. */
  --brand:     #006491;
  --brand-hi:  #0079b0;
  --brand-ink: #ffffff;
  --brand-dim: #e7f2f8;
  --brand-line:#b7d8e8;

  /* Domino's red is the mark and the moments that should catch the eye. */
  --red:       #e31837;
  --red-dim:   #fdeaed;
  --red-line:  #f6c3cc;

  --good:      #17794a;
  --good-bg:   #e7f5ed;
  --good-line: #b3dfc7;
  --warn:      #8a5a00;
  --warn-bg:   #fdf3e2;
  --warn-line: #efd9a8;
  --bad:       #c1121f;
  --bad-bg:    #fdeaec;
  --bad-line:  #f5c4c9;

  --r-sm: 6px;
  --r-md: 9px;
  --r-lg: 12px;
  --r-xl: 16px;

  --shadow-1: 0 1px 2px rgba(16,24,40,.05);
  --shadow-2: 0 4px 12px rgba(16,24,40,.08), 0 1px 3px rgba(16,24,40,.06);
  --shadow-3: 0 20px 48px rgba(16,24,40,.14);

  --ease: cubic-bezier(.22,.61,.36,1);

  /* Module accent, set per element. Light theme reads the soft pair. */
  --chip-bg: hsl(var(--h, 200) 52% 95%);
  --chip-fg: hsl(var(--h, 200) 44% 33%);
  --chip-line: hsl(var(--h, 200) 38% 87%);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:        #0d1117;
  --surface:   #151b23;
  --surface-2: #1a212a;
  --raised:    #1e262f;
  --border:    #26303b;
  --border-2:  #35414f;

  --ink:       #e8edf3;
  --ink-soft:  #a6b2c0;
  --ink-mute:  #788595;

  --brand:     #3aa6dd;
  --brand-hi:  #52b6e8;
  --brand-ink: #06202c;
  --brand-dim: #10283a;
  --brand-line:#1d4964;

  --red:       #ff4d64;
  --red-dim:   #2d1319;
  --red-line:  #5a222d;

  --good:      #45d483;  --good-bg: #0f241a;  --good-line: #1e4a34;
  --warn:      #e9b03a;  --warn-bg: #241d0c;  --warn-line: #493c16;
  --bad:       #ff6b78;  --bad-bg:  #2b1317;  --bad-line:  #522128;

  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 4px 14px rgba(0,0,0,.4);
  --shadow-3: 0 20px 48px rgba(0,0,0,.55);

  --chip-bg: hsl(var(--h, 200) 34% 17%);
  --chip-fg: hsl(var(--h, 200) 62% 68%);
  --chip-line: hsl(var(--h, 200) 30% 28%);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ─────────────────────────────────────────────── */
header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 6px;
  padding: 0 22px; height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
header .brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 640; font-size: 14.5px; letter-spacing: -.01em;
  color: var(--ink) !important; margin-right: 12px; white-space: nowrap;
}
header .brand:hover { text-decoration: none; }
header .brand .mark {
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 7px; background: var(--red); font-size: 13px;
}
header nav { display: flex; gap: 1px; align-items: center; flex-wrap: wrap; }
header nav a {
  color: var(--ink-soft); font-size: 13.5px; font-weight: 500;
  padding: 6px 10px; border-radius: var(--r-sm);
  transition: background .14s var(--ease), color .14s var(--ease);
}
header nav a:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
header nav a.active { color: var(--ink); font-weight: 580; background: var(--bg); }
header .spacer { margin-left: auto; }
header .who { font-size: 12.5px; color: var(--ink-mute); display: flex; align-items: center; gap: 10px; }
header .who a { color: var(--ink-soft); }

.theme-toggle {
  border: 1px solid var(--border-2); background: var(--surface); color: var(--ink-soft);
  height: 28px; padding: 0 10px; border-radius: var(--r-sm); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 550; box-shadow: none;
}
.theme-toggle:hover { background: var(--bg); filter: none; }

/* ── Layout ─────────────────────────────────────────────── */
main { max-width: 1080px; margin: 0 auto; padding: 30px 22px 72px; }

h1 { font-size: 25px; line-height: 1.22; letter-spacing: -.022em; font-weight: 660; margin: 0 0 5px; }
h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-mute); font-weight: 620; margin: 32px 0 12px;
}
h3 { font-size: 15px; font-weight: 610; margin: 0 0 5px; letter-spacing: -.008em; }
h4 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--ink-soft); }

.sub { color: var(--ink-soft); margin: 0 0 24px; font-size: 14.5px; }
.empty { color: var(--ink-mute); font-size: 14px; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-1);
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); gap: 14px; }

a.card {
  display: block; color: inherit;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), border-color .16s var(--ease);
}
a.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--border-2);
  text-decoration: none;
}
.card p { margin: 0; color: var(--ink-soft); font-size: 13.5px; }

/* Module tile: colour lives in the chip and the price, never the whole card. */
.tile { position: relative; }
.glyph {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; font-size: 16px;
  background: var(--chip-bg); border: 1px solid var(--chip-line);
  margin-bottom: 12px;
}
.tile-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 14px; flex-wrap: wrap;
}
.price { font-weight: 620; font-size: 13.5px; color: var(--ink); white-space: nowrap; }
.price .per { font-size: 11.5px; font-weight: 500; color: var(--ink-mute); }

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px 26px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-1);
}
.hero h1 { font-size: 27px; }
.hero .where { color: var(--ink-mute); font-size: 13.5px; }
.hero-stats {
  display: flex; gap: 0; margin-top: 22px; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding-top: 18px;
}
.hero-stats > div { flex: 1 1 120px; padding-right: 18px; }
.hero-stats > div + div { border-left: 1px solid var(--border); padding-left: 18px; }
.hero-stats .n { font-size: 26px; font-weight: 660; letter-spacing: -.026em; line-height: 1.15; }
.hero-stats .k {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-mute); margin-top: 4px;
}
.hero-stats .accent { color: var(--red); }

/* ── Pills ──────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 580; letter-spacing: .01em;
  padding: 2px 8px; border-radius: var(--r-sm);
  border: 1px solid var(--border-2); color: var(--ink-soft); background: var(--surface-2);
  white-space: nowrap;
}
.pill.on   { color: var(--good); border-color: var(--good-line); background: var(--good-bg); }
.pill.off  { color: var(--ink-mute); }
.pill.warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.pill.bad  { color: var(--bad);  border-color: var(--bad-line);  background: var(--bad-bg); }

/* ── Tables ─────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-mute); font-weight: 600; padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

/* ── Forms ──────────────────────────────────────────────── */
label {
  display: block; font-size: 12px; font-weight: 560;
  color: var(--ink-soft); margin: 0 0 5px;
}
.field { margin-bottom: 14px; }

input[type=text], input[type=email], input[type=password],
input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 11px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border-2); border-radius: var(--r-md);
  font: inherit;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-dim);
}
input::placeholder { color: var(--ink-mute); }
select { appearance: none; cursor: pointer; }

button, .btn {
  font: inherit; font-weight: 560; font-size: 14px;
  padding: 9px 15px; border-radius: var(--r-md);
  border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  cursor: pointer; box-shadow: var(--shadow-1);
  transition: filter .14s var(--ease), transform .1s var(--ease);
  white-space: nowrap;
}
button:hover { filter: brightness(1.06); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; filter: none; }

button.ghost {
  background: var(--surface); color: var(--ink-soft); border-color: var(--border-2);
}
button.ghost:hover { background: var(--bg); color: var(--ink); filter: none; }
button.small { padding: 4px 10px; font-size: 12.5px; border-radius: var(--r-sm); }

/* Entitlement grid cell: on takes the module colour, quietly. */
button.cell-on {
  background: var(--chip-bg); color: var(--chip-fg); border-color: var(--chip-line);
  font-weight: 620;
}
button.cell-on:hover { filter: brightness(.97); }

/* ── Notices ────────────────────────────────────────────── */
.notice {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--good-bg); border: 1px solid var(--good-line); color: var(--good);
  padding: 11px 13px; border-radius: var(--r-md); margin-bottom: 20px; font-size: 14px;
}
.notice.bad  { background: var(--bad-bg);  border-color: var(--bad-line);  color: var(--bad); }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }

/* ── Auth ───────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; }
.auth-card {
  width: 100%; max-width: 388px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 32px 30px 26px;
  box-shadow: var(--shadow-3);
}
.auth-card .mark {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--red); font-size: 22px; margin-bottom: 18px;
}
.auth-card h1 { font-size: 21px; margin-bottom: 4px; }
.auth-card .sub { font-size: 14px; margin-bottom: 22px; }
.auth-card button { width: 100%; padding: 11px; margin-top: 2px; }
.auth-foot { margin-top: 16px; font-size: 13px; color: var(--ink-mute); text-align: center; }

/* ── Kanban ─────────────────────────────────────────────── */
.col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.col-head h3 { margin: 0; text-transform: capitalize; }
.person { border-top: 1px solid var(--border); padding: 11px 0 2px; }
.person:first-of-type { border-top: none; }
.person .nm { font-weight: 570; display: flex; align-items: center; gap: 7px; }
.person .meta { color: var(--ink-mute); font-size: 12px; margin-top: 2px; }
.person .acts { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }

.spend { display: flex; align-items: baseline; gap: 6px; font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.spend .per { font-size: 12px; font-weight: 500; color: var(--ink-mute); }

code {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 5px; font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
details summary { cursor: pointer; color: var(--ink-mute); font-size: 13px; }
details summary:hover { color: var(--ink-soft); }
details[open] summary { margin-bottom: 8px; }
hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

@media (max-width: 640px) {
  header { padding: 0 14px; height: auto; min-height: 54px; flex-wrap: wrap; padding-bottom: 8px; }
  main { padding: 22px 15px 56px; }
  h1 { font-size: 21px; }
  .hero { padding: 20px; }
  .hero h1 { font-size: 23px; }
  .hero-stats > div + div { border-left: none; padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
