:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #1d2733;
  --muted: #64707d;
  --line: #dde3ea;
  --brand: #0f5c63;
  --brand-ink: #ffffff;
  --accent: #e07a2e;
  --ok: #1c7c3c;
  --off: #a33a2e;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Hind Siliguri", "Noto Sans Bengali", system-ui, sans-serif; font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; line-height: 1.3; }
h2 { font-size: 20px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand-mark { display: inline-grid; place-items: center; min-width: 34px; padding: 0 5px; font-size: 13px; letter-spacing: .02em; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; font-family: system-ui, sans-serif; }

/* guest */
body.guest { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #0f5c63 0%, #0b3f44 100%); }
.guest-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: 14px; padding: 28px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.guest-card .brand { margin-bottom: 20px; color: var(--brand); }

/* forms */
.form { display: grid; gap: 14px; }
.form.narrow { max-width: 560px; }
.form label { display: grid; gap: 5px; font-weight: 500; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form label[hidden] { display: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 14px; display: grid; gap: 12px; margin: 0; }
legend { padding: 0 6px; font-weight: 600; color: var(--brand); }
input, select { font: inherit; padding: 9px 11px; border: 1px solid #c6ced8; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus { outline: 2px solid rgba(15,92,99,.35); border-color: var(--brand); }
input[type=checkbox] { width: auto; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; cursor: pointer; text-decoration: none !important; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #0c4c52; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #eef2f5; }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; }

/* alerts */
.alert { border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.alert-ok { background: #e6f4ea; color: #155c2d; border: 1px solid #b9dfc4; }
.alert-error { background: #fdecea; color: #8a2a1f; border: 1px solid #f3c2bb; }

/* shell */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: #0f2f33; color: #dbe7e8; padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { color: #fff; margin-bottom: 10px; }
.sidebar .muted { color: #93aeb1; }
.sidebar a { color: #dbe7e8; }
.company-box { background: rgba(255,255,255,.06); border-radius: 8px; padding: 10px 12px; margin-bottom: 6px; }
.company-name { font-weight: 600; color: #fff; }
.company-box a { color: #f3b98b; }
.nav-label { margin-top: 12px; font-size: 12px; letter-spacing: .03em; color: #93aeb1; text-transform: uppercase; }
.nav { display: grid; gap: 2px; }
.nav a, .nav span { display: block; padding: 7px 10px; border-radius: 7px; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.active { background: var(--accent); color: #fff; }
.nav.sub a, .nav.sub span { font-size: 14px; }
.nav .disabled { color: #7f9a9d; }
.nav .disabled em { font-style: normal; font-size: 11px; background: rgba(255,255,255,.1); border-radius: 4px; padding: 1px 5px; margin-left: 4px; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); display: grid; gap: 4px; }
.sidebar-foot .btn { color: #dbe7e8; border-color: rgba(255,255,255,.2); margin-top: 6px; width: 100%; }
.sidebar-foot .btn:hover { background: rgba(255,255,255,.08); }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 16px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 20px; flex: 1; }
.topbar-title { flex: 1; min-width: 0; display: grid; gap: 2px; }
.topbar-title .crumb { font-size: 12px; color: var(--muted, #6b7280); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.topbar-title .crumb strong { color: var(--brand, #0f4c4c); font-weight: 600; }
.topbar-title .crumb-sep { opacity: .6; }
.menu-btn { display: none; font-size: 22px; cursor: pointer; padding: 2px 8px; border-radius: 6px; }
.content { padding: 24px; display: grid; gap: 18px; align-content: start; }

/* cards & grids */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 10px; align-content: start; }
.card-title { font-weight: 600; font-size: 16px; }
.grid { display: grid; gap: 14px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 14px 16px; }
.stat-num { font-size: 28px; font-weight: 700; color: var(--brand); }
.stat-label { color: var(--muted); font-size: 14px; }
.list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.steps { display: flex; flex-wrap: wrap; gap: 8px; }
.step { border: 1.5px solid var(--brand); color: var(--brand); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: 14px; }
.step small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eef2f5; color: var(--muted); margin-left: 4px; }
.badge-ok { background: #e6f4ea; color: var(--ok); }
.badge-off { background: #fdecea; color: var(--off); }

/* tables */
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; font-size: 14px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
form.inline { display: inline-flex; align-items: center; gap: 4px; margin: 0 10px 4px 0; }

/* mobile */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; transform: translateX(-100%); transition: transform .2s; z-index: 20; }
  .nav-toggle:checked + .shell .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .menu-btn { display: inline-block; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
}

/* language switch */
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-switch form { margin: 0; }
.lang-switch button { font: inherit; font-size: 13px; border: 0; background: transparent; padding: 4px 12px; cursor: pointer; color: inherit; }
.lang-switch button.active { background: var(--brand); color: #fff; }
.guest-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.guest-card .guest-head .brand { margin-bottom: 0; }
.sidebar .lang-switch { border-color: rgba(255,255,255,.2); margin-bottom: 8px; align-self: flex-start; }
.sidebar .lang-switch button.active { background: var(--accent); }

/* order module */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; z-index: 3; }
.grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.num { text-align: right !important; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.topbar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; }
.filters input, .filters select { width: auto; min-width: 150px; flex: 1 1 150px; }
.table.compact td, .table.compact th { padding: 6px 8px; }
.table.compact input { padding: 6px 8px; }
.in-xs { width: 74px !important; padding: 5px 6px !important; }
.in-sm { width: 96px !important; padding: 5px 6px !important; }
.in-md { width: 150px !important; padding: 5px 6px !important; }
.acc-table td, .acc-table th { padding: 6px 8px; font-size: 14px; }
.acc-table .group-head td { background: #f1f6f6; border-top: 2px solid var(--line); }
.row-off td { opacity: .55; text-decoration: line-through; }
.row-off td:last-child, .row-off td:last-child * { text-decoration: none; opacity: 1; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: #eef2f5; color: var(--muted); }
.pill-submitted { background: #fff3e0; color: #a35a12; }
.pill-approved { background: #e6f4ea; color: var(--ok); }
.status-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.bar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bar-actions form { margin: 0; }
.formula { background: #fff8ec; border: 1px dashed #e9c38f; border-radius: 8px; padding: 8px 12px; margin: 0; color: #6d4a1c; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.stat-inline .stat-num { font-size: 26px; }
.danger { color: var(--off); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; }
@media (max-width: 860px) {
  .form-grid, .form-grid.three, .grid.two-col { grid-template-columns: 1fr; }
}

/* bookings */
.pill-draft { background: #eef2f5; color: var(--muted); }
.pill-cancelled { background: #fdecea; color: var(--off); }
.ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ladder li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); }
.ladder li small { color: var(--muted); }
.ladder li.done { background: #e6f4ea; border-color: #b9dfc4; }
.ladder li.done span::before { content: "✔ "; color: var(--ok); }
.ladder li.now { background: #fff3e0; border-color: #f2c48d; font-weight: 600; }

/* tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 500; }
.tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tabs a:hover { text-decoration: none; }

/* production floor */
.bar { height: 8px; border-radius: 999px; background: #e7ecf0; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.bar.big { height: 12px; margin-top: 6px; }
.floor { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.floor-col { align-content: start; }
.floor-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.floor-job { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
.floor-job:hover { background: #f6f8fa; text-decoration: none; }
.handover { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.handover:first-of-type { border-top: 0; }
.thumb { display: block; max-width: 160px; max-height: 120px; border-radius: 8px; margin-top: 6px; border: 1px solid var(--line); object-fit: cover; }
.photo-prev img { max-width: 220px; max-height: 160px; border-radius: 8px; border: 1px solid var(--line); }
.log-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.log-row:first-of-type { border-top: 0; }
.track { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.track-step { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 4px; background: #fafbfc; }
.track-step.on { border-color: var(--brand); background: #eaf4f5; }
.track-step.done { border-color: #b9dfc4; background: #e6f4ea; }

/* Notifications */
.bell { position: relative; font-size: 20px; text-decoration: none; line-height: 1; padding: 4px; }
.bell-count { position: absolute; top: -4px; right: -6px; min-width: 18px; padding: 1px 5px; border-radius: 999px; background: var(--off); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.notif-list { display: grid; gap: 0; padding: 0; }
.notif { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: #f3f8f7; border-left: 3px solid var(--brand, #1f6f66); }
.notif-title { font-weight: 600; }
.alert-info { background: #e8f2f3; color: #0f4c52; border: 1px solid #bcd9dc; }
.company-logo { max-height: 40px; max-width: 160px; display: block; margin-bottom: 6px; }
.qr-label { display: inline-grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; border: 1px dashed var(--line); padding: 10px; border-radius: 8px; background: #fff; }
.qr-label .qr { width: 140px; height: 140px; }
.scan-box { max-width: 480px; margin: 0 auto; }
#reader { width: 100%; border-radius: 10px; overflow: hidden; background: #000; min-height: 240px; }
@media print { .no-print { display: none !important; } }

/* Accounts */
a.stat { color: inherit; text-decoration: none; display: grid; gap: 4px; }
.acc-num { font-size: 18px; font-weight: 700; color: var(--brand); line-height: 1.35; }
.stat-num.acc-num { font-size: 20px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.acc-catrow { display: grid; grid-template-columns: minmax(120px, 220px) 1fr auto; gap: 10px; align-items: center; }

/* Quality control */
.ok { color: var(--ok); }
.pill-qc-pass { background: #e6f4ea; color: var(--ok); }
.pill-qc-fail { background: #fbe9e7; color: var(--off); }
.pill-qc-hold { background: #fdf3e3; color: #9a5b12; }
.sev { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; vertical-align: middle; }
.sev-critical { background: var(--off); color: #fff; }
.sev-major { background: #fde7d6; color: #9a4410; }
.sev-minor { background: #edf1f4; color: var(--muted); }
.qc-defects { display: grid; gap: 4px; }
.qc-cat { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 8px; }
.qc-def { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qc-def.has { border-color: var(--accent); background: #fff7f0; }
.qc-name { flex: 1; min-width: 0; }
.qc-step { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.qc-step input { width: 64px; text-align: center; }
.qc-step .btn { min-width: 38px; font-size: 18px; line-height: 1; }
.qc-extra input[name=extra_name] { flex: 1; min-width: 0; }
.qc-summary { padding: 10px 12px; border-radius: 8px; background: #f3f6f8; border: 1px solid var(--line); }
.qc-verdict { border-left: 6px solid var(--line); }
.qc-verdict-pass { border-left-color: var(--ok); } .qc-verdict-pass .stat-num { color: var(--ok); }
.qc-verdict-fail { border-left-color: var(--off); } .qc-verdict-fail .stat-num { color: var(--off); }
.qc-verdict-hold { border-left-color: #c27a17; } .qc-verdict-hold .stat-num { color: #9a5b12; }
@media (max-width: 560px) { .qc-def { flex-wrap: wrap; } .qc-extra select { flex: 1; } }

/* Planning board */
.pb { display: grid; gap: 2px; min-width: max-content; }
.pb-row { display: grid; grid-template-columns: 170px repeat(var(--days), minmax(30px, 1fr)); gap: 2px; align-items: stretch; }
.pb-label { padding: 4px 8px; position: sticky; left: 0; background: var(--surface); z-index: 1; line-height: 1.25; }
.pb-head .pb-day { text-align: center; font-size: 12px; font-weight: 700; padding: 3px 0; border-radius: 4px; background: #f3f6f8; line-height: 1.1; }
.pb-head .pb-day span { display: block; font-weight: 400; font-size: 10px; color: var(--muted); }
.pb-day.off, .pb-load.off { background: repeating-linear-gradient(45deg, #eef1f4, #eef1f4 4px, #f8fafb 4px, #f8fafb 8px); }
.pb-day.today { background: var(--brand); color: #fff; } .pb-day.today span { color: #dfeeee; }
.pb-line { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 4px; }
.pb-load { display: flex; align-items: center; justify-content: center; font-size: 11px; border-radius: 4px; background: #f7f9fa; min-height: 26px; color: var(--muted); text-decoration: none; }
.pb-load.free { color: #b8c3cc; } .pb-load.free:hover { background: #e8f2f3; color: var(--brand); }
.pb-load.l1 { background: #e3f1e7; color: #1c6b36; } .pb-load.l2 { background: #fdf0d5; color: #8a5a07; } .pb-load.l3 { background: #fbe0dc; color: var(--off); font-weight: 700; }
.pb-plan .pb-label { color: var(--muted); }
.pb-bar { position: relative; display: block; min-height: 26px; border-radius: 6px; background: #d6e8ea; border: 1px solid #9cc7cb; overflow: hidden; color: var(--ink); text-decoration: none; }
.pb-bar .pb-fill { position: absolute; inset: 0 auto 0 0; background: #9fd0b0; }
.pb-bar .pb-text { position: relative; display: block; padding: 3px 8px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-bar.st-done { background: #e6f4ea; border-color: #9fd0b0; } .pb-bar.behind { border: 2px solid var(--off); }
.pb-bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; } .pb-bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pb-legend { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; } .pb-legend .pb-load { width: 34px; min-height: 20px; }
.pill-plan-planned { background: #e8f0fb; color: #1d4f91; } .pill-plan-running { background: #fdf3e3; color: #9a5b12; }
.pill-plan-done { background: #e6f4ea; color: var(--ok); } .pill-plan-cancelled { background: #eef1f4; color: var(--muted); }

/* ---- Order receive / merchandising ---- */
.inline { display: inline; }
.btn-xs { padding: 4px 10px; font-size: 12.5px; border-radius: 999px; }
.btn-dark { background: #0e1a14; color: #fff; }
.warn { color: #9a5b12; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; margin-top: 4px; }
.chip { background: #eef3ef; border-radius: 6px; padding: 1px 7px; font-size: 12px; color: #334; }
.pill-stage { background: #fdf3e3; color: #9a5b12; }
.orders-table td { vertical-align: middle; }
.pipe { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 12px; }
.pipe-step { display: grid; justify-items: center; min-width: 86px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); color: var(--muted); background: #fafbfc; text-decoration: none; }
.pipe-step strong { font-size: 22px; line-height: 1.1; }
.pipe-step span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.pipe-step.has { border-color: #b9dfc4; background: #e6f4ea; color: #0f5132; }
.pipe-step.sel { outline: 2px solid var(--brand); }
.pipe-arrow { color: #b0b8b4; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 12px; background: #f4f6f5; flex-wrap: wrap; }
.seg-opt { display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; }
.seg-opt:has(input:checked) { background: var(--brand); color: #fff; }
.seg-opt input { accent-color: #fff; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.input-group { display: flex; gap: 6px; }
.input-group input { flex: 1; min-width: 0; }
.input-group select { width: auto; }
.calc-out { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.calc-out > div { background: #0e1a14; color: #e8f3ec; border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.calc-out > div[hidden] { display: none; }
.calc-out span { font-size: 11.5px; opacity: .75; text-transform: uppercase; letter-spacing: .04em; }
.calc-out strong { font-size: 22px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #7ee2a8; }
.calc-out small { opacity: .7; }
.req-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.req-grid > div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.req-grid strong { display: block; font-size: 18px; }
.note-bn { background: #fff8e6; border-left: 3px solid #e0a100; padding: 6px 10px; border-radius: 6px; }
@media (max-width: 760px) { .form-grid.four { grid-template-columns: 1fr 1fr; } }
.g-only[hidden], [hidden].g-only { display: none !important; }

/* ---- Knitting floor & dyeing batches ---- */
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.job-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 14px; }
.job-card { display: grid; gap: 6px; color: inherit; text-decoration: none; padding: 12px 14px; }
.job-card:hover { border-color: var(--brand); text-decoration: none; }
.mini-bars { display: flex; align-items: flex-end; gap: 10px; min-height: 110px; }
.mini-bars a { display: grid; justify-items: center; gap: 2px; color: inherit; text-decoration: none; flex: 1; max-width: 70px; }
.mini-bars span { width: 100%; background: var(--brand); border-radius: 6px 6px 0 0; opacity: .85; }
.mini-bars small { font-size: 11px; color: var(--muted); } .mini-bars b { font-size: 12px; }
.batch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 14px; }
.batch-card { display: grid; gap: 8px; color: inherit; text-decoration: none; }
.batch-card:hover { border-color: var(--brand); text-decoration: none; }
.steps { display: flex; flex-wrap: wrap; gap: 4px; }
.step-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: #eef1f4; color: var(--muted); }
.step-chip.done { background: #e6f4ea; color: #0f5132; }
.step-chip.next { background: #fdf3e3; color: #9a5b12; outline: 1px dashed #d89b3c; }
.recipe { background: #f7f8fa; border-left: 3px solid #b8c2cc; padding: 6px 10px; border-radius: 6px; white-space: pre-line; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.pill-shade-pending { background: #fdf3e3; color: #9a5b12; }
.pill-shade-approved { background: #e6f4ea; color: var(--ok); }
.pill-shade-redye { background: #fbe9e7; color: var(--off); }
.timeline { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
.timeline li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; }
.timeline li.next { background: #fdf8ee; }
.tl-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #c9d1d9; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; }
.timeline li.done .tl-dot { background: var(--ok); border-color: var(--ok); }
.timeline li.next .tl-dot { border-color: #d89b3c; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }

/* ---- TNA time schedule ---- */
.tna-head { display: flex; justify-content: space-between; padding: 10px 14px 0; }
.tna-col { width: 38%; min-width: 220px; }
.tna-track { position: relative; height: 22px; background: repeating-linear-gradient(90deg, #f6f8f7 0 1px, transparent 1px 40px); border-radius: 6px; }
.tna-plan { position: absolute; top: 3px; height: 7px; background: #c9d6e3; border-radius: 4px; }
.tna-act { position: absolute; top: 12px; height: 7px; border-radius: 4px; background: var(--brand); }
.tna-act.done { background: var(--ok); } .tna-act.done_late, .tna-act.overdue { background: var(--off); } .tna-act.due_soon, .tna-act.late_start { background: #d89b3c; }
.tna-today { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #e0a100; }
.tna-legend { padding: 8px 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tna-legend .legend { position: static; display: inline-block; width: 22px; height: 7px; }
.tna-legend .tna-today.legend { width: 2px; height: 12px; }
.tna-pill-done { background: #e6f4ea; color: var(--ok); }
.tna-pill-done_late { background: #fdecea; color: var(--off); }
.tna-pill-overdue { background: #a33a2e; color: #fff; }
.tna-pill-late_start { background: #fdf3e3; color: #9a5b12; }
.tna-pill-due_soon { background: #fff4d6; color: #8a6100; }
.tna-pill-running { background: #e8f0fb; color: #1d4f91; }
.tna-pill-pending, .tna-pill-unplanned { background: #eef1f4; color: var(--muted); }
tr.tna-overdue td:first-child { box-shadow: inset 3px 0 0 var(--off); }
.tna-chip-done { background: #e6f4ea; color: #0f5132; } .tna-chip-done_late { background: #fdecea; color: var(--off); }
.tna-chip-overdue { background: #a33a2e; color: #fff; } .tna-chip-due_soon, .tna-chip-late_start { background: #fff4d6; color: #8a6100; }
.tna-chip-running { background: #e8f0fb; color: #1d4f91; }
.tna-edit summary { cursor: pointer; }
.tna-edit[open] { position: relative; }
.tna-edit[open] form { position: absolute; right: 0; z-index: 5; width: 320px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.tna-dash-row { padding: 4px 0; border-bottom: 1px dashed var(--line); }
@media print { .no-print, .sidebar, .topbar, header, nav { display: none !important; } .tna-col { width: 45%; } }

/* Yarn */
.pill-yb-booked { background: #e8f0fb; color: #1d4f91; } .pill-yb-partial { background: #fdf3e3; color: #9a5b12; }
.pill-yb-received { background: #e6f4ea; color: var(--ok); } .pill-yb-closed { background: #eef1f4; color: var(--muted); }
.pill-yb-cancelled { background: #fdecea; color: var(--off); }
.pill-ym-receive { background: #e6f4ea; color: var(--ok); } .pill-ym-issue { background: #e8f0fb; color: #1d4f91; }
.pill-ym-return { background: #fdf3e3; color: #9a5b12; } .pill-ym-adjust { background: #eef1f4; color: var(--muted); }
.section-title { font-size: 16px; margin: 18px 0 8px; }

/* Reports */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 28px; min-width: 120px; }
.spark span { flex: 1; background: var(--brand); opacity: .75; border-radius: 2px 2px 0 0; min-width: 4px; }
.pct { font-variant-numeric: tabular-nums; }
.pct-done { color: var(--ok); font-weight: 600; }
.pill-risk-late { background: #fdecea; color: var(--off); } .pill-risk-risk { background: #fdf3e3; color: #9a5b12; } .pill-risk-ok { background: #e6f4ea; color: var(--ok); }
th.center { text-align: center; }
.report-table td, .report-table th { white-space: nowrap; }
.report-table td:first-child { white-space: normal; min-width: 180px; }
a.stat { color: inherit; text-decoration: none; display: block; }
@media print { .report-table { font-size: 11px; } .card { break-inside: avoid; box-shadow: none; } }

/* Buyer portal */
.portal-cards .job-card { display: grid; gap: 6px; }
.pill-state-on_track { background: #e6f4ea; color: var(--ok); } .pill-state-watch { background: #fdf3e3; color: #9a5b12; }
.pill-state-delayed { background: #fdecea; color: var(--off); } .pill-state-shipped { background: #e8f0fb; color: #1d4f91; } .pill-state-hold { background: #eef1f4; color: var(--muted); }
.prog-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; align-items: center; margin: 7px 0; }
.bar span.done { background: var(--ok); }
.thread { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; margin-bottom: 10px; }
.msg { background: #f3f5f7; border-radius: 10px; padding: 8px 12px; max-width: 80%; }
.msg-mine { background: #e8f0fb; justify-self: end; }
.msg-head { display: flex; gap: 8px; margin-bottom: 2px; }
.msg-form { display: flex; gap: 8px; align-items: flex-end; }
.msg-form textarea { flex: 1; }

/* Users */
.avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; background: #e3ecef; color: var(--brand); font-weight: 700; font-size: 15px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-lg { width: 76px; height: 76px; font-size: 24px; }
.users-table td { vertical-align: middle; }
.row-off td { opacity: .55; }
.chip-off { text-decoration: line-through; opacity: .6; }
.chip-co { background: #e8f0fb; color: #1d4f91; }
.badge-owner { background: #2d1b4e; color: #fff; }
.role-row { display: flex; align-items: center; gap: 6px; margin: 3px 0; }

/* factory picker above every page */
.factory-bar { display: flex; align-items: center; gap: 10px; padding: 8px 24px; background: #0f3d3e; color: #fff; font-size: 14px; flex-wrap: wrap; }
.factory-bar label { font-weight: 600; }
.factory-bar select { min-width: 220px; max-width: 100%; padding: 6px 10px; border-radius: 8px; border: 0; font: inherit; color: #0f2a2b; background: #fff; }
.factory-bar .badge-owner { margin-left: auto; padding: 3px 10px; border-radius: 999px; font-size: 12px; background: #e07b2a; }
@media (max-width: 900px) { .factory-bar { padding: 8px 16px; } .factory-bar select { flex: 1; min-width: 0; } }

/* panel home: live tiles + work lists */
.alert-warn { background: #fff4e5; color: #8a4b0f; border: 1px solid #f3d3a8; }
a.dash-tile { color: inherit; display: block; transition: box-shadow .15s, transform .15s; }
a.dash-tile[href]:hover { box-shadow: 0 4px 14px rgba(15, 92, 99, .12); transform: translateY(-1px); }
.dash-tile .stat-num { font-size: 26px; word-break: break-word; }
.dash-tile.tone-warn { border-left-color: var(--accent); }
.dash-tile.tone-warn .stat-num { color: #b4581a; }
.dash-tile.tone-bad { border-left-color: var(--off); }
.dash-tile.tone-bad .stat-num { color: var(--off); }
.dash-tile.tone-ok { border-left-color: var(--ok); }
.dash-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 16px; margin-bottom: 16px; }
.dash-lists .card { margin-bottom: 0; }
.dash-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dash-head .card-title { margin-bottom: 0; }
.dash-empty { margin: 8px 0 0; color: var(--ok); }
.dash-list .table td, .dash-list .table th { font-size: 13.5px; }
.dash-bar { height: 6px; min-width: 90px; background: #e8edf1; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.dash-bar span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.dash-bar span.bad { background: var(--off); }
.chip-s { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; background: #eef1f4; color: var(--muted); white-space: nowrap; }
.chip-s.tone-ok { background: #e6f4ea; color: #155c2d; }
.chip-s.tone-warn { background: #fff4e5; color: #8a4b0f; }
.chip-s.tone-bad { background: #fdecea; color: #8a2a1f; }
.txt-bad { color: var(--off); font-weight: 600; }
.txt-warn { color: #b4581a; }
.txt-muted { color: var(--muted); }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 900px) { .dash-lists { grid-template-columns: 1fr; } }

/* topbar: logged-in user */
.top-user { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border: 1px solid var(--line); border-radius: 999px; background: #fff; max-width: 260px; }
.top-user .avatar { flex: none; }
.top-user-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.top-user-txt strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-user-txt span { font-size: 11px; color: var(--muted, #6b7785); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) { .top-user { padding: 2px; border: 0; } .top-user-txt { display: none; } }

/* store: booking live status */
.bs-tiles { margin-bottom: 14px; }
.bs-tile { color: inherit; text-decoration: none !important; }
.bs-tile:hover, .bs-tile.active { box-shadow: 0 0 0 2px var(--brand) inset; }
.bs-status { min-width: 330px; }
.bs-steps { list-style: none; margin: 2px 0 6px; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); font-size: 11px; color: var(--muted); line-height: 1.2; }
.bs-steps.bs-steps-3 { grid-template-columns: repeat(3, 1fr); }
.bs-steps li { position: relative; text-align: center; padding-top: 16px; }
.bs-steps li::before { content: ""; position: absolute; top: 5px; left: -50%; right: 50%; height: 3px; background: #dfe5ea; }
.bs-steps li:first-child::before { display: none; }
.bs-steps li span { position: absolute; top: 0; left: 50%; width: 13px; height: 13px; margin-left: -6.5px; border-radius: 50%; background: #fff; border: 2px solid #cbd4db; z-index: 1; }
.bs-steps li.done { color: var(--ok); }
.bs-steps li.done span { background: var(--ok); border-color: var(--ok); }
.bs-steps li.done::before, .bs-steps li.now::before { background: var(--ok); }
.bs-steps li.now { color: var(--accent, #e07a2f); font-weight: 700; }
.bs-steps li.now span { background: var(--accent, #e07a2f); border-color: var(--accent, #e07a2f); box-shadow: 0 0 0 4px rgba(224, 122, 47, .2); animation: bs-pulse 1.6s ease-in-out infinite; }
@keyframes bs-pulse { 50% { box-shadow: 0 0 0 7px rgba(224, 122, 47, 0); } }
.bs-cancel { opacity: .55; }
.bs-table td:nth-child(2) { min-width: 190px; }
@media (prefers-reduced-motion: reduce) { .bs-steps li.now span { animation: none; } }

/* form drafts (saved in this browser) */
.draft-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.draft-bar span { flex: 1 1 260px; }
.draft-btn { margin-right: 6px; }
.draft-status { margin-right: 10px; color: var(--ok); }

/* own factory / outside factory (subcontract) */
.work-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: #eef5f1; }
.work-mode.is-out { background: #fff4e5; }
.wm-badge { font-weight: 700; }
.wm-edit { flex-basis: 100%; }
.wm-edit summary { cursor: pointer; display: inline; }
.wm-form { margin-top: 8px; }
.chip-out { background: #fff4e5; color: #8a4b0f; }
.handover-form .seg { margin: 4px 0 8px; }

/* CCTV viewer */
.cctv { display: grid; grid-template-columns: 250px 1fr; gap: 14px; align-items: start; }
.cctv-list { display: flex; flex-direction: column; gap: 6px; max-height: 78vh; overflow: auto; }
.cctv-nvr { font-weight: 700; margin-top: 8px; font-size: 13px; }
.cctv-cam { display: flex; flex-direction: column; text-align: left; gap: 2px; padding: 7px 9px; border: 1px solid var(--line, #e3e8ec); border-radius: 8px; background: #fff; cursor: pointer; }
.cctv-cam:hover { border-color: var(--brand, #0f6e78); }
.cctv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.cctv-bar .spacer { flex: 1; }
.cctv-main:fullscreen { background: #000; padding: 10px; }
.cctv-grid { display: grid; gap: 6px; }
.cctv-grid.n1 { grid-template-columns: 1fr; }
.cctv-grid.n4 { grid-template-columns: repeat(2, 1fr); }
.cctv-grid.n9 { grid-template-columns: repeat(3, 1fr); }
.cctv-grid.n16 { grid-template-columns: repeat(4, 1fr); }
.cctv-tile { position: relative; aspect-ratio: 16 / 9; background: #111; border: 2px solid #111; border-radius: 6px; overflow: hidden; color: #ccc; cursor: pointer; }
.cctv-tile.sel { border-color: #f0a020; }
.cctv-tile iframe { width: 100%; height: 100%; border: 0; display: block; }
.cctv-ph { display: flex; align-items: center; justify-content: center; text-align: center; height: 100%; padding: 10px; font-size: 13px; }
.cctv-name { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 3px 8px; font-size: 12px; background: rgba(0,0,0,.55); color: #fff; z-index: 1; }
.cctv-name button { background: none; border: 0; color: #fff; cursor: pointer; }
@media (max-width: 800px) { .cctv { grid-template-columns: 1fr; } .cctv-list { max-height: 260px; } .cctv-grid.n9, .cctv-grid.n16 { grid-template-columns: repeat(2, 1fr); } }
.cctv-run { color: #1a8f3c; font-size: 11px; font-weight: 700; margin-left: 4px; }
.cctv-cam.run { border-color: #2fa24f; background: #effaf2; }
.cctv-tile.run { box-shadow: 0 0 0 2px #2fa24f inset; }
.cctv-name .cctv-run { color: #7dff9e; flex: 1; margin: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* texflowing brand */
.brand-logo { height: 38px; width: auto; display: block; flex: none; }
.brand-name { font-size: 19px; letter-spacing: .01em; }
.guest-card .brand-full { height: 92px; width: auto; display: block; }