@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --navy: #0b1f3a;
  --navy-mid: #1a3255;
  --navy-light: #2a4a72;
  --gold: #e8a020;
  --gold-light: #f5c055;
  --gold-pale: #fef3d8;
  --teal: #0d7a6a;
  --teal-light: #e6f4f1;
  --red: #c0392b;
  --red-light: #fdf0ee;
  --amber: #d4780a;
  --amber-light: #fef8ec;
  --green: #1a7a4a;
  --green-light: #e8f5ee;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e2e5ea;
  --border-strong: #c8cdd5;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-hint: #9ca3af;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'IBM Plex Sans Thai', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--navy-mid); }

.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--navy);
  color: #FFFFFF;
}

.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo .brand {
  font-size: 15px;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.5px;
}

.sidebar-logo .sub {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 2px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 1px;
}

.nav-section {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.nav-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  padding: 4px 18px 8px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 9px 18px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #FFFFFF; }

.nav-item.active {
  background: rgba(232, 160, 32, 0.12);
  color: var(--gold-light);
  border-left-color: var(--gold);
}

.app-main {
  flex: 1;
  min-width: 0;
}

.app-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-topbar .topbar-actions {
  margin-left: auto;
}

.topbar-user {
  color: var(--text-secondary);
  font-size: 12px;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 0;
}

.page-content {
  padding: 24px 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  line-height: normal;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s;
  font-family: inherit;
  cursor: pointer;
}

.btn-outline {
  border-color: #c8cdd5;
  color: var(--text-secondary);
  background: transparent;
}

.btn-outline:hover { background: var(--bg); }
.btn-outline.is-active { border-color: var(--navy-mid); color: var(--navy-mid); }

.btn-gold {
  background: var(--gold);
  color: #FFFFFF;
  border-color: var(--gold);
}

.btn-gold:hover { background: var(--amber); }

.btn-primary {
  background: var(--navy);
  color: #FFFFFF;
  border-color: var(--navy);
}

.btn-primary:hover { background: var(--navy-mid); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.panel + .panel { margin-top: 14px; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.card-action {
  font-size: 12px;
  color: var(--navy-light);
  cursor: pointer;
  font-weight: 500;
}

.card-body { padding: 16px 18px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.page-title {
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-strip.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  position: relative;
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.kpi-card.blue::before { background: var(--navy); }
.kpi-card.gold::before { background: var(--gold); }
.kpi-card.red::before { background: #c0392b; }
.kpi-card.green::before { background: #1a7a4a; }
.kpi-card.amber::before { background: #d4780a; }

.kpi-label {
  color: var(--text-hint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
  font-weight: 500;
}
.kpi-value {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  margin-top: 0;
  color: var(--text-primary);
  font-family: "IBM Plex Mono", monospace;
}
.kpi-sub { font-size: 11px; color: var(--text-hint); margin-top: 3px; }
.kpi-trend { font-size: 11px; margin-top: 3px; font-weight: 500; }
.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }

.work-order-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.work-order-full { grid-column: 1 / -1; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.form-grid.three-col { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.full { grid-template-columns: 1fr; }

.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-group.span2 { grid-column: span 2; }
.form-group.span3 { grid-column: span 3; }

.form-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-hint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 8px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  grid-column: 1 / -1;
}

input[type="text"].plate-input {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.parts-table-wrap {
  grid-column: 1 / -1;
  background: var(--bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.parts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.parts-table th {
  background: #edeef0;
  text-align: left;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-strong);
  line-height: 1.6;
}

.parts-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  line-height: 1.6;
}

.parts-table tr:last-child td { border-bottom: none; }

.parts-table input[type="text"],
.parts-table input[type="number"],
.parts-table select {
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid transparent;
  background: transparent;
}

.parts-table input:focus,
.parts-table select:focus {
  border-color: var(--navy-light);
  background: var(--surface);
  border-radius: 4px;
  box-shadow: none;
}

.parts-total-row td {
  background: var(--gold-pale);
  font-weight: 600;
  font-size: 12px;
}

.sub-select { width: 100%; font-size: 11px; }

.parts-add-row {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
}

.btn-add-row {
  background: transparent;
  color: var(--navy-light);
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 500;
}

.btn-add-row:hover { background: var(--bg); }

.file-upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.file-upload-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 8px;
  background: var(--bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-upload-zone:hover {
  border-color: var(--navy-light);
  background: #f0f4f8;
}

.file-upload-zone.is-dragging {
  border-color: var(--teal);
  background: #ecfffb;
}

.file-upload-text { font-size: 12px; color: var(--text-secondary); }
.file-upload-sub { font-size: 11px; color: var(--text-hint); margin-top: 2px; }

.entry-hidden-file-input { display: none; }

.file-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.file-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--teal-light);
  border: 1px solid #b2ddd5;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-top: 8px;
}

.file-preview-placeholder {
  margin-top: 0;
  border-style: dashed;
  background: #f7fafc;
}

.file-thumb-wrap {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  background: #e4eef3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.file-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-thumb-fallback {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
}

.file-preview .file-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--teal);
  flex: 1;
}

.file-remove {
  font-size: 16px;
  color: var(--text-hint);
  cursor: pointer;
  border: 0;
  background: transparent;
  line-height: 1;
  padding: 2px 4px;
}

.proof-modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 20px;
}

.proof-modal[hidden] {
  display: none !important;
  pointer-events: none;
}

.proof-modal-dialog {
  position: relative;
  width: min(90vw, 920px);
  max-height: 90vh;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.proof-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  border: 0;
  background: rgba(17, 24, 39, 0.65);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.proof-modal-image {
  width: 100%;
  height: min(78vh, 720px);
  object-fit: contain;
  background: #0b1220;
}

.proof-modal-caption {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid #e9eef3;
}

.entry-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.entry-summary-num {
  font-size: 20px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  color: var(--navy);
}

.entry-summary-num.gold { color: var(--amber); }
.entry-summary-num.red { color: var(--red); }

.entry-summary-label {
  font-size: 10px;
  color: var(--text-hint);
}

.entry-recent-title {
  font-size: 11px;
  color: var(--text-hint);
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.entry-recent-list { font-size: 12px; }

.entry-recent-row {
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 8px;
  align-items: center;
}

.entry-recent-row:last-child { border-bottom: none; }

.entry-recent-row span:first-child {
  color: var(--text-hint);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}

.entry-recent-row span:nth-child(2) { color: var(--text-secondary); }

.entry-recent-row span:last-child {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
}

.stack-col { display: flex; flex-direction: column; gap: 16px; }
.card-scroll { overflow-x: auto; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

.mix-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  text-align: center;
}

.mix-tile {
  border-radius: 8px;
  padding: 12px 8px;
}

.mix-tile .mix-num {
  font-size: 18px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
}

.mix-tile .mix-label {
  font-size: 11px;
  margin-top: 2px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  padding: 12px 0 0;
}

.pag-btn {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
}

.pag-btn.active {
  background: var(--navy);
  color: #FFFFFF;
  border-color: var(--navy);
}

.pag-info {
  font-size: 11px;
  color: var(--text-hint);
  margin-right: auto;
}

/* ── INVENTORY ─────────────────────────────────────────── */
.stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.stock-ok { background: var(--teal-light); color: var(--teal); }
.stock-low { background: var(--amber-light); color: var(--amber); }
.stock-out { background: var(--red-light); color: var(--red); }

.lot-row { background: var(--bg); }
.lot-row td { padding: 6px 12px; font-size: 12px; color: var(--text-secondary); }

.lot-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--navy);
  color: white;
  font-family: "IBM Plex Mono", monospace;
}

.fifo-arrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--teal);
  font-weight: 600;
  background: var(--teal-light);
  padding: 1px 7px;
  border-radius: 10px;
}

.ledger-in { color: var(--teal); font-weight: 600; }
.ledger-out { color: var(--red); font-weight: 600; }

.receive-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px 18px;
}

.progress-bar-wrap {
  background: var(--border);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
  flex: 1;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.line-item-grid {
  display: grid;
  grid-template-columns: 80px 1fr 170px 190px 90px 120px 120px 60px;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--surface);
}

.total-row {
  margin-top: 12px;
  font-size: 16px;
}

.vehicle-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.vehicle-plate-large { font-size: 26px; font-weight: 700; color: var(--navy-mid); }
.vehicle-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; flex: 1; }
.vstat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.vstat-label { font-size: 11px; color: var(--text-hint); }
.vstat-val { font-size: 16px; font-weight: 600; }

.section-divider { margin: 12px 0 8px; font-size: 12px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.section-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); margin-left: 8px; }
.section-divider { display: flex; align-items: center; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-item { display: grid; grid-template-columns: 14px 1fr; gap: 10px; align-items: start; }
.tl-dot { width: 12px; height: 12px; border-radius: 999px; border: 2px solid var(--navy-mid); margin-top: 8px; }
.tl-dot.repeat { border-color: var(--red); background: var(--red); }
.tl-dot.repair { border-color: var(--navy-mid); background: var(--navy-mid); }
.tl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; }
.tl-card.flagged { border-color: #FACAC5; background: #FDF3F2; }
.tl-card-header { display: grid; grid-template-columns: 130px 1fr auto; gap: 8px; align-items: center; }
.tl-date { font-size: 12px; color: var(--text-hint); }
.tl-title { font-size: 13px; font-weight: 500; }
.tl-amount { font-family: "IBM Plex Mono", monospace; font-size: 13px; font-weight: 600; }

.bar-group { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { font-size: 11px; color: var(--text-secondary); width: 130px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 20px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--navy); border-radius: 3px; transition: width 0.4s ease; }
.bar-fill.gold { background: var(--gold); }
.bar-fill.teal { background: var(--teal); }
.bar-fill.sky { background: #9ECFE8; }
.bar-fill.gray { background: #B0BEC5; }
.bar-fill.peach { background: #E8A080; }
.bar-val { font-size: 11px; width: 72px; text-align: right; font-family: "IBM Plex Mono", monospace; color: var(--text-secondary); flex-shrink: 0; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}

.dot-done { background: var(--teal); }
.dot-repeat { background: var(--red); }

.type-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

.type-internal { background: var(--teal-light); color: var(--teal); }
.type-external { background: var(--amber-light); color: var(--amber); }

.pm-overdue-row td { background: transparent; }
.pm-due-row td { background: transparent; }
.section-gap-top { margin-top: 20px; }

.repeat-alert {
  background: #fdf3f2;
  border: 1px solid #facac5;
  border-left: 4px solid var(--red);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.repeat-alert .alert-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.repeat-alert .badge-repeat {
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}

.repeat-alert .truck-id {
  font-size: 12px;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
  color: var(--navy);
}

.repeat-alert .alert-detail { font-size: 12px; color: var(--text-secondary); }

/* ── PAGE-SCOPED STYLES ────────────────────────────────── */
.page-entry .entry-wo-code {
  font-size: 11px;
  color: var(--text-hint);
  font-family: "IBM Plex Mono", monospace;
}
.page-entry .entry-section-divider { margin-top: 0; }
.page-entry .entry-section-meta {
  margin-left: auto;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text-hint);
  font-size: 11px;
}
.page-entry .entry-mt4 { margin-top: 4px; }
.page-entry .entry-col-idx { width: 40px; }
.page-entry .entry-col-system { width: 140px; }
.page-entry .entry-col-subcategory { width: 150px; }
.page-entry .entry-col-qty { width: 90px; text-align: center; }
.page-entry .entry-col-unit-price { width: 130px; text-align: right; }
.page-entry .entry-col-line-total { width: 130px; text-align: right; }
.page-entry .entry-col-action { width: 36px; }
.page-entry .entry-total-label { text-align: right; }
.page-entry .entry-total-value {
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
}
.page-entry .entry-sidebar-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.page-entry .entry-sidebar-body { padding: 10px 14px; }
.page-entry .entry-summary-cell { text-align: center; }

.page-inv-receive .inv-receive-grn {
  font-size: 11px;
  color: var(--text-hint);
  font-family: "IBM Plex Mono", monospace;
}
.page-inv-receive .inv-receive-lines-block { margin-top: 16px; }
.page-inv-receive .inv-receive-lines-title { grid-column: unset; padding-top: 0; }
.page-inv-receive .inv-receive-lines-wrap { margin-top: 8px; }
.page-inv-receive .inv-receive-col-idx { width: 28px; }
.page-inv-receive .inv-receive-col-sku { width: 90px; }
.page-inv-receive .inv-receive-col-qty { width: 65px; text-align: center; }
.page-inv-receive .inv-receive-col-unit { width: 120px; text-align: right; }
.page-inv-receive .inv-receive-col-total { width: 120px; text-align: right; }
.page-inv-receive .inv-receive-row-num { color: var(--text-hint); font-size: 11px; text-align: center; }
.page-inv-receive .inv-receive-sku { font-family: "IBM Plex Mono", monospace; font-size: 11px; }
.page-inv-receive .inv-receive-input-qty {
  width: 100%;
  text-align: center;
  padding: 6px 8px;
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
}
.page-inv-receive .inv-receive-input-unit {
  width: 100%;
  text-align: right;
  padding: 6px 8px;
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
}
.page-inv-receive .inv-receive-line-total {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  padding-right: 10px;
}
.page-inv-receive .inv-receive-side-col { display: flex; flex-direction: column; gap: 16px; }
.page-inv-receive .inv-receive-side-body { padding: 10px 14px; }
.page-inv-receive .inv-receive-recent-table { font-size: 12px; }
.page-inv-receive .inv-receive-recent-grn { font-family: "IBM Plex Mono", monospace; font-size: 11px; }

.page-inv-stock .inv-stock-search { width: 220px; }
.page-inv-stock .inv-stock-filter-select { width: auto; font-size: 12px; padding: 5px 8px; }
.page-inv-stock .inv-stock-hint { font-size: 11px; color: var(--text-hint); }
.page-inv-stock .inv-stock-table-wrap { overflow-x: auto; }
.page-inv-stock .inv-stock-sku { font-family: "IBM Plex Mono", monospace; font-size: 11px; }
.page-inv-stock .inv-stock-name { font-weight: 500; }
.page-inv-stock .inv-stock-lots { text-align: center; font-size: 12px; }
.page-inv-stock .inv-stock-on-hand {
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  font-size: 14px;
}
.page-inv-stock .inv-stock-on-hand.is-out { color: var(--red); }
.page-inv-stock .inv-stock-on-hand.is-low { color: var(--amber); }
.page-inv-stock .inv-stock-on-hand.is-ok { color: var(--teal); }
.page-inv-stock .inv-stock-min { text-align: center; font-size: 12px; color: var(--text-hint); }

.page-inv-movement .inv-movement-part-select { width: auto; font-size: 12px; padding: 5px 8px; min-width: 220px; }
.page-inv-movement .inv-movement-date { width: auto; font-size: 12px; }
.page-inv-movement .inv-movement-date-sep { font-size: 12px; color: var(--text-hint); }
.page-inv-movement .inv-movement-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.page-inv-movement .inv-movement-kpi-card { padding: 12px 16px; }
.page-inv-movement .inv-movement-sku {
  font-size: 13px;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
}
.page-inv-movement .inv-movement-balance-out { color: var(--red); }
.page-inv-movement .inv-movement-table-wrap { overflow-x: auto; }
.page-inv-movement .inv-movement-date-cell {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  white-space: nowrap;
}
.page-inv-movement .inv-movement-type-in,
.page-inv-movement .inv-movement-type-out {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.page-inv-movement .inv-movement-type-in { background: var(--teal-light); color: var(--teal); }
.page-inv-movement .inv-movement-type-out { background: var(--red-light); color: var(--red); }
.page-inv-movement .inv-movement-ref { font-size: 12px; font-family: "IBM Plex Mono", monospace; }
.page-inv-movement .inv-movement-plate { font-size: 10px; }
.page-inv-movement .inv-movement-empty { font-size: 12px; color: var(--text-hint); }
.page-inv-movement .inv-movement-lot { text-align: center; }
.page-inv-movement .inv-movement-qty {
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
}
.page-inv-movement .inv-movement-balance {
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
}

.page-inv-dashboard .inv-dashboard-table-wrap { overflow-x: auto; }
.page-inv-dashboard .inv-dashboard-table-sm { font-size: 12px; }
.page-inv-dashboard .inv-dashboard-col-center { text-align: center; }
.page-inv-dashboard .inv-dashboard-col-right { text-align: right; }
.page-inv-dashboard .inv-dashboard-sku {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--text-hint);
}
.page-inv-dashboard .inv-dashboard-name { font-size: 13px; font-weight: 500; }
.page-inv-dashboard .inv-dashboard-onhand {
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  font-size: 14px;
}
.page-inv-dashboard .inv-dashboard-onhand.is-out { color: var(--red); }
.page-inv-dashboard .inv-dashboard-onhand.is-low { color: var(--amber); }
.page-inv-dashboard .inv-dashboard-min {
  text-align: center;
  font-size: 12px;
  color: var(--text-hint);
}
.page-master .master-tree-card { margin-bottom: 14px; }
.page-master .master-mt10 { margin-top: 10px; }
.page-master .master-mt12 { margin-top: 12px; }
.page-master .master-btn-xs { font-size: 11px; padding: 4px 10px; }
.page-master .master-table-wrap { overflow-x: auto; }
.page-master .master-col-right { text-align: right; }
.page-master .master-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.page-master .master-sub-table { margin-top: 8px; }
.page-master .master-sub-form {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.page-master .master-sub-name { max-width: 220px; }
.page-master .master-sub-code { max-width: 140px; }
.page-master .repair-table td {
  font-size: 11px;
  line-height: 1.6;
}

.repair-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border: 0;
  background: transparent;
}

.repair-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-hint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  line-height: 1.6;
}

.repair-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  line-height: 1.6;
}

.repair-table tr:last-child td { border-bottom: none; }
.repair-table tr:hover td { background: #f9fafb; }

.plate-badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  background: var(--navy);
  color: #FFFFFF;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  display: inline-block;
}

.cat-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  display: inline-block;
}

.cat-engine { background: #EBF3FF; color: #1A4FA0; }
.cat-trans { background: #EEF5E8; color: #2A6118; }
.cat-chassis { background: #FEF7E5; color: #8A5A00; }

.amount-cell {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  color: var(--text-primary);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.filter-bar select,
.filter-bar input[type="date"] {
  width: auto;
  padding: 5px 8px;
  font-size: 12px;
}

.filter-input { width: auto; }
.filter-input-sm { width: 95px; }
.filter-to-text { font-size: 12px; color: var(--text-hint); }
.btn-search-sm { padding: 5px 12px; font-size: 12px; }
.page-size-select { padding: 4px 8px; font-size: 12px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 8px;
}
.status-overdue { background: var(--red); color: #FFFFFF; }
.status-due { background: var(--amber); color: #FFFFFF; }
.status-ok { background: var(--green-light); color: var(--green); border: 1px solid #B2DDD5; }

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}

.settings-card-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-child { border-bottom: none; }

.settings-label { flex: 1; }
.settings-label .slabel { font-size: 13px; font-weight: 500; }
.settings-label .sdesc { font-size: 12px; color: var(--text-hint); }

.settings-control { display: flex; align-items: center; gap: 8px; }

.toggle {
  width: 36px;
  height: 20px;
  background: var(--teal);
  border-radius: 10px;
  position: relative;
}

.toggle.off { background: var(--border-strong); }

.toggle::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  background: #FFFFFF;
  border-radius: 50%;
  top: 3px;
  left: 19px;
}

.toggle.off::after { left: 3px; }

.cat-tree { font-size: 13px; }

.cat-parent {
  font-weight: 600;
  color: var(--navy);
  padding: 6px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cat-children {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 10px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.cat-child-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  border: 1px solid;
}

.cat-index-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  background: var(--surface);
  font-family: inherit;
  color: var(--text-primary);
  transition: border-color 0.15s;
  outline: none;
  line-height: 1.25;
}

textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  background: var(--surface);
  font-family: inherit;
  color: var(--text-primary);
  resize: vertical;
  min-height: 72px;
  transition: border-color 0.15s;
  outline: none;
  line-height: 1.35;
}

label { font-size: 12px; font-weight: 500; line-height: 1.2; color: var(--text-secondary); display: block; margin-bottom: 4px; }
label .req { color: var(--red); margin-left: 2px; }

input:focus, select:focus, textarea:focus {
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(42, 74, 114, 0.1);
  outline: none;
}

.flash {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0 0 12px;
}

.flash-notice { background: var(--teal-light); border: 1px solid #B2DDD5; color: var(--teal); }
.flash-alert { background: var(--red-light); border: 1px solid #FACAC5; color: var(--red); }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
}
th, td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
}

.auth-page {
  min-height: calc(100vh - 76px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 22px;
}

.auth-brand {
  background: linear-gradient(160deg, var(--navy), var(--navy-mid));
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 28px rgba(11, 31, 58, 0.18);
}

.auth-brand-mark {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--gold-light);
  border: 1px solid rgba(245, 192, 85, 0.35);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 14px;
}

.auth-brand h1 {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.25;
}

.auth-brand p {
  margin: 0 0 14px;
  color: rgba(248, 250, 252, 0.86);
}

.auth-brand ul {
  margin: 0;
  padding-left: 18px;
  color: rgba(248, 250, 252, 0.9);
}

.auth-card-wrap { display: grid; }

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
}

.auth-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.auth-card-head h2 {
  margin: 0;
  font-size: 22px;
}

.auth-card-head span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-hint);
}

.auth-form { display: grid; gap: 12px; }

.auth-field label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.auth-field input[type="email"],
.auth-field input[type="password"] {
  width: 100%;
  border: 1px solid #c8cdd5;
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 14px;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--navy-mid);
  box-shadow: 0 0 0 3px rgba(26, 50, 85, 0.14);
}

.auth-check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-submit {
  margin-top: 2px;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.auth-submit:hover { filter: brightness(0.95); }

.auth-links {
  margin-top: 12px;
  font-size: 13px;
}

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .app-layout { display: block; }
  .app-sidebar { width: 100%; min-width: 0; }
  .filters-grid { grid-template-columns: 1fr 1fr; }
  .kpi-strip { grid-template-columns: 1fr 1fr; }
  .work-order-grid { grid-template-columns: 1fr; }
  .line-item-grid { grid-template-columns: 1fr 1fr; }
  .vehicle-stats { grid-template-columns: 1fr 1fr; }
  .tl-card-header { grid-template-columns: 1fr; }
  .bar-row { display: grid; grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .settings-row { display: block; }
  .settings-control { margin-top: 8px; }
}

/* ── reports: monthly summary + ranking additions ── */
.bar-pct {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  width: 44px;
  text-align: right;
  color: var(--text-hint);
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 28px 12px;
  color: var(--text-hint);
  font-size: 13px;
}

.card-action-text {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-hint);
}

.heatmap-wrap { overflow-x: auto; }
.heatmap {
  border-collapse: separate;
  border-spacing: 2px;
  font-size: 11px;
  width: 100%;
}
.heatmap th {
  padding: 4px 8px;
  font-size: 10px;
  color: var(--text-hint);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}
.heatmap th.hm-th-plate { text-align: left; }
.heatmap td {
  padding: 6px 8px;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  font-size: 11px;
  border-radius: 4px;
  min-width: 60px;
}
.heatmap td.hm-lbl {
  background: transparent;
  text-align: left;
  padding-left: 0;
  font-family: "IBM Plex Sans Thai", sans-serif;
  font-weight: 500;
  color: var(--text-secondary);
}
.heatmap td.amount-cell {
  background: transparent;
  font-family: "IBM Plex Mono", monospace;
}
.hm-0 { background: #f4f5f7; color: var(--text-hint); }
.hm-1 { background: #ebf3ff; color: #1a4fa0; }
.hm-2 { background: #dbeafe; color: #1a4fa0; }
.hm-3 { background: #bfdbfe; color: #1e40af; }
.hm-4 { background: #93c5fd; color: #1e3a8a; }
.hm-5 { background: #3b82f6; color: #fff; }
.hm-6 { background: #1d4ed8; color: #fff; }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
  font-size: 10px;
  color: var(--text-hint);
}
.heatmap-legend span {
  padding: 2px 8px;
  border-radius: 3px;
}

.rank-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
}
.rank-num.r1 { background: var(--gold); color: #fff; }
.rank-num.r2 { background: #b0bec5; color: #fff; }
.rank-num.r3 { background: #cd7f32; color: #fff; }
.rank-num.rn { background: var(--bg); color: var(--text-hint); }

.ranking-table th.rank-col { width: 56px; }
.ranking-table th.rank-total,
.ranking-table td.rank-total {
  font-weight: 700;
  color: var(--navy);
}
.ranking-table .mono-cell {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--text-secondary);
}

.rank-bar {
  width: 80px;
  height: 8px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
}
.rank-bar-fill {
  height: 100%;
  background: var(--navy);
  border-radius: 2px;
}

.pag {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  padding: 10px 14px;
}
.pag-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-family: inherit;
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pag-btn:hover { background: var(--bg); }
.pag-btn.on {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
