/* ── Login ───────────────────────────────────────────────────────────────── */
#login-screen{position:fixed;inset:0;background:#1a2744;display:flex;align-items:center;justify-content:center;z-index:999}
#login-screen.hidden{display:none}
#login-box{background:#fff;border-radius:12px;padding:40px 36px;width:100%;max-width:380px;box-shadow:0 20px 60px rgba(0,0,0,.4)}
#login-logo{font-size:22px;font-weight:800;letter-spacing:2px;color:#1a2744;margin-bottom:4px}
#login-subtitle{font-size:13px;color:#6b7a99;margin-bottom:28px}
#app{display:flex;flex-direction:column;min-height:100vh}
#app.hidden{display:none}

/* ── Reset & Base ────────────────────────────────────────────────────────── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:14px;background:#f0f2f5;color:#1a1a2e;min-height:100vh}
a{text-decoration:none;color:inherit}
button{cursor:pointer;border:none;background:none;font-family:inherit;font-size:inherit}
input,select,textarea{font-family:inherit;font-size:inherit}
#navbar{background:#1a2744;color:#fff;display:flex;align-items:center;padding:0 24px;height:52px;position:sticky;top:0;z-index:100;box-shadow:0 2px 8px rgba(0,0,0,.25)}
.nav-brand{font-size:14px;font-weight:700;letter-spacing:2px;color:#e8edf5;margin-right:32px}
.nav-links{display:flex;gap:4px}
.nav-link{padding:6px 14px;border-radius:6px;color:#a8b4cc;font-size:13px;font-weight:500;transition:all .15s}
.nav-link:hover{background:rgba(255,255,255,.08);color:#fff}
.nav-link.active{background:rgba(255,255,255,.12);color:#fff}
.nav-cta{background:#2563eb;color:#fff;font-weight:600}
.nav-cta::before{content:"+ "}
.nav-cta:hover,.nav-cta.active{background:#1d4ed8;color:#fff}
.nav-menu-wrap{position:relative;display:inline-flex;align-items:center}
.nav-gear-btn{background:none;border:none;color:#a8b4cc;font-size:17px;cursor:pointer;padding:2px 6px;line-height:1;border-radius:6px}
.nav-gear-btn:hover{background:rgba(255,255,255,.08);color:#fff}
.nav-menu{position:absolute;top:100%;right:0;margin-top:8px;background:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.18);min-width:180px;z-index:1000;padding:5px}
.nav-menu-item{display:block;padding:8px 12px;font-size:13px;color:#374151;text-decoration:none;border-radius:5px;white-space:nowrap;cursor:pointer}
.nav-menu-item:hover{background:#f3f4f6;color:#111827}
/* Full-width: views use the whole screen (was capped at 1600px, which left big blank
   margins on wide monitors). Data-entry forms + modals keep their own readable max-width. */
