/* Sigma YardOS. Colours, fonts and logo come from the Sigma Surveillance website (src/assets/css/main.css);
   spacing, row heights and motion timings come from the YardOS spec's design tokens. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/inter.woff2) format('woff2'); }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/sora.woff2) format('woff2'); }

:root {
  /* Sigma website palette */
  --midnight: #06121f;
  --navy: #0a1f3d;
  --navy-2: #0f2a52;
  --blue: #1f63ff;
  --blue-2: #3b82ff;
  --blue-deep: #1449d6;
  --cyan: #22d3ee;
  --ink: #0b1526;
  --text: #3a4a61;
  --muted: #5b6b82;
  --disabled: #9aa6b8;
  --line: #e2e8f0;
  --surface: #f5f7fb;
  --surface-2: #eaf0f8;
  --white: #fff;
  --blue-tint: #eef3ff;
  /* Status: base colours from the site; darker text shades keep labels readable on their tints */
  --green: #22c55e; --green-ink: #15803d; --green-tint: #e8f8ee;
  --amber: #f5a524; --amber-ink: #a15c00; --amber-tint: #fff4e0;
  --red: #ff4d5e; --red-ink: #c81e33; --red-tint: #ffecee;

  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Sora', 'Inter', system-ui, sans-serif;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-card: 16px;
  --radius-modal: 16px;
  --shadow-sm: 0 1px 2px rgba(11, 21, 38, .06), 0 1px 3px rgba(11, 21, 38, .06);
  --shadow: 0 10px 30px -12px rgba(11, 21, 38, .18), 0 2px 6px rgba(11, 21, 38, .05);
  --shadow-modal: 0 30px 60px -20px rgba(6, 18, 31, .35);
  --ease-in: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.4, 0, 1, 1);
  --gutter: 24px;
  --topbar-h: 64px;
}
@media (max-width: 720px) { :root { --gutter: 16px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--text); font: 400 14px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { color: var(--ink); font-family: var(--font-head); margin: 0; }
h1 { font-size: 24px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 600; line-height: 1.3; }
h3 { font-size: 15px; font-weight: 600; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.label { font-size: 12px; font-weight: 500; letter-spacing: .01em; color: var(--muted); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Top bar (navy, like the website's dark sections) ---------- */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--topbar-h); background: linear-gradient(180deg, var(--navy), var(--midnight)); color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.topbar__inner { max-width: 1280px; margin: 0 auto; height: 100%; padding: 0 var(--gutter); display: flex; align-items: center; gap: 16px; }
.topbar__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; flex-shrink: 0; }
.topbar__brand img { height: 34px; width: auto; display: block; }
.topbar__product { font: 600 12px/1 var(--font-head); letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); border-left: 1px solid rgba(255,255,255,.2); padding-left: 12px; }
.topbar__spacer { flex: 1; }
.topbar select { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.22); border-radius: var(--radius); height: 38px; padding: 0 32px 0 12px; max-width: 260px; }
.topbar select option { color: var(--ink); }
.topbar .btn--ghost { color: #fff; border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.06); }
.topbar .btn--ghost:hover { background: rgba(255,255,255,.14); }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: rgba(255,255,255,.8); white-space: nowrap; }
.live__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
.live--off .live__dot { background: var(--amber); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.usermenu { font-size: 13px; color: rgba(255,255,255,.85); white-space: nowrap; }
.usermenu a { color: #fff; font-weight: 600; }
.thumbs img.uploading { opacity: .5; }
@media (max-width: 720px) {
  .topbar__inner { gap: 8px; }
  .topbar__brand img { height: 26px; }
  .topbar__product, .usermenu__name, .live__text { display: none; }
  .topbar select { max-width: 150px; min-width: 0; }
}
@media (max-width: 420px) {
  .topbar__brand img { height: 20px; }
  .topbar select { max-width: 110px; padding-right: 20px; }
  .topbar .btn--ghost { padding: 0 8px; }
}

.banner { background: var(--amber-tint); color: var(--amber-ink); border-bottom: 1px solid #f6d79c; padding: 8px var(--gutter); text-align: center; font-weight: 500; }

/* ---------- Layout ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 24px var(--gutter) 48px; }
.page__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page__head .sub { margin-top: 4px; }
.layout-admin { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; }
.sidenav { display: flex; flex-direction: column; gap: 4px; }
.sidenav a { display: block; padding: 10px 12px; border-radius: var(--radius); color: var(--ink); text-decoration: none; font-weight: 500; }
.sidenav a:hover { background: var(--surface-2); }
.sidenav a[aria-current="page"] { background: var(--blue-tint); color: var(--blue); font-weight: 600; }
@media (max-width: 860px) { .layout-admin { grid-template-columns: 1fr; } .sidenav { flex-direction: row; overflow-x: auto; } .sidenav a { white-space: nowrap; } }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); }
.card__pad { padding: 24px; }
@media (max-width: 720px) { .card__pad { padding: 16px; } }
.card + .card { margin-top: 16px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; padding: 12px 12px 10px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.tabs button[aria-selected="true"] { color: var(--blue); border-color: var(--blue); }

/* ---------- Buttons and inputs (website style) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius); border: 1.5px solid transparent; font: 600 14px/1 var(--font-body); cursor: pointer; white-space: nowrap; text-decoration: none; transition: background 120ms, border-color 120ms, box-shadow 120ms, transform 120ms; }
.btn--primary { background: linear-gradient(180deg, #3576ff, var(--blue)); color: #fff; box-shadow: 0 6px 18px -8px rgba(31,99,255,.7), inset 0 1px 0 rgba(255,255,255,.2); }
.btn--primary:hover { background: linear-gradient(180deg, #4a85ff, #2a6cff); }
.btn--primary:active { background: var(--blue-deep); }
.btn--secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--secondary:hover { background: var(--surface); border-color: #c5d0e0; }
.btn--danger { background: var(--red-ink); color: #fff; }
.btn--danger:hover { background: #a8172a; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn--block { width: 100%; }
.btn[disabled] { background: var(--surface); color: var(--disabled); border-color: var(--line); box-shadow: none; cursor: not-allowed; }
.btn .spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 16px; }
.field label { font-size: 12px; font-weight: 500; letter-spacing: .01em; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input { height: 40px; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; font-size: 14px; color: var(--ink); transition: box-shadow 100ms, border-color 100ms; }
textarea.input { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(31,99,255,.25); }
.input.flash { animation: flash-fill 600ms var(--ease-in); }
@keyframes flash-fill { from { background: var(--blue-tint); } to { background: #fff; } }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 > .field + .field { margin-top: 0; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }
.form-error { color: var(--red-ink); font-size: 13px; font-weight: 500; margin: 12px 0 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 500; letter-spacing: .01em; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
.table td { height: 48px; padding: 6px 16px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.actions { text-align: right; white-space: nowrap; }
.table tbody tr { transition: background 1200ms var(--ease-in); }
.table tbody tr.row-new { animation: row-in 220ms var(--ease-in); }
.table tbody tr.row-flash { background: var(--blue-tint); transition: none; }
@keyframes row-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.table .num { font-weight: 600; }
.cards-mobile { display: none; }
@media (max-width: 720px) {
  .table--responsive thead { display: none; }
  .table--responsive tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 12px 16px; border-bottom: 1px solid var(--line); gap: 2px 12px; }
  .table--responsive td { height: auto; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  .table--responsive td[data-label]::before { content: attr(data-label) ': '; color: var(--muted); font-size: 12px; }
  .table--responsive td.actions { grid-column: 2; grid-row: 1 / span 6; align-self: center; display: flex; flex-direction: column; gap: 6px; white-space: normal; }
  .page__head .toolbar { width: 100%; }
  .find .input { max-width: none; }
}

/* ---------- Status badges: colour + icon + word, never colour alone ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { font-size: 11px; line-height: 1; }
.badge--ok { background: var(--green-tint); color: var(--green-ink); }
.badge--ok::before { content: '\2713'; }
.badge--hold { background: var(--amber-tint); color: var(--amber-ink); }
.badge--hold::before { content: '\26A0'; }
.badge--blocked { background: var(--red-tint); color: var(--red-ink); }
.badge--blocked::before { content: '\26D4'; }
.badge--muted { background: var(--surface-2); color: var(--muted); }
.badge--muted::before { content: '\2013'; }
.badge--info { background: var(--blue-tint); color: var(--blue-deep); }
.badge--info::before { content: '\2139'; }

/* ---------- Empty, loading ---------- */
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, #f3f6fb 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite linear; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Side panel (fast entry, damage) ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(6, 18, 31, .45); animation: fade-in 150ms var(--ease-in); }
.panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 81; width: 420px; max-width: 100%; background: #fff; box-shadow: var(--shadow-modal); display: flex; flex-direction: column; animation: panel-in 220ms var(--ease-in); }
.panel__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.panel__body { flex: 1; overflow-y: auto; padding: 24px; }
.panel__foot { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.panel__foot .btn--primary { flex: 1; height: 44px; }
.close { background: none; border: 0; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.close:hover { background: var(--surface); color: var(--ink); }
@keyframes panel-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(6, 18, 31, .55); animation: fade-in 150ms var(--ease-in); }
.modal { width: 480px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow-y: auto; background: #fff; border-radius: var(--radius-modal); box-shadow: var(--shadow-modal); animation: modal-in 180ms var(--ease-in); }
.modal--danger { border-top: 4px solid var(--red); }
.modal__head { padding: 20px 24px 0; }
.modal__body { padding: 16px 24px; }
.modal__foot { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 24px 20px; }
.modal-wrap.closing, .overlay.closing { animation: fade-out 140ms var(--ease-out) forwards; }
@keyframes modal-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade-out { to { opacity: 0; } }
.hold-box { background: var(--red-tint); color: var(--red-ink); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.hold-box strong { display: block; }

/* ---------- Autofill ---------- */
.ac { position: relative; }
.ac__list { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); list-style: none; margin: 0; padding: 4px; max-height: 280px; overflow-y: auto; }
.ac__item { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.ac__item[aria-selected="true"], .ac__item:hover { background: var(--blue-tint); }
.ac__item .line1 { color: var(--ink); font-weight: 600; }
.ac__item .line2 { font-size: 12px; color: var(--muted); }

/* ---------- Photos ---------- */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.damage-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.damage-item:last-child { border-bottom: 0; }
.prior { background: var(--amber-tint); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 20px; }
.prior h3 { color: var(--amber-ink); margin-bottom: 4px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); font-weight: 500; max-width: 360px; animation: toast-in 200ms var(--ease-in); }
.toast--error { background: var(--red-ink); }
.toast__action { margin-left: 12px; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; padding: 4px 10px; font-weight: 600; cursor: pointer; }
.toast__action:hover { background: rgba(255,255,255,.24); }
.counts:empty { display: none; }
.count-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.count-chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: 500 13px/1 var(--font-body); color: var(--ink); }
button.count-chip { cursor: pointer; }
button.count-chip:hover { border-color: #c5d0e0; background: var(--surface); }
.count-chip[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); color: var(--blue-deep); }
.count-chip--all { background: var(--surface-2); }
.count-chip__value { font-weight: 700; font-variant-numeric: tabular-nums; }
.count-chip--full { border-color: var(--red); }
.count-chip__full { font-size: 11px; font-weight: 700; color: var(--red-ink); background: var(--red-tint); border-radius: 4px; padding: 2px 6px; }
.input--narrow { width: 110px; }
.input--auto { width: auto; }
.btn--danger-text { color: var(--red-ink); border-color: transparent; }
.btn--danger-text:hover { background: var(--red-tint); }
.find { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.find .input { max-width: 360px; }
.find__count { font-size: 12px; color: var(--muted); }
.table tbody tr.row-match td { background: var(--blue-tint); }
.shortcuts { font-size: 12px; color: var(--muted); margin: -8px 0 16px; }
.shortcuts kbd { font: 600 11px/1 var(--font-body); background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; color: var(--ink); }
.time-quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.time-quick .chip { height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink); }
.time-quick .chip[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); color: var(--blue-deep); }
.hint--learn { font-size: 12px; color: var(--amber-ink); background: var(--amber-tint); border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
.tag-usual { font-size: 11px; font-weight: 600; color: var(--green-ink); background: var(--green-tint); border-radius: 4px; padding: 1px 6px; margin-left: 6px; }
.toast.leaving { animation: toast-out 160ms var(--ease-out) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px); } }

/* ---------- Login (navy, like the website hero) ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 20% -10%, rgba(31,99,255,.35), transparent 60%), linear-gradient(180deg, var(--navy), var(--midnight)); }
.auth__card { width: 400px; max-width: 100%; background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow-modal); padding: 32px; }
.auth__logo { display: block; margin: 0 auto 8px; width: 240px; max-width: 100%; height: auto; }
.auth__product { text-align: center; font: 600 12px/1 var(--font-head); letter-spacing: .16em; text-transform: uppercase; color: var(--blue); margin-bottom: 32px; }
.auth__card .btn { width: 100%; height: 44px; margin-top: 24px; }
.auth__foot { text-align: center; margin-top: 16px; font-size: 12px; color: rgba(255,255,255,.6); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

.tag-blacklisted { font-size: 11px; font-weight: 700; color: var(--red-ink); background: var(--red-tint); border-radius: 4px; padding: 1px 6px; margin-left: 6px; }

.outage { background: var(--red-tint); color: var(--red-ink); border: 1px solid #f7c4ca; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.check { display: inline-flex; align-items: center; gap: 4px; }

.outage { flex-direction: column; align-items: stretch; }
.outage__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.check-group { padding: 8px 16px 0; }
.check-group h3 { margin: 12px 0 4px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface); }
.chip--on { background: var(--blue-tint); border-color: var(--blue); color: var(--blue-deep); }


.chip { height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink); margin: 2px 4px 2px 0; }
.chip[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); color: var(--blue-deep); }


.instructions { background: var(--blue-tint); border: 1px solid #c9d8ff; color: var(--ink); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; }
.instructions__text { white-space: pre-line; font-size: 13px; margin-top: 2px; }

.notice { background: #fff7e6; border: 1px solid #f5d38a; color: var(--ink); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; margin: 4px 0 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }
