/* ==========================================================================
   Forge Masters — clan war tracker
   Styled to match Forge Master: Idle RPG — flat cartoon UI, thick black
   outlines, hard offset shadows, bright primary buttons, rounded panels.
   ========================================================================== */

:root {
  --ink: #21262e;
  --ink-soft: #5a636f;
  --ink-faint: #949cab;
  --line: #21262e;

  --sky-1: #bfe4f8;
  --sky-2: #e6f3fb;
  --ground: #d9c98d;

  --panel: #ffffff;
  --panel-2: #f1f3f6;
  --panel-3: #e4e8ee;

  --navy: #39434f;
  --navy-dark: #2b333d;

  --red: #f4564e;
  --red-dark: #c8382f;
  --blue: #3ba7f0;
  --blue-dark: #1f7cba;
  --green: #5fc45f;
  --green-dark: #3f9a3f;
  --gold: #ffd53d;
  --gold-dark: #d9a406;
  --orange: #ff9c3a;
  --purple: #b07de0;
  --purple-dark: #8452b8;

  --skill: #6fa8dc;
  --pet: #7ec97e;
  --mount: #b07de0;

  --r-lg: 20px;
  --r: 14px;
  --r-sm: 9px;
  --bw: 3px;

  --font: 'Nunito', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: var(--font);
  font-weight: 600;
  color: var(--ink);
  background-color: var(--sky-2);
  background-image: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 260px, #f4f7fa 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.01em; }
a { color: var(--blue-dark); }

/* Bold outlined display text, the way the game titles its banners. */
.stroked {
  color: #fff;
  -webkit-text-stroke: 3px var(--line);
  paint-order: stroke fill;
  font-weight: 800;
}

.stroked--gold { color: var(--gold); }

/* ------------------------------------------------------------ base pieces */

.panel {
  background: var(--panel);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 5px 0 rgba(33, 38, 46, 0.18);
}

.panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--navy);
  border-bottom: var(--bw) solid var(--line);
  border-radius: 16px 16px 0 0;
}

.panel__note { margin-left: auto; font-size: 11.5px; font-weight: 700; color: #aebbc9; white-space: nowrap; }

.panel__head h2, .panel__head h3 {
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.02em;
}

.panel__body { padding: 18px; }

.icon { width: 1em; height: 1em; flex: none; fill: currentColor; vertical-align: -0.14em; }

/* Game sprites cropped from the real game UI. */
.gicon {
  width: 26px;
  height: 26px;
  flex: none;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}

.gicon--lg { width: 40px; height: 40px; }
.gicon--sm { width: 19px; height: 19px; }

/* Chunky buttons with a hard bottom edge that depresses on click. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: var(--navy);
  border: var(--bw) solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 4px 0 var(--navy-dark);
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease, filter 0.15s ease;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
}

.btn:hover:not(:disabled) { filter: brightness(1.07); }

.btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--navy-dark);
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary { background: var(--red); box-shadow: 0 4px 0 var(--red-dark); }
.btn--primary:active:not(:disabled) { box-shadow: 0 0 0 var(--red-dark); }

.btn--blue { background: var(--blue); box-shadow: 0 4px 0 var(--blue-dark); }
.btn--blue:active:not(:disabled) { box-shadow: 0 0 0 var(--blue-dark); }

.btn--green { background: var(--green); box-shadow: 0 4px 0 var(--green-dark); }
.btn--green:active:not(:disabled) { box-shadow: 0 0 0 var(--green-dark); }

.btn--light {
  background: var(--panel-2);
  color: var(--ink);
  text-shadow: none;
  box-shadow: 0 4px 0 var(--panel-3);
}
.btn--light:active:not(:disabled) { box-shadow: 0 0 0 var(--panel-3); }

.btn--sm { padding: 6px 12px; font-size: 12px; border-width: 2px; border-radius: 10px; box-shadow-offset: 3px; }
.btn--block { width: 100%; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

input[type='text'], input[type='password'], input[type='number'], select, textarea {
  width: 100%;
  padding: 11px 13px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  background: var(--panel-2);
  border: var(--bw) solid var(--line);
  border-radius: var(--r);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(59, 167, 240, 0.32);
}

input::placeholder { color: var(--ink-faint); font-weight: 600; }

.hint { font-size: 12.5px; font-weight: 600; color: var(--ink-faint); line-height: 1.5; }

.alert {
  padding: 11px 14px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r);
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 14px;
}

.alert--error { background: #ffe0de; color: #a8322a; }
.alert--ok { background: #dff5df; color: #2f7a2f; }
.alert:empty { display: none; }

/* ================================================================= LOGIN == */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 26px 18px; }
.gate__inner { width: 100%; max-width: 430px; }
.gate__crest { text-align: center; margin-bottom: 20px; }