#main-content{width:100%;box-sizing:border-box;margin:0 auto;padding:20px 24px}
#order-form{max-width:1200px}
.page-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}
.page-title{font-size:20px;font-weight:700;color:#1a2744}
.card{background:#fff;border-radius:10px;box-shadow:0 1px 4px rgba(0,0,0,.08);padding:20px;margin-bottom:20px}
.card-title{font-size:13px;font-weight:700;color:#6b7a99;text-transform:uppercase;letter-spacing:.8px;margin-bottom:16px}
.btn{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;border-radius:7px;font-size:13px;font-weight:600;transition:all .15s}
.btn-primary{background:#1a56db;color:#fff}.btn-primary:hover{background:#1648c0}
.btn-secondary{background:#f0f2f5;color:#374151;border:1px solid #d1d5db}.btn-secondary:hover{background:#e5e7eb}
.btn-danger{background:#fee2e2;color:#dc2626}.btn-danger:hover{background:#fecaca}
.btn-success{background:#d1fae5;color:#065f46}.btn-success:hover{background:#a7f3d0}
.btn-sm{padding:5px 10px;font-size:12px}
.btn-icon{padding:6px 8px}
.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse}
th{background:#f8f9fb;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;color:#6b7a99;padding:10px 12px;text-align:left;border-bottom:1px solid #e5e7eb;white-space:nowrap}
td{padding:10px 12px;border-bottom:1px solid #f0f2f5;vertical-align:middle}
tr:last-child td{border-bottom:none}
tr:hover td{background:#fafbff}
.table-actions{display:flex;gap:6px}
.badge{display:inline-block;padding:3px 9px;border-radius:12px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.4px}
.badge-pending{background:#fef3c7;color:#92400e}
.badge-scheduled{background:#dbeafe;color:#1e40af}
.badge-in_production{background:#d1fae5;color:#065f46}
.badge-complete{background:#e0e7ff;color:#3730a3}
.badge-paused{background:#fff7ed;color:#9a3412;border:1px solid #fed7aa}
.badge-shipped{background:#f3f4f6;color:#374151}
.prod-order-paused{border-color:#fed7aa!important;background:#fffbeb!important}
.form-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:16px}
.form-grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.form-full{grid-column:1/-1}
.form-group{display:flex;flex-direction:column;gap:5px}
.form-group label{font-size:12px;font-weight:600;color:#374151;text-transform:uppercase;letter-spacing:.5px}
.form-group input,.form-group select,.form-group textarea{padding:8px 10px;border:1px solid #d1d5db;border-radius:6px;background:#fff;transition:border-color .15s}
.form-group input:focus,.form-group select:focus,.form-group textarea:focus{outline:none;border-color:#1a56db;box-shadow:0 0 0 3px rgba(26,86,219,.1)}
.form-group textarea{resize:vertical;min-height:70px}
.form-section-title{font-size:12px;font-weight:700;color:#1a56db;text-transform:uppercase;letter-spacing:.8px;padding-bottom:8px;border-bottom:2px solid #e8edf5;margin-bottom:16px}
.form-actions{display:flex;gap:10px;padding-top:20px}
.field-hint{font-size:11px;color:#9ca3af;margin-top:2px}
.calc-panel{background:#f0f7ff;border:1px solid #bfdbfe;border-radius:8px;padding:16px}
.calc-panel-title{font-size:12px;font-weight:700;color:#1e40af;text-transform:uppercase;letter-spacing:.6px;margin-bottom:12px}
.calc-result{background:#fff;border:1px solid #bfdbfe;border-radius:6px;padding:12px 16px;margin-top:12px}
.calc-result-row{display:flex;justify-content:space-between;padding:4px 0;font-size:13px}
.calc-result-row .label{color:#6b7a99}
.calc-result-row .value{font-weight:700;color:#1a2744}
.calc-result-row.highlight .value{color:#1a56db;font-size:15px}
.lineup-filters{display:flex;gap:10px;margin-bottom:16px;flex-wrap:wrap;align-items:center}
.filter-btn{padding:6px 14px;border-radius:20px;font-size:12px;font-weight:600;border:1px solid #d1d5db;color:#6b7a99;background:#fff;transition:all .15s}
.filter-btn.active{background:#1a56db;color:#fff;border-color:#1a56db}
.filter-search{padding:7px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:13px;min-width:200px}
.row-overdue td{background:#fff5f5!important}
.row-overdue td:first-child{border-left:3px solid #ef4444}
.row-due-soon td{background:#fffbeb!important}
.row-due-soon td:first-child{border-left:3px solid #f59e0b}
.progress-wrap{width:100px;background:#e5e7eb;border-radius:4px;height:6px}
.progress-bar{height:6px;border-radius:4px;background:#1a56db}
.progress-text{font-size:11px;color:#6b7a99;margin-top:2px}
.stats-row{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:16px;margin-bottom:24px}
.stat-card{background:#fff;border-radius:10px;padding:16px 20px;box-shadow:0 1px 4px rgba(0,0,0,.07)}
.stat-label{font-size:11px;font-weight:700;color:#9ca3af;text-transform:uppercase;letter-spacing:.6px}
.stat-value{font-size:26px;font-weight:800;color:#1a2744;margin-top:4px}
.stat-sub{font-size:11px;color:#6b7a99;margin-top:2px}
#modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:200;display:flex;align-items:flex-start;justify-content:center;padding-top:60px}
#modal-overlay.hidden{display:none}
#modal-box{background:#fff;border-radius:12px;width:90%;max-width:860px;max-height:85vh;overflow-y:auto;box-shadow:0 20px 60px rgba(0,0,0,.2)}
#modal-header{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid #e5e7eb;position:sticky;top:0;background:#fff;z-index:1}
#modal-title{font-size:16px;font-weight:700;color:#1a2744}
#modal-close{font-size:18px;color:#9ca3af;padding:4px 8px;border-radius:4px}
#modal-close:hover{background:#f0f2f5}
#modal-body{padding:20px}
/* Address-autocomplete mode (customer form): let the Google suggestions dropdown escape the
   modal's scroll/clip. The box stops clipping + uncaps height; scrolling moves to the overlay so
   long forms still scroll. Scoped to .modal-af (added only while an autocomplete box is mounted). */
#modal-overlay.modal-af{overflow-y:auto}
#modal-box.modal-af{overflow:visible;max-height:none}
/* Searchable order picker (combobox): a search input over a dropdown list of orders. */
.ordercombo-search{width:100%;padding:8px 10px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;box-sizing:border-box;font-family:inherit}
.ordercombo-list{position:absolute;left:0;right:0;top:calc(100% + 2px);z-index:40;max-height:300px;overflow-y:auto;background:#fff;border:1px solid #d1d5db;border-radius:8px;box-shadow:0 8px 28px rgba(0,0,0,.16)}
.ordercombo-item{padding:8px 11px;font-size:13px;cursor:pointer;border-bottom:1px solid #f3f4f6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ordercombo-item:hover,.ordercombo-item.active{background:#eff6ff}
.ordercombo-badge{display:inline-block;background:#ddd6fe;color:#5b21b6;font-size:10px;font-weight:700;padding:0 5px;border-radius:3px;margin-right:6px;vertical-align:middle}
.ordercombo-empty{padding:8px 11px;color:#9ca3af;font-size:13px}
.settings-list{border:1px solid #e5e7eb;border-radius:8px;overflow:hidden}
.settings-list-item{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid #f0f2f5;background:#fff}
.settings-list-item:last-child{border-bottom:none}
.settings-list-add{display:flex;gap:8px;margin-top:12px}
.settings-list-add input{flex:1;padding:8px 10px;border:1px solid #d1d5db;border-radius:6px}
.prod-order-selector{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:12px;margin-bottom:20px}
.prod-order-card{background:#fff;border:2px solid #e5e7eb;border-radius:10px;padding:14px 16px;cursor:pointer;transition:all .15s}
.prod-order-card:hover{border-color:#1a56db}
.prod-order-card.selected{border-color:#1a56db;background:#f0f7ff}
.prod-order-card .wo{font-size:11px;color:#9ca3af;font-weight:600}
.prod-order-card .customer{font-size:15px;font-weight:700;color:#1a2744;margin:2px 0}
.prod-order-card .spec{font-size:13px;color:#4b5563}
.prod-order-card .balance{font-size:12px;color:#6b7a99;margin-top:6px}
.roll-entry-form{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap;margin-bottom:20px}
.roll-entry-form .form-group{min-width:140px}
/* Schedule */
.sched-layout{display:flex;gap:16px}
.sched-sidebar{width:200px;flex-shrink:0;overflow-y:auto;max-height:calc(100vh-120px);position:sticky;top:72px}
.sched-main-wrap{flex:1;overflow-x:auto}
.sched-order-card{background:#fff;border:1px solid #e5e7eb;border-radius:8px;padding:10px;margin-bottom:8px;cursor:grab;transition:border-color .15s}
.sched-order-card:hover{border-color:#1a56db;background:#fafbff}
.sched-order-card:active{cursor:grabbing}
.sched-table{width:100%;border-collapse:collapse}
.sched-table thead{position:sticky;top:0;z-index:5}
.sched-th-date{background:#1a2744;color:#fff;padding:10px 6px;font-size:11px;font-weight:700;text-transform:uppercase;width:70px;text-align:center;border:1px solid #2d3d5a}
.sched-th-line{background:#1a2744;color:#fff;padding:10px 12px;font-size:12px;font-weight:700;text-align:center;border:1px solid #2d3d5a;min-width:180px}
.sched-th-total{background:#0f172a;color:#fff;padding:10px 6px;font-size:11px;font-weight:700;width:80px;text-align:center;border:1px solid #2d3d5a}
.sched-rate{font-size:10px;font-weight:400;color:#a8b4cc;margin-top:2px}
.sched-date-cell{padding:8px 4px;text-align:center;border:1px solid #e5e7eb;vertical-align:middle;background:#f8f9fb;font-size:11px;width:70px}
.sched-cell{padding:5px 7px;border:1px solid #e5e7eb;vertical-align:top;min-height:50px}
.sched-total-cell{padding:8px 4px;border:1px solid #e5e7eb;vertical-align:middle;text-align:center;background:#f8f9fb;font-size:12px}
.sched-past .sched-date-cell,.sched-past .sched-cell,.sched-past .sched-total-cell{background:#f3f4f6;color:#9ca3af}
.sched-today-row .sched-date-cell{background:#1a56db;color:#fff;font-weight:700}
.sched-today-row .sched-cell{background:#fffde7;border-color:#fbbf24}
.sched-today-row .sched-total-cell{background:#fffde7}
.sched-weekend .sched-date-cell,.sched-weekend .sched-cell,.sched-weekend .sched-total-cell{background:#fafafa}
.sched-week-separator td{background:#243352;color:#c3cde3;padding:4px 10px;font-size:11px;font-weight:600;letter-spacing:.5px}
/* Block cards: per-ORDER ribbon tint via --sa-bg/--sa-ac (set inline from a hash of the order id)
   so a multi-day/multi-line run reads as one continuous ribbon; the accent border doubles as the
   status color (green running / red hard-stop / grey pulled). */
.sched-assign{background:var(--sa-bg,#eff6ff);border:1px solid rgba(16,24,40,.08);border-left:4px solid var(--sa-ac,#93c5fd);border-radius:7px;padding:5px 7px;margin-bottom:4px;font-size:11px;box-shadow:0 1px 2px rgba(16,24,40,.06)}
.sched-past .sched-assign{background:#f3f4f6;border-color:#e5e7eb;border-left-color:#cbd5e1;box-shadow:none}
.sa-pulled{background:repeating-linear-gradient(45deg,#f8fafc 0 6px,#eef2f7 6px 12px)!important}
.sched-assign-customer{font-weight:700;font-size:12px;color:#1e3a5f}
.sched-assign-po{font-weight:700;font-size:12.5px;color:#111827;line-height:1.2}
.sched-assign-cust{font-size:10.5px;color:#6b7a99;margin:1px 0}
.sched-assign-spec{font-size:10px;color:#6b7a99}
.sched-assign-hours{color:#374151;margin-top:1px}
.sched-assign-balance{color:#1a56db;font-size:10px}
.sched-assign-actions{display:flex;gap:2px;margin-top:3px;opacity:0;transition:opacity .12s}
.sched-assign:hover .sched-assign-actions,.sched-startup-card:hover .sched-assign-actions{opacity:1}
@media (hover:none){.sched-assign-actions{opacity:1}}
.sched-actuals{display:flex;gap:8px;font-size:10px;margin-top:3px;padding-top:3px;border-top:1px dashed #d1d5db;flex-wrap:wrap}
.sched-proj{color:#9ca3af}
.sched-act{color:#059669;font-weight:700}
.sched-down{color:#dc2626;font-weight:600}
.sched-add-btn{padding:3px 6px;border:1px dashed #d1d5db;border-radius:4px;color:#9ca3af;font-size:11px;cursor:pointer;background:transparent;transition:all .15s;font-weight:600}
.sched-add-btn:hover{border-color:#1a56db;color:#1a56db;background:#f0f7ff}
.sched-startup-btn{padding:3px 6px;border:1px dashed #d97706;border-radius:4px;color:#d97706;font-size:11px;cursor:pointer;background:transparent;transition:all .15s;font-weight:600}
.sched-startup-btn:hover{border-color:#b45309;color:#b45309;background:#fffbeb}
.sched-cell-actions{display:flex;gap:3px;margin-top:2px}
.sched-startup-card{background:#fffbeb;border:1px solid #fde68a;border-left:4px solid #d97706;border-radius:7px;padding:5px 7px;margin-bottom:4px;font-size:11px;box-shadow:0 1px 2px rgba(16,24,40,.06)}
.sched-startup-card .sched-assign-customer{color:#92400e}
.sched-startup-card .sched-assign-hours{color:#78350f}
.sched-hours-bar{font-size:9px;text-align:right;margin-bottom:3px;color:#9ca3af}
.sched-hours-bar.full{color:#dc2626;font-weight:700}
/* Day-load bar: how full the day is vs its OPEN hours (partial days included) */
.sched-loadtrack{height:3px;background:#e5e7eb;border-radius:2px;margin-top:2px;overflow:hidden}
.sched-loadtrack i{display:block;height:100%;border-radius:2px}
/* Closed days (weekends + manually-closed weekdays share .sched-weekend): subtle hatch */
.sched-weekend .sched-cell{background:repeating-linear-gradient(45deg,#fafafa 0 10px,#f3f4f6 10px 20px)}
.sched-today-row .sched-cell{background:#fefce8;border-color:#facc15}
.sched-drag-over{background:#dbeafe!important;border:2px dashed #1a56db!important}
/* Larger, more readable Schedule grid (the page is now full-width, so use the room). */
.sched-th-line{font-size:13.5px}
.sched-th-date,.sched-th-total,.sched-total-cell{font-size:12.5px}
.sched-date-cell{font-size:12.5px}
.sched-cell{padding:7px 9px;min-height:56px}
.sched-assign{font-size:12.5px;padding:6px 9px}
.sched-assign-customer{font-size:13.5px}
.sched-assign-po{font-size:13.5px}
.sched-assign-cust{font-size:11.5px}
.sched-assign-spec,.sched-assign-balance,.sched-actuals,.sched-rate{font-size:11.5px}
.sched-week-separator td{font-size:12.5px;padding:6px 12px}
.sched-add-btn,.sched-startup-btn,.sched-startup-card{font-size:12.5px}
.th-sort{cursor:pointer;user-select:none;white-space:nowrap}
/* Lineup week-group separators + jump-to flash (piece 4). */
.lineup-week-separator td{background:#1a2744;color:#cdd6e6;padding:7px 14px;font-size:13px;font-weight:700;letter-spacing:.3px}
.lineup-week-separator .lwk-meta{float:right;font-weight:400;color:#9fb0cc}
.lwk-flash{animation:lwkflash 1.6s ease-out}
@keyframes lwkflash{0%{background:#fcd34d}55%{background:#fef3c7}100%{background:transparent}}
.th-sort:hover{background:#eef0f5!important}
.sort-icon{color:#d1d5db;font-size:10px;margin-left:2px}
.sort-icon.active{color:#1a56db}

/* ── Hamburger (hidden on desktop) ──────────────────────────────────────── */
#nav-hamburger{display:none;background:none;border:none;color:#fff;font-size:22px;padding:8px;margin-left:auto;line-height:1}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media(max-width:768px){
  #nav-hamburger{display:block}
  #navbar{flex-wrap:wrap;height:auto;padding:0 16px;position:sticky;top:0;z-index:100}
  .nav-brand{padding:14px 0;font-size:13px}
  .nav-links{display:none;flex-direction:column;width:100%;gap:0;padding-bottom:8px}
  .nav-links.open{display:flex}
  .nav-link{padding:10px 4px;border-radius:0;font-size:15px;border-bottom:1px solid rgba(255,255,255,.07)}
  .nav-link:last-child{border-bottom:none}
  #logout-btn{margin-left:0!important;width:100%;text-align:left;padding:10px 4px;font-size:15px;border-top:1px solid rgba(255,255,255,.15);margin-top:4px}

  #main-content{padding:12px}
  .page-header{flex-wrap:wrap;gap:8px;margin-bottom:14px}
  .page-title{font-size:17px}

  /* Stats row — 2 columns on mobile */
  .stats-row{grid-template-columns:1fr 1fr;gap:10px;margin-bottom:16px}
  .stat-value{font-size:20px}

  /* Cards */
  .card{padding:14px;margin-bottom:14px}

  /* Forms */
  .form-grid{grid-template-columns:1fr}
  .form-grid-2{grid-template-columns:1fr}
  .form-actions{flex-wrap:wrap}
  .form-actions .btn{flex:1;justify-content:center}
  .roll-entry-form{flex-direction:column;gap:10px}
  .roll-entry-form .form-group{min-width:unset;width:100%}

  /* Tables → card layout */
  .table-wrap{overflow-x:unset}
  table.mobile-cards,table.mobile-cards thead{display:block}
  table.mobile-cards thead{display:none}
  table.mobile-cards tbody{display:block}
  table.mobile-cards tr{display:block;background:#fff;border:1px solid #e5e7eb;border-radius:8px;margin-bottom:10px;padding:10px 12px;box-shadow:0 1px 3px rgba(0,0,0,.06)}
  table.mobile-cards td{display:flex;justify-content:space-between;align-items:center;padding:5px 0;border:none;font-size:13px;border-bottom:1px solid #f0f2f5}
  table.mobile-cards td:last-child{border-bottom:none}
  table.mobile-cards td[data-label]::before{content:attr(data-label);font-size:11px;font-weight:700;color:#9ca3af;text-transform:uppercase;letter-spacing:.4px;margin-right:8px;flex-shrink:0}
  table.mobile-cards td.actions-cell{justify-content:flex-end;padding-top:8px}
  .row-overdue td:first-child{border-left:none}
  table.mobile-cards tr.row-overdue{border-left:3px solid #ef4444}
  table.mobile-cards tr.row-due-soon{border-left:3px solid #f59e0b}

  /* Lineup filters */
  .lineup-filters{gap:6px}
  .filter-search{min-width:unset;width:100%}

  /* Production order selector */
  .prod-order-selector{grid-template-columns:1fr}

  /* Schedule — scrollable on mobile */
  .sched-layout{flex-direction:column}
  .sched-sidebar{width:100%;max-height:200px;position:static}
  .sched-main-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}

  /* Modal */
  #modal-overlay{padding-top:0;align-items:flex-end}
  #modal-box{width:100%;max-width:100%;border-radius:16px 16px 0 0;max-height:90vh}

  /* Settings */
  .settings-list-add{flex-wrap:wrap}
  .settings-list-add input{width:100%}
  .settings-list-item{flex-wrap:wrap;gap:6px}

  /* Operator back bar — match 12px mobile padding and 52px navbar height */
  .op-back-bar{top:52px;margin:0 -12px 16px}
}

/* ── Accessibility: focus-visible outlines ───────────────────────────────── */
.btn:focus-visible,.op-order-btn:focus-visible,.op-back-btn:focus-visible,
.filter-btn:focus-visible,.sched-add-btn:focus-visible,.sched-startup-btn:focus-visible,
.op-tab:focus-visible,.nav-link:focus-visible{outline:2px solid #1a56db;outline-offset:2px}

/* ── Operator Mode ────────────────────────────────────────────────────────── */
.op-tabs{display:flex;background:#1e3a5f;border-bottom:2px solid #2563eb}
.op-tab{flex:1;padding:14px;min-height:44px;background:none;border:none;color:#93c5fd;font-size:15px;font-weight:600;cursor:pointer;letter-spacing:.3px;transition:background .15s}
.op-tab.active{background:#2563eb;color:#fff}
.op-order-btn{display:block;width:100%;background:#fff;border:1.5px solid #e5e7eb;border-radius:12px;padding:16px 18px;margin-bottom:12px;text-align:left;cursor:pointer;transition:border-color .15s,box-shadow .15s}
.op-order-btn:hover{border-color:#93c5fd;box-shadow:0 2px 8px rgba(37,99,235,.1)}
.op-order-btn:active{background:#f0f7ff;border-color:#2563eb}
.op-ob-wo{font-size:12px;font-weight:700;color:#6b7a99;text-transform:uppercase;letter-spacing:.5px;margin-bottom:4px}
.op-ob-customer{font-size:20px;font-weight:700;color:#1e3a5f;margin-bottom:4px}
.op-ob-spec{font-size:13px;color:#6b7a99;margin-bottom:6px}
.op-ob-bal{font-size:14px;font-weight:600}
.op-paused-badge{background:#fff7ed;color:#9a3412;font-size:11px;padding:2px 6px;border-radius:4px;border:1px solid #fed7aa;margin-left:6px;font-weight:600}
.op-order-header{background:#fff;border:1.5px solid #e5e7eb;border-radius:12px;padding:16px;margin-bottom:12px}
.op-oh-wo{font-size:12px;font-weight:700;color:#6b7a99;text-transform:uppercase;letter-spacing:.5px}
.op-oh-customer{font-size:22px;font-weight:700;color:#1e3a5f;margin:4px 0}
.op-oh-spec{font-size:13px;color:#6b7a99;margin-bottom:12px}
.op-oh-stats{display:flex;gap:16px;flex-wrap:wrap}
.op-stat{display:flex;flex-direction:column;gap:2px}
.op-stat span{font-size:11px;color:#9ca3af;text-transform:uppercase;letter-spacing:.4px}
.op-stat strong{font-size:16px}
.op-status-banner{border-radius:8px;padding:10px 14px;font-weight:700;font-size:14px;margin-bottom:12px;border-left:4px solid}
.op-status-complete{background:#d1fae5;color:#065f46;border-color:#059669}
.op-status-last{background:#fffbeb;color:#92400e;border-color:#d97706}
.op-status-paused{background:#fff7ed;color:#9a3412;border-color:#f97316}
.op-entry-card{margin-top:12px}
.op-entry-top{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:16px}
.op-weight-area{margin-bottom:16px}
.op-weight-label{display:block;font-size:13px;font-weight:700;color:#374151;margin-bottom:8px;text-transform:uppercase;letter-spacing:.5px}
.op-weight-input{width:100%;font-size:48px;font-weight:700;padding:16px 20px;border:2px solid #d1d5db;border-radius:12px;text-align:center;color:#1e3a5f;box-sizing:border-box;-moz-appearance:textfield}
.op-weight-input:focus{border-color:#2563eb;outline:none;box-shadow:0 0 0 3px rgba(37,99,235,.2)}
.op-weight-input::-webkit-inner-spin-button,.op-weight-input::-webkit-outer-spin-button{opacity:1;height:48px}
.op-btn-row{display:flex;gap:10px}
.op-add-btn{flex:2;padding:14px;font-size:18px;font-weight:700;letter-spacing:.5px}
.op-close-btn{flex:1;padding:14px;font-size:14px}
.op-rolls-list{display:flex;flex-direction:column;gap:6px}
.op-roll-row{display:flex;align-items:center;gap:10px;padding:10px 12px;background:#f8fafc;border-radius:8px}
.op-roll-left{display:flex;align-items:center;gap:10px;flex:1;min-width:0}
.op-roll-num{font-weight:700;font-size:14px;color:#1e3a5f;white-space:nowrap}
.op-roll-wt{font-size:16px;font-weight:600;white-space:nowrap}
.op-roll-right{display:flex;flex-direction:column;align-items:flex-end;gap:2px;min-width:0}
.op-roll-meta{font-size:12px;color:#6b7a99;white-space:nowrap}
.op-pallets-list{display:flex;flex-direction:column;gap:6px}
.op-pallet-row{display:flex;align-items:center;gap:12px;padding:10px 12px;background:#f0fdf4;border-radius:8px;border:1px solid #bbf7d0}
.op-pallet-left{flex:1;display:flex;align-items:center;gap:10px}
.op-pallet-num{font-weight:700;color:#059669}
.op-pallet-stats{font-size:13px;color:#6b7a99}
@media(max-width:768px){
  .op-ob-customer{font-size:18px}
  .op-oh-customer{font-size:19px}
  .op-weight-input{font-size:36px;padding:14px 16px}
  .op-add-btn{font-size:16px;padding:12px}
  .op-btn-row{flex-direction:column}
  .op-close-btn{flex:none}
  .op-roll-row{flex-wrap:wrap}
  .op-roll-left{width:100%}
  .op-roll-right{width:100%;flex-direction:row;gap:8px;align-items:center;justify-content:flex-start}
}

/* ── Operator Schedule ────────────────────────────────────────────────────── */
.op-sched-lines{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;align-items:start}
.op-sched-line-col{background:#f8fafc;border:1.5px solid #e5e7eb;border-radius:12px;overflow:hidden}
.op-sched-line-hdr{background:#1e3a5f;color:#fff;font-size:14px;font-weight:800;padding:10px 14px;letter-spacing:.5px;text-transform:uppercase}
.op-sched-day-block{padding:10px 12px;border-bottom:1px solid #e5e7eb}
.op-sched-day-block:last-child{border-bottom:none}
.op-sched-day-today{background:#eff6ff;border-left:3px solid #2563eb}
.op-sched-day-label{font-size:12px;margin-bottom:8px;display:flex;align-items:center;gap:6px}
.op-sched-block{border-radius:8px;padding:8px 10px;margin-bottom:6px;line-height:1.4}
.op-sched-block:last-child{margin-bottom:0}
.op-sched-order{background:#dbeafe;border:1px solid #bfdbfe}
.op-sched-startup{background:#fef3c7;border:1px solid #fde68a;color:#92400e}
.op-sched-wo{font-size:11px;font-weight:800;color:#1e40af;letter-spacing:.3px;text-transform:uppercase}
.op-sched-customer{font-size:14px;font-weight:700;color:#1e3a5f;margin:2px 0}
.op-sched-detail{font-size:12px;color:#1e40af;margin-top:2px}
.op-sched-pill{font-size:11px;font-weight:600;background:#e0e7ff;color:#3730a3;border-radius:4px;padding:1px 6px}
.op-sched-empty-day{font-size:12px;color:#9ca3af;padding:4px 0}
.op-today-badge{background:#2563eb;color:#fff;font-size:12px;padding:2px 8px;border-radius:4px;font-weight:700}
@media(max-width:768px){
  .op-sched-lines{grid-template-columns:1fr}
}

/* ── Operator back bar ────────────────────────────────────────────────────── */
.op-back-bar{position:sticky;top:var(--op-bar-top, 52px);z-index:100;display:flex;align-items:center;gap:12px;background:#1e3a5f;padding:10px 16px;margin:0 -24px 16px;box-shadow:0 2px 8px rgba(0,0,0,.25)}
.op-back-btn{flex-shrink:0;padding:9px 16px;background:#fff;border:none;border-radius:8px;font-size:15px;font-weight:800;color:#1e3a5f;cursor:pointer;letter-spacing:.2px;transition:background .15s;white-space:nowrap;min-height:44px}
.op-back-btn:hover{background:#e2e8f0}
.op-back-btn:active{background:#cbd5e1}
.op-back-wo{color:#93c5fd;font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ── Missing classes used in app.js ──────────────────────────────────────── */
/* .release-row — inline release schedule rows in order form */
.release-row{display:flex;gap:8px;align-items:flex-end;margin-bottom:8px;flex-wrap:wrap}
/* .calc-tab — calculator mode tabs (uses .btn .btn-secondary .btn-sm + active) */
.calc-tab.active{background:#1a56db;color:#fff;border-color:#1a56db}
/* .prod-content — production tab content area */
#prod-content{min-height:100px}

/* ── Touch targets: ensure 44px min-height on interactive elements ───────── */
/* Mobile only — avoids impacting tight desktop schedule/table buttons */
@media(max-width:768px){
  .nav-link{min-height:44px;display:flex;align-items:center}
  .filter-btn{min-height:44px}
  .op-order-btn{min-height:44px}
  .op-tab{min-height:44px}
}
/* op-add-btn and op-close-btn are large action buttons — 44px everywhere */
.op-add-btn{min-height:48px}
.op-close-btn{min-height:48px}

/* ── Operator form selects — 16px prevents iOS zoom; 44px touch target ────── */
.op-form-select{padding:10px;border:1px solid #d1d5db;border-radius:6px;background:#fff;min-height:44px;font-size:16px;width:100%}
.op-form-select:focus{outline:none;border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.15)}

/* ── Input font size: 16px on mobile to prevent iOS Safari auto-zoom ─────── */
@media(max-width:768px){
  input,select,textarea,
  .form-group input,.form-group select,.form-group textarea,
  .filter-search,.settings-list-add input,
  .op-weight-input,.op-form-select{font-size:16px!important}
}
/* iPad: wider than 768px so the rule above misses it, but Safari still auto-zooms on a
   <16px input — and zooming WHILE the native date/time wheel popover opens leaves the
   wheel's touch targets misaligned, so it pops up but won't scroll (owner report
   2026-07-23, Time Entry). Key on touch-primary instead of width, scoped to the
   picker-popping types so desktop table density is untouched. */
@media(pointer:coarse){
  input[type=date],input[type=time],input[type=datetime-local]{font-size:16px!important;min-height:34px}
}

/* ── Loading / spinner state ─────────────────────────────────────────────── */
.loading{display:flex;align-items:center;justify-content:center;padding:40px;color:#9ca3af;font-size:15px;gap:12px}
.loading::before{content:'';display:inline-block;width:20px;height:20px;border:3px solid #e5e7eb;border-top-color:#1a56db;border-radius:50%;animation:spin .6s linear infinite;flex-shrink:0}
@keyframes spin{to{transform:rotate(360deg)}}
.spinner{display:inline-block;width:16px;height:16px;border:2px solid #e5e7eb;border-top-color:#1a56db;border-radius:50%;animation:spin .6s linear infinite;vertical-align:middle}

/* ── Mobile admin view improvements ─────────────────────────────────────── */
@media(max-width:768px){
  /* All buttons get 44px tap target; undo for small table-action buttons */
  .btn{min-height:44px;font-size:14px;padding:10px 18px}
  .table-actions .btn,.btn-icon{min-height:34px;padding:6px 10px;font-size:12px}

  /* Page headers: stack title on top, action buttons full-width below */
  .page-header{flex-direction:column;align-items:stretch;gap:10px}
  .page-header>.btn{justify-content:center}
  .page-header>div:not(.page-title){display:flex;gap:8px;flex-wrap:wrap}
  .page-header>div:not(.page-title)>.btn{flex:1;min-width:0;justify-content:center}

  /* Any table inside a card that isn't already mobile-cards: scroll, don't overflow page */
  .card table:not(.mobile-cards){display:block;overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}

  /* Hide the 8-week capacity table on mobile — too wide, not useful on a phone */
  .lineup-capacity-card{display:none!important}

  /* Filter buttons: larger tap target */
  .filter-btn{min-height:40px;padding:8px 14px;font-size:13px}

  /* Settings list inputs: fill available space instead of fixed pixel widths */
  .settings-list-item input{flex:1;min-width:0;width:auto!important}

  /* Lineup: hide less-critical columns so mobile cards stay concise */
  table.mobile-cards td[data-label="PO#"],
  table.mobile-cards td[data-label="Color/Finish"],
  table.mobile-cards td[data-label="Ordered"],
  table.mobile-cards td[data-label="Progress"]{display:none}
}

/* ── Print styles: packing list / shipping view ──────────────────────────── */
@media print{
  #navbar,#nav-hamburger,.op-back-bar,
  .btn,.table-actions,.lineup-filters,
  .page-header button,.form-actions,
  #modal-overlay{display:none!important}
  body{background:#fff;font-size:11pt}
  .card{box-shadow:none;border:1px solid #ccc;page-break-inside:avoid}
  .table-wrap{overflow:visible}
  table{width:100%}
  th,td{padding:6px 8px;font-size:10pt}
  .badge{border:1px solid currentColor}
  /* Packing list / shipping pallets: keep rows together */
  .op-pallet-row,.op-roll-row{page-break-inside:avoid;border:1px solid #ccc;margin-bottom:4px;padding:6px 8px;border-radius:0}
  .op-pallets-list,.op-rolls-list{display:block}
  /* Stats row: print compact */
  .stats-row{display:flex;flex-wrap:wrap;gap:8px}
  .stat-card{flex:0 0 140px;box-shadow:none;border:1px solid #ccc;padding:8px 10px}
  .stat-value{font-size:18pt}
}

/* ── Shipping Calendar ───────────────────────────────────────────────────── */

/* View tabs (List | Calendar) */
.ship-view-tabs{display:flex;gap:0;border-bottom:2px solid #e5e7eb;margin-bottom:20px}
.ship-view-tab{padding:10px 20px;cursor:pointer;font-size:14px;font-weight:500;color:#6b7280;border-bottom:2px solid transparent;margin-bottom:-2px;transition:color .15s,border-color .15s}
.ship-view-tab.active{color:#1a56db;border-bottom-color:#1a56db}

/* Outer container */
.ship-cal-wrap{display:flex;flex-direction:column;width:100%}

/* Toolbar */
.ship-cal-toolbar{display:flex;align-items:center;gap:12px;margin-bottom:16px;flex-wrap:wrap}

/* Week / Month toggle buttons */
.ship-cal-view-btn{display:inline-flex;align-items:center;padding:5px 12px;border-radius:6px;font-size:12px;font-weight:600;border:1px solid #d1d5db;background:#f0f2f5;color:#374151;transition:all .15s;cursor:pointer}
.ship-cal-view-btn:hover{background:#e5e7eb}
.ship-cal-view-btn.active{background:#1a2744;color:#fff;border-color:#1a2744}

/* Layout: calendar + sidebar */
.ship-cal-layout{display:flex;flex-direction:row;gap:16px;align-items:flex-start}

/* Calendar grid */
.ship-cal-grid{flex:1;min-width:0;display:grid;grid-template-columns:repeat(7,1fr)}

/* Day header (Mon Jun 9) */
.ship-cal-day-header{background:#f0f2f5;padding:8px;font-size:12px;font-weight:600;text-align:center;border:1px solid #e5e7eb}

/* Day column (week view) */
.ship-cal-day-col{border:1px solid #e5e7eb;border-top:none;min-height:120px;padding:8px;background:#fff;vertical-align:top}
.ship-cal-day-col.today{border-left:3px solid #2563eb;background:#eff6ff}

/* Order card */
.ship-cal-order-card{background:#fff;border:1px solid #e5e7eb;border-left:3px solid #6b7280;border-radius:6px;padding:8px 10px;margin-bottom:6px;cursor:pointer;transition:box-shadow .15s}
.ship-cal-order-card:hover{box-shadow:0 2px 8px rgba(0,0,0,.12)}
.ship-cal-order-card.status-planned{border-left-color:#2563eb}
.ship-cal-order-card.status-shipped{border-left-color:#059669}
.ship-cal-order-card.status-overdue{border-left-color:#dc2626}

/* Card inner lines */
.ship-cal-card-wo{font-size:12px;font-weight:700;color:#1a2744;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ship-cal-card-detail{font-size:11px;color:#6b7280;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Card status badge */
.ship-cal-card-status{font-size:10px;padding:1px 6px;border-radius:10px;font-weight:600;display:inline-block}

/* Empty day placeholder */
.ship-cal-empty-day{color:#d1d5db;font-size:12px;text-align:center;padding:16px 0}

/* Unscheduled sidebar */
.ship-unscheduled{background:#f8f9fb;border:1px solid #e5e7eb;border-radius:10px;padding:16px;min-width:200px;max-width:280px;flex-shrink:0}
.ship-unsched-title{font-size:13px;font-weight:700;color:#1a2744;margin-bottom:10px}
.ship-unsched-item{padding:10px;border:1px solid #e5e7eb;border-radius:6px;margin-bottom:8px;background:#fff;cursor:pointer;transition:border-color .15s}
.ship-unsched-item:hover{border-color:#2563eb}
.ship-unsched-wo{font-size:12px;font-weight:700}
.ship-unsched-detail{font-size:11px;color:#6b7280}

/* Doc generation buttons */
.ship-doc-btns{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}

/* Month view grid */
.ship-cal-month-grid{display:grid;grid-template-columns:repeat(7,1fr)}
.ship-cal-month-day{min-height:80px;border:1px solid #e5e7eb;padding:4px 6px;background:#fff}
.ship-cal-month-day.today{background:#eff6ff}
.ship-cal-month-day-num{font-size:11px;font-weight:600;color:#6b7280;margin-bottom:4px}
.ship-cal-month-dot{width:8px;height:8px;border-radius:50%;display:inline-block;margin:1px}

/* Mobile responsive */
@media(max-width:768px){
  .ship-cal-layout{flex-direction:column}
  .ship-unscheduled{max-width:100%;width:100%}
  #ship-cal-sidebar{max-height:60vh;overflow-y:auto}
}

/* Print: shipping docs only */
@media print{
  body > *:not(.ship-packing-list):not(.ship-loading-doc){display:none!important}
  .ship-packing-list,.ship-loading-doc{display:block!important}
}

/* ── Schedule mobile list view ──────────────────────────────────────────── */
.sched-m-list{display:flex;flex-direction:column;gap:10px}
.sched-m-day{background:#fff;border:1px solid #e5e7eb;border-radius:10px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.06)}
.sched-m-today{border-left:3px solid #1a56db}
.sched-m-closed{opacity:.6}
.sched-m-day-hdr{display:flex;align-items:center;gap:8px;padding:10px 14px;background:#f8f9fb;border-bottom:1px solid #e5e7eb;font-weight:700;font-size:14px;color:#1e3a5f;flex-wrap:wrap}
.sched-m-today-badge{background:#1a56db;color:#fff;font-size:10px;font-weight:700;border-radius:3px;padding:2px 6px;flex-shrink:0}
.sched-m-line-block{padding:8px 12px 6px;border-bottom:1px solid #f0f2f5}
.sched-m-line-block:last-child{border-bottom:none}
.sched-m-line-label{font-size:10px;font-weight:700;color:#9ca3af;text-transform:uppercase;letter-spacing:.5px;margin-bottom:5px}
.sched-m-card{background:#f8f9fb;border-radius:6px;padding:8px 10px;margin-bottom:4px;border:1px solid #e5e7eb}
.sched-m-card:last-child{margin-bottom:0}
.sched-m-startup-card{background:#fefce8;border-color:#fde68a;color:#92400e;font-size:12px;font-weight:600;padding:8px 10px}
.sched-m-customer{font-weight:700;font-size:14px;color:#1e3a5f}
.sched-m-spec{font-size:12px;color:#6b7a99;margin-top:1px}
.sched-m-meta{font-size:12px;color:#374151;margin-top:3px}
.sched-m-day-total{padding:6px 14px;font-size:12px;font-weight:600;color:#1e40af;text-align:right;background:#eff6ff;border-top:1px solid #dbeafe}
.sched-m-empty{padding:8px 14px;font-size:12px;color:#9ca3af;font-style:italic}

/* ── AI panel: full-screen on touch devices (iPhone, iPad, iPad+keyboard) to
   eliminate position:fixed + virtual keyboard viewport lag ──────────────── */
@media(any-pointer:coarse){
  #ai-panel{
    inset:0!important;
    width:100%!important;
    height:100%!important;
    bottom:0!important;
    right:0!important;
    border-radius:0!important;
    box-shadow:none!important;
    transform:none!important;
  }
  #ai-panel > div:last-child{
    padding-bottom:env(safe-area-inset-bottom,12px);
  }
}
