/* =========================================================================
   ACTOM Turbo Machines — application stylesheet
   Locally bundled. No CDN dependencies.
   ========================================================================= */

:root {
  /* ACTOM Turbo Machines brand palette (sampled from actomturbo.co.za) */
  --brand: #08385a;        /* primary navy */
  --brand-dark: #032b4a;
  --brand-blue: #006cb8;   /* ACTOM corporate blue */
  --accent: #57b7dd;       /* cyan accent */
  /* Alarm red — reserved for P1 / breakdown / overdue / destructive */
  --red: #d6001c;
  --red-dark: #a80016;
  --red-soft: #fdecee;
  --ink: #032a47;
  --steel: #08385a;
  --steel-2: #0d4a75;
  --bg: #eef1f5;
  --surface: #ffffff;
  --line: #dde3ea;
  --text: #1b2430;
  --muted: #667487;
  --ok: #157347;
  --ok-soft: #e3f4ec;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --info: #1d4ed8;
  --info-soft: #e8eefc;
  --grey-soft: #eceff3;
  --purple: #6d28d9;
  --purple-soft: #f1eafe;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .16);
  --font: "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.45;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.45rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; color: var(--steel); }
h3 { font-size: .95rem; }

/* ------------------------------------------------------------------ layout */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px;
  background: linear-gradient(180deg, var(--ink) 0%, var(--steel) 100%);
  color: #cfd8e3; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand img.brand-logo { width: 172px; height: auto; display: block; }
.sidebar .brand-name { font-weight: 700; color: #fff; font-size: .95rem; line-height: 1.15; }
.sidebar .brand-sub { font-size: .62rem; letter-spacing: .18em; color: #93a3b8; text-transform: uppercase; }
.nav-section { padding: 14px 10px 4px; font-size: .64rem; letter-spacing: .16em;
  text-transform: uppercase; color: #7f8ea1; }
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 14px; margin: 1px 6px; border-radius: 7px;
  color: #cfd8e3; font-size: .87rem; text-decoration: none;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a.active { background: var(--brand-blue); color: #fff; font-weight: 600; }
.nav a .ico { width: 17px; text-align: center; opacity: .85; }
.sidebar .foot { margin-top: auto; padding: 12px 16px; font-size: .7rem; color: #7f8ea1;
  border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 10px 22px; position: sticky; top: 0; z-index: 40;
}
.topbar .page-title { font-weight: 700; font-size: 1.02rem; }
.topbar .spacer { flex: 1; }
.topbar form.search { display: flex; }
.topbar input[type=search] {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px;
  width: 230px; font-size: .85rem; background: var(--bg);
}
.userchip { display: flex; align-items: center; gap: 9px; }
.userchip .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--steel); color: #fff; display: grid; place-items: center;
  font-size: .8rem; font-weight: 700;
}
.userchip .who { line-height: 1.15; }
.userchip .who .nm { font-weight: 600; font-size: .84rem; }
.userchip .who .rl { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.content { padding: 22px; max-width: 1500px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .grow { flex: 1; }

/* ------------------------------------------------------------------- cards */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); margin-bottom: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.stat .l { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.stat.tone-red .v { color: var(--red); }
.stat.tone-amber .v { color: var(--warn); }
.stat.tone-green .v { color: var(--ok); }
.stat.tone-blue .v { color: var(--info); }
.stat.alert { border-left: 4px solid var(--red); padding-left: 12px; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.panel > .panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.panel > .panel-head h2 { margin: 0; font-size: .8rem; }
.panel > .panel-head .grow { flex: 1; }
.panel > .panel-body { padding: 16px; }
.panel.p1-panel { border: 1px solid #f3b3bc; }
.panel.p1-panel > .panel-head { background: var(--red-soft); border-bottom-color: #f3b3bc; }
.panel.p1-panel > .panel-head h2 { color: var(--red-dark); }

/* ------------------------------------------------------------------ tables */
.tablewrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.data th {
  text-align: left; font-size: .66rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: #fafbfc;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #f7f9fb; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.row-overdue td { background: #fff5f6; }
tr.row-overdue:hover td { background: #ffeef0 !important; }
.jobcell .jn { font-weight: 700; }
.jobcell .jd { color: var(--muted); font-size: .8rem; }

/* ------------------------------------------------------------------ badges */
.prio {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .72rem; letter-spacing: .04em;
  border-radius: 6px; padding: 3px 8px; min-width: 30px;
}
.prio-p1 { background: var(--red); color: #fff; }
.prio-p2 { background: var(--warn); color: #fff; }
.prio-p3 { background: var(--brand); color: #fff; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 99px; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-green { background: var(--ok-soft); color: var(--ok); }
.pill-amber { background: var(--warn-soft); color: var(--warn); }
.pill-red { background: var(--red-soft); color: var(--red-dark); }
.pill-blue { background: var(--info-soft); color: var(--info); }
.pill-grey { background: var(--grey-soft); color: #55657a; }
.pill-purple { background: var(--purple-soft); color: var(--purple); }

.tag { font-size: .72rem; background: var(--grey-soft); border-radius: 5px; padding: 2px 7px; color: #46566b; }
.due-overdue { color: var(--red-dark); font-weight: 700; }
.due-today { color: var(--warn); font-weight: 700; }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  font-family: var(--font); font-size: .84rem; font-weight: 600;
  padding: 8px 14px; text-decoration: none; transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--info); }
.btn-ghost:hover { background: var(--info-soft); }
.btn-danger { background: #fff; color: var(--red-dark); border-color: #f0b6bd; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 4px 10px; font-size: .76rem; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ------------------------------------------------------------------- forms */
form .field { margin-bottom: 14px; }
label { display: block; font-size: .76rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: #46566b; margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], input[type=search], select, textarea, .input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; font-family: var(--font); font-size: .9rem; background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(87, 183, 221, .45); border-color: var(--brand-blue);
}
.field .help { font-size: .74rem; color: var(--muted); margin-top: 3px; }
.field .err { color: var(--red-dark); font-size: .78rem; margin-top: 4px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.errorbox {
  background: var(--red-soft); border: 1px solid #f0b6bd; color: var(--red-dark);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-weight: 600; font-size: .85rem;
}

/* ----------------------------------------------------------------- filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select, .filters input { width: auto; padding: 6px 9px; font-size: .8rem; }
.filters input[type=search] { min-width: 190px; }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; right: 18px; top: 16px; z-index: 300; display: flex;
  flex-direction: column; gap: 8px; max-width: 380px; }
.toast {
  background: var(--ink); color: #fff; border-radius: 9px; padding: 11px 16px;
  box-shadow: var(--shadow-lg); font-size: .86rem; display: flex; gap: 9px;
  align-items: flex-start; animation: toast-in .18s ease-out;
}
.toast.success { border-left: 4px solid #2fbf71; }
.toast.error { border-left: 4px solid var(--red); }
.toast.info { border-left: 4px solid var(--accent); }
@keyframes toast-in { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------------ dialog */
dialog {
  border: none; border-radius: 12px; padding: 0; box-shadow: var(--shadow-lg);
  width: min(480px, 92vw);
}
dialog::backdrop { background: rgba(15, 23, 42, .5); }
dialog .dlg-head { padding: 14px 18px; border-bottom: 1px solid var(--line);
  font-weight: 700; display: flex; align-items: center; }
dialog .dlg-head .grow { flex: 1; }
dialog .dlg-body { padding: 18px; }

/* ------------------------------------------------------------- empty states */
.empty {
  text-align: center; padding: 34px 20px; color: var(--muted);
}
.empty .big { font-size: 1rem; font-weight: 700; color: #46566b;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.empty.good .big { color: var(--ok); }

/* ------------------------------------------------------------------ charts */
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 34px; gap: 8px; align-items: center; font-size: .8rem; }
.bar-row .bar-label { color: #46566b; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--grey-soft); height: 14px; border-radius: 7px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 7px; background: var(--steel-2); min-width: 2px; }
.bar-fill.p1 { background: var(--red); }
.bar-fill.p2 { background: var(--warn); }
.bar-fill.p3 { background: var(--brand); }
.bar-row .bar-val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.chartgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 20px; }

/* -------------------------------------------------------------- route steps */
.route { display: flex; flex-wrap: wrap; gap: 0; align-items: center; }
.route .step { display: flex; align-items: center; gap: 7px; }
.route .dot {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: .72rem; font-weight: 800; border: 2px solid var(--line); color: var(--muted);
  background: #fff;
}
.route .step.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.route .step.now .dot { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; box-shadow: 0 0 0 4px rgba(87, 183, 221, .3); }
.route .lbl { font-size: .78rem; font-weight: 600; color: #46566b; }
.route .step.now .lbl { color: var(--brand); font-weight: 800; }
.route .conn { width: 26px; height: 2px; background: var(--line); margin: 0 8px; }

/* ---------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 14px 30px; }
.timeline li::before {
  content: ""; position: absolute; left: 3px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: #fff; border: 3px solid var(--steel-2);
}
.timeline li .t { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline li .s { font-size: .85rem; }
.timeline li .a { font-size: .74rem; color: var(--muted); }

/* ---------------------------------------------------------- planning board */
.board { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); align-items: start; }
.machine-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.machine-col .mc-head { padding: 11px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.machine-col .mc-head .code { font-weight: 800; font-size: .95rem; }
.machine-col .mc-head .grow { flex: 1; }
.machine-col .mc-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.jobcard {
  border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px;
  padding: 9px 11px; background: #fff; font-size: .82rem;
}
.jobcard.p1 { border-left-color: var(--red); }
.jobcard.p2 { border-left-color: var(--warn); }
.jobcard.p3 { border-left-color: var(--brand); }
.jobcard .top { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; }
.jobcard .jn { font-weight: 800; }
.jobcard .jd { color: var(--muted); }
.jobcard .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.jobcard .lane { font-size: .62rem; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 800; color: var(--muted); }
.jobcard.current { box-shadow: 0 0 0 2px rgba(21, 115, 71, .25); }
.jobcard.current .lane { color: var(--ok); }
.jobcard form { display: inline; }

/* ------------------------------------------------------------ job control */
.jobcontrol { border-left: 4px solid var(--brand-blue); }
.jobcontrol.p1-border { border-left-color: var(--red); }
.nextstep { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn-big { font-size: 1rem; padding: 12px 22px; }

/* -------------------------------------------------------------- login page */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(87,183,221,.3), transparent 60%),
    radial-gradient(700px 400px at 10% 110%, rgba(0,108,184,.35), transparent 60%),
    linear-gradient(160deg, #021c31 0%, var(--brand-dark) 55%, var(--brand) 100%);
  padding: 20px;
}
.login-card {
  width: min(400px, 94vw); background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 34px 34px 28px;
}
.login-card .lc-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-card .lc-brand img { height: 44px; width: auto; }
.login-card h1 { font-size: 1.15rem; margin: 0; }
.login-card .lc-sub { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; }
.login-note { margin-top: 16px; font-size: .74rem; color: var(--muted); text-align: center; }

/* ================================================================== KIOSK */
body.kiosk {
  background:
    radial-gradient(900px 500px at 90% -10%, rgba(87,183,221,.18), transparent 60%),
    linear-gradient(170deg, #021c31, var(--brand));
  color: #eef2f7; min-height: 100vh;
}
.kiosk-shell { max-width: 1050px; margin: 0 auto; padding: 22px 18px 40px; }
.kiosk-top { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.kiosk-top img { height: 52px; width: auto; }
.kiosk-top .t1 { font-weight: 800; font-size: 1.05rem; color: #fff; }
.kiosk-top .t2 { font-size: .66rem; letter-spacing: .2em; text-transform: uppercase; color: #93a3b8; }
.kiosk-top .grow { flex: 1; }
.kiosk-user { font-size: .9rem; color: #cfd8e3; text-align: right; }
.kiosk-user b { color: #fff; }

.kiosk-panel {
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; padding: 26px;
}
.kiosk h1 { color: #fff; font-size: 1.5rem; }
.kiosk label { color: #b9c5d4; font-size: .8rem; }
.kiosk input[type=text], .kiosk input[type=password], .kiosk input[type=number], .kiosk select {
  font-size: 1.5rem; padding: 16px 18px; border-radius: 12px; border: 2px solid rgba(255,255,255,.2);
  background: rgba(13, 20, 30, .6); color: #fff; letter-spacing: .04em;
}
.kiosk input:focus, .kiosk select:focus { outline: 3px solid rgba(87,183,221,.55); border-color: var(--accent); }
.kbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: none; border-radius: 12px; cursor: pointer; font-family: var(--font);
  font-size: 1.15rem; font-weight: 800; letter-spacing: .04em; padding: 16px 26px;
  text-transform: uppercase; text-decoration: none;
}
.kbtn:hover { text-decoration: none; filter: brightness(1.08); }
.kbtn-primary { background: var(--brand-blue); color: #fff; width: 100%; }
.kbtn-secondary { background: rgba(255,255,255,.12); color: #eef2f7; }
.kbtn-ghost { background: transparent; color: #9fb0c3; font-size: .95rem; }
.kiosk .errorbox { background: rgba(214,0,28,.18); border-color: rgba(214,0,28,.5); color: #ffb9c2; font-size: 1rem; }

.kiosk-jobhead { text-align: center; margin-bottom: 18px; }
.kiosk-jobhead .jn { font-size: 2.3rem; font-weight: 900; color: #fff; letter-spacing: .02em; }
.kiosk-jobhead .jd { font-size: 1.35rem; color: #dbe4ee; text-transform: uppercase; letter-spacing: .05em; }
.kiosk-jobhead .prio { font-size: 1rem; margin-top: 10px; padding: 6px 16px; }
.kiosk-meta { display: flex; justify-content: center; gap: 26px; margin-top: 14px; flex-wrap: wrap;
  font-size: 1rem; color: #b9c5d4; }
.kiosk-meta b { color: #fff; }

.tilegrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile {
  background: rgba(255,255,255,.07); border: 2px solid rgba(255,255,255,.14);
  border-radius: 14px; padding: 18px 10px; text-align: center; cursor: pointer;
  color: #fff; font-family: var(--font); transition: border-color .1s, background .1s;
  -webkit-tap-highlight-color: transparent;
}
.tile:hover { background: rgba(255,255,255,.12); }
.tile .code { font-size: 1.25rem; font-weight: 900; letter-spacing: .03em; }
.tile .nm { font-size: .74rem; color: #a9b8c9; margin-top: 3px; }
.tile .avail { font-size: .7rem; margin-top: 7px; color: #7f95ac; }
.tile.selected { border-color: var(--accent); background: rgba(87,183,221,.16); }
.tile.low .avail { color: #ffb9c2; font-weight: 700; }
.kiosk-cat { margin: 20px 0 10px; font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: #93a3b8; }

.cartbar {
  position: sticky; bottom: 0; margin-top: 24px;
  background: rgba(10, 16, 24, .95); border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px; padding: 16px; backdrop-filter: blur(6px);
}
.cartline { display: flex; align-items: center; gap: 14px; padding: 8px 4px; font-size: 1.1rem; }
.cartline .cl-code { font-weight: 800; flex: 1; }
.stepper { display: flex; align-items: center; gap: 0; }
.stepper button {
  width: 52px; height: 52px; font-size: 1.6rem; font-weight: 800; border: none; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff;
}
.stepper button:first-child { border-radius: 10px 0 0 10px; }
.stepper button:last-child { border-radius: 0 10px 10px 0; }
.stepper .qty {
  width: 62px; height: 52px; display: grid; place-items: center; font-size: 1.4rem;
  font-weight: 800; background: rgba(13,20,30,.8);
}
.kiosk-success { text-align: center; padding: 30px 10px; }
.kiosk-success .tick {
  width: 90px; height: 90px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--ok); display: grid; place-items: center; font-size: 3rem; color: #fff;
}
.kiosk-success h1 { font-size: 2rem; letter-spacing: .06em; }
.kiosk-success .lines { font-size: 1.25rem; margin: 14px 0; color: #dbe4ee; }
.kiosk-success .count { color: #93a3b8; font-size: .9rem; margin-top: 18px; }

/* ================================================================ TV BOARD */
body.tv {
  background: #041b2d; color: #e8eef5; min-height: 100vh; font-size: 17px;
  overflow-x: hidden;
}
.tv-shell { padding: 22px 30px; }
.tv-head { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.tv-head img { height: 62px; width: auto; }
.tv-head .t1 { font-size: 1.5rem; font-weight: 900; color: #fff; letter-spacing: .02em; }
.tv-head .t2 { font-size: .8rem; letter-spacing: .3em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.tv-head .grow { flex: 1; }
.tv-clock { text-align: right; }
.tv-clock .tm { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff; }
.tv-clock .dt { font-size: .85rem; color: #8fa1b8; }

.tv-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.tv-stat {
  background: #08283f; border: 1px solid #10395c; border-radius: 12px;
  padding: 12px 20px; min-width: 130px;
}
.tv-stat .v { font-size: 2.2rem; font-weight: 900; line-height: 1.05; }
.tv-stat .l { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: #8fa1b8; font-weight: 700; }
.tv-stat.red .v { color: #ff5468; }
.tv-stat.green .v { color: #3ddc84; }
.tv-stat.amber .v { color: #ffc24b; }
.tv-stat.blue .v { color: #6db2ff; }

.tv-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.tv-section { background: #062338; border: 1px solid #10395c; border-radius: 14px; margin-bottom: 18px; overflow: hidden; }
.tv-section .sec-head {
  padding: 12px 18px; font-size: .95rem; font-weight: 900; letter-spacing: .14em;
  text-transform: uppercase; color: #b6cde2; border-bottom: 1px solid #10395c;
  display: flex; align-items: center; gap: 10px;
}
.tv-section.attn { border-color: #7d2531; }
.tv-section.attn .sec-head { background: #3d0f17; color: #ff97a4; }
.tv-section .sec-head .cnt {
  margin-left: auto; background: #0f3a5c; border-radius: 8px; padding: 2px 12px;
  font-size: .9rem; color: #fff;
}
.tv-section.attn .sec-head .cnt { background: var(--red); }

table.tv-table { width: 100%; border-collapse: collapse; }
table.tv-table th {
  text-align: left; font-size: .66rem; letter-spacing: .12em; text-transform: uppercase;
  color: #5f8bb0; padding: 9px 18px; border-bottom: 1px solid #0a2c46;
}
table.tv-table td { padding: 11px 18px; border-bottom: 1px solid #082943; font-size: 1.02rem; }
table.tv-table tr:last-child td { border-bottom: 0; }
table.tv-table .jn { font-weight: 900; color: #fff; font-size: 1.06rem; }
table.tv-table .jd { color: #b9c9dd; }
table.tv-table .mach { font-weight: 800; color: #6db2ff; }
.tv-p1card {
  display: flex; align-items: center; gap: 16px; padding: 13px 18px;
  border-bottom: 1px solid #2a1017;
}
.tv-p1card:last-child { border-bottom: 0; }
.tv-p1card .prio { font-size: .95rem; padding: 6px 12px; }
.tv-p1card .jn { font-size: 1.25rem; font-weight: 900; color: #fff; }
.tv-p1card .jd { font-size: 1.05rem; color: #ffd7dc; text-transform: uppercase; }
.tv-p1card .where { margin-left: auto; text-align: right; font-size: .95rem; color: #b9c9dd; }
.tv-p1card .where b { color: #fff; }
.tv-empty { padding: 22px 18px; color: #72859e; font-size: 1rem; text-align: center; }
.tv-empty .big { font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: #3ddc84; }

.tv-machines { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; }
.tv-mchip {
  border-radius: 9px; padding: 7px 13px; font-weight: 800; font-size: .95rem;
  border: 1px solid #10395c; background: #08283f; color: #b6cde2;
}
.tv-mchip.RUNNING { border-color: #1d5c3d; color: #3ddc84; }
.tv-mchip.AVAILABLE { border-color: #244a73; color: #6db2ff; }
.tv-mchip.SETUP { border-color: #6d5420; color: #ffc24b; }
.tv-mchip.BREAKDOWN { border-color: #7d2531; color: #ff5468; background: #2b0e14; }
.tv-mchip.MAINTENANCE { border-color: #4a3a6b; color: #b79df5; }
.tv-mchip.OFFLINE { color: #6f8098; }
.tv-updated { text-align: right; color: #55657a; font-size: .75rem; padding: 4px 6px 0; }

/* ---------------------------------------------------------------- help */
.help-btn {
  width: 32px; height: 32px; padding: 0; border-radius: 50%;
  font-weight: 800; font-size: .95rem; flex: 0 0 auto;
  color: var(--brand-blue); border-color: var(--brand-blue);
}
.help-btn:hover { background: var(--info-soft); }
.help-body { font-size: .92rem; }
.help-body ul { margin: 0; padding-left: 20px; }
.help-body li { margin: 8px 0; }
.kiosk-help-btn {
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1);
  color: #fff; font-size: 1.2rem; font-weight: 800; cursor: pointer;
}
dialog.kiosk-dlg { background: #0b2540; color: #e4edf5; }
dialog.kiosk-dlg .dlg-head { border-bottom-color: rgba(255,255,255,.15); }
dialog.kiosk-dlg .help-body { font-size: 1.05rem; }

/* ------------------------------------------------------------- responsive */
.back-btn { flex: 0 0 auto; white-space: nowrap; }
.mobile-only { display: none !important; }

@media (max-width: 1100px) {
  .tv-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -240px; transition: left .18s; z-index: 100; height: 100vh;
    box-shadow: 4px 0 18px rgba(0,0,0,.35); }
  .sidebar.open { left: 0; }
  .menu-btn { display: inline-flex !important; }
  .content { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .topbar input[type=search] { width: 150px; }
  .page-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 640px) {
  .topbar form.search { display: none; }
  .nav a.mobile-only { display: flex !important; }
  .userchip .who { display: none; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
  .card { padding: 10px 12px; }
  .stat .v { font-size: 1.35rem; }
  .stat .l { font-size: .62rem; }
  .content { padding: 10px; }
  .panel > .panel-body { padding: 12px; }
  .panel > .panel-head { padding: 10px 12px; }
  table.data { font-size: .8rem; }
  table.data th, table.data td { padding: 7px 8px; }
  .filters select, .filters input[type=search] { flex: 1 1 45%; min-width: 0; }
  .page-head { gap: 8px; }
  .page-head .btn { flex: 1 1 auto; }
  .nextstep { align-items: stretch; flex-direction: column; }
  .nextstep form { width: 100%; }
  .nextstep .btn-big { width: 100%; }
  .nextstep .grow { display: none; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; }
  .board { grid-template-columns: 1fr; }
  .chartgrid { grid-template-columns: 1fr !important; }
  dialog { width: 94vw; }
  .route .conn { width: 12px; margin: 0 4px; }
  .kiosk-shell { padding: 14px 10px 30px; }
  .tilegrid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 9px; }
  .kiosk-panel { padding: 18px 14px; }
  .kiosk h1 { font-size: 1.2rem; }
}
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; cursor: pointer; font-size: 1rem; }

/* ---------------------------------------------------------------- misc */
.muted { color: var(--muted); }
.small { font-size: .78rem; }
.mb0 { margin-bottom: 0; }
.flex { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.inline-form { display: inline; }
.pagination { display: flex; gap: 6px; align-items: center; padding: 12px 16px; font-size: .82rem; }
