/* VOEPL Tool Room — shared styles */
:root {
  --brand-navy: #1a365d;
  --brand-navy-dark: #13284a;
  --brand-accent: #e3a008;
  --brand-accent-dark: #b97c00;
  --ok: #2f855a;
  --warn: #c05621;
  --bad: #c53030;
  --ink: #1a202c;
  --ink-soft: #4a5568;
  --mute: #718096;
  --line: #e2e8f0;
  --line-strong: #cbd5e0;
  --bg: #f7fafc;
  --card: #ffffff;
  --row-alt: #f8fafc;
  --shadow: 0 1px 2px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--brand-navy); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top nav ---------- */
.vp-nav {
  background: var(--brand-navy);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}
.vp-nav .brand {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
}
.vp-nav .brand small {
  font-weight: 400;
  opacity: 0.75;
  font-size: 12px;
  margin-left: 6px;
}
.vp-nav .nav-links {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
}
.vp-nav a {
  color: #dbeafe;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12.5px;
  white-space: nowrap;
  text-decoration: none;
}
.vp-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.vp-nav a.active { background: var(--brand-accent); color: #1a202c; font-weight: 600; }
.vp-nav .nav-tools {
  display: flex;
  gap: 6px;
  align-items: center;
}
.vp-nav .nav-tools button {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}
.vp-nav .nav-tools button:hover { background: rgba(255,255,255,0.2); }

/* ---------- Page layout ---------- */
.vp-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
}
.vp-page h1 {
  margin: 4px 0 4px 0;
  font-size: 22px;
  color: var(--brand-navy);
}
.vp-page .subtitle {
  color: var(--mute);
  margin: 0 0 16px 0;
  font-size: 13px;
}