.crest {
  width: 118px;
  height: 118px;
  border: 4px solid var(--line);
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 6px 0 rgba(33, 38, 46, 0.2);
  animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

.gate__title { margin-top: 16px; font-size: 38px; line-height: 1.05; }
.gate__sub {
  margin-top: 8px;
  display: inline-block;
  padding: 5px 15px;
  font-size: 12.5px;
  font-weight: 800;
  color: #fff;
  background: var(--navy);
  border: var(--bw) solid var(--line);
  border-radius: 20px;
}

.gate__tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 10px 10px 0; }

.gate__tab {
  padding: 11px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-faint);
  background: var(--panel-2);
  border: var(--bw) solid var(--line);
  border-radius: 12px 12px 0 0;
  cursor: pointer;
  transition: all 0.14s ease;
}

.gate__tab + .gate__tab { border-left: none; }
.gate__tab:hover { color: var(--ink-soft); }
.gate__tab.is-active { color: #fff; background: var(--blue); }

.gate__form { padding: 20px; display: flex; flex-direction: column; gap: 15px; }
/* display:flex would otherwise beat the [hidden] default of display:none. */
.gate__form[hidden] { display: none; }
.gate__foot { margin-top: 18px; text-align: center; }

/* =================================================================== APP == */

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  background: var(--navy);
  border-bottom: var(--bw) solid var(--line);
  box-shadow: 0 4px 0 rgba(33, 38, 46, 0.18);
}

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }

.brand__mark {
  width: 40px;
  height: 40px;
  border: 3px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.brand__name { font-size: 17px; font-weight: 800; color: #fff; line-height: 1.15; }
.brand__tag { font-size: 11px; font-weight: 700; color: #9fb0c2; }

.nav { display: flex; gap: 6px; margin-left: 12px; flex: 1; flex-wrap: wrap; }

/* Phone-only menu button. Hidden wherever the tabs fit inline. */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 11px;
  cursor: pointer;
}

.nav-toggle:active { transform: translateY(1px); }
.nav-toggle .icon { font-size: 17px; }

.nav__link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 800;
  color: #c3cedb;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.nav__link:hover { color: #fff; background: rgba(255, 255, 255, 0.16); }

.nav__link.is-active {
  color: #fff;
  background: var(--blue);
  border-color: var(--line);
  box-shadow: 0 3px 0 var(--blue-dark);
}

.topbar__user { display: flex; align-items: center; gap: 11px; }
.topbar__name { font-size: 13.5px; font-weight: 800; color: #fff; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 800;
  color: #fff;
  border: 2px solid var(--line);
  border-radius: 20px;
}

.badge--admin { background: var(--gold); color: var(--ink); }
.badge--member { background: var(--blue); }

.main { flex: 1; width: 100%; max-width: 1500px; margin: 0 auto; padding: 24px 20px 60px; }

.view { display: none; }
.view.is-active { display: block; animation: pop 0.2s ease; }

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.995); }
  to { opacity: 1; transform: none; }
}

.view__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.view__title { font-size: 30px; }
.view__desc { margin-top: 4px; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.view__actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* -------------------------------------------------------------- dashboard */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 15px;
  margin-bottom: 22px;
}

