/* PrintLab Printing Operator Dashboard. Same look as the Designer Dashboard; --accent is a sample until brand colours are confirmed. */
:root {
  --accent: #1D4ED8;
  --accent-dark: #1E3A8A;
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --line: #E2E6EC;
  --line-soft: #EEF1F4;
  --line-strong: #C9D1DC;
  --text: #111827;
  --text-2: #334155;
  --muted: #5B6472;
  --good: #166534;
  --bad: #8F1D12;
  --g-overdue-bg: #FDE7E4; --g-overdue-fg: #8F1D12;
  --g-today-bg: #FFE4CC;   --g-today-fg: #8A3B00;
  --g-d12-bg: #FFF1BF;     --g-d12-fg: #664A00;
  --g-d3-bg: #DCEBFF;      --g-d3-fg: #1447A6;
  --g-d4-bg: #E6EDF5;      --g-d4-fg: #334155;
  --g-d5-bg: #EEF1F4;      --g-d5-fg: #475569;
  --g-later-bg: #F3F4F6;   --g-later-fg: #475569;
  --display: "Space Grotesk", Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2, h3 { font-family: var(--display); margin: 0; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px clamp(16px, 3vw, 32px); display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand:hover { color: inherit; }
.logo { width: 36px; height: 36px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font: 700 14px var(--display); }
.brand-name { font: 700 16px var(--display); }
.topbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.sync { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: #15803D; }
.dot.bad { background: #B91C1C; }
.pill { padding: 6px 12px; border-radius: 999px; background: var(--line-soft); color: var(--text-2); font-weight: 600; font-size: 13px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; font-weight: 600; min-height: 44px; }
.toplink { font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }

.banner { padding: 12px clamp(16px, 3vw, 32px); font-size: 14px; }
.banner.stale { background: var(--g-overdue-bg); color: var(--bad); border-bottom: 1px solid #F5C2BB; }
.flash { border-radius: 10px; padding: 12px 16px; font-weight: 500; }
.flash.ok { background: #DCFCE7; color: var(--good); }
.flash.error { background: var(--g-overdue-bg); color: var(--bad); }

main { max-width: 1296px; margin: 0 auto; padding: 24px clamp(16px, 3vw, 32px) 48px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 16px; }

/* period switch */
.period { display: flex; align-items: center; gap: 8px; }
select, input[type=text], input[type=password], input[type=number], input[type=file] {
  font: inherit; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--text); max-width: 100%;
}
input[type=file] { padding: 6px; }

/* totals */
.total { flex: 1 1 200px; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: block; }
a.total:hover { border-color: var(--accent); color: inherit; }
.total .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.total .num { font: 700 36px/1.15 var(--display); margin-top: 4px; }
.num.today { color: var(--g-today-fg); }
.num.overdue { color: var(--bad); }

/* due-date groups */
.groups { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.group { flex: 1 1 110px; border-radius: 10px; padding: 12px 14px; text-decoration: none; display: block; }
.group .label { font-size: 13px; font-weight: 600; }
.group .num { font: 700 26px var(--display); }
a.group:hover { outline: 2px solid currentColor; outline-offset: -2px; }
.g-overdue { background: var(--g-overdue-bg); color: var(--g-overdue-fg) !important; }
.g-today { background: var(--g-today-bg); color: var(--g-today-fg) !important; }
.g-d1, .g-d2, .g-d12 { background: var(--g-d12-bg); color: var(--g-d12-fg) !important; }
.g-d3 { background: var(--g-d3-bg); color: var(--g-d3-fg) !important; }
.g-d4 { background: var(--g-d4-bg); color: var(--g-d4-fg) !important; }
.g-d5 { background: var(--g-d5-bg); color: var(--g-d5-fg) !important; }
.g-later { background: var(--g-later-bg); color: var(--g-later-fg) !important; }

/* designers + ranking */
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split > .main-col { flex: 999 1 600px; min-width: 0; }
.split > .side-col { flex: 1 1 280px; min-width: 0; }
.cards { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.dcard { flex: 1 1 280px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.dcard.mine { border: 2px solid var(--accent); padding: 17px; }
.dhead { display: flex; align-items: center; gap: 12px; }
.dhead .who { flex: 1 1 auto; min-width: 0; }
.dname { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.score { text-align: right; }
.score .big { font: 700 30px/1 var(--display); color: var(--accent); }
.stats3 { display: flex; gap: 8px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 10px 0; }
.stats3 > div { flex: 1 1 0; }
.stats3 .v { font-weight: 700; font-size: 18px; }
.cells { display: flex; gap: 6px; }
.cell { flex: 1 1 0; min-width: 0; border-radius: 8px; padding: 6px 2px; text-align: center; text-decoration: none; }
.cell .l { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .n { font-size: 16px; font-weight: 700; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; color: var(--accent); font: 600 14px Inter, system-ui, sans-serif; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.block { display: flex; width: 100%; }

.avatar { border-radius: 50%; object-fit: cover; object-position: 50% 25%; /* passport-style photos: keep the face, not the shirt */ flex: none; background: var(--line); color: #475569; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.rank-list { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.rank-row .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.bar { height: 8px; border-radius: 999px; background: var(--line-soft); }
.bar > div { height: 8px; border-radius: 999px; background: var(--accent); }
.note { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }

/* designer header */
.dheader { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.dheader .id { display: flex; align-items: center; gap: 16px; flex: 1 1 280px; }
.breakdown { display: flex; flex-wrap: wrap; gap: 12px; flex: 2 1 480px; }
.bk { flex: 1 1 110px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.bk .v { font: 700 24px var(--display); }
.bk.total-score { background: var(--accent); border-color: var(--accent); color: #fff; }
.pos { color: var(--good); }
.neg { color: var(--bad); }

/* tabs + filters */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 0; flex-wrap: wrap; }
.tab { padding: 12px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; min-height: 44px; display: inline-flex; align-items: center; }
.tab[aria-current=page] { color: var(--accent); border-bottom-color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.fbtn { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; color: var(--text-2); font: 600 13px Inter, system-ui, sans-serif; text-decoration: none; display: inline-flex; align-items: center; }
.fbtn[aria-current=true] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* tables */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.jobs { min-width: 860px; }
th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
td.jobno { font-weight: 700; white-space: nowrap; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.empty { padding: 24px; text-align: center; color: var(--muted); }
.mini-select { min-height: 32px; padding: 2px 6px; font-size: 13px; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 13px; }
.field input { width: 100%; min-height: 44px; }

/* admin */
.admin-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.admin table { min-width: 720px; }
.admin td form { display: inline; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline-form .field { min-width: 160px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.check { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
details.edit > summary { cursor: pointer; color: var(--accent); font-weight: 600; min-height: 36px; display: inline-flex; align-items: center; }
details.edit[open] { background: var(--bg); border-radius: 10px; padding: 8px 12px 12px; }
.err-text { color: var(--bad); max-width: 520px; overflow-wrap: anywhere; }

@media (max-width: 600px) {
  h1 { font-size: 22px; }
  .total .num { font-size: 28px; }
  .cells { flex-wrap: wrap; }
  .cell { flex: 1 1 28%; }
}

/* operator dashboard additions */
.topnav { display: flex; gap: 16px; flex: 1 1 auto; margin-left: 12px; }
.num-sub { font-size: 20px; color: var(--bad); }
.machines { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 14px; }
.machine { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; text-decoration: none; color: inherit; }
a.machine:hover { border-color: var(--accent); color: inherit; }
.mtop { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mname { font-weight: 600; overflow-wrap: anywhere; }
.mload { font: 700 24px var(--display); }
.mstats { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--text-2); }

tr.row-overdue td { background: #FFF6F5; }
tr.row-overdue td.jobno { box-shadow: inset 4px 0 0 var(--bad); }
.st-queued { background: var(--line-soft); color: var(--text-2); }
.st-printing { background: #DCEBFF; color: #1447A6; }
.st-done { background: #DCFCE7; color: var(--good); }
.cat-reprint { background: #F3E8FF; color: #6B21A8; font-size: 11px; padding: 2px 8px; }
.cat-operator { background: var(--g-overdue-bg); color: var(--bad); }
.cat-design { background: #F3E8FF; color: #6B21A8; }
.cat-customer { background: var(--g-d3-bg); color: var(--g-d3-fg); }
.cat-other { background: var(--line-soft); color: var(--text-2); }
.cat-not_reprint { background: #F3F4F6; color: var(--muted); }
.cat-review { background: var(--g-today-bg); color: var(--g-today-fg); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-bar .field { min-width: 180px; }
td.reason { min-width: 260px; }
.reason-form { display: flex !important; gap: 6px; align-items: center; }
.reason-form input[type=text] { flex: 1 1 auto; min-width: 180px; min-height: 34px; }
textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; width: 100%; resize: vertical; }
@media (max-width: 760px) { .topnav { order: 3; flex-basis: 100%; margin-left: 0; } .total { flex-basis: 140px; padding: 14px 16px; } }

/* Due-soon boxes (Late, Today, 1–2d, 3d) blink while they hold job orders, so they catch the eye. */
.cell.blink { animation: cell-blink 1.2s ease-in-out infinite; }
@keyframes cell-blink {
  0%, 100% { box-shadow: 0 0 0 0 transparent; filter: none; }
  50% { box-shadow: 0 0 0 3px currentColor; filter: saturate(1.6) brightness(0.92); }
}

/* Overdue highlight: the operator card gets a red frame and a banner; the team Overdue boxes get a red ring. */
.dcard.has-overdue { border: 2px solid var(--bad); border-left-width: 6px; background: #FFFBFA; }
.overdue-flag { margin: -4px 0 0; padding: 6px 10px; border-radius: 8px; background: var(--g-overdue-bg); color: var(--bad);
  font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.overdue-flag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); animation: dot-pulse 1.2s ease-in-out infinite; }
@keyframes dot-pulse { 50% { opacity: .25; } }
.total.total-alert { box-shadow: inset 0 0 0 2px var(--bad); background: var(--g-overdue-bg); }
.group.group-alert { box-shadow: inset 0 0 0 2px var(--g-overdue-fg); }
.shared-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 1px 5px; border-radius: 4px;
  background: var(--g-d4-bg); color: var(--g-d4-fg); }
@media (prefers-reduced-motion: reduce) {
  .cell.blink { animation: none; box-shadow: 0 0 0 2px currentColor; }
  .overdue-flag::before { animation: none; }
}
.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dhead .who { min-width: 0; }

/* Machine cards (same look as operator cards). Icons until a photo is uploaded in Settings › Machines. */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.mavatar { border-radius: 14px; object-fit: cover; flex: none; }
.micon { display: inline-flex; align-items: center; justify-content: center; }
.k-wide    { background: #DCEBFF; color: #1447A6; }
.k-uv      { background: #F3E8FF; color: #6B21A8; }
.k-digital { background: #DCFCE7; color: #166534; }
.k-offset  { background: #FFE4CC; color: #8A3B00; }
.k-plotter { background: #E0F2FE; color: #075985; }
.k-stamp   { background: #FCE7F3; color: #9D174D; }
.k-shirt   { background: #FEF9C3; color: #854D0E; }
.k-printer { background: var(--line-soft); color: var(--text-2); }
.k-laminate  { background: #CCFBF1; color: #115E59; }
.k-finishing { background: #FFE4E6; color: #9F1239; }
.station-h { font-size: 16px; margin: 18px 0 10px; }
.mcard .dname { overflow-wrap: anywhere; line-height: 1.25; }
.mcard.idle { opacity: .72; }
.mcard .bar { margin-top: -4px; }
.v.v-sm { font-size: 15px; white-space: nowrap; }
