/* ShiftBoss - design tokens and components. See DESIGN.md. */

:root {
  --surface: #F4F7FA;
  --panel: #FFFFFF;
  --felt: #EAF1F6;
  --felt-2: #E1EAF2;
  --ink: #182B49;
  --ink-2: #5B6B85;
  --ink-3: #8496AC;
  --line: #DCE5EE;
  --line-2: #C9D6E2;

  --heat: #FF7A1A;
  --heat-700: #E96A0D;
  --heat-ink: #A8460B;
  --fresh: #2FA45C;
  --fresh-ink: #1E7A44;
  --alert: #E5484D;
  --alert-ink: #B4272C;
  --coin: #F2B90D;
  --coin-ink: #8A6A00;
  --violet: #7A5AF8;
  --sky: #3E8DDD;
  --teal: #12897E;

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

  --sh-1: 0 1px 2px rgba(24,43,73,.06), 0 6px 16px -10px rgba(24,43,73,.22);
  --sh-2: 0 2px 4px rgba(24,43,73,.07), 0 14px 30px -14px rgba(24,43,73,.30);
  --sh-3: 0 18px 50px -18px rgba(24,43,73,.45);

  --t: 180ms cubic-bezier(.2,.8,.3,1);
  --spring: 200ms cubic-bezier(.2,1.25,.4,1);

  --rail: 280px;
  --side: 360px;
  --pad: 18px;
}

* { box-sizing: border-box; }

html, body {
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  height: 100vh;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

button { font: inherit; color: inherit; cursor: pointer; }

input, select, textarea { font-size: 16px; font-family: inherit; }

:focus-visible {
  outline: 3px solid rgba(62,141,221,.55);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--r-md);
  z-index: 999;
  font-weight: 600;
}
.skip-link:focus { left: 12px; }

/* ---------------------------------------------------------------- top bar */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px var(--pad);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(24,43,73,.03);
  flex: 0 0 auto;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong {
  font-family: Outfit, Inter, sans-serif;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.02em;
}
.brand-text em { font-style: normal; font-size: 11.5px; color: var(--ink-2); font-weight: 500; }

.clockbox {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 20px;
  border-left: 1px solid var(--line);
  min-width: 176px;
}
.clock {
  font-family: Outfit, sans-serif;
  font-weight: 700;
  font-size: 34px;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 1px;
}
.clock .colon { opacity: .5; margin: 0 1px; }
.clock .ap { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-left: 6px; letter-spacing: 0; }
.clockmeta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-2); }
.daymeta { white-space: nowrap; font-weight: 500; }
.daymeta .dot { color: var(--ink-3); }

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--felt);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill.rush { background: rgba(255,122,26,.15); color: var(--heat-ink); }

