/* ============================================================
   COSCASA ERP — Operational Clarity Design System
   ============================================================ */

:root {
  /* Brand & ink */
  --ink:        #0b0d10;
  --ink-2:      #1a1d21;
  --paper:      #ffffff;
  --canvas:     #f5f6f7;
  --border:     #e3e5e8;
  --border-2:   #cdd0d4;
  --muted:      #6b7280;
  --muted-2:    #9aa1a9;

  /* Status / priority */
  --red:        #d92020;
  --red-soft:   #fff1f0;
  --red-line:   #ffd3cf;
  --amber:      #c97a05;
  --amber-soft: #fff8eb;
  --amber-line: #ffe2a8;
  --green:      #117a3a;
  --green-soft: #ecfaef;
  --green-line: #b9ecc4;
  --blue:       #1d4ed8;
  --blue-soft:  #eff4ff;
  --blue-line:  #c8d6ff;
  --purple:     #6d28d9;
  --purple-soft:#f5f0ff;
  --purple-line:#e0d2ff;
  --slate:      #475569;
  --slate-soft: #f1f3f6;

  /* Type */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Consolas, monospace;

  /* Geometry */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(11,13,16,.04);
  --shadow-md: 0 1px 3px rgba(11,13,16,.06), 0 4px 12px rgba(11,13,16,.04);
  --shadow-lg: 0 10px 32px rgba(11,13,16,.12);
}