.stat {
  position: relative;
  padding: 16px 18px;
  background: var(--panel);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 5px 0 rgba(33, 38, 46, 0.18);
}

.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 16px; right: 16px;
  height: 5px;
  background: var(--accent, var(--blue));
  border-radius: 0 0 6px 6px;
}

.stat--skill { --accent: var(--skill); }
.stat--pet { --accent: var(--pet); }
.stat--mount { --accent: var(--mount); }
.stat--total { --accent: var(--gold); }

.stat__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-soft);
}

.stat__value {
  margin-top: 9px;
  font-size: 31px;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat__foot { margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--ink-faint); }

.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }

/* War week */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 9px; }

.day {
  padding: 11px 8px;
  text-align: center;
  background: var(--panel-2);
  border: var(--bw) solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 3px 0 rgba(33, 38, 46, 0.14);
  transition: transform 0.14s ease;
}

.day:hover { transform: translateY(-3px); }

.day.is-today {
  background: var(--gold);
  box-shadow: 0 3px 0 var(--gold-dark);
}

.day__n { font-size: 11px; font-weight: 800; color: var(--ink-faint); }
.day.is-today .day__n { color: #7a5f04; }
.day__name { margin-top: 4px; font-size: 12px; font-weight: 800; line-height: 1.25; min-height: 30px; }
.day__mult { margin-top: 5px; font-size: 16px; font-weight: 800; color: var(--red); }

.day__boost {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 800;
  color: #6b4d00;
  background: var(--gold);
  border: 2px solid var(--line);
  border-radius: 20px;
}
.day.is-today .day__mult { color: #a8322a; }
.day.is-today .day__boost { background: #fff; }
.day__pts { margin-top: 3px; font-size: 11.5px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.day__tags { display: flex; justify-content: center; gap: 4px; margin-top: 7px; min-height: 18px; }

/* Leaderboard */
.board { display: flex; flex-direction: column; gap: 8px; }

.board__row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
}

.board__rank {
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  color: var(--ink-faint);
}

.board__row:nth-child(1) .board__rank { color: var(--gold-dark); }
.board__row:nth-child(2) .board__rank { color: #8d98a6; }
.board__row:nth-child(3) .board__rank { color: #c07a3a; }
.board__name { font-size: 14px; font-weight: 800; }
.board__pts { font-size: 14px; font-weight: 800; color: var(--blue-dark); font-variant-numeric: tabular-nums; }

/* Mix bar */
.mix {
  display: flex;
  height: 18px;
  border: var(--bw) solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: var(--panel-2);
}

.mix__seg { transition: width 0.45s ease; }
.mix__seg--skill { background: var(--skill); }
.mix__seg--pet { background: var(--pet); }
.mix__seg--mount { background: var(--mount); }

.legend { display: flex; gap: 15px; flex-wrap: wrap; margin-top: 13px; }
.legend__item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.legend__swatch { width: 14px; height: 14px; border: 2px solid var(--line); border-radius: 5px; }

/* ----------------------------------------------------------------- tables */

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 5px 0 rgba(33, 38, 46, 0.18);
}

/* No min-width: the sheet is meant to fit the screen. The intermediate mount
   columns are behind a toggle precisely so it can. */
table.sheet { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }

table.sheet thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 9px 5px;
  font-size: 11.5px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
  color: #fff;
  background: var(--navy);
  border-bottom: var(--bw) solid var(--line);
  cursor: pointer;
  user-select: none;
}

table.sheet thead th:first-child { text-align: left; border-radius: 16px 0 0 0; }
/* The name column takes the slack so the numeric columns stay tight. */
table.sheet tbody td:first-child, table.sheet thead th:first-child { width: 1%; white-space: nowrap; }
table.sheet thead th:last-child { border-radius: 0 16px 0 0; }
table.sheet thead th:hover { background: #48545f; }
table.sheet thead th.group-skill { box-shadow: inset 0 5px 0 var(--skill); }
table.sheet thead th.group-pet { box-shadow: inset 0 5px 0 var(--pet); }
table.sheet thead th.group-mount { box-shadow: inset 0 5px 0 var(--mount); }
table.sheet thead th.group-total { box-shadow: inset 0 5px 0 var(--gold); }
table.sheet thead th.group-hammer { box-shadow: inset 0 5px 0 #9aa3ad; }

table.sheet tbody td {
  padding: 6px 5px;
  text-align: right;
  white-space: nowrap;
  font-weight: 700;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--panel-3);
  font-variant-numeric: tabular-nums;
}

table.sheet tbody td:first-child { text-align: left; font-weight: 800; color: var(--ink); }
table.sheet tbody tr:nth-child(even) td { background: #fafbfc; }
table.sheet tbody tr:hover td { background: #eaf5fd; }
table.sheet tbody tr.is-me td { background: #fff6d6; box-shadow: inset 3px 0 0 var(--gold); }
table.sheet tbody tr.is-empty td { color: var(--ink-faint); }

td.num-strong { color: var(--ink); font-weight: 800; }
td.num-total { color: var(--blue-dark); font-weight: 800; }

table.sheet tfoot td {
  position: sticky;
  bottom: 0;
  padding: 10px 5px;
  text-align: right;
  font-weight: 800;
  color: #fff;
  background: var(--navy);
  border-top: var(--bw) solid var(--line);
  font-variant-numeric: tabular-nums;
}

table.sheet tfoot td:first-child { text-align: left; }

.cell-input {
  /* min-width too: table layout will otherwise squeeze a plain width and clip
     the last digit of five-figure ticket counts. */
  width: 100%;
  min-width: 72px;
  max-width: 84px;
  padding: 4px 5px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--panel-3);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  transition: all 0.13s ease;
}

/* Drop the spinner arrows — they steal room from five- and six-digit values. */
.cell-input::-webkit-outer-spin-button,
.cell-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cell-input { -moz-appearance: textfield; appearance: textfield; }

.cell-input:hover { border-color: var(--ink-faint); }
.cell-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59, 167, 240, 0.3); }
.cell-input.is-saved { border-color: var(--green); background: #edfaed; }
.cell-input.is-error { border-color: var(--red); background: #ffeceb; }

.stale { color: var(--orange); font-weight: 800; }

/* ------------------------------------------------------------ my stockpile */

.stock-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.stock-card { padding: 0; overflow: hidden; }

.stock-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 17px;
  border-bottom: var(--bw) solid var(--line);
}

.stock-card--skill .stock-card__head { background: #dceaf8; }
.stock-card--pet .stock-card__head { background: #ddf3dd; }
.stock-card--mount .stock-card__head { background: #ede0f8; }
.stock-card--vial .stock-card__head { background: #dff2e4; }
.stock-card--hammer .stock-card__head { background: #e6e9ed; }

/* --------------------------------------------------- saving a resource */

/* Points that are held back: still shown, but visibly out of the total. */
.is-held { color: var(--ink-faint) !important; text-decoration: line-through; }

/* The generic input rule (attribute selector) outranks a bare .cell-input, so
   its roomy 13px side padding was eating the digits. Pin the table's own. */
table.sheet input.cell-input { padding: 5px 5px; border-width: 2px; border-radius: 9px; font-size: 12.5px; }

/* Costs are two or three digits; the room goes to the five-digit columns. */
table.sheet .cell-input--narrow { min-width: 50px; max-width: 54px; }

.save-toggle {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0;
  font-size: 11px;
  color: var(--ink-faint);
  background: transparent;
  border: 2px solid var(--panel-3);
  border-radius: 6px;
  cursor: pointer;
  vertical-align: -3px;
}

.save-toggle:hover { border-color: var(--ink-faint); }
.save-toggle.is-on { color: var(--ink); background: var(--gold); border-color: var(--line); }

.save-toggle--chip {
  display: inline-flex;
  gap: 6px;
  width: auto;
  height: auto;
  margin: 0;
  padding: 6px 10px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 800;
  border-radius: 20px;
}

.mcard__saves { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 14px 13px; }

.save-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
}

.save-check input { width: 18px; height: 18px; flex: none; accent-color: var(--gold-dark); }

.stock-card__icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  background: #fff;
  border: var(--bw) solid var(--line);
  border-radius: 14px;
}

.stock-card__title { font-size: 16px; font-weight: 800; }
.stock-card__sub { font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-top: 2px; }
.stock-card__body { padding: 16px 17px; display: flex; flex-direction: column; gap: 14px; }

.readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
}

.readout__label { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
/* The arithmetic behind the total, so the number is never a mystery. */
.readout__note { display: block; margin-top: 2px; font-size: 11px; font-weight: 700; color: var(--ink-faint); }
.readout__value { font-size: 22px; font-weight: 800; color: var(--blue-dark); font-variant-numeric: tabular-nums; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ------------------------------------------------------------------ admin */

/* The areas must be named at every width. If they are only defined inside a
   media query, `grid-area: col` below that width points at lines that do not
   exist and the browser stacks all three panels into one cell. */
.admin-grid {
  display: grid;
  gap: 18px;
  align-items: start;
  grid-template-columns: 1fr;
  grid-template-areas:
    "col"
    "schedule"
    "roster";
}

/* Point values and Accounts share one column, stacked directly on top of each
   other, so Accounts is not pushed down by whatever the tallest panel is. */
.admin-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

@media (min-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "col schedule"
      "col roster";
  }
}

@media (min-width: 1250px) {
  .admin-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-areas: "col schedule roster";
  }
}

.admin-col      { grid-area: col; }
.admin-schedule { grid-area: schedule; }
.admin-roster   { grid-area: roster; }
.list { display: flex; flex-direction: column; gap: 9px; max-height: 470px; overflow-y: auto; }

.list__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 11px;
  padding: 10px 13px;
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
}

.list__row { flex-wrap: wrap; }
.list__main { min-width: 0; flex: 1 1 170px; }
.list__title { font-size: 14px; font-weight: 800; }
.list__meta { font-size: 12px; font-weight: 600; color: var(--ink-faint); margin-top: 2px; line-height: 1.35; }
.list__actions { display: flex; gap: 6px; flex: 0 0 auto; }

.code-pill {
  font-family: 'Consolas', 'SF Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink);
  background: var(--gold);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 12px;
}

.day-editor { display: flex; flex-direction: column; gap: 9px; }

/* Day number, name and multiplier on the first line; the resource chips wrap
   onto a second line so nothing gets crushed in a narrow column. */
.day-editor__row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 74px 84px;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
}

.day-editor__row input { min-width: 0; padding: 7px 7px; font-size: 13.5px; text-align: right; }

/* Spinner arrows would eat most of these narrow boxes. */
.day-editor__row input[type='number']::-webkit-outer-spin-button,
.day-editor__row input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.day-editor__row input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
.day-editor__row .d-name { text-align: left; }

/* A small unit marker in front of the multiplier and boost boxes, so the two
   number fields are never mistaken for each other. */
.day-editor__num { display: flex; align-items: center; gap: 4px; min-width: 0; }
.day-editor__num > span {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-faint);
  flex: none;
}
.day-editor__n { font-size: 12.5px; font-weight: 800; color: var(--ink-soft); }
.day-editor__cats { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  padding: 5px 11px;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink-soft);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.13s ease;
}

.chip:hover { background: var(--panel-3); }
.chip.is-on[data-cat='skill'] { background: var(--skill); color: #fff; }
.chip.is-on[data-cat='pet'] { background: var(--pet); color: #fff; }
.chip.is-on[data-cat='mount'] { background: var(--mount); color: #fff; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 13px; }

/* Toast */
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 9px; }

.toast {
  min-width: 220px;
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
  background: var(--navy);
  border: var(--bw) solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 4px 0 rgba(33, 38, 46, 0.25);
  animation: toast-in 0.22s ease;
}

.toast--ok { background: var(--green); }
.toast--error { background: var(--red); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.empty { padding: 40px 20px; text-align: center; font-weight: 700; color: var(--ink-faint); }
.spinner-wrap { display: grid; place-items: center; padding: 70px 20px; }

.spinner {
  width: 44px; height: 44px;
  border: 5px solid var(--panel-3);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 15px; }
.toolbar input[type='text'] { max-width: 240px; }

/* ------------------------------------------------ sheet: phone card layout */

/* Below the breakpoint the table is replaced by one card per member — sixteen
   columns can never be made to fit a phone, and a sideways-scrolling table is
   miserable to use with a thumb. */
.sheet-mobile { display: none; }

.mcard {
  background: var(--panel);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 4px 0 rgba(33, 38, 46, 0.16);
  margin-bottom: 13px;
  overflow: hidden;
}

.mcard.is-me { border-color: var(--gold-dark); box-shadow: 0 4px 0 var(--gold-dark); }

.mcard__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  background: var(--panel-2);
  border-bottom: 2px solid var(--line);
}

.mcard.is-me .mcard__head { background: #fff6d6; }
.mcard__name { font-size: 15px; font-weight: 800; }
.mcard__total { font-size: 17px; font-weight: 800; color: var(--blue-dark); font-variant-numeric: tabular-nums; }

.mcard__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 13px 14px;
}

.mcard__field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mcard__field > span { font-size: 11.5px; font-weight: 800; color: var(--ink-soft); }
.mcard__field > b { font-size: 15px; font-variant-numeric: tabular-nums; }

/* Inside a card the inputs get the full column, not the table's tight cap. */
.mcard__field .cell-input {
  width: 100%;
  max-width: none;
  padding: 9px 10px;
  font-size: 15px;
  border-width: 2px;
  border-color: var(--panel-3);
}

.mcard__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-top: 2px solid var(--panel-3);
  background: #fafbfc;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.mcard__foot span { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: 1fr; }
  .week { grid-template-columns: repeat(4, 1fr); }
}

/* Swap the sheet to cards well before phone widths — the table stops being
   comfortable long before it stops fitting. */
@media (max-width: 1260px) {
  .sheet-desktop { display: none; }
  /* On a tablet or small laptop the cards sit side by side instead of
     stretching across the whole screen. */
  .sheet-mobile { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 0 14px; align-items: start; }
  /* Only the table has hideable columns, so the toggle is meaningless here. */
  #toggleBreakdown { display: none; }
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; padding: 9px 12px; gap: 10px; }
  .brand__mark { width: 34px; height: 34px; }
  .brand__name { font-size: 15px; }
  .brand__tag { display: none; }

  .nav-toggle { display: inline-flex; margin-left: auto; }

  /* The tabs become a dropdown under the header, each one full width with its
     label spelled out. */
  .nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0 2px;
  }

  .nav.is-open { display: flex; }

  .nav__link {
    width: 100%;
    justify-content: flex-start;
    gap: 11px;
    padding: 12px 14px;
    font-size: 14.5px;
    border-radius: 12px;
  }

  .nav__link .icon { font-size: 18px; }

  .topbar__user { gap: 8px; }
  .topbar__name { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .main { padding: 16px 11px 46px; }
  .week { grid-template-columns: repeat(2, 1fr); }
  .view__title { font-size: 22px; }
  .view__head { gap: 12px; }
  .row-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 11px; }
  .stat { padding: 13px 13px; }
  .stat__value { font-size: 21px; }
  .stat__label { font-size: 11.5px; }

  .settings-grid { grid-template-columns: 1fr 1fr; }
  .panel__body { padding: 14px; }
  .panel__head { flex-wrap: wrap; }
  .panel__note { margin-left: 0; width: 100%; }
  .toolbar input[type='text'] { max-width: none; flex: 1 1 140px; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .day-editor__row { grid-template-columns: 42px minmax(0, 1fr); }
  .day-editor__num { grid-column: span 1; }
  .mcard__grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .gate__title { font-size: 30px; }
}