.vp-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.vp-card h2 {
  margin: 0 0 12px 0;
  font-size: 15px;
  color: var(--brand-navy);
  border-bottom: 2px solid var(--brand-accent);
  padding-bottom: 6px;
  display: inline-block;
}
.vp-card h3 {
  font-size: 13px;
  color: var(--brand-navy);
  margin: 12px 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Form fields ---------- */
.vp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.vp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vp-field label {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
}
.vp-field input,
.vp-field select,
.vp-field textarea {
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}
.vp-field input:focus,
.vp-field select:focus,
.vp-field textarea:focus {
  outline: none;
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 2px rgba(26,54,93,0.15);
}
.vp-field input[readonly],
.vp-field input:disabled {
  background: #f1f5f9;
  color: var(--ink-soft);
}

/* ---------- Buttons ---------- */
.vp-btn {
  background: var(--brand-navy);
  color: #fff;
  border: 1px solid var(--brand-navy);
  padding: 7px 14px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s;
}
.vp-btn:hover { background: var(--brand-navy-dark); }
.vp-btn.secondary {
  background: #fff;
  color: var(--brand-navy);
}
.vp-btn.secondary:hover { background: #edf2f7; }
.vp-btn.accent {
  background: var(--brand-accent);
  color: #1a202c;
  border-color: var(--brand-accent);
}
.vp-btn.accent:hover { background: var(--brand-accent-dark); color: #fff; }
.vp-btn.danger {
  background: #fff;
  color: var(--bad);
  border-color: var(--bad);
}
.vp-btn.danger:hover { background: var(--bad); color: #fff; }
.vp-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.vp-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* ---------- Tables ---------- */
.vp-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.vp-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.vp-table th {
  background: var(--brand-navy);
  color: #fff;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.1);
}
.vp-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.vp-table tr:nth-child(even) td { background: var(--row-alt); }
.vp-table tr:hover td { background: #fffbf0; }
.vp-table td.num,
.vp-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.vp-table td input,
.vp-table td select {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 12.5px;
  font-family: inherit;
  background: #fff;
}
.vp-table td input:focus,
.vp-table td select:focus {
  outline: none;
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 2px rgba(26,54,93,0.15);
}
.vp-table td.total-row,
.vp-table tr.total-row td {
  background: #fef3c7 !important;
  font-weight: 700;
}

/* ---------- KPI cards ---------- */
.vp-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.vp-kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-accent);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.vp-kpi .label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--mute);
  letter-spacing: 0.5px;
  font-weight: 600;
}
.vp-kpi .value {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-navy);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.vp-kpi .hint {
  font-size: 11px;
  color: var(--mute);
  margin-top: 2px;
}
.vp-kpi.ok { border-left-color: var(--ok); }
.vp-kpi.warn { border-left-color: var(--warn); }
.vp-kpi.bad { border-left-color: var(--bad); }

/* ---------- Tile grid (landing) ---------- */
.vp-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.vp-tile {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  display: block;
}
.vp-tile:hover {
  transform: translateY(-2px);
  border-color: var(--brand-accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  text-decoration: none;
}
.vp-tile .icon {
  font-size: 26px;
  margin-bottom: 6px;
}
.vp-tile .title {
  font-weight: 700;
  font-size: 15px;
  color: var(--brand-navy);
}
.vp-tile .desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 4px;
  line-height: 1.4;
}

/* ---------- Status pills ---------- */
.vp-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.vp-pill.ok { background: #c6f6d5; color: #22543d; }
.vp-pill.warn { background: #feebc8; color: #7b341e; }
.vp-pill.bad { background: #fed7d7; color: #742a2a; }
.vp-pill.info { background: #bee3f8; color: #2a4365; }
.vp-pill.mute { background: #e2e8f0; color: #4a5568; }

.vp-badge {
  display: inline-block;
  background: var(--brand-accent);
  color: #1a202c;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

/* ---------- Toast ---------- */
.vp-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--brand-navy);
  color: #fff;
  padding: 10px 18px;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  z-index: 1000;
  font-size: 13px;
  animation: slideIn 0.2s ease-out;
}
.vp-toast.ok { background: var(--ok); }
.vp-toast.bad { background: var(--bad); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---------- Utility ---------- */
.vp-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.vp-row.right { justify-content: flex-end; }
.vp-right { text-align: right; }
.vp-center { text-align: center; }
.vp-mute { color: var(--mute); }
.vp-bold { font-weight: 700; }
.vp-small { font-size: 12px; }
.vp-divider { border-top: 1px solid var(--line); margin: 14px 0; }
.vp-hide { display: none !important; }
.vp-ok { color: var(--ok); }
.vp-warn { color: var(--warn); }
.vp-bad { color: var(--bad); }

.vp-empty {
  padding: 30px;
  text-align: center;
  color: var(--mute);
  font-style: italic;
  background: var(--row-alt);
  border-radius: var(--radius);
}

/* ---------- Filter bar ---------- */
.vp-filter {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  padding: 12px;
  background: #edf2f7;
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.vp-filter .vp-field { min-width: 140px; }

/* ---------- Print ---------- */
@media print {
  .vp-nav, .vp-btn-row, .vp-btn, .no-print { display: none !important; }
  body { background: #fff; }
  .vp-card { box-shadow: none; border: 1px solid #000; page-break-inside: avoid; }
  .vp-page { max-width: none; padding: 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .vp-nav { padding: 8px 10px; }
  .vp-nav .brand { font-size: 14px; }
  .vp-nav a { font-size: 11.5px; padding: 5px 7px; }
  .vp-page { padding: 10px; }
  .vp-grid { grid-template-columns: 1fr; }
}

/* ==========================================================
   AUTH — login page, user chip, role badges, nav drawer
   ========================================================== */

/* User chip shown in top nav */
.vp-nav .user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 20px;
  padding: 4px 6px 4px 10px;
  font-size: 12px;
  color: #fff;
  white-space: nowrap;
}
.vp-nav .user-chip .who { font-weight: 600; }
.vp-nav .user-chip .role {
  background: var(--brand-accent);
  color: #1a202c;
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.vp-nav .user-chip button.logout {
  background: transparent;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  opacity: 0.8;
}
.vp-nav .user-chip button.logout:hover { opacity: 1; }

/* Hamburger (mobile only) */
.vp-nav .nav-toggle {
  display: none;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  padding: 5px 9px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
@media (max-width: 860px) {
  .vp-nav .nav-toggle { display: inline-block; order: 1; }
  .vp-nav .nav-links {
    order: 5;
    flex-basis: 100%;
    flex-direction: column;
    gap: 2px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .vp-nav.open .nav-links { max-height: 70vh; padding-top: 8px; }
  .vp-nav .nav-links a { padding: 10px 12px; font-size: 14px; }
}

/* Login page */
.vp-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: linear-gradient(135deg, #1a365d 0%, #13284a 60%, #0a1a33 100%);
}
.vp-login-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  padding: 28px;
  width: 100%;
  max-width: 380px;
}
.vp-login-brand {
  text-align: center;
  margin-bottom: 20px;
}
.vp-login-brand .logo {
  font-weight: 800;
  font-size: 28px;
  color: var(--brand-navy);
  letter-spacing: 2px;
}
.vp-login-brand .sub {
  color: var(--mute);
  font-size: 13px;
  margin-top: 2px;
}
.vp-login-card h1 {
  font-size: 16px;
  color: var(--brand-navy);
  text-align: center;
  margin: 12px 0 16px 0;
  font-weight: 600;
}
.vp-login-card .vp-field label { font-size: 13px; }
.vp-login-card input {
  padding: 11px 12px !important;
  font-size: 15px !important;
}
.vp-login-card .pin-input {
  text-align: center;
  letter-spacing: 10px;
  font-size: 22px !important;
  font-weight: 600;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.vp-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.vp-keypad button {
  padding: 14px 0;
  font-size: 20px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  color: var(--brand-navy);
}
.vp-keypad button:hover { background: #f1f5f9; }
.vp-keypad button:active { background: #e2e8f0; }
.vp-keypad button.wide { grid-column: span 1; }
.vp-keypad button.clear { color: var(--bad); }
.vp-login-error {
  background: #fed7d7;
  color: #742a2a;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
  margin-top: 10px;
  display: none;
}
.vp-login-error.show { display: block; }
.vp-login-submit {
  width: 100%;
  padding: 12px !important;
  font-size: 15px !important;
  margin-top: 12px !important;
}
.vp-login-hint {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--mute);
  line-height: 1.5;
}
.vp-login-hint code {
  background: #edf2f7;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}

/* ==========================================================
   SHOP-FLOOR (Operator Entry) — tablet-first, touch-friendly
   ========================================================== */
.shop-floor { max-width: 1100px; }
.shop-floor h1 { font-size: 24px; }

/* Active session banner */
.sf-session-card {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.sf-session-card.idle { border-color: var(--line-strong); background: #f8fafc; }
.sf-session-card.active {
  border-color: var(--ok);
  background: linear-gradient(180deg, #f0fff4 0%, #fff 100%);
}
.sf-session-card.active .status { color: var(--ok); }

.sf-session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.sf-session-header .status {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--mute);
}
.sf-session-header .elapsed {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 36px;
  font-weight: 700;
  color: var(--brand-navy);
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}
.sf-session-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  font-size: 14px;
}
.sf-session-meta .cell {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}
.sf-session-meta .cell .lbl {
  font-size: 11px;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.sf-session-meta .cell .val {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

/* Giant touch buttons */
.sf-actions {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
}
@media (max-width: 760px) {
  .sf-actions { grid-template-columns: 1fr 1fr; }
  .sf-actions .primary { grid-column: span 2; }
}
.sf-btn {
  padding: 22px 18px;
  font-size: 17px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.08s, box-shadow 0.12s;
  box-shadow: var(--shadow);
}
.sf-btn .glyph { font-size: 26px; line-height: 1; }
.sf-btn.primary.start { background: var(--ok); color: #fff; }
.sf-btn.primary.stop  { background: var(--bad); color: #fff; }
.sf-btn.primary:disabled { opacity: 0.35; cursor: not-allowed; }
.sf-btn.secondary { background: #fff; color: var(--brand-navy); border: 2px solid var(--brand-navy); }
.sf-btn.warn  { background: #fff; color: var(--warn); border: 2px solid var(--warn); }
.sf-btn:hover:not(:disabled) { transform: translateY(-1px); }
.sf-btn:active:not(:disabled) { transform: translateY(0); }

/* Card pickers (mold + machine) */
.sf-picker { margin-top: 16px; }
.sf-picker h3 {
  font-size: 13px;
  color: var(--brand-navy);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 8px 0;
}
.sf-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.sf-option {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.08s;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.sf-option:hover { border-color: var(--brand-accent); }
.sf-option.selected {
  border-color: var(--brand-navy);
  background: #ebf4ff;
  box-shadow: inset 0 0 0 1px var(--brand-navy);
}
.sf-option .title {
  font-weight: 700;
  color: var(--brand-navy);
  font-size: 14px;
  margin-bottom: 2px;
}
.sf-option .sub { font-size: 12px; color: var(--ink-soft); }
.sf-option:active { transform: scale(0.98); }

/* Operation chips (compact row) */
.sf-ops {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.sf-ops .sf-chip {
  padding: 10px 14px;
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.sf-ops .sf-chip.selected {
  border-color: var(--brand-navy);
  background: var(--brand-navy);
  color: #fff;
}

/* Today's summary strip */
.sf-today-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.sf-today-summary .stat {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-accent);
  border-radius: 6px;
  padding: 10px 14px;
}
.sf-today-summary .stat .lbl {
  font-size: 11px;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.sf-today-summary .stat .val {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-navy);
  font-variant-numeric: tabular-nums;
}
.sf-today-summary .stat.ok   { border-left-color: var(--ok); }
.sf-today-summary .stat.bad  { border-left-color: var(--bad); }
.sf-today-summary .stat.warn { border-left-color: var(--warn); }

/* Timeline list (replaces busy table on shop floor) */
.sf-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sf-timeline .item {
  display: grid;
  grid-template-columns: 90px 1fr 80px 40px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
}
.sf-timeline .item .time { font-family: ui-monospace, monospace; color: var(--ink-soft); font-size: 12px; }
.sf-timeline .item .what { font-weight: 600; color: var(--ink); }
.sf-timeline .item .hrs  { text-align: right; font-weight: 700; color: var(--brand-navy); font-variant-numeric: tabular-nums; }
.sf-timeline .item.work     { border-left: 4px solid var(--ok); }
.sf-timeline .item.break    { border-left: 4px solid var(--mute); }
.sf-timeline .item.downtime { border-left: 4px solid var(--bad); }

/* Role-denied toast helper */
.vp-nav.restricted a.locked {
  opacity: 0.45;
  pointer-events: none;
}

/* Slightly more air for tables on small screens */
@media (max-width: 720px) {
  .vp-table th, .vp-table td { padding: 10px 8px; font-size: 13px; }
  .sf-btn { font-size: 15px; padding: 18px 12px; min-height: 70px; }
  .sf-session-header .elapsed { font-size: 28px; }
}
