/* ==========================================================================
   FlexiFlow – Flexpress brand, touch-first shop-floor UI (FRD §3)
   ========================================================================== */
:root {
    --plum: #6F1064;
    --plum-dark: #5A0D51;
    --plum-soft: #9F5997;
    --plum-tint: #F6F0F6;
    --teal: #36A5B5;
    --teal-bright: #00B3A6;
    --ice: #F3FBFC;
    --ice-border: #DCEBED;
    --bg: #EBF1F4;
    --bg-2: #F6F7F9;
    --surface: #FFFFFF;
    --text: #233B3F;
    --text-2: #415458;
    --muted: #6B7F84;
    --line: #E3EAEC;

    --ready: #0D6EFD;
    --ready-tint: #E8F0FE;
    --progress: #00B3A6;
    --progress-tint: #E6F7F5;
    --hold: #DC3545;
    --hold-tint: #FDECEE;
    --due: #FD7E14;
    --due-tint: #FFF3E8;
    --done: #198754;
    --done-tint: #E8F5EE;
    --pending: #8A9BA0;
    --pending-tint: #EEF2F3;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(35, 59, 63, .06), 0 2px 8px rgba(35, 59, 63, .05);
    --shadow-lg: 0 12px 40px rgba(35, 59, 63, .22);
    --touch: 48px;
    --touch-lg: 56px;
    --font: "Inter", "Segoe UI", "Nunito", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    font-family: var(--font);
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { margin: 0; color: var(--text); }
a { color: var(--plum); }
button { font-family: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.mt { margin-top: 16px; }
.hidden { display: none !important; }

/* ---- App shell ---------------------------------------------------------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    height: 64px; background: var(--plum); color: #fff;
    display: flex; align-items: center; gap: 22px; padding: 0 22px;
    position: sticky; top: 0; z-index: 30;
}
.topbar .brand { font-weight: 800; font-size: 21px; letter-spacing: .5px; color: #fff; text-decoration: none; }
.topbar .section { font-size: 15px; letter-spacing: .6px; text-transform: uppercase; color: #E9C9E4; }
.topbar nav { display: flex; gap: 4px; margin-left: 10px; }
.topbar nav a {
    color: #F2DDEE; text-decoration: none; font-weight: 600; font-size: 14px;
    padding: 0 14px; height: 40px; display: inline-flex; align-items: center; border-radius: 20px; white-space: nowrap;
}
.topbar nav a:hover { background: rgba(255, 255, 255, .1); }
.topbar nav a.active { background: rgba(255, 255, 255, .18); color: #fff; }
.topbar .user-chip {
    display: flex; align-items: center; gap: 10px; background: rgba(0, 0, 0, .18);
    border-radius: 24px; padding: 6px 6px 6px 14px; font-size: 13.5px;
}
.topbar .user-chip .role { color: #E9C9E4; font-size: 12px; }
.topbar .user-chip button {
    background: rgba(255, 255, 255, .15); color: #fff; border: 0; border-radius: 18px;
    height: 34px; padding: 0 14px; cursor: pointer; font-weight: 600;
}
.app-main { flex: 1; padding: 18px 20px 28px; }

.live-pill {
    display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 16px;
    border-radius: 20px; background: rgba(0, 0, 0, .2); font-size: 13.5px; color: #fff; white-space: nowrap;
}
.live-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal-bright); box-shadow: 0 0 0 0 rgba(0, 179, 166, .7); animation: pulse 2s infinite; }
.live-pill.offline .dot { background: var(--due); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(0, 179, 166, .6); } 70% { box-shadow: 0 0 0 8px rgba(0, 179, 166, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 179, 166, 0); } }

/* ---- Buttons (≥ 48px touch targets) -------------------------------------- */
.btn {
    min-height: var(--touch); padding: 0 20px; border-radius: var(--radius-sm); border: 1.5px solid transparent;
    font-weight: 700; font-size: 14.5px; letter-spacing: .2px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--surface); color: var(--text); border-color: var(--ice-border);
    transition: filter .12s, transform .05s; user-select: none;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-lg { min-height: var(--touch-lg); font-size: 16px; padding: 0 26px; border-radius: 10px; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--plum); color: #fff; border-color: var(--plum); }
.btn-teal { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn-ready { background: var(--ready); color: #fff; border-color: var(--ready); }
.btn-complete { background: var(--done); color: #fff; border-color: var(--done); }
.btn-hold { background: var(--hold-tint); color: var(--hold); border-color: var(--hold); }
.btn-rework { background: var(--due-tint); color: #C55A00; border-color: var(--due); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-outline { background: var(--ice); color: var(--text); border-color: var(--teal); }
.btn-danger { background: var(--hold); color: #fff; border-color: var(--hold); }
.icon-btn {
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--ice-border); background: var(--surface);
    cursor: pointer; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2);
}

/* ---- Pills, badges -------------------------------------------------------- */
.pill {
    display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; padding: 3px 9px;
    font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; white-space: nowrap;
}
.pill-lg { font-size: 13px; padding: 8px 16px; border-radius: 8px; min-width: 120px; justify-content: center; }
.st-pending { background: var(--pending-tint); color: var(--pending); }
.st-ready { background: var(--ready-tint); color: var(--ready); }
.st-inprogress { background: var(--progress-tint); color: #00877D; }
.st-onhold { background: var(--hold-tint); color: var(--hold); }
.st-completed { background: var(--done-tint); color: var(--done); }
.st-skipped, .st-cancelled { background: var(--pending-tint); color: var(--muted); text-decoration: line-through; }
.prio { border: 1px solid; border-radius: 6px; font-size: 10.5px; font-weight: 800; padding: 3px 8px; letter-spacing: .6px; }
.prio-express { color: var(--due); border-color: #FFD9B8; background: var(--due-tint); }
.prio-standard { color: var(--teal); border-color: #BFE3E8; background: var(--ice); }
.prio-saver { color: var(--muted); border-color: var(--line); background: var(--bg-2); }
.prio-collect { color: #00877D; border-color: #BCE8E3; background: var(--progress-tint); }
.badge-rework { background: var(--due); color: #fff; }
.badge-changed { background: var(--ready); color: #fff; }
.count-pill {
    min-width: 32px; height: 26px; border-radius: 13px; border: 1.5px solid var(--teal); color: var(--teal);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; padding: 0 8px;
}
.stage-num {
    width: 28px; height: 28px; border-radius: 50%; background: var(--plum); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex: none;
}

/* ---- Filter bar ---------------------------------------------------------- */
.filter-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--surface); margin: -18px -20px 16px; padding: 12px 20px; border-bottom: 1px solid var(--line);
}
.chip {
    height: var(--touch); padding: 0 18px; border-radius: 10px; border: 1.5px solid var(--ice-border); background: var(--ice);
    font-weight: 700; font-size: 13.5px; cursor: pointer; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px;
}
.chip.active { background: var(--plum); border-color: var(--plum); color: #fff; }
.chip.due { background: var(--due-tint); border-color: #FFD9B8; color: #C55A00; }
.chip.due.active { background: var(--due); color: #fff; border-color: var(--due); }
.chip.hold { background: var(--hold-tint); border-color: #F5C2C7; color: var(--hold); }
.chip.hold.active { background: var(--hold); color: #fff; border-color: var(--hold); }
.chip.rework { background: var(--due-tint); border-color: #FFD9B8; color: #C55A00; }
.chip.rework.active { background: #C55A00; color: #fff; }
.select, .input, .textarea {
    height: var(--touch); border-radius: 10px; border: 1.5px solid var(--ice-border); background: var(--ice);
    padding: 0 14px; font-size: 14px; color: var(--text); font-family: inherit; min-width: 0;
}
.textarea { height: auto; min-height: 80px; padding: 10px 14px; resize: vertical; }
.select:focus, .input:focus, .textarea:focus { outline: 2px solid var(--teal); outline-offset: 0; background: #fff; }
.filter-select { display: inline-flex; align-items: center; gap: 6px; }
.filter-select label { font-size: 13px; font-weight: 700; color: var(--text-2); }

/* ---- Production board ------------------------------------------------------ */
.board {
    display: grid; grid-template-columns: repeat(6, minmax(232px, 1fr)); gap: 14px; overflow-x: auto;
    align-items: start; padding-bottom: 8px;
}
.column { background: #F4F8F9; border: 1px solid var(--ice-border); border-radius: 14px; min-height: 260px; display: flex; flex-direction: column; }
.column-head {
    display: flex; align-items: center; gap: 10px; padding: 14px 14px; background: var(--ice);
    border-bottom: 1px solid var(--ice-border); border-radius: 14px 14px 0 0;
}
.column-head h3 { font-size: 16px; font-weight: 700; flex: 1; }
.column-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.column-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 8px; }

.job-card {
    position: relative; background: var(--surface); border-radius: 10px; padding: 12px 12px 12px 16px;
    box-shadow: var(--shadow); border: 1px solid var(--line); cursor: pointer; overflow: hidden; text-align: left;
    width: 100%; font: inherit; color: inherit;
}
.job-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--pending); }
.job-card.s-ready::before { background: var(--ready); }
.job-card.s-inprogress::before { background: var(--progress); }
.job-card.s-onhold::before { background: var(--hold); }
.job-card.s-completed::before { background: var(--done); }
.job-card.s-onhold { border-color: #F5C2C7; }
.job-card:hover { box-shadow: 0 4px 14px rgba(35, 59, 63, .12); }
.job-card .code { color: var(--plum); font-weight: 800; font-size: 15.5px; }
.job-card .product { font-weight: 700; font-size: 15px; margin-top: 4px; }
.job-card .customer { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.job-card .step { border-radius: 8px; padding: 8px 10px; margin: 10px 0 8px; }
.job-card .step .label { font-size: 10.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; }
.job-card .step .name { font-size: 13.5px; margin-top: 3px; color: var(--text); }
.job-card .step.s-ready { background: var(--ready-tint); color: var(--ready); }
.job-card .step.s-inprogress { background: var(--progress-tint); color: #00877D; }
.job-card .step.s-onhold { background: var(--hold-tint); color: var(--hold); }
.job-card .step.s-completed { background: var(--done-tint); color: var(--done); }
.job-card .step.s-pending { background: var(--pending-tint); color: var(--pending); }
.job-card .parallel { font-size: 12px; color: var(--text-2); margin: -2px 0 8px; }
.job-card .meta { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.job-card .meta .eq-maint { color: var(--hold); font-weight: 600; }
.job-card .due { font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-top: 2px; }
.job-card .due.today { color: var(--due); }
.job-card .due.overdue { color: var(--hold); }
.job-card .flags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.progress-track { height: 4px; background: var(--line); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.progress-track > div { height: 100%; background: var(--teal-bright); }

/* ---- Wallboard ------------------------------------------------------------ */
.wallboard { padding: 14px 16px; min-height: 100vh; }
.wallboard .wall-head { display: flex; align-items: center; gap: 18px; background: var(--plum); color: #fff; margin: -14px -16px 14px; padding: 10px 20px; }
.wallboard .wall-head .brand { font-size: 24px; font-weight: 800; }
.wallboard .wall-head .clock { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wallboard .wall-chips { display: flex; gap: 10px; margin-bottom: 14px; }
.wallboard .job-card .code { font-size: 17px; }
.wallboard .job-card .product { font-size: 16px; }

/* ---- Modal ------------------------------------------------------------------ */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(35, 59, 63, .45); z-index: 100;
    display: flex; align-items: flex-start; justify-content: center; padding: 3vh 2vw; overflow-y: auto;
}
.modal {
    background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: min(1180px, 100%);
    display: flex; flex-direction: column; max-height: none;
}
.modal.size-sm { width: min(520px, 100%); }
.modal.size-md { width: min(760px, 100%); }
.modal-head { background: var(--ice); border-bottom: 1px solid var(--ice-border); border-radius: 18px 18px 0 0; padding: 18px 24px; display: flex; gap: 16px; align-items: flex-start; }
.modal-head h2 { font-size: 22px; color: var(--plum); font-weight: 800; }
.modal-head .sub { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.modal-body { padding: 18px 24px; }
.modal-foot { padding: 14px 24px 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---- Job detail -------------------------------------------------------------- */
.stage-steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
.stage-step { border-radius: 8px; padding: 10px 12px; font-size: 13px; font-weight: 700; background: var(--bg-2); color: var(--muted); }
.stage-step.done { background: var(--done-tint); color: var(--done); }
.stage-step.current { background: var(--plum); color: #fff; }
.stage-step.na { background: transparent; border: 1px dashed var(--line); color: #B2C0C3; font-weight: 600; }
.detail-grid { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 20px; align-items: start; }
.panel { border: 1px solid var(--ice-border); border-radius: var(--radius); background: #FBFCFD; padding: 16px 18px; }
.panel h3 { font-size: 17px; }
.panel .panel-sub { color: var(--teal); font-size: 12px; margin: 2px 0 10px; }
.spec-row { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.spec-row:last-child { border-bottom: 0; }
.spec-row .k { color: var(--muted); font-weight: 700; font-size: 12.5px; }
.banner { border-radius: 10px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 14px; }
.banner.hold { background: var(--hold-tint); color: var(--hold); border: 1px solid #F5C2C7; }
.banner.changed { background: var(--ready-tint); color: #0A58CA; border: 1px solid #B6D4FE; }
.banner.rework { background: var(--due-tint); color: #A04800; border: 1px solid #FFD9B8; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 14px; }
.tabs button { background: none; border: 0; padding: 0 16px; height: 44px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; font-size: 14px; }
.tabs button.active { color: var(--plum); border-bottom-color: var(--plum); }

.task-row { border: 1px solid var(--ice-border); border-radius: 10px; padding: 12px 14px; display: flex; gap: 14px; align-items: flex-start; background: #fff; }
.task-row + .task-row { margin-top: 10px; }
.task-row.active { border: 2px solid var(--teal); background: var(--ice); }
.task-row.s-onhold { border-color: #F5C2C7; background: #FFF9FA; }
.task-row.removed { opacity: .5; }
.task-row .stage-tag { background: var(--plum-tint); color: var(--plum); font-size: 12px; font-weight: 700; border-radius: 6px; padding: 5px 9px; white-space: nowrap; }
.task-row .t-name { font-weight: 700; font-size: 15px; }
.task-row .t-meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.task-row .t-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.task-row .t-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-left: auto; }
.track-tag { font-size: 10.5px; font-weight: 800; border-radius: 4px; padding: 2px 6px; margin-left: 6px; vertical-align: middle; }
.track-Cover { background: #FCE8F9; color: var(--plum); }
.track-Inner { background: #E5F4F6; color: #1F7E8B; }

/* ---- Tap-select tiles (zero-typing) ---------------------------------------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile {
    min-height: 64px; border-radius: 10px; border: 2px solid var(--ice-border); background: var(--ice);
    font-weight: 700; font-size: 14.5px; cursor: pointer; padding: 10px 14px; text-align: left; color: var(--text);
}
.tile.selected { border-color: var(--plum); background: var(--plum-tint); color: var(--plum); }
.tile .tile-sub { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 3px; }
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper .value { min-width: 70px; text-align: center; font-size: 22px; font-weight: 800; }

/* ---- Workstation -------------------------------------------------------------- */
.ws-banner { display: inline-flex; gap: 12px; background: var(--teal-bright); color: #fff; font-weight: 700; padding: 0 18px; height: 44px; align-items: center; border-radius: 10px; font-size: 14.5px; }
.ws-running { background: #fff; border: 2px solid var(--teal-bright); border-radius: 16px; padding: 18px 22px; margin-bottom: 18px; }
.ws-running .tag { display: inline-block; background: var(--ice); color: #00877D; font-weight: 800; font-size: 11.5px; letter-spacing: .5px; border-radius: 6px; padding: 7px 12px; }
.ws-running h2 { font-size: 24px; margin: 12px 0 6px; }
.ws-running .facts { color: var(--text-2); font-size: 14px; }
.ws-running .next { color: var(--plum); font-size: 13px; margin-top: 8px; }
.ws-running .actions { display: flex; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.ws-running .actions .btn { min-width: 220px; }
.ws-section { font-weight: 800; font-size: 15px; letter-spacing: .3px; text-transform: uppercase; margin: 18px 0 10px; color: var(--text); }
.ws-item { background: #fff; border-radius: 12px; border: 1px solid var(--line); padding: 16px 20px; display: flex; align-items: center; gap: 18px; }
.ws-item + .ws-item { margin-top: 10px; }
.ws-item .code { color: var(--plum); font-weight: 800; min-width: 130px; }
.ws-item .what { font-weight: 700; font-size: 16px; }
.ws-item .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.ws-item .due { color: var(--due); font-weight: 700; font-size: 13px; white-space: nowrap; }
.ws-item .due.overdue { color: var(--hold); }
.ws-item .btn { min-width: 220px; }
.ws-picker .group-title { margin: 18px 0 8px; font-weight: 800; color: var(--text-2); }

/* ---- Cards, tables, admin ------------------------------------------------------ */
.card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card-head { background: var(--ice); border-bottom: 1px solid var(--ice-border); padding: 14px 20px; border-radius: 16px 16px 0 0; display: flex; align-items: center; gap: 12px; }
.card-head h3 { font-size: 17px; flex: 1; }
.card-body { padding: 8px 20px 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.list-row { display: grid; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.list-row:hover { background: var(--bg-2); }
.list-row .name { font-weight: 700; }
.list-row .accent { color: var(--plum); font-size: 13px; }
.list-row.inactive { opacity: .55; }
.actor-row { grid-template-columns: 1.3fr 1.2fr 1.6fr auto; }
.equip-row { grid-template-columns: 1.4fr 1.3fr 1.2fr auto; }
.eq-available { background: var(--done-tint); color: var(--done); }
.eq-running { background: var(--progress-tint); color: #00877D; }
.eq-maintenance { background: var(--hold-tint); color: var(--hold); }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 10px 8px; border-bottom: 2px solid var(--line); }
table.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.table tr.clickable { cursor: pointer; }
table.table tr.clickable:hover td { background: var(--bg-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.check { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; min-height: var(--touch); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--plum); }
.sub-nav { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.sub-nav a { text-decoration: none; height: 42px; padding: 0 16px; display: inline-flex; align-items: center; border-radius: 10px; background: #fff; border: 1px solid var(--line); color: var(--text-2); font-weight: 700; font-size: 14px; }
.sub-nav a.active { background: var(--plum); color: #fff; border-color: var(--plum); }
.page-title { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.page-title h1 { font-size: 22px; }

/* ---- Reports ----------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi .k-label { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.kpi .k-value { font-size: 30px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }
.hbar { display: grid; grid-template-columns: 170px 1fr 48px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13.5px; }
.hbar .track { height: 18px; background: var(--bg-2); border-radius: 4px; overflow: hidden; display: flex; }
.hbar .seg { height: 100%; }
.hbar .seg + .seg { margin-left: 2px; }
.hbar .seg:last-child { border-radius: 0 4px 4px 0; }
.hbar .val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.vbars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.vbars .vb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.vbars .vb .bar { width: 100%; max-width: 34px; background: var(--plum); border-radius: 4px 4px 0 0; min-height: 2px; }
.vbars .vb .lbl { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.vbars .vb .num { font-size: 11px; font-weight: 700; color: var(--text-2); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin: 4px 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---- Login -------------------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 20px; background: linear-gradient(180deg, var(--plum) 0, var(--plum) 220px, var(--bg) 220px); }
.login-card { width: min(920px, 100%); background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; }
.login-card .head { padding: 26px 30px 10px; }
.login-card .head .brand { color: var(--plum); font-weight: 800; font-size: 28px; letter-spacing: .5px; }
.login-card .body { padding: 10px 30px 30px; }
.actor-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.actor-tile { border: 2px solid var(--ice-border); background: var(--ice); border-radius: 14px; padding: 16px 12px; cursor: pointer; text-align: center; min-height: 120px; }
.actor-tile .avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--plum); color: #fff; font-weight: 800; font-size: 19px; display: flex; align-items: center; justify-content: center; margin: 0 auto 8px; }
.actor-tile .nm { font-weight: 700; }
.actor-tile .dp { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 84px); gap: 12px; justify-content: center; margin-top: 16px; }
.pin-pad button { height: 72px; font-size: 26px; font-weight: 700; border-radius: 14px; border: 1.5px solid var(--ice-border); background: var(--ice); cursor: pointer; color: var(--text); }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin-top: 10px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--plum); }
.pin-dots span.on { background: var(--plum); }

/* ---- Toasts ------------------------------------------------------------------------------ */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--text); color: #fff; padding: 14px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer; animation: slidein .2s ease-out; }
.toast .t-title { font-weight: 800; display: block; margin-bottom: 2px; }
.toast.success { background: var(--done); }
.toast.error { background: var(--hold); }
.toast.warning { background: #C55A00; }
.toast.info { background: var(--plum); }
@keyframes slidein { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.loading { padding: 40px; text-align: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--plum); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 28px; text-align: center; color: var(--muted); background: #fff; border-radius: 12px; border: 1px dashed var(--line); }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #FFF3CD; padding: 12px 20px; z-index: 1000; box-shadow: 0 -1px 4px rgba(0, 0, 0, .2); }
#blazor-error-ui .reload { margin-left: 10px; }

/* ---- Job sheet (print) --------------------------------------------------------------------- */
.sheet { background: #fff; max-width: 900px; margin: 0 auto; padding: 28px 34px; border-radius: 12px; box-shadow: var(--shadow); }
.sheet h1 { color: var(--plum); font-size: 26px; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.sheet td, .sheet th { border: 1px solid #CCD6D9; padding: 7px 9px; text-align: left; vertical-align: top; }
.sheet th { background: var(--ice); }
.sheet .box { width: 18px; height: 18px; border: 2px solid var(--text); display: inline-block; }
.sheet .code-big { font-size: 34px; font-weight: 800; letter-spacing: 1px; }
.no-print { }

@media print {
    body { background: #fff; }
    .no-print, .topbar, .toasts { display: none !important; }
    .sheet { box-shadow: none; padding: 0; max-width: none; }
    .app-main { padding: 0; }
}

/* ---- Responsive (tablets in portrait) --------------------------------------------------------- */
@media (max-width: 1360px) {
    .detail-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .kpis { grid-template-columns: repeat(3, 1fr); }
    .stage-steps { grid-template-columns: repeat(3, 1fr); }
    .topbar nav a { padding: 0 10px; }
    .topbar .user-chip .role, .topbar .section { display: none; }
    .topbar { gap: 12px; }
}
@media (max-width: 760px) {
    .topbar .section, .topbar .user-chip .role { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .ws-item { flex-wrap: wrap; }
}