/* Reset */
*,*::before,*::after { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

/* ============================================================
   App shell
   ============================================================ */
.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

/* Mobile: collapse sidebar off-canvas, add hamburger toggle */
@media (max-width: 768px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed !important; top: 0; left: 0; bottom: 0;
    width: 260px; z-index: 100;
    transform: translateX(-100%);
    transition: transform .2s ease;
    overflow-y: auto;
  }
  body.menu-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.4); }
  body.menu-open::after {
    content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99;
  }
  .mobile-menu-btn {
    display: inline-flex !important;
    align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: transparent; border: 0; cursor: pointer;
    font-size: 22px; color: var(--ink);
    margin-right: 6px;
  }
  .topbar { padding: 0 8px; gap: 6px; height: 48px; }
  .topbar .crumbs { font-size: 12px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .search { display: none; }
  .content, .container { padding: 10px !important; gap: 12px; }
  /* Stack any grid to single column on phone */
  .print-card-grid,
  .home-grid,
  .customer-grid,
  .sp-kpis,
  .bill-kpis,
  .otd-kpis,
  .aging-row,
  .kpi-row { grid-template-columns: 1fr !important; }
  /* Tables: horizontal scroll instead of squashed */
  .table-wrap, .bill-table, .data-table { overflow-x: auto; display: block; }
  .page-head { flex-wrap: wrap; gap: 10px; }
  .page-head h1 { font-size: 20px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .tab { white-space: nowrap; }
  .filters { grid-template-columns: 1fr !important; gap: 8px; }
  .row-3, .row-2 { grid-template-columns: 1fr !important; gap: 10px; }
  .svc-grid { grid-template-columns: 1fr !important; }
  .section-body { padding: 14px; }
  .section-head .desc { display: none; }
  .row-3 .field > .flex, .row-2 .field > .flex,
  .row-3 .field > div[style*="flex"], .row-2 .field > div[style*="flex"] { flex-wrap: wrap !important; }
  .art-preview-img { min-height: 160px; }
  .bulk-price-input { flex-wrap: wrap !important; }
}
.mobile-menu-btn { display: none; }
.sidebar {
  background: var(--ink);
  color: #d6d8db;
  /* Independently scrollable sidebar so long nav lists (sewing teams, cutting machines)
     don't push bottom items off the viewport. position: sticky keeps it pinned. */
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 24px;
  font-weight: 700; font-size: 16px; letter-spacing: 0.04em;
  color: #fff;
}
/* Brand mark: SK + red swoosh — inline SVG element */
.brand-mark {
  width: 26px; height: 26px;
  display: inline-block;
  flex-shrink: 0;
  overflow: visible;
}
.brand-mark text {
  font-family: "Arial Black", "Helvetica Neue", Helvetica, sans-serif;
}
.sidebar .role-tag {
  margin: 4px 8px 18px;
  padding: 8px 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-md);
  font-size: 11px;
  color: #b0b3b8;
  text-transform: uppercase; letter-spacing: .08em;
}
.sidebar .role-tag b { color: #fff; font-weight: 600; letter-spacing: .04em; }

/* Team Lead indicator — shown inside the "Signed in as" panel for sales / sales_lead roles.
   Sales: clickable chip linking to their lead's team dashboard.
   Lead:  chip linking to their own team dashboard. */
.sidebar .team-tag {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; padding: 7px 9px;
  background: linear-gradient(135deg, rgba(124, 58, 237, .22) 0%, rgba(168, 85, 247, .14) 100%);
  border: 1px solid rgba(168, 85, 247, .35);
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .12s;
  text-transform: none;
  letter-spacing: 0;
}
.sidebar .team-tag:hover {
  background: linear-gradient(135deg, rgba(124, 58, 237, .35) 0%, rgba(168, 85, 247, .22) 100%);
  border-color: rgba(168, 85, 247, .55);
  transform: translateX(2px);
}
.sidebar .team-tag-icon { font-size: 16px; flex-shrink: 0; }
.sidebar .team-tag-body { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.sidebar .team-tag-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: .1em;
  opacity: .68; font-weight: 600;
}
.sidebar .team-tag-name {
  font-size: 12px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar .team-tag-arrow {
  opacity: .55; font-size: 14px; transition: transform .12s, opacity .12s;
}
.sidebar .team-tag:hover .team-tag-arrow { opacity: 1; transform: translateX(2px); }
.sidebar .team-tag-empty {
  background: rgba(255, 255, 255, .04);
  border-color: rgba(255, 255, 255, .08);
  cursor: default;
}
.sidebar .team-tag-empty:hover { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); transform: none; }

/* Informational team chip (sales member viewing their lead — not clickable) */
.sidebar .team-tag-info { cursor: default; }
.sidebar .team-tag-info:hover {
  /* No hover effect — it's read-only info */
  background: linear-gradient(135deg, rgba(124, 58, 237, .22) 0%, rgba(168, 85, 247, .14) 100%);
  border-color: rgba(168, 85, 247, .35);
  transform: none;
}
.sidebar .team-tag-lead {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  border-color: rgba(168, 85, 247, .6);
}
.sidebar .team-tag-lead:hover {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  border-color: rgba(168, 85, 247, .9);
}

.nav-section {
  font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  color: #6c7077; padding: 14px 10px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-md);
  color: #c5c8cc; font-size: 13px; line-height: 1;
  transition: background .12s, color .12s;
}
.nav-link:hover { background: rgba(255,255,255,.04); color: #fff; }
.nav-link.active { background: rgba(255,255,255,.09); color: #fff; }
.nav-link .count {
  margin-left: auto;
  background: rgba(255,255,255,.08); color: #fff;
  font-size: 11px; padding: 1px 7px; border-radius: 10px;
}
.nav-link .count.alert { background: var(--red); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
}
.topbar .crumbs { color: var(--muted); font-size: 13px; }
.topbar .crumbs b { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.search {
  flex: 0 1 360px;
  display: flex; align-items: center; gap: 8px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 6px 10px;
}
.search input { border: 0; background: transparent; outline: 0; flex: 1; font-size: 13px; }
.search .kbd {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 3px; padding: 1px 5px;
}
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border); border-radius: 100px;
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #2a2d33, #0b0d10);
  color: #fff; font-size: 11px; font-weight: 600;
  display: grid; place-items: center;
}

.content {
  padding: 24px;
  flex: 1;
  display: flex; flex-direction: column; gap: 20px;
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
}
.page-head h1 {
  margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em;
}
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: 13px; font-weight: 500;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--canvas); border-color: var(--border-2); }
.btn-primary {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-danger {
  background: var(--red); color: #fff; border-color: var(--red);
}
.btn-success {
  background: var(--green); color: #fff; border-color: var(--green);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--canvas); color: var(--ink); border-color: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 18px; font-size: 14px; }

/* ============================================================
   Cards & panels
   ============================================================ */
.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head { padding: 16px 20px 0; }
.card-body { padding: 12px 20px 20px; }
.card h3 {
  margin: 0 0 4px; font-size: 14px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.card h3 + .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.divider { height: 1px; background: var(--border); margin: 0; border: 0; }

/* Stat grid */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}
.stat {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px 18px;
}
.stat .label {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
}
.stat .value {
  margin-top: 6px; font-size: 24px; font-weight: 600; letter-spacing: -.02em;
}
.stat .delta { font-size: 12px; color: var(--green); margin-top: 4px; }
.stat .delta.neg { color: var(--red); }
.stat.accent-red { border-color: var(--red-line); background: var(--red-soft); }
.stat.accent-amber { border-color: var(--amber-line); background: var(--amber-soft); }
.stat.accent-green { border-color: var(--green-line); background: var(--green-soft); }

/* ============================================================
   Filters bar
   ============================================================ */
.filters {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: grid; grid-template-columns: repeat(5, 1fr) auto; gap: 12px;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600;
}
.field input, .field select, .field textarea {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 7px 10px; font-size: 13px;
  outline: 0; transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--ink); box-shadow: 0 0 0 3px rgba(11,13,16,.06);
}

/* ============================================================
   Table
   ============================================================ */
.table-wrap {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}

/* ============================================================
   Tabs — segmented button row used across stations & reports
   ============================================================ */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  background: transparent;
  border: 0;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.08s;
}
.tab:hover {
  background: var(--canvas);
  color: var(--ink);
  border-color: var(--border-2, #d4d4d8);
}
.tab.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.tab.active:hover {
  background: #1a1a1a;
}
/* Semantic color variants (work in both idle and active states) */
.tab.danger { border-color: #fecaca; color: var(--red, #dc2626); background: #fef2f2; }
.tab.danger:hover { background: #fee2e2; border-color: #fca5a5; }
.tab.danger.active { background: var(--red, #dc2626); color: #fff; border-color: var(--red, #dc2626); }
.tab.danger.active:hover { background: #b91c1c; }
.tab.danger .tab-count { background: #fecaca; color: var(--red, #dc2626); }
.tab.danger.active .tab-count { background: rgba(255,255,255,.22); color: #fff; }

.tab.success { border-color: #bbf7d0; color: var(--green, #16a34a); background: #f0fdf4; }
.tab.success:hover { background: #dcfce7; border-color: #86efac; }
.tab.success.active { background: var(--green, #16a34a); color: #fff; border-color: var(--green, #16a34a); }
.tab.success.active:hover { background: #15803d; }
.tab.success .tab-count { background: #bbf7d0; color: var(--green, #16a34a); }
.tab.success.active .tab-count { background: rgba(255,255,255,.22); color: #fff; }
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--canvas);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-family: ui-monospace, monospace;
}
.tab.active .tab-count {
  background: rgba(255,255,255,.18);
  color: #fff;
}
table.t {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table.t th, table.t td {
  padding: 11px 12px; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
table.t th {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600;
  background: #fafbfc;
  position: sticky; top: 0;
}
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: #fafbfc; }
table.t tr.urgent td { background: var(--red-soft); }
table.t tr.urgent:hover td { background: #ffe6e3; }
table.t tr.urgent td:first-child { box-shadow: inset 3px 0 0 var(--red); }
table.t tr.super-urgent td { background: #fff0ec; }
table.t tr.super-urgent td:first-child { box-shadow: inset 3px 0 0 var(--red); }
table.t tr.super-urgent .badge.urgent { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(217,32,32,0); }
  50% { box-shadow: 0 0 0 4px rgba(217,32,32,.15); }
}
table.t .num { font-variant-numeric: tabular-nums; }
table.t .order-id { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 100px;
  letter-spacing: .02em;
  border: 1px solid transparent;
}
.badge.normal   { background: var(--slate-soft); color: var(--slate); border-color: #dde1e6; }
.badge.confirmed{ background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line); }
.badge.sample   { background: var(--purple-soft); color: var(--purple); border-color: var(--purple-line); }
.badge.void     { background: #f0f1f3; color: #475569; border-color: #dde1e6; text-decoration: line-through; }
.badge.urgent   { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.badge.super    { background: var(--red); color: #fff; border-color: var(--red); }
.badge.paid     { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.badge.unpaid   { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.badge.free     { background: var(--purple-soft); color: var(--purple); border-color: var(--purple-line); }

/* ============================================================
   Status dots (production stages)
   ============================================================ */
.stage-row { display: flex; align-items: center; gap: 6px; }
.stage {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--muted);
}
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #d6d9dd; flex-shrink: 0;
}
.dot.skip   { background: transparent; border: 1.5px dashed #cdd0d4; box-sizing: border-box; }
.dot.queue  { background: #d6d9dd; }
.dot.active { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.dot.done   { background: var(--green); }
.stage.done { color: var(--ink-2); }

/* Compact production grid (used in listing) */
.prod-grid {
  display: grid; grid-template-columns: repeat(5, auto); gap: 4px 10px;
  font-size: 11px; line-height: 1.2;
}
.prod-cell {
  display: flex; align-items: center; gap: 4px; color: var(--muted);
  white-space: nowrap;
}
.prod-cell .date { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 11px; }

/* ============================================================
   Form sections (new order)
   ============================================================ */
.section {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 16px;
}
.section-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.section-head .num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
}
.section-head h2 {
  margin: 0; font-size: 14px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
.section-head .desc { color: var(--muted); font-size: 12px; margin-left: auto; }
.section-body { padding: 20px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* Multi-select services */
.svc-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.svc {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; transition: border-color .12s, background .12s;
}
.svc input[type=checkbox] { margin-top: 2px; accent-color: var(--ink); }
.svc:hover { border-color: var(--border-2); }
.svc.checked { border-color: var(--ink); background: #fafbfc; }
.svc .svc-title { font-weight: 600; font-size: 13px; }
.svc .svc-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.svc-remark {
  margin-top: 8px;
  width: 100%; resize: vertical; min-height: 32px;
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 5px 8px; font-size: 12px;
}

/* Sizes grid */
.sizes-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px;
}
.size-cell {
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 10px 12px;
}
.size-cell .lbl {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600;
}
.size-cell input {
  width: 100%; border: 0; background: transparent; outline: 0;
  font-size: 18px; font-weight: 600; padding: 4px 0 0;
}
.size-cell.filled { background: #fafbfc; }

/* Pricing table (sizes + per-size unit price) */
.pricing-table-wrap { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.pricing-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pricing-table th { background: var(--canvas); text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.pricing-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.pricing-table tbody tr:hover { background: #fafbfc; }
.pricing-table tbody tr.has-qty { background: #fafffa; }
.pricing-table tbody tr.has-qty .size-label { color: var(--ink); font-weight: 600; }
.pricing-table .size-label { font-weight: 600; color: var(--muted); width: 80px; }
.pricing-table input[type="number"] { width: 100%; border: 1px solid transparent; background: transparent; padding: 6px 8px; border-radius: var(--r-sm); font-size: 14px; font-weight: 500; }
.pricing-table input[type="number"]:hover { border-color: var(--border); }
.pricing-table input[type="number"]:focus { border-color: var(--ink); outline: 0; background: #fff; }
.pricing-table .custom-label-input { width: 100%; border: 1px solid var(--border); background: #fff; padding: 6px 8px; border-radius: var(--r-sm); font-size: 13px; }
.pricing-table .rm-input { display: flex; align-items: center; gap: 4px; border: 1px solid transparent; padding: 0 8px; border-radius: var(--r-sm); }
.pricing-table .rm-input:hover { border-color: var(--border); }
.pricing-table .rm-input:focus-within { border-color: var(--ink); background: #fff; }
.pricing-table .rm-input span { font-size: 11px; color: var(--muted); font-weight: 600; }
.pricing-table .rm-input input { padding-left: 0; }
.pricing-table .subtotal-cell { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.pricing-table tfoot td { padding: 12px; background: var(--canvas); border-top: 2px solid var(--ink); border-bottom: 0; }
.pricing-table tfoot .custom-row td { background: #fff; border-top: 1px dashed var(--border); padding: 8px 12px; }
.pricing-table tr.custom td:first-child { padding: 6px 12px; }

.size-total {
  grid-column: 7 / 9;
  background: var(--ink); color: #fff;
  border-radius: var(--r-md); padding: 10px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.size-total .lbl { color: rgba(255,255,255,.6); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.size-total .v { font-size: 22px; font-weight: 600; }

/* Upload */
.upload {
  border: 1.5px dashed var(--border-2); border-radius: var(--r-lg);
  padding: 28px; text-align: center; color: var(--muted);
  background: #fafbfc;
}
.upload b { color: var(--ink); }

/* ============================================================
   Queue cards (station view)
   ============================================================ */
.queue {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
}
.q-card {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
}
.q-card.urgent { border-color: var(--red-line); background: var(--red-soft); }
.q-card.urgent::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 3px; background: var(--red); border-radius: 0 2px 2px 0;
}
.q-card.super-urgent { border-color: var(--red); }
.q-card.super-urgent::before {
  background: var(--red); width: 4px;
}
.q-head { display: flex; align-items: center; gap: 10px; }
.q-head .order-id { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.q-head h3 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }
.q-meta {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.q-card.urgent .q-meta { border-color: var(--red-line); }
.q-meta .k { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.q-meta .v { font-size: 13px; font-weight: 500; margin-top: 2px; }
.q-art {
  width: 100%; height: 90px; border-radius: var(--r-md);
  background: linear-gradient(135deg, #e3e5e8, #c5c8cc);
  position: relative; overflow: hidden;
}
.q-art::after {
  content: "ARTWORK"; position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 10px; letter-spacing: .2em; color: rgba(255,255,255,.85); font-weight: 700;
}
.q-foot { display: flex; align-items: center; gap: 8px; }
.q-foot .spacer { flex: 1; }

/* ============================================================
   Modal (cutting team picker)
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(11,13,16,.5);
  display: grid; place-items: center;
  padding: 32px;
  z-index: 50;
}
.modal-backdrop[hidden] { display: none !important; }
.modal {
  background: var(--paper); border-radius: var(--r-lg);
  width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; }
.modal-head .close {
  margin-left: auto;
  background: transparent; border: 0; font-size: 18px; color: var(--muted);
  width: 28px; height: 28px; border-radius: var(--r-md);
}
.modal-head .close:hover { background: var(--canvas); color: var(--ink); }
.modal-body { padding: 18px 22px; }

/* Customer picker rows */
.cust-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); cursor: pointer; }
.cust-row:hover { background: var(--canvas); }
.cust-row:last-child { border-bottom: 0; }
.cust-row-co { font-weight: 600; font-size: 14px; }
.cust-row-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cust-row-tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.cust-tag { background: var(--blue-soft); color: var(--blue); padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  background: #fafbfc;
}

/* Team picker rows */
.team-list { display: flex; flex-direction: column; gap: 6px; }
.team-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--r-md); cursor: pointer;
}
.team-row:hover { border-color: var(--border-2); background: #fafbfc; }
.team-row.selected { border-color: var(--ink); background: #fafbfc; }
.team-row .name { font-weight: 600; font-size: 14px; }
.team-row .meta { color: var(--muted); font-size: 12px; }
.team-row .rate {
  margin-left: auto; font-family: var(--mono); font-size: 13px;
  background: var(--canvas); padding: 4px 8px; border-radius: var(--r-sm);
}
.team-row .load {
  font-size: 11px; color: var(--muted); margin-left: 12px;
}

/* ============================================================
   Cutting Dashboard — team grids + assign modal
   ============================================================ */
.team-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--blue-line);
}
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.team-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.team-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.team-name { font-weight: 600; font-size: 15px; }
.team-note { font-size: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.team-jobs { display: flex; flex-direction: column; gap: 8px; min-height: 48px; }
.team-job-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.team-job-row:last-child { border-bottom: 0; }
.team-foot {
  display: flex;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.team-pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}
.team-pick {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  background: var(--paper);
  transition: border-color .12s, background .12s;
}
.team-pick:hover { border-color: var(--border-2); background: #fafbfc; }
.team-pick:has(input:checked) { border-color: var(--ink); background: #fafbfc; }
.team-pick input[type="radio"] { margin-top: 4px; }
.team-pick-body { flex: 1; }

.warning-box {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  border-radius: var(--r-md);
  font-size: 12px;
  color: var(--amber);
}

/* ============================================================
   Tables, KPIs, filter bar (Commission, etc.)
   ============================================================ */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--paper); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; }
.kpi-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.kpi-val { font-size: 22px; font-weight: 600; font-family: var(--mono); }

.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; padding: 12px 14px; background: var(--paper); border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 14px; align-items: center; }
.filter-bar label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.filter-bar select { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--paper); font-size: 13px; min-width: 160px; }

.data-table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; font-size: 13px; }
.data-table th { text-align: left; padding: 10px 12px; background: var(--canvas); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table tfoot td { background: var(--canvas); border-top: 2px solid var(--border-2); padding: 12px; }
.data-table .empty-row { text-align: center; padding: 40px 12px; }
.link { color: var(--blue); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }

.status-pill { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid; }
.status-pill.green { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.status-pill.amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.status-pill.blue  { background: var(--blue-soft);  color: var(--blue);  border-color: var(--blue-line);  }
.status-pill.grey  { background: var(--canvas);     color: var(--muted); border-color: var(--border); }
.status-pill.red   { background: var(--red-soft);   color: var(--red);   border-color: var(--red-line); }

/* ============================================================
   Printing queue — photo-thumbnail cards
   ============================================================ */
.print-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.print-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.print-card:hover { border-color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow); }
.print-card.urgent { border-color: var(--red-line); }
.print-card.urgent:hover { border-color: var(--red); }

/* ============================================================
   SUPER URGENT card — fiery animated frame
   ============================================================ */
.print-card.super-urgent,
.q-card.super-urgent {
  position: relative;
  border: 0 !important;
  background:
    linear-gradient(var(--paper), var(--paper)) padding-box,
    linear-gradient(135deg, #fbbf24 0%, #f97316 25%, #dc2626 50%, #f97316 75%, #fbbf24 100%) border-box;
  border: 2px solid transparent !important;
  background-size: 100% 100%, 300% 100%;
  animation: super-card-flow 4s linear infinite;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, .55), 0 4px 14px rgba(220, 38, 38, .22);
}
.print-card.super-urgent { animation: super-card-flow 4s linear infinite, super-card-pulse 1.8s ease-in-out infinite; }
.q-card.super-urgent     { animation: super-card-flow 4s linear infinite, super-card-pulse 1.8s ease-in-out infinite; }
.print-card.super-urgent:hover,
.q-card.super-urgent:hover {
  transform: translateY(-3px);
  animation-play-state: paused;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, .25), 0 10px 24px rgba(220, 38, 38, .35);
}
/* Inner red wash so the card body reads as "hot" */
.print-card.super-urgent::after,
.q-card.super-urgent::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(254, 226, 226, .35) 0%, transparent 35%, transparent 100%);
  pointer-events: none;
  border-radius: inherit;
  z-index: 0;
}
.print-card.super-urgent > *,
.q-card.super-urgent > * { position: relative; z-index: 1; }

/* Corner flame ribbon (top-right) */
.print-card.super-urgent::before,
.q-card.super-urgent.super-ribbon::before {
  content: "🔥 SUPER URGENT";
  position: absolute;
  top: 10px; right: -32px;
  transform: rotate(38deg);
  background: linear-gradient(135deg, #f97316 0%, #dc2626 60%, #991b1b 100%);
  color: #fff;
  font-size: 9px; font-weight: 800;
  letter-spacing: .12em;
  padding: 4px 36px;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
  box-shadow: 0 2px 6px rgba(220, 38, 38, .55);
  z-index: 5;
  animation: super-card-flicker 1.3s ease-in-out infinite alternate;
  pointer-events: none;
  white-space: nowrap;
}
/* q-card uses a different left-rail accent already — override it for super-urgent */
.q-card.super-urgent::before { width: auto; background: linear-gradient(135deg, #f97316 0%, #dc2626 60%, #991b1b 100%); }

@keyframes super-card-flow {
  0%   { background-position: 0% 0%, 0% 50%; }
  100% { background-position: 0% 0%, 300% 50%; }
}
@keyframes super-card-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(239, 68, 68, .55), 0 4px 14px rgba(220, 38, 38, .22); }
  70%  { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0),   0 4px 14px rgba(220, 38, 38, .22); }
  100% { box-shadow: 0 0 0 0   rgba(239, 68, 68, 0),   0 4px 14px rgba(220, 38, 38, .22); }
}
@keyframes super-card-flicker {
  from { filter: drop-shadow(0 0 3px rgba(254, 215, 170, .5)); }
  to   { filter: drop-shadow(0 0 7px rgba(254, 215, 170, .95)); }
}

/* Respect reduced-motion preference — keep the look, drop the animation */
@media (prefers-reduced-motion: reduce) {
  .print-card.super-urgent,
  .q-card.super-urgent,
  .print-card.super-urgent::before,
  .q-card.super-urgent::before { animation: none !important; }
}

.print-card-thumb {
  position: relative;
  width: 100%;
  height: 180px;
  background: var(--canvas);
  overflow: hidden;
}
.print-card-corner { position: absolute; top: 8px; left: 8px; }
.print-card-due {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(11,13,16,.78); color: #fff;
  padding: 3px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  backdrop-filter: blur(4px);
}
.print-card-due * { color: #fff !important; }
.print-card-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.print-card-id-row { display: flex; justify-content: space-between; align-items: baseline; }
.print-card-job { font-weight: 600; font-size: 14px; line-height: 1.3; }
.print-card-cust { font-size: 12px; color: var(--muted); }
.print-card-spec { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.print-card-spec b { color: var(--ink); }
.print-card-foot {
  display: flex; gap: 6px; align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}

/* ============================================================
   Login screen
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: grid; grid-template-columns: 1.1fr 1fr;
  background: var(--canvas);
}
.login-art {
  background: var(--ink);
  color: #fff;
  padding: 48px 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-art .brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; letter-spacing: .04em; }
.login-art .pitch h1 {
  font-size: 38px; line-height: 1.1; font-weight: 600; letter-spacing: -.02em;
  max-width: 14ch;
}
.login-art .pitch p { color: rgba(255,255,255,.6); max-width: 36ch; font-size: 14px; }
.login-art .meta { font-family: var(--mono); font-size: 11px; color: rgba(255,255,255,.4); letter-spacing: .08em; }
@media (max-width: 768px) {
  .login-page { grid-template-columns: 1fr; }
  .login-art { padding: 32px 24px; min-height: auto; }
  .login-art .pitch h1 { font-size: 24px; }
  .login-art .pitch p { font-size: 13px; max-width: 100%; }
  .login-art .meta { display: none; }
  .login-panel { padding: 32px 24px !important; }
}
.login-art .grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}
.login-art .accent {
  position: absolute; right: -120px; bottom: -120px;
  width: 360px; height: 360px;
  background: var(--red); border-radius: 50%; opacity: .9;
  filter: blur(0px);
}
.login-form-wrap {
  display: grid; place-items: center; padding: 48px;
}
.login-form {
  width: 100%; max-width: 380px;
}
.login-form h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.login-form .sub { color: var(--muted); font-size: 13px; margin-bottom: 28px; }
.login-form .field { margin-bottom: 14px; }
.login-form .field input {
  padding: 10px 12px; font-size: 14px;
}
.login-form .btn-primary { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }
.login-form .footnote { margin-top: 24px; font-size: 12px; color: var(--muted); text-align: center; }

/* ============================================================
   Index (mockup hub) page
   ============================================================ */
.hub {
  max-width: 1080px; margin: 0 auto; padding: 56px 32px;
}
.hub-head { margin-bottom: 36px; }
.hub-head .eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); font-weight: 600;
}
.hub-head h1 { margin: 8px 0 8px; font-size: 36px; font-weight: 600; letter-spacing: -.02em; }
.hub-head p { color: var(--muted); max-width: 60ch; font-size: 15px; }
.hub-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
.hub-card {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color .12s, transform .12s;
}
.hub-card:hover { border-color: var(--ink); transform: translateY(-1px); }
.hub-card .num {
  font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .12em;
}
.hub-card h3 { margin: 0; font-size: 17px; font-weight: 600; }
.hub-card p { margin: 0; color: var(--muted); font-size: 13px; }
.hub-card .roles {
  margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px;
}
.hub-card .role-chip {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  background: var(--canvas); color: var(--ink-2);
  padding: 2px 7px; border-radius: 100px;
}
.hub-foot { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }

/* Queue legend */
.legend {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 16px;
  margin-top: 16px;
  background: var(--canvas); border-radius: var(--r-md);
  font-size: 12px; color: var(--muted);
  align-items: center;
}
.legend-sort {
  grid-column: 2; font-size: 11px; color: var(--muted-2, #9ca3af);
  margin-top: 2px;
}

/* Misc utilities */
.muted { color: var(--muted); }
.right { text-align: right; }
.flex { display: flex; gap: 8px; align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; }
.mono { font-family: var(--mono); }


/* Department / method pill colors */
.method-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid transparent; }
.method-pill.print { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.method-pill.dtf { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.method-pill.cut { background: #f5deb3; color: #7c4a03; border-color: #d4a373; }
.method-pill.sew { background: #fce7f3; color: #be185d; border-color: #f9a8d4; }
.method-pill.pack { background: #cffafe; color: #0e7490; border-color: #67e8f9; }
.method-pill.sample { background: #f3e8ff; color: #6b21a8; border-color: #d8b4fe; }
.method-pill.ghost { background: var(--canvas); color: var(--muted); border-color: var(--border); }
.badge.sample { background: #f3e8ff; color: #6b21a8; border-color: #d8b4fe; }