.speeds { display: flex; align-items: center; gap: 6px; }
.spd, .skip-rush {
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--ink-2);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 13px;
  transition: background var(--t), color var(--t), border-color var(--t), transform var(--t);
  font-variant-numeric: tabular-nums;
}
.spd:hover, .skip-rush:hover { border-color: var(--ink-3); color: var(--ink); }
.spd:active, .skip-rush:active { transform: translateY(1px); }
.spd[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.skip-rush { background: rgba(255,122,26,.10); border-color: rgba(255,122,26,.35); color: var(--heat-ink); }
.skip-rush:hover { background: rgba(255,122,26,.18); border-color: var(--heat); color: var(--heat-ink); }

.scores { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.score-stat {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--felt);
  border-radius: var(--r-md);
  padding: 7px 13px;
  min-width: 96px;
  position: relative;
}
.score-icon { width: 20px; height: 20px; flex: 0 0 auto; }
.score-icon svg { width: 100%; height: 100%; display: block; }
.score-body { display: flex; flex-direction: column; line-height: 1.1; }
.score-body b {
  font-family: Outfit, sans-serif;
  font-weight: 700;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.score-body i { font-style: normal; font-size: 10.5px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.score-stat.service { padding-bottom: 10px; }
.score-bar {
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 6px;
  height: 3px;
  border-radius: 2px;
  background: rgba(24,43,73,.12);
  overflow: hidden;
}
.score-bar i { display: block; height: 100%; background: var(--fresh); transition: width var(--t), background var(--t); }
.score-stat.warn .score-bar i { background: var(--coin); }
.score-stat.bad .score-bar i { background: var(--alert); }

.topactions { display: flex; gap: 8px; }

.btn {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 9px 15px;
  font-weight: 700;
  font-size: 13px;
  transition: background var(--t), border-color var(--t), transform var(--t), box-shadow var(--t);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--heat); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.06); }
.btn-primary:hover { background: var(--heat-700); }
.btn-ghost { background: var(--panel); border-color: var(--line-2); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: #22385c; }

/* ---------------------------------------------------------------- layout */

.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--side);
  grid-template-rows: minmax(0, 1fr);
  gap: 14px;
  padding: 14px var(--pad);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-1);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 10px;
}
.panel-head h2 {
  font-family: Outfit, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.hint { font-size: 11px; color: var(--ink-3); font-weight: 500; }

/* ---------------------------------------------------------------- roster */

.roster {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.crew {
  display: grid;
  grid-template-columns: 36px minmax(0,1fr);
  gap: 9px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
  flex: 0 0 auto;
  touch-action: none;
  cursor: grab;
  transition: box-shadow var(--t), border-color var(--t), transform var(--t);
  position: relative;
}
.crew:hover { border-color: var(--line-2); box-shadow: var(--sh-1); }
.crew.is-posted { background: linear-gradient(90deg, rgba(234,241,246,.75), rgba(255,255,255,0) 70%); }
.crew.is-tired { border-color: rgba(229,72,77,.45); }

.av {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--c, #1F3B63);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: Outfit, sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .01em;
  flex: 0 0 auto;
}
.av.sm { width: 30px; height: 30px; border-radius: 10px; font-size: 12px; }

.crew-main { min-width: 0; }
.crew-top { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.crew-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lvl {
  font-family: Outfit, sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(122,90,248,.12);
  color: #4B31B8;
  padding: 1px 6px;
  border-radius: 6px;
  flex: 0 0 auto;
}
.crew-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-2);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
}
.crew-post {
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: .01em;
  color: var(--ink);
  background: var(--tint, var(--felt));
  border-radius: 5px;
  padding: 1px 6px;
  flex: 0 0 auto;
}
.crew-post.off { background: transparent; color: var(--ink-2); padding-left: 0; font-weight: 500; }
.skillnote { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.meters { display: flex; align-items: center; gap: 5px; margin-left: auto; flex: 0 0 auto; width: 74px; }
.meter {
  flex: 1 1 auto;
  height: 5px;
  border-radius: 3px;
  background: rgba(24,43,73,.10);
  overflow: hidden;
}
.meter { display: block; }
.meter i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--fresh);
  transition: width 240ms linear, background var(--t);
}
.meter.low i { background: var(--alert); }
.meter.mid i { background: var(--coin); }
.meter-label {
  font-size: 10px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  flex: 0 0 auto;
  width: 30px;
  text-align: right;
}

.crew-xp {
  height: 3px;
  border-radius: 2px;
  background: rgba(24,43,73,.09);
  margin-top: 6px;
  overflow: hidden;
}
.crew-xp i { display: block; height: 100%; background: var(--violet); opacity: .75; transition: width 240ms linear; }

.crew-task {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--ink-2);
  background: var(--felt);
  border-radius: 8px;
  padding: 4px 8px;
  margin-top: 2px;
}
.crew-task .meter { height: 4px; }
.crew-task b { color: var(--ink); font-weight: 600; }

.log-wrap {
  flex: 0 0 auto;
  height: 172px;
  border-top: 1px solid var(--line);
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.log-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.log-head h3 {
  font-family: Outfit, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-2);
}
.log-head span { font-size: 10.5px; color: var(--ink-2); white-space: nowrap; }
.log-head b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.log-head .dot { color: var(--ink-3); }
.log { display: flex; flex-direction: column; gap: 5px; overflow: hidden; flex: 1 1 auto; }
.log-item {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--ink-2);
  background: var(--felt);
  border-left: 3px solid var(--sky);
  border-radius: 8px;
  padding: 5px 8px;
  flex: 0 0 auto;
  animation: logIn 200ms cubic-bezier(.2,.9,.3,1);
}
.log-item.warn { border-left-color: var(--coin); }
.log-item.bad { border-left-color: var(--alert); color: var(--alert-ink); }
.log-item.good { border-left-color: var(--fresh); }
.log-item.level { border-left-color: var(--violet); color: #4B31B8; }
@keyframes logIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.log-empty { font-size: 11.5px; color: var(--ink-3); }

/* ---------------------------------------------------------------- center */

.center {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  min-width: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  flex: 0 0 auto;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: 11px 14px;
}
.metric b {
  display: block;
  font-family: Outfit, sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.metric i { font-style: normal; font-size: 11.5px; color: var(--ink-2); font-weight: 500; }
.metric.alert b { color: var(--alert-ink); }

.board-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-1);
  padding: 12px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plan {
  position: relative;
  height: 100%;
  width: auto;
  max-width: 100%;
  aspect-ratio: 1000 / 730;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--felt);
}
.plan-svg-wrap { position: absolute; inset: 0; }
.plan-svg { width: 100%; height: 100%; display: block; }
.fp-lane {
  font-family: Outfit, sans-serif;
  font-size: 17px;
  font-weight: 700;
  fill: #7C8DA1;
  letter-spacing: .16em;
  text-anchor: middle;
}
.fp-note {
  font-family: Outfit, sans-serif;
  font-size: 13px;
  font-weight: 600;
  fill: #7C8DA1;
  letter-spacing: .12em;
  text-anchor: middle;
}

.plan-overlay { position: absolute; inset: 0; }

.station, .room { position: absolute; padding: 7px 8px; display: flex; flex-direction: column; }

