/* ══════════════════════════════════════════
   Divesea Repairs v3 — Embossed Gold/Dark Theme
   Restyle only: every selector from v2 kept,
   no markup / JS / data changes required.
   ══════════════════════════════════════════ */

:root {
  --gold: #cd9812;
  --gold-dark: #a87b0e;
  --gold-light: #e8b830;
  --bg-dark: #0f0f14;
  --bg-card: #1b1b22;
  --bg-input: #14141a;
  --text: #f0f0f5;
  --text-muted: #8f8f9d;
  --border: #2e2e38;
  --border-strong: #3a3a45;
  --danger: #c0392b;
  --success: #27ae60;
  --info: #2980b9;
  --warning: #f39c12;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow-emboss: 0 2px 0 #0a0a0d, 0 4px 8px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(1100px 500px at 50% -10%, rgba(205, 152, 18, 0.07), transparent 60%),
    linear-gradient(180deg, #15151c 0%, var(--bg-dark) 340px);
  background-color: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--gold-light); text-decoration: none; transition: color 0.15s; }
a:hover { color: #f5cc55; }

/* ─── Layout ─── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 20px 80px;
}
.container-wide { max-width: 1800px; padding: 20px 20px 80px; }

/* Repairs/PO data tables: short-content columns (job/PO#, customer,
   category, vendor, dates) shouldn't wrap just because a neighboring
   column (product name, notes) has long free text. */
#repairsTable td:first-child, #repairsTable th:first-child,
#repairsTable td:nth-child(2), #repairsTable th:nth-child(2),
#repairsTable td:nth-child(4), #repairsTable th:nth-child(4),
#repairsTable td:nth-child(6), #repairsTable th:nth-child(6),
#repairsTable td:nth-child(8), #repairsTable th:nth-child(8),
table.data-table td:first-child, table.data-table th:first-child {
  white-space: nowrap;
}
/* PO table has no long free-text column in list view (that's only on the
   detail page) — nowrap everywhere avoids re-tuning nth-child every time a
   column gets added. */
#poTable td, #poTable th {
  white-space: nowrap;
}

header.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background:
    radial-gradient(680px 160px at 12% -20%, rgba(205, 152, 18, 0.16), transparent 65%),
    linear-gradient(180deg, rgba(46, 46, 58, 0.95) 0%, rgba(15, 15, 20, 0.97) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(205, 152, 18, 0.35);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

/* Animated gold sheen sweeping along the header's bottom edge */
header.site-header::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold) 25%, var(--gold-light) 50%, var(--gold) 75%, transparent);
  background-size: 240% 100%;
  animation: header-sheen 7s linear infinite;
  pointer-events: none;
}
@keyframes header-sheen {
  0% { background-position: 240% 0; }
  100% { background-position: -240% 0; }
}

/* Ambient rising bubbles — subtle nod to the dive-shop brand */
.header-bubbles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.header-bubbles span {
  position: absolute;
  bottom: -14px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(232, 184, 48, 0.45), rgba(205, 152, 18, 0.05));
  animation: bubble-rise linear infinite;
}
.header-bubbles span:nth-child(1) { left: 55%; width: 5px;  height: 5px;  animation-duration: 6.5s; animation-delay: 0s; }
.header-bubbles span:nth-child(2) { left: 68%; width: 8px;  height: 8px;  animation-duration: 8s;   animation-delay: 1.6s; }
.header-bubbles span:nth-child(3) { left: 80%; width: 4px;  height: 4px;  animation-duration: 5.5s; animation-delay: 3s; }
.header-bubbles span:nth-child(4) { left: 90%; width: 7px;  height: 7px;  animation-duration: 7.2s; animation-delay: 0.8s; }
.header-bubbles span:nth-child(5) { left: 97%; width: 5px;  height: 5px;  animation-duration: 6s;   animation-delay: 2.4s; }
@keyframes bubble-rise {
  0%   { transform: translateY(0) scale(1);     opacity: 0; }
  12%  { opacity: 0.7; }
  85%  { opacity: 0.15; }
  100% { transform: translateY(-52px) scale(0.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  header.site-header::after, .header-bubbles span { animation: none; }
}

.header-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-logo {
  height: 40px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.55));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
}
.header-logo:hover {
  transform: scale(1.06) rotate(-1.5deg);
  filter: drop-shadow(0 3px 12px rgba(205, 152, 18, 0.55));
}
.header-tagline {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  padding-left: 16px;
  border-left: 1px solid var(--border-strong);
}

header nav {
  position: relative;
  z-index: 1;
}
header nav a {
  margin-left: 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.15s;
  display: inline-block;
}
header nav a:hover {
  color: var(--gold-light);
  border-color: var(--border-strong);
  background: rgba(205, 152, 18, 0.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* ─── Cards ─── */
.card {
  background: linear-gradient(180deg, #20202a 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 28px;
  margin-bottom: 24px;
}
.card h2 {
  color: var(--gold-light);
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.card h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 56px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

/* ─── Forms ─── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25) inset;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: #5c5c68; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25) inset, 0 0 0 3px rgba(205, 152, 18, 0.18);
}
.form-group select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23cd9812' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.form-group textarea { min-height: 96px; resize: vertical; }
.form-group input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  accent-color: var(--gold);
  box-shadow: none;
}
.form-group input[type="file"] {
  padding: 10px;
  box-shadow: none;
  background: transparent;
  border-style: dashed;
}
.form-group input[type="file"]::file-selector-button {
  background: linear-gradient(180deg, #2a2a35 0%, #15151a 100%);
  border: 1px solid var(--border-strong);
  border-bottom: 2px solid var(--gold);
  border-radius: 6px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 8px 14px;
  margin-right: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.form-group input[type="file"]::file-selector-button:hover {
  color: var(--gold-light);
  border-bottom-color: var(--gold-light);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ─── Buttons — embossed Divesea style ─── */
.btn {
  display: inline-block;
  padding: 11px 22px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.15s;
}
.btn-primary {
  background: linear-gradient(180deg, #2a2a35 0%, #15151a 100%);
  border-bottom: 2px solid var(--gold);
  color: var(--text);
  box-shadow: var(--shadow-emboss);
}
.btn-primary:hover {
  border-bottom-color: var(--gold-light);
  box-shadow: 0 1px 0 #0a0a0d, 0 2px 4px rgba(0, 0, 0, 0.3);
  transform: translateY(1px);
  color: var(--gold-light);
}
.btn-success {
  background: linear-gradient(180deg, #2e9e5b 0%, #1e7a42 100%);
  border-bottom: 2px solid #1a6338;
  color: #fff;
  box-shadow: var(--shadow-emboss);
}
.btn-success:hover { filter: brightness(1.1); transform: translateY(1px); box-shadow: 0 1px 0 #0a0a0d, 0 2px 4px rgba(0, 0, 0, 0.3); }
.btn-danger {
  background: linear-gradient(180deg, #d04437 0%, #a02e23 100%);
  border-bottom: 2px solid #7e241b;
  color: #fff;
  box-shadow: var(--shadow-emboss);
}
.btn-danger:hover { filter: brightness(1.1); transform: translateY(1px); box-shadow: 0 1px 0 #0a0a0d, 0 2px 4px rgba(0, 0, 0, 0.3); }
.btn-secondary {
  background: linear-gradient(180deg, #23232c 0%, #17171d 100%);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  box-shadow: 0 1px 0 #0a0a0d, 0 2px 4px rgba(0, 0, 0, 0.2);
}
.btn-secondary:hover {
  border-color: var(--gold);
  color: var(--gold-light);
  transform: translateY(1px);
  box-shadow: none;
}
.btn:disabled {
  background: linear-gradient(180deg, #1a1a20 0%, #111118 100%);
  border-color: #222;
  border-bottom-color: #444;
  color: #555;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-block { width: 100%; }

/* ─── Status Badges — ghost pills, same hue map ─── */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border: 1px solid transparent;
}
.badge-submitted  { background: rgba(243, 156, 18, 0.16); color: #f5b041; border-color: rgba(243, 156, 18, 0.6); }
.badge-received   { background: rgba(52, 73, 94, 0.25);   color: #aebfd0; border-color: rgba(52, 73, 94, 0.7); }
.badge-diagnosing { background: rgba(41, 128, 185, 0.18); color: #6fb6e8; border-color: rgba(41, 128, 185, 0.6); }
.badge-repairing  { background: rgba(142, 68, 173, 0.18); color: #c39ae0; border-color: rgba(142, 68, 173, 0.6); }
.badge-sent-vendor{ background: rgba(230, 126, 34, 0.16); color: #f0a55f; border-color: rgba(230, 126, 34, 0.6); }
.badge-at-vendor  { background: rgba(211, 84, 0, 0.18);   color: #ef9354; border-color: rgba(211, 84, 0, 0.6); }
.badge-returned   { background: rgba(22, 160, 133, 0.16); color: #58cdb6; border-color: rgba(22, 160, 133, 0.6); }
.badge-ready      { background: rgba(39, 174, 96, 0.18);  color: #63d68f; border-color: rgba(39, 174, 96, 0.65); }
.badge-collected  { background: rgba(127, 140, 141, 0.18); color: #aab4b5; border-color: rgba(127, 140, 141, 0.6); }

/* ─── Tables ─── */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.data-table th {
  background: rgba(205, 152, 18, 0.05);
  color: var(--gold);
  font-weight: 600;
  text-align: left;
  padding: 12px;
  border-bottom: 2px solid var(--gold);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
}
table.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data-table tr { transition: background 0.12s; }
table.data-table tr:hover { background: rgba(205, 152, 18, 0.05); }
table.data-table tr.overdue { background: rgba(192, 57, 43, 0.12); }
table.data-table tr.overdue:hover { background: rgba(192, 57, 43, 0.2); }

/* ─── Tabs ─── */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.tab {
  padding: 10px 18px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  margin-bottom: -2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.15s;
}
.tab:hover { color: var(--gold-light); background: rgba(205, 152, 18, 0.05); }
.tab.active {
  color: var(--gold-light);
  border-bottom-color: var(--gold);
  background: linear-gradient(180deg, rgba(205, 152, 18, 0.08), transparent);
}
.tab .count {
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  margin-left: 6px;
}
.tab.active .count { background: rgba(205, 152, 18, 0.2); color: var(--gold-light); }

/* ─── Search Bar ─── */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-bar input,
.search-bar select {
  flex: 1;
  min-width: 180px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25) inset;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-bar input:focus,
.search-bar select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25) inset, 0 0 0 3px rgba(205, 152, 18, 0.18);
}

/* ─── Description Lists (detail view) ─── */
dl.detail-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 18px;
  font-size: 0.92rem;
}
dl.detail-list dt {
  color: var(--text-muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  padding-top: 2px;
}
dl.detail-list dd { color: var(--text); word-break: break-word; }

/* ─── Progress Bars ─── */
.progress-track {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 18px 0;
  padding: 16px 12px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) inset;
}
.progress-step {
  flex: 1;
  text-align: center;
  position: relative;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  padding: 8px 4px 4px;
  border-top: 3px solid var(--border-strong);
  transition: all 0.2s;
}
.progress-step::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--border-strong);
  border: 2px solid var(--bg-input);
  transition: all 0.2s;
}
.progress-step.active {
  color: var(--gold-light);
  border-top-color: var(--gold);
}
.progress-step.active::before {
  background: var(--gold);
  box-shadow: 0 0 10px rgba(205, 152, 18, 0.6);
}
.progress-step.done {
  color: #63d68f;
  border-top-color: var(--success);
}
.progress-step.done::before { background: var(--success); }

/* ─── History Log ─── */
.history-log { list-style: none; padding: 0; }
.history-log li {
  padding: 10px 14px;
  border-left: 3px solid var(--border-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 8px;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 0.15s;
}
.history-log li:hover { border-left-color: var(--gold); }
.history-log li .time { color: var(--text-muted); font-size: 0.76rem; }
.history-log li .field { color: var(--gold-light); font-weight: 600; }

/* ─── Alerts / Messages ─── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.92rem;
  border: 1px solid;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.alert-success { background: rgba(39, 174, 96, 0.12); border-color: rgba(39, 174, 96, 0.55); color: #6fdd9a; }
.alert-error { background: rgba(192, 57, 43, 0.12); border-color: rgba(192, 57, 43, 0.55); color: #f08a7d; }
.alert-info { background: rgba(41, 128, 185, 0.12); border-color: rgba(41, 128, 185, 0.55); color: #74bce8; }

/* ─── Section Headers on Detail Page ─── */
.section-header {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--gold);
  margin: 26px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.section-header::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 40px;
  height: 2px;
  background: var(--gold);
}

/* ─── Danger Zone ─── */
.danger-zone {
  position: fixed;
  bottom: 16px;
  right: 16px;
  border: 1px dashed rgba(192, 57, 43, 0.4);
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(15, 15, 20, 0.85);
  backdrop-filter: blur(6px);
  text-align: right;
  z-index: 100;
  opacity: 0.55;
  transition: opacity 0.2s;
}
.danger-zone:hover { opacity: 1; }
.danger-zone h3 { display: none; }
.danger-zone p { display: none; }
.danger-zone .btn-danger {
  font-size: 0.72rem;
  padding: 6px 12px;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  box-shadow: none;
}
.danger-zone .btn-danger:hover { background: var(--danger); color: #fff; transform: none; }

/* ─── Login Page ─── */
body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-bubbles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.login-bubbles span {
  position: absolute;
  bottom: -24px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(232, 184, 48, 0.4), rgba(205, 152, 18, 0.03));
  animation: bubble-rise-full linear infinite;
}
.login-bubbles span:nth-child(1) { left: 8%;  width: 10px; height: 10px; animation-duration: 12s; animation-delay: 0s; }
.login-bubbles span:nth-child(2) { left: 22%; width: 6px;  height: 6px;  animation-duration: 9s;  animation-delay: 2s; }
.login-bubbles span:nth-child(3) { left: 40%; width: 14px; height: 14px; animation-duration: 15s; animation-delay: 4s; }
.login-bubbles span:nth-child(4) { left: 60%; width: 8px;  height: 8px;  animation-duration: 10s; animation-delay: 1s; }
.login-bubbles span:nth-child(5) { left: 78%; width: 12px; height: 12px; animation-duration: 13s; animation-delay: 5s; }
.login-bubbles span:nth-child(6) { left: 90%; width: 7px;  height: 7px;  animation-duration: 8s;  animation-delay: 3s; }
@keyframes bubble-rise-full {
  0%   { transform: translateY(0) scale(1); opacity: 0; }
  10%  { opacity: 0.65; }
  90%  { opacity: 0.1; }
  100% { transform: translateY(-100vh) scale(0.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .login-bubbles span { animation: none; display: none; }
}

.login-container {
  position: relative;
  z-index: 1;
  max-width: 380px;
  width: 100%;
  padding: 40px 36px 36px;
  background: linear-gradient(180deg, #20202a 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), 0 0 90px rgba(205, 152, 18, 0.09);
  text-align: center;
}
.login-logo {
  display: block;
  width: 180px;
  max-width: 75%;
  height: auto;
  margin: 0 auto 20px;
  filter: drop-shadow(0 4px 18px rgba(205, 152, 18, 0.35));
}
.login-container h1 {
  font-size: 1.28rem;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.4px;
}
.login-subtitle {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  margin-bottom: 28px;
}
.login-container .form-group { text-align: left; }
.login-container .input-wrap { position: relative; }
.login-container .input-wrap .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.15s;
}
.login-container .input-wrap input { padding-left: 42px; padding-right: 42px; }
.login-container .input-wrap:focus-within .input-icon { color: var(--gold); }
.login-container .password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  line-height: 0;
  border-radius: 4px;
  transition: color 0.15s;
}
.login-container .password-toggle:hover { color: var(--gold-light); }
.login-container .password-toggle svg { width: 16px; height: 16px; display: block; }
.login-container #loginError .alert { animation: login-shake 0.4s; }
@keyframes login-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* ─── Tracking Page ─── */
.track-result {
  max-width: 600px;
  margin: 30px auto;
}
.track-result .status-hero {
  text-align: center;
  padding: 34px 30px;
  background: linear-gradient(180deg, #20202a 0%, var(--bg-card) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--gold);
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}
.track-result .status-hero .job-num {
  font-size: 1.6rem;
  color: var(--gold-light);
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 1px 0 #0a0a0d;
}
.track-result .status-hero .product-name {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 8px 0;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .container { padding: 12px 12px 60px; }
  .card { padding: 20px; }
  table.data-table { font-size: 0.8rem; }
  table.data-table th, table.data-table td { padding: 8px 6px; }
  dl.detail-list { grid-template-columns: 120px 1fr; }
  header.site-header { flex-direction: column; gap: 10px; text-align: center; position: static; }
  header nav a { margin: 0 8px; }
}

/* ─── Purchase Orders — same badge/card language, new status hues ─── */
.badge-po-open      { background: rgba(41, 128, 185, 0.18); color: #6fb6e8; border-color: rgba(41, 128, 185, 0.6); }
.badge-po-partial   { background: rgba(243, 156, 18, 0.16); color: #f5b041; border-color: rgba(243, 156, 18, 0.6); }
.badge-po-received  { background: rgba(39, 174, 96, 0.18);  color: #63d68f; border-color: rgba(39, 174, 96, 0.65); }
.badge-po-cancelled { background: rgba(127, 140, 141, 0.18); color: #aab4b5; border-color: rgba(127, 140, 141, 0.6); }
.badge-pay-unpaid   { background: rgba(192, 57, 43, 0.14);  color: #f08a7d; border-color: rgba(192, 57, 43, 0.55); }
.badge-pay-partial  { background: rgba(243, 156, 18, 0.16); color: #f5b041; border-color: rgba(243, 156, 18, 0.6); }
.badge-pay-paid     { background: rgba(39, 174, 96, 0.18);  color: #63d68f; border-color: rgba(39, 174, 96, 0.65); }

/* ─── Stat Tiles — KPI row for backorder / reorder summaries ─── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-tile {
  background: linear-gradient(180deg, #20202a 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
}
.stat-tile .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1.1;
  text-shadow: 0 1px 0 #0a0a0d;
}
.stat-tile .stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 6px;
}
.stat-tile.stat-warn .stat-value { color: #f5b041; }
.stat-tile.stat-danger .stat-value { color: #f08a7d; }

/* ─── Line-item editor (New PO builder) ─── */
table.line-item-editor { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
table.line-item-editor th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 6px 8px;
}
table.line-item-editor td { padding: 4px 8px; }
table.line-item-editor input,
table.data-table input {
  width: 100%;
  padding: 11px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}
table.line-item-editor input:focus,
table.data-table input:focus { outline: none; border-color: var(--gold); }

/* ─── SKU/product search type-ahead ─── */
.sku-search-wrap { position: relative; }
.sku-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 340px;
  max-height: 320px;
  overflow-y: auto;
  background: linear-gradient(180deg, #23232d 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  z-index: 50;
}
.sku-suggest-item {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 0.84rem;
}
.sku-suggest-item:last-child { border-bottom: none; }
.sku-suggest-item:hover, .sku-suggest-item.active {
  background: rgba(205, 152, 18, 0.1);
}
.sku-suggest-item .ss-sku { color: var(--gold-light); font-weight: 600; font-size: 0.76rem; letter-spacing: 0.4px; }
.sku-suggest-item .ss-name { color: var(--text); margin-top: 2px; }
.sku-suggest-item .ss-price { color: var(--text-muted); font-size: 0.76rem; float: right; }
.sku-suggest-empty { padding: 12px; color: var(--text-muted); font-size: 0.82rem; text-align: center; }

/* ─── Receiving progress bar (per line item) ─── */
.receive-bar { height: 6px; border-radius: 3px; background: var(--bg-input); overflow: hidden; margin-top: 4px; }
.receive-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); transition: width 0.2s; }

/* ─── Staff Calendar ─── */
:root {
  --cal-task: var(--info);
  --cal-order: var(--warning);
  --cal-holiday: var(--danger);
  --cal-leave: #9b59b6;
  --cal-event: #e91e8c;
}
.cal-type-task    { background: rgba(41, 128, 185, 0.18); color: #6fb6e8; border-color: rgba(41, 128, 185, 0.6); }
.cal-type-order   { background: rgba(243, 156, 18, 0.16); color: #f5b041; border-color: rgba(243, 156, 18, 0.6); }
.cal-type-holiday { background: rgba(192, 57, 43, 0.14);  color: #f08a7d; border-color: rgba(192, 57, 43, 0.55); }
.cal-type-leave   { background: rgba(155, 89, 182, 0.18); color: #c39ae0; border-color: rgba(155, 89, 182, 0.6); }
.cal-type-event   { background: rgba(233, 30, 140, 0.16); color: #f27ab8; border-color: rgba(233, 30, 140, 0.55); }

.cal-view-toggle { margin-bottom: 16px; }

.cal-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .cal-layout { grid-template-columns: 1fr; }
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.cal-nav h2 { color: var(--gold-light); font-size: 1.2rem; margin: 0; }
.cal-nav .btn-sm { padding: 5px 12px; }

.cal-grid {
  display: grid;
  /* minmax(0, 1fr), not plain 1fr — otherwise a cell with long unbroken
     text (a holiday name, a PO title) grows past its fair share and the
     other six columns get squeezed or pushed off the right edge. */
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  width: 100%;
}
.cal-weekday-header {
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  text-align: center;
  padding: 8px 4px;
  min-width: 0;
}
.cal-day-cell {
  background: var(--bg-dark);
  min-height: 96px;
  min-width: 0;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-day-cell.cal-outside-month { background: var(--bg-input); opacity: 0.5; }
.cal-day-cell.cal-today { box-shadow: inset 0 0 0 2px var(--gold); }
.cal-day-number { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.cal-day-cell.cal-today .cal-day-number { color: var(--gold-light); }
.cal-event-chip {
  display: block;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event-chip.cal-done { opacity: 0.5; text-decoration: line-through; }
.cal-more-link { font-size: 0.7rem; color: var(--text-muted); cursor: pointer; }

.cal-agenda-day {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.cal-agenda-day:last-child { border-bottom: none; }
.cal-agenda-date { color: var(--gold-light); font-weight: 600; font-size: 0.85rem; margin-bottom: 8px; }
.cal-agenda-empty { color: var(--text-muted); font-size: 0.82rem; }
.cal-agenda-event { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.cal-agenda-event .cal-agenda-time { color: var(--text-muted); font-size: 0.76rem; width: 60px; flex-shrink: 0; }

.cal-side-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.cal-side-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.85rem;
}
.cal-side-item .cal-side-meta { color: var(--text-muted); font-size: 0.76rem; margin-top: 2px; }
.cal-side-item .cal-side-actions { margin-top: 8px; display: flex; gap: 8px; }

/* ─── Utility ─── */
.text-center { text-align: center; }
.text-gold { color: var(--gold-light); }
.text-muted { color: var(--text-muted); }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none !important; }

/* Print styles */
@media print {
  body { background: #fff; color: #000; }
  .btn, .tabs, .search-bar, .danger-zone { display: none !important; }
  .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; background: #fff; }
}