.station { border-radius: var(--r-lg); transition: box-shadow var(--t), background var(--t); }
.station.drop-hot {
  background: rgba(255,255,255,.55);
  box-shadow: inset 0 0 0 2px var(--acc, var(--heat));
}
.st-head { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; }
.st-name {
  font-family: Outfit, sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -.01em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.st-sub {
  font-size: 10px;
  color: var(--ink-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.st-state {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-2);
  flex: 0 0 auto;
  white-space: nowrap;
}
.st-state.hot { color: var(--heat-ink); }
.st-state.bad { color: var(--alert-ink); }
.st-state.good { color: var(--fresh-ink); }

.slots { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }

.slot {
  width: 34px; height: 34px;
  border-radius: 11px;
  border: 2px dashed rgba(24,43,73,.22);
  background: rgba(255,255,255,.5);
  display: grid;
  place-items: center;
  transition: border-color var(--t), background var(--t), transform var(--t);
  position: relative;
}
.slot.filled { border-style: solid; border-color: transparent; background: transparent; padding: 0; }
.slot-plus { color: var(--ink-3); font-weight: 700; font-size: 15px; line-height: 1; }
.slot.drop-hot { border-color: var(--acc, var(--heat)); background: #fff; transform: scale(1.08); }

body.dragging-crew .slot:not(.filled) { border-color: rgba(24,43,73,.42); background: rgba(255,255,255,.85); }

.token {
  width: 34px; height: 34px;
  border-radius: 11px;
  background: var(--c, #1F3B63);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: Outfit, sans-serif;
  font-weight: 700;
  font-size: 12px;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 2px 5px rgba(24,43,73,.28);
  position: relative;
  transition: transform var(--t), box-shadow var(--t);
}
.token:hover { transform: translateY(-2px); box-shadow: 0 5px 12px rgba(24,43,73,.32); }
.token .fit {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--fresh);
}
.token .fit.mid { background: var(--coin); }
.token .fit.bad { background: var(--alert); }
.token.tired { opacity: .78; }
.token .zzz {
  position: absolute;
  top: -5px; left: -5px;
  background: var(--alert);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  border-radius: 5px;
  padding: 0 3px;
  letter-spacing: .04em;
}

.room {
  border-radius: 14px;
  justify-content: space-between;
  pointer-events: none;
}
.room-name {
  font-family: Outfit, sans-serif;
  font-weight: 700;
  font-size: 11.5px;
  color: var(--ink);
  line-height: 1.15;
}
.room-temp { font-size: 9.5px; color: var(--ink-2); font-weight: 500; }
.room-foot { display: flex; align-items: center; gap: 6px; }
.room .meter { background: rgba(24,43,73,.14); }
.room-pct { font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }

@keyframes lowpulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}
.low-pulse { animation: lowpulse 1.4s ease-in-out infinite; }

/* ---------------------------------------------------------------- queue */

.queue {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-1);
  padding: 11px 14px 12px;
  flex: 0 0 auto;
  height: 152px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.queue-head { display: flex; align-items: baseline; justify-content: space-between; }
.queue-head h2 { font-family: Outfit, sans-serif; font-size: 15px; font-weight: 700; }
.queue-count { font-size: 11.5px; color: var(--ink-2); font-weight: 500; }
.queue-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  flex: 1 1 auto;
  align-items: flex-start;
}
.ticket {
  flex: 0 0 auto;
  width: 132px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 9px;
  background: var(--felt);
}
.ticket.late { border-color: rgba(229,72,77,.5); background: rgba(229,72,77,.07); }
.ticket.hot { border-color: rgba(255,122,26,.45); background: rgba(255,122,26,.07); }
.ticket-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ticket-id { font-family: Outfit, sans-serif; font-size: 10.5px; font-weight: 700; color: var(--ink-2); }
.ticket-ch { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.ticket-name { font-size: 12px; font-weight: 600; margin: 3px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket .meter { height: 4px; }
.ticket-foot { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-2); margin-top: 5px; font-variant-numeric: tabular-nums; }
.queue-empty { color: var(--ink-3); font-size: 12.5px; padding: 10px 2px; }

/* ---------------------------------------------------------------- side panel */

.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 12px 0;
  flex: 0 0 auto;
}
.tab {
  flex: 1 1 0;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 6px;
  border-radius: 10px;
  transition: background var(--t), color var(--t);
}
.tab:hover { background: var(--felt); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; }

.pane {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* scrolling panes must never squash their cards */
.pane > * { flex: 0 0 auto; }

.sec-title {
  font-family: Outfit, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* day tab */
.dp {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  background: var(--panel);
  transition: border-color var(--t), background var(--t);
  cursor: pointer;
  width: 100%;
  text-align: left;
  display: block;
}
.dp:hover { border-color: var(--line-2); background: var(--felt); }
.dp.editing { border-color: var(--ink); background: var(--felt); }
.dp.live { border-color: rgba(255,122,26,.55); }
.dp-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dp-name { font-family: Outfit, sans-serif; font-weight: 700; font-size: 14px; }
.dp-time { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dp-bar { display: flex; gap: 3px; margin-top: 8px; }
.dp-seg { height: 6px; border-radius: 3px; flex: 1 1 0; background: rgba(24,43,73,.10); }
.dp-seg.on { background: var(--fresh); }
.dp-seg.part { background: var(--coin); }
.dp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.dp-cover { font-size: 11px; color: var(--ink-2); }
.dp-cover.bad { color: var(--alert-ink); font-weight: 600; }
.tag {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--felt-2);
  color: var(--ink-2);
}
.tag.live { background: rgba(255,122,26,.16); color: var(--heat-ink); }
.tag.edit { background: var(--ink); color: #fff; }
.mini {
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--ink-2);
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 600;
  transition: border-color var(--t), color var(--t), background var(--t);
}
.mini:hover { border-color: var(--ink-3); color: var(--ink); background: var(--felt); }

.copy-row { display: flex; justify-content: flex-end; margin: -4px 0 0; }

.note {
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--felt);
  border-radius: 10px;
  padding: 9px 11px;
}
.note b { color: var(--ink); }

/* tasks tab */
.taskcard {
  border: 1px solid var(--line);
  border-left: 4px solid var(--acc, var(--sky));
  border-radius: var(--r-md);
  padding: 9px 11px;
  background: var(--panel);
  cursor: grab;
  touch-action: none;
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}
.taskcard:hover { box-shadow: var(--sh-1); transform: translateY(-1px); }
.task-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.task-title { font-weight: 600; font-size: 13px; }
.task-meta { font-size: 10.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.task-blurb { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; }
.task-rewards { display: flex; gap: 6px; margin-top: 7px; }
.chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--felt);
  color: var(--ink-2);
  letter-spacing: .02em;
}
.chip.xp { background: rgba(122,90,248,.12); color: #4B31B8; }
.chip.coin { background: rgba(242,185,13,.18); color: var(--coin-ink); }
.chip.auto { background: rgba(229,72,77,.12); color: var(--alert-ink); }

.taskrow {
  display: grid;
  grid-template-columns: 30px minmax(0,1fr) auto;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 10px;
}
.taskrow.unassigned { border-style: dashed; border-color: var(--line-2); }
.task-need { font-size: 11px; color: var(--ink-2); margin-top: 1px; }
.taskrow .task-title { font-size: 12.5px; }

/* inventory tab */
.inv-sec { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.inv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  background: var(--felt);
  border-bottom: 1px solid var(--line);
}
.inv-head h3 { font-family: Outfit, sans-serif; font-size: 13px; font-weight: 700; }
.inv-head span { font-size: 10.5px; color: var(--ink-2); }
.inv-row { display: grid; grid-template-columns: minmax(0,1fr) 74px; gap: 10px; align-items: center; padding: 8px 12px; }
.inv-row + .inv-row { border-top: 1px solid #EFF3F7; }
.inv-name { font-size: 12.5px; font-weight: 500; }
.inv-name.low { color: var(--alert-ink); font-weight: 600; }
.inv-num { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }
.inv-row .meter { height: 7px; margin-top: 4px; }

/* ---------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  left: calc(var(--pad) + var(--rail) + 26px);
  bottom: 24px;
  z-index: 60;
  display: none;
  flex-direction: column-reverse;
  gap: 8px;
  max-width: 330px;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-md);
  padding: 10px 13px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--sh-2);
  display: flex;
  gap: 9px;
  align-items: flex-start;
  animation: toastin 200ms cubic-bezier(.2,.9,.3,1);
  border-left: 4px solid var(--sky);
}
.toast.warn { border-left-color: var(--coin); }
.toast.bad { border-left-color: var(--alert); }
.toast.good { border-left-color: var(--fresh); }
.toast.level { border-left-color: var(--violet); }
.toast.leaving { animation: toastout 220ms ease-in forwards; }
@keyframes toastin { from { opacity: 0; transform: translateX(-14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastout { to { opacity: 0; transform: translateY(6px) scale(.98); } }

.pops { position: fixed; inset: 0; pointer-events: none; z-index: 55; }
.pop {
  position: absolute;
  font-family: Outfit, sans-serif;
  font-weight: 700;
  font-size: 11px;
  color: #4B31B8;
  background: #fff;
  border: 1px solid rgba(122,90,248,.35);
  border-radius: 999px;
  padding: 1px 7px;
  box-shadow: 0 4px 12px -6px rgba(24,43,73,.5);
  animation: popup 900ms ease-out forwards;
  white-space: nowrap;
}
.pop.coin { color: var(--coin-ink); border-color: rgba(242,185,13,.5); }
.pop.level { color: #fff; background: var(--heat); border-color: var(--heat-700); }
@keyframes popup {
  0% { opacity: 0; transform: translateY(2px); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-34px); }
}

/* ---------------------------------------------------------------- drag ghost */

.drag-ghost {
  position: fixed;
  top: 0; left: 0;
  z-index: 999;
  pointer-events: none;
  box-shadow: var(--sh-3);
  border-radius: var(--r-md);
  background: var(--panel);
  opacity: .96;
  transform-origin: 20% 50%;
}
.drag-source { opacity: .38; }
body.is-dragging { cursor: grabbing; }
body.is-dragging * { cursor: grabbing !important; }

/* ---------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(24,43,73,.5);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade 180ms ease-out;
}
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--panel);
  border-radius: 22px;
  box-shadow: var(--sh-3);
  width: min(620px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px 24px 20px;
  animation: cardin 220ms cubic-bezier(.2,1.2,.4,1);
}
@keyframes cardin { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

.sc-top { display: flex; align-items: center; gap: 16px; }
.sc-grade {
  width: 78px; height: 78px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-family: Outfit, sans-serif;
  font-weight: 800;
  font-size: 40px;
  color: #fff;
  background: var(--ink);
  flex: 0 0 auto;
  letter-spacing: -.03em;
}
.sc-grade.S { background: linear-gradient(150deg, #FF7A1A, #E96A0D); }
.sc-grade.A { background: linear-gradient(150deg, #2FA45C, #1E7A44); }
.sc-grade.B { background: linear-gradient(150deg, #3E8DDD, #2C6BA8); }
.sc-grade.C { background: linear-gradient(150deg, #7C8DB5, #566688); }
.sc-head h2 { font-family: Outfit, sans-serif; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.sc-head p { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

.sc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0 14px;
}
.sc-stat { background: var(--felt); border-radius: var(--r-md); padding: 11px 13px; }
.sc-stat b {
  display: block;
  font-family: Outfit, sans-serif;
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.sc-stat i { font-style: normal; font-size: 11px; color: var(--ink-2); }

.sc-best {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 13px;
}
.sc-best .av { width: 42px; height: 42px; font-size: 15px; }
.sc-best-body b { display: block; font-size: 14px; font-weight: 700; }
.sc-best-body i { font-style: normal; font-size: 11.5px; color: var(--ink-2); }
.sc-best-num { margin-left: auto; text-align: right; }
.sc-best-num b { font-family: Outfit, sans-serif; font-size: 17px; font-weight: 700; }
.sc-best-num i { font-style: normal; display: block; font-size: 10.5px; color: var(--ink-2); }

.sc-bank {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  background: rgba(242,185,13,.14);
  font-size: 13px;
  font-weight: 600;
  color: var(--coin-ink);
}
.sc-actions { display: flex; gap: 10px; margin-top: 18px; }
.sc-actions .btn { flex: 1 1 auto; padding: 12px 16px; font-size: 14px; }

/* ---------------------------------------------------------------- mobile */

.mobilebar { display: none; }

@media (max-width: 1180px) {
  :root { --rail: 246px; --side: 320px; --pad: 14px; }
  .brand-text em { display: none; }
  .clockbox { min-width: 150px; padding-left: 14px; }
  .clock { font-size: 28px; }
  .score-stat { min-width: 84px; padding: 6px 10px; }
  .metric b { font-size: 21px; }
}

@media (max-width: 1000px) {
  .speeds .skip-rush { display: none; }
}

@media (max-width: 900px) {
  body { height: auto; overflow-y: auto; display: block; }

  .topbar {
    flex-wrap: wrap;
    gap: 12px 16px;
    padding: 10px 14px 12px;
    position: sticky;
    top: 0;
  }
  .brand { flex: 1 1 auto; }
  .clockbox { border-left: none; padding-left: 0; min-width: 0; margin-left: auto; align-items: flex-end; }
  .clockmeta { justify-content: flex-end; }
  .speeds { order: 3; flex: 1 1 100%; }
  .spd { flex: 1 1 auto; padding: 10px 6px; }
  .speeds .skip-rush { display: block; flex: 1 1 100%; padding: 10px; }
  .scores { order: 4; flex: 1 1 100%; margin-left: 0; }
  .score-stat { flex: 1 1 0; }
  .topactions { order: 5; flex: 1 1 100%; }
  .topactions .btn { flex: 1 1 0; padding: 11px; }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px 12px 84px;
    gap: 12px;
  }
  .panel { overflow: visible; }
  .roster { overflow: visible; max-height: none; }
  .pane { overflow: visible; }

  .layout[data-mtab="floor"] > .rail,
  .layout[data-mtab="floor"] > .side,
  .layout[data-mtab="crew"] > .center,
  .layout[data-mtab="crew"] > .side,
  .layout[data-mtab="ops"] > .rail,
  .layout[data-mtab="ops"] > .center { display: none; }

  .plan { aspect-ratio: auto; height: auto; width: 100%; background: transparent; overflow: visible; }
  .plan-svg-wrap { display: none; }
  .plan-overlay {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .station, .room {
    position: static !important;
    left: auto !important; top: auto !important;
    width: auto !important; height: auto !important;
    background: var(--tint, var(--felt));
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 9px 10px;
    min-height: 74px;
  }
  .station.wide, .room.wide { grid-column: 1 / -1; }
  .board-wrap { padding: 10px; }
  .metrics { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .queue { min-height: 0; }

  .mobilebar {
    display: flex;
    position: fixed;
    left: 12px; right: 12px; bottom: 12px;
    z-index: 70;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--sh-2);
    padding: 5px;
    gap: 4px;
  }
  .mtab {
    flex: 1 1 0;
    border: none;
    background: transparent;
    border-radius: 10px;
    padding: 11px 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--ink-2);
  }
  .mtab[aria-pressed="true"] { background: var(--ink); color: #fff; }

  .toasts { display: flex; left: 12px; right: 12px; bottom: 76px; max-width: none; }
  .toasts .toast:nth-last-child(n+3) { display: none; }
  .log-wrap { height: auto; max-height: 220px; }
}

@media (max-width: 420px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .clock { font-size: 26px; }
  .brand-text strong { font-size: 17px; }
  .st-sub { display: none; }
  .station, .room { min-height: 66px; }
  .sc-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
