:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --sidebar-width: 320px;
  --header-height: 56px;
  --time-col-width: 70px;
  --hour-height: 60px;
  --start-hour: 6;
  --end-hour: 20;
}

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

html, body {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Resolve icon fonts from the page folder so they load in the desktop app */
@font-face {
  font-family: "Font Awesome 6 Free";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("vendor/webfonts/fa-solid-900.woff2") format("woff2"),
       url("vendor/webfonts/fa-solid-900.ttf") format("truetype");
}
@font-face {
  font-family: "Font Awesome 6 Free";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("vendor/webfonts/fa-regular-400.woff2") format("woff2"),
       url("vendor/webfonts/fa-regular-400.ttf") format("truetype");
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
}

/* ========== TOP NAV ========== */
.top-nav {
  min-height: var(--header-height);
  height: auto;
  background: #0f172a;
  color: white;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.25rem 1rem;
  gap: 0.5rem 1rem;
  flex-shrink: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
}

.logo i {
  color: #38bdf8;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  flex: 1;
  flex-wrap: wrap;
  min-width: 0;
}

.nav-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s;
}

.nav-btn:hover {
  background: #1e293b;
  color: white;
}

.nav-btn.active {
  background: var(--primary);
  color: white;
}

.nav-win-menu {
  position: fixed;
  z-index: 6000;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  padding: 0.3rem;
}
.nav-win-menu[hidden] { display: none; }
.nav-win-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}
.nav-win-menu button:hover {
  background: #eff6ff;
  color: var(--primary-dark);
}

.nav-right {
  font-size: 0.875rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 0;
}

/* ========== VIEWS ========== */
#main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.view {
  display: none;
  height: 100%;
  overflow: auto;
}

.view.active {
  display: flex;
  flex-direction: column;
}
#view-billing { overflow: hidden; }

/* ========== DISPATCH BOARD ========== */
.dispatch-layout {
  display: flex;
  height: 100%;
  min-height: 0;
}

.unscheduled-panel {
  width: var(--sidebar-width);
  background: #f8fafc;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.panel-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: white;
}

.panel-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.search-box {
  position: relative;
}

.search-box i {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.search-box input {
  width: 100%;
  padding: 0.4rem 0.6rem 0.4rem 1.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}

.unscheduled-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.load-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.load-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.load-card.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.load-card .card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.priority-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
}

.priority-badge.p1 { background: #fee2e2; color: #991b1b; }
.priority-badge.p2 { background: #ffedd5; color: #9a3412; }
.priority-badge.p3 { background: #fef3c7; color: #92400e; }
.priority-badge.p4 { background: #e0e7ff; color: #3730a3; }
.priority-badge.none { background: #f1f5f9; color: #64748b; }

.duration-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.load-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.load-card .product {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.load-card .details {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.3;
}

/* Board area */
.board-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.date-nav > #prev-day,
.date-nav > #next-day {
  background: white;
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  flex-shrink: 0;
  color: #1e293b;
}

.date-nav > #prev-day:hover,
.date-nav > #next-day:hover {
  background: #f1f5f9;
}

.chev-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
  flex-shrink: 0;
}

.date-nav h2 {
  font-size: 1rem;
  font-weight: 600;
  min-width: 220px;
  text-align: center;
}

.date-nav .datetime-pair {
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}

.board-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.hidden-drivers-wrap { position: relative; }
.hidden-drivers-wrap .btn.has-hidden {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}
.hidden-drivers-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 220px;
  max-height: 280px;
  overflow: auto;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  z-index: 80;
  padding: 0.3rem;
}
.hidden-drivers-empty {
  padding: 0.7rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.hidden-drivers-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: inherit;
  text-align: left;
}
.hidden-drivers-item:hover { background: #f1f5f9; }
.hidden-drivers-item .show-link { color: var(--primary); font-weight: 600; }
.hidden-drivers-item.all {
  border-top: 1px solid var(--border);
  margin-top: 0.2rem;
  font-weight: 600;
}

.view-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}

.board-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  display: flex;
  position: relative;
}

.empty-lane {
  padding: 1rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 160px;
}
.bol-photo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}
.bol-photo-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #0f172a;
}
.bol-photo-card img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  background: #0f172a;
}
.bol-photo-card figcaption {
  padding: 0.4rem 0.55rem;
  font-size: 0.75rem;
  color: var(--text);
  background: #f8fafc;
}

.time-column {
  width: var(--time-col-width);
  flex-shrink: 0;
  background: #f8fafc;
  border-right: 1px solid var(--border);
  position: sticky;
  left: 0;
  z-index: 10;
}

.time-label {
  height: var(--hour-height);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0.25rem 0.5rem 0 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  border-bottom: 1px solid #f1f5f9;
}

.drivers-grid {
  display: flex;
  min-width: max-content;
  gap: 6px;
  padding: 0 4px;
}

.driver-column {
  width: 160px;
  border-right: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-radius: 4px;
  position: relative;
  background: white;
  flex-shrink: 0;
}

.driver-header {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0 0.4rem;
  text-align: center;
  line-height: 1.2;
}

.driver-header .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.driver-header .status-dot.inactive {
  background: #cbd5e1;
}

.hour-slot {
  height: var(--hour-height);
  border-bottom: 1px solid #f1f5f9;
  position: relative;
}

.hour-slot:nth-child(even) {
  background: #fafbfc;
}

.hour-slot.drop-target {
  background: #dbeafe !important;
  outline: 2px dashed var(--primary);
}

/* Scheduled load blocks on the board */
.scheduled-block {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font-size: 0.72rem;
  color: white;
  overflow: hidden;
  cursor: grab;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  z-index: 2;
  line-height: 1.25;
}

.scheduled-block .block-customer {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scheduled-block .block-product {
  opacity: 0.9;
  font-size: 0.68rem;
}

.scheduled-block .block-duration {
  opacity: 0.8;
  font-size: 0.65rem;
}

.scheduled-block:hover {
  filter: brightness(1.08);
}

/* Current time line */
.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--danger);
  z-index: 20;
  pointer-events: none;
}

.now-line::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
}

/* ========== PAGE HEADERS & TABLES ========== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: white;
  border-bottom: 1px solid var(--border);
}

#view-customers .page-header {
  padding: 1.25rem 2rem;
}

.page-header h1 {
  font-size: 1.35rem;
  font-weight: 600;
}
.page-header .chev-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.table-container {
  padding: 1rem 1.5rem;
  overflow: auto;
  flex: 1;
  min-height: 240px;
}

#view-customers .table-container {
  padding: 1.25rem 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#rack-prices-table,
#pricing-entries-table {
  table-layout: auto;
  min-width: 960px;
}

th, td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tr:hover td {
  background: #f8fafc;
}

/* ========== CARDS GRID (Suppliers) ========== */
.cards-grid {
  padding: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.supplier-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.supplier-card-header {
  padding: 0.9rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.supplier-card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.supplier-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
}

.terminals-list {
  padding: 0.5rem 1rem 1rem;
}

.terminal-item {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.terminal-item:last-child {
  margin-bottom: 0;
}

.terminal-item strong {
  display: block;
  margin-bottom: 0.15rem;
}

.terminal-item .pin {
  font-family: monospace;
  background: #e0e7ff;
  color: #3730a3;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.terminal-item .times {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.add-terminal-btn {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.4rem;
  font-size: 0.8rem;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn.primary {
  background: var(--primary);
  color: white;
}

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

.btn.secondary {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.btn.secondary:hover {
  background: #f1f5f9;
}

.btn.danger {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.btn.danger:hover {
  background: #fee2e2;
}

.btn.danger-fill {
  background: #dc2626;
  color: #fff;
  border: 1px solid #b91c1c;
}
.btn.danger-fill:hover {
  background: #b91c1c;
  color: #fff;
}

.btn.small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: var(--text);
}

/* ========== MODALS ========== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-content.wide {
  max-width: 860px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal form {
  padding: 1.25rem;
}

.form-row {
  margin-bottom: 1rem;
}

.form-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row.three-col {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.75rem;
}

.form-row small {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #0f172a;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.25s;
  z-index: 2000;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.4;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.status-badge.unscheduled {
  background: #f1f5f9;
  color: #64748b;
}

.status-badge.scheduled {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.completed {
  background: #dcfce7;
  color: #166534;
}

/* Supplier terminal picker */
.hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.supplier-terminals-picker {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  background: #f8fafc;
}

.stp-row {
  display: grid;
  grid-template-columns: 28px 1fr 110px 70px 70px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

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

.stp-row.disabled {
  opacity: 0.45;
}

.stp-row input[type="text"],
.stp-row input[type="number"] {
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 100%;
}

.stp-row .term-name {
  font-weight: 500;
}

.stp-row .term-loc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stp-header {
  display: grid;
  grid-template-columns: 28px 1fr 110px 70px 70px;
  gap: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0.25rem 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

/* Customer detail layout */
.detail-layout {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem;
  overflow: auto;
  flex: 1;
}

.detail-col {
  flex: 1;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-col.wide {
  flex: 1.6;
}

.detail-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.detail-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.address-item, .tank-item {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
}

.address-item:last-child, .tank-item:last-child {
  margin-bottom: 0;
}

.address-item .addr-label, .tank-item .tank-title {
  font-weight: 600;
  margin-bottom: 0.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge-primary {
  font-size: 0.65rem;
  background: #dbeafe;
  color: #1e40af;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-weight: 600;
}

.tank-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.tank-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

.tank-table { width: 100%; }
.tank-table td { vertical-align: middle; }

.txn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.txn-table th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.txn-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.txn-table tr:hover td {
  background: #f8fafc;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #f1f5f9;
}

/* Autocomplete */
.autocomplete-wrap { position: relative; }
.autocomplete-results {
  display: none;
  position: absolute;
  left: 0; right: 0; top: 100%;
  background: white;
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}
.autocomplete-results.open { display: block; }
.ac-item {
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  border-bottom: 1px solid #f1f5f9;
}
.ac-item:hover, .ac-item.active { background: #eff6ff; }
.ac-item .ac-sub { font-size: 0.75rem; color: var(--text-muted); }
.selected-chip {
  margin-top: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
}
.selected-chip button {
  background: none; border: none; cursor: pointer; color: #1e40af; font-size: 1rem; line-height: 1;
}

/* Tank allocations on load form */
.tank-alloc-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.4rem;
}
.tank-alloc-row {
  display: grid;
  grid-template-columns: 28px 1fr 110px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0.35rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.tank-alloc-row:last-child { border-bottom: none; }
.tank-alloc-row.disabled { opacity: 0.45; }
.tank-alloc-row input[type="number"] {
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 100%;
}
.tank-alloc-row .ta-info { line-height: 1.3; }
.tank-alloc-row .ta-sub { font-size: 0.72rem; color: var(--text-muted); }

/* Context menu */
.context-menu {
  display: none;
  position: fixed;
  z-index: 3000;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  min-width: 240px;
  padding: 0.35rem;
}
.context-menu.open { display: block; }
.context-menu button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.875rem;
  border-radius: 6px;
  color: var(--text);
}
.context-menu button:hover { background: #f1f5f9; }
.context-menu button i { width: 1.1rem; color: var(--text-muted); }

/* Per-tank supplier / lift type rows */
.tank-alloc-row {
  grid-template-columns: 28px 1.1fr 80px 80px !important;
  gap: 0.35rem !important;
}
.ta-header-step1,
.ta-header {
  grid-template-columns: 28px 1.1fr 80px 80px;
}
.tank-alloc-row select {
  padding: 0.25rem 0.3rem;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 100%;
  background: white;
}
.tank-alloc-row.disabled select {
  pointer-events: none;
}
.ta-header {
  display: grid;
  grid-template-columns: 28px 1.1fr 80px 80px;
  gap: 0.35rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0.25rem 0.35rem 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.15rem;
}
.ta-header-step1 { grid-template-columns: 28px 1.1fr 80px 80px; }

#load-step-source { padding-bottom: 0.25rem; }
#load-source-list { max-height: 52vh; overflow: auto; }
.src-tank {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  margin-bottom: 0.75rem;
  overflow: visible;
}
.src-tank-h {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.src-tank-target { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.src-row-h {
  display: grid;
  grid-template-columns: 90px 1.15fr 120px 1.2fr;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem 0.2rem;
  font-size: 0.65rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}
.src-row {
  display: grid;
  grid-template-columns: 90px 1.15fr 120px 1.2fr;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  align-items: center;
  border-top: 1px solid #f1f5f9;
}
.src-row .src-gallons,
.src-row .src-lift,
.src-row .src-contract {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: white;
}
.src-row .src-gallons { font-variant-numeric: tabular-nums; }
.src-contract-wrap { min-width: 0; }

/* Supplier PIN inputs by lift type */
.stp-row {
  grid-template-columns: 28px 1fr 80px 80px 80px 55px 55px !important;
}
.stp-header {
  grid-template-columns: 28px 1fr 80px 80px 80px 55px 55px !important;
}


/* Settings gear menu */
.settings-menu-wrap {
  position: relative;
}
.settings-gear-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  font-size: 1.05rem;
  color: #94a3b8;
}
.settings-gear-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
}
.settings-gear-btn:hover,
.settings-gear-btn.open {
  background: #1e293b;
  color: white;
}
.settings-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  min-width: 210px;
  padding: 0.35rem;
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
  z-index: 200;
}
.settings-dropdown.open {
  display: block;
}
.settings-dropdown .settings-item {
  width: 100%;
  justify-content: flex-start;
  color: #cbd5e1;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.settings-dropdown .settings-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  pointer-events: none;
}
.sys-setting-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.help-tip {
  position: relative;
  display: inline-flex;
  color: #94a3b8;
  cursor: help;
  font-size: 0.92rem;
}
.help-tip:hover,
.help-tip:focus {
  color: #2563eb;
  outline: none;
}
.help-tip-text {
  display: none;
  position: absolute;
  left: 1.15rem;
  top: 50%;
  transform: translateY(-50%);
  width: 260px;
  padding: 0.55rem 0.7rem;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
  z-index: 40;
}
.help-tip:hover .help-tip-text,
.help-tip:focus .help-tip-text {
  display: block;
}
.settings-dropdown .settings-item:hover {
  background: #1e293b;
  color: white;
}
.settings-dropdown .settings-item.active {
  background: var(--primary);
  color: white;
}

/* Subtle quarter-hour guides inside each hour slot */
.hour-slot {
  background-image: linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(25% - 1px),
    #e2e8f0 calc(25% - 1px),
    #e2e8f0 25%,
    transparent 25%,
    transparent calc(50% - 1px),
    #cbd5e1 calc(50% - 1px),
    #cbd5e1 50%,
    transparent 50%,
    transparent calc(75% - 1px),
    #e2e8f0 calc(75% - 1px),
    #e2e8f0 75%,
    transparent 75%
  );
}
.hour-slot:nth-child(even) {
  background-color: #fafbfc;
  background-image: linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(25% - 1px),
    #e2e8f0 calc(25% - 1px),
    #e2e8f0 25%,
    transparent 25%,
    transparent calc(50% - 1px),
    #cbd5e1 calc(50% - 1px),
    #cbd5e1 50%,
    transparent 50%,
    transparent calc(75% - 1px),
    #e2e8f0 calc(75% - 1px),
    #e2e8f0 75%,
    transparent 75%
  );
}

.pin-supplier-checks {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  background: #f8fafc;
}

/* Driver off / unavailable */
.driver-column.driver-off .slots-container {
  background: repeating-linear-gradient(
    -45deg,
    #e2e8f0,
    #e2e8f0 8px,
    #f1f5f9 8px,
    #f1f5f9 16px
  );
  opacity: 0.85;
}
.driver-column.driver-off .hour-slot {
  pointer-events: none;
  background-image: none !important;
  background-color: transparent !important;
}
.driver-header.header-off {
  background: #64748b !important;
  color: #f1f5f9 !important;
}
.driver-header .off-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: #fef2f2;
  color: #b91c1c;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  margin-left: 0.25rem;
}
.driver-header .hidden-badge {
  background: #e2e8f0;
  color: #334155;
}
.driver-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.05rem;
}
.driver-header .hide-driver-btn,
.driver-header .toggle-off-btn {
  margin-left: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  opacity: 0.85;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 4px;
}
.driver-header .hide-driver-btn svg,
.driver-header .toggle-off-btn svg {
  width: 14px;
  height: 14px;
  display: block;
  pointer-events: none;
}
.driver-header .hide-driver-btn:hover,
.driver-header .toggle-off-btn:hover {
  opacity: 1;
  background: rgba(15, 23, 42, 0.08);
}
.driver-header-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.driver-column.driver-hidden-shown .driver-header {
  background: #e2e8f0;
}
.status-dot.off {
  background: #94a3b8 !important;
  box-shadow: none !important;
}
.hour-slot.slot-off {
  cursor: not-allowed;
}

.slots-container.drop-target-col {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: rgba(37, 99, 235, 0.04);
}
.scheduled-block {
  box-sizing: border-box;
}

.driver-header {
  cursor: grab;
}
.driver-header.dragging-header {
  opacity: 0.55;
  cursor: grabbing;
}
.driver-header .drag-handle {
  color: #94a3b8;
  font-size: 0.75rem;
  margin-right: 0.1rem;
  cursor: grab;
}
.driver-column.drop-before {
  box-shadow: inset 3px 0 0 var(--primary);
}
.driver-column.drop-after {
  box-shadow: inset -3px 0 0 var(--primary);
}
.driver-column.column-dragging {
  opacity: 0.7;
}

.ta-supplier-picker {
  position: relative;
  min-width: 0;
}
.ta-supplier-search {
  width: 100%;
  padding: 0.25rem 0.35rem;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
}
.ta-supplier-search:disabled {
  background: #f1f5f9;
  color: #94a3b8;
}
.ta-supplier-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  max-height: 180px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  z-index: 50;
}
.ta-supplier-option {
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
  cursor: pointer;
}
.ta-supplier-option:hover,
.ta-supplier-option.selected {
  background: #eff6ff;
  color: #1d4ed8;
}
.ta-supplier-dropdown-float {
  z-index: 5000 !important;
}

/* Cargas-style customer home */
.cargas-customer {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  margin: -1rem;
  background: #f1f5f9;
}
.cargas-header {
  background: #0284c7;
  color: white;
  padding: 1.15rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.cargas-header-main { flex: 1; min-width: 0; }
.cargas-header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}
.cargas-header-meta {
  font-size: 0.8rem;
  opacity: 0.95;
  margin-top: 0.25rem;
}
.cargas-header-actions { display: flex; gap: 0.6rem; }
.cargas-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.cargas-side {
  width: 200px;
  background: #0369a1;
  color: white;
  padding: 0.85rem 0;
  flex-shrink: 0;
  overflow-y: auto;
}
.cargas-side-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
  background: transparent;
  color: #e0f2fe;
  text-align: left;
  padding: 0.8rem 1.25rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.cargas-side-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.cargas-side-btn.active {
  background: #0c4a6e;
  color: white;
  border-left: 3px solid #7dd3fc;
}
.side-count {
  background: white;
  color: #0369a1;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 1.25rem;
  text-align: center;
  padding: 0.1rem 0.35rem;
}
.cargas-main {
  flex: 1;
  overflow: auto;
  padding: 1.25rem 1.5rem;
}
.ctab { display: none; }
.ctab.active { display: block; }
.cargas-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 1100px) {
  .cargas-grid { grid-template-columns: 1fr 1fr; }
}
.cargas-panel {
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  overflow: hidden;
}
.cargas-panel-h {
  background: #0284c7;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cargas-panel-b { padding: 1rem 1.15rem; font-size: 0.85rem; }
.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.4rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.kv.sub { grid-template-columns: 120px 1fr; padding-left: 0.5rem; font-size: 0.8rem; color: #475569; }
.kv span:first-child { color: #64748b; }
.balance-panel .amt-due, .amt-due { color: #dc2626; font-weight: 700; }
.amt-credit { color: #16a34a; font-weight: 600; }
.text-danger { color: #dc2626; font-weight: 600; }
hr.soft { border: none; border-top: 1px solid #e2e8f0; margin: 0.5rem 0; }
.link-btn {
  background: transparent;
  border: none;
  color: #e0f2fe;
  cursor: pointer;
  font-size: 0.8rem;
  text-decoration: underline;
}
.btn.small { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

.ta-price {
  width: 100%;
  padding: 0.25rem 0.3rem;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.loads-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.loads-tab {
  border: 1px solid var(--border);
  background: white;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-muted);
}
.loads-tab:hover { background: #f8fafc; color: var(--text); }
.loads-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-weight: 600;
}
.status-badge.dispatched { background: #dbeafe; color: #1d4ed8; }
.status-badge.completed { background: #e2e8f0; color: #475569; }
.status-badge.billed { background: #dcfce7; color: #166534; }
.scheduled-block.status-dispatched {
  filter: none;
}
.scheduled-block.status-completed,
.scheduled-block.status-billed {
  background: #36454F !important;
  color: #f8fafc !important;
}
.scheduled-block.status-completed .block-product,
.scheduled-block.status-billed .block-product,
.scheduled-block.status-completed .block-duration,
.scheduled-block.status-billed .block-duration {
  opacity: 0.9;
}

.modal.open input,
.modal.open textarea,
.modal.open select {
  pointer-events: auto !important;
  -webkit-user-select: text !important;
  user-select: text !important;
}

body.modal-open .context-menu { display: none !important; }

/* ========== DRIVER TABLET (single-file local) ========== */
#driver-tablet-app {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #0f172a;
  color: #f1f5f9;
  display: flex;
  flex-direction: column;
  font-size: 18px;
  height: 100dvh;
  max-height: 100dvh;
}
#driver-tablet-app[hidden] { display: none !important; }
body.tablet-mode #app { display: none; }
body.tablet-mode { background: #0f172a; }

.tablet-login {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.tablet-login-card {
  width: 100%;
  max-width: 420px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 1.5rem;
}
.tablet-login-card h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.tablet-login-card p { color: #94a3b8; margin-bottom: 1rem; }
#tablet-pin-display {
  text-align: center;
  font-size: 2.2rem;
  letter-spacing: 0.4em;
  height: 3.2rem;
  font-family: ui-monospace, Menlo, monospace;
}
.tablet-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}
.tablet-pad button {
  height: 64px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #f1f5f9;
  border-radius: 12px;
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
}
.tablet-pad button.go { background: #38bdf8; color: #0f172a; border: none; }
.tablet-pad button.clear { background: #334155; }
.tablet-error { color: #f87171; text-align: center; min-height: 1.4em; margin-top: 0.75rem; }

.tablet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid #334155;
  background: #111827;
}
.tablet-kicker { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: #94a3b8; }
.tablet-driver-name { font-size: 1.25rem; font-weight: 600; }
.tablet-header-actions { display: flex; gap: 0.5rem; }
.tablet-btn {
  height: 48px;
  padding: 0 1rem;
  border-radius: 12px;
  border: none;
  background: #334155;
  color: #f1f5f9;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
}
.tablet-btn-sky { background: #38bdf8; color: #0f172a; }
.tablet-btn-wide { width: 100%; margin-top: 0.5rem; }

.tablet-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  grid-template-rows: minmax(0, 1fr);
}
.tablet-jobs, .tablet-tanks, .tablet-job {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.tablet-jobs, .tablet-tanks {
  padding: 1rem;
  background: #111827;
}
.tablet-jobs { border-right: 1px solid #334155; }
.tablet-tanks { border-left: 1px solid #334155; }
.tablet-job { padding: 1.25rem 1.5rem; }
.tablet-job-card {
  width: 100%;
  text-align: left;
  background: #0f172a;
  color: #f1f5f9;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
}
.tablet-job-card.active { border-color: #38bdf8; background: #1e293b; }
.tablet-job-card strong { display: block; font-size: 1.1rem; }
.tablet-time { color: #38bdf8; margin-top: 0.25rem; }
.tablet-muted { color: #94a3b8; }
.tablet-h1 { font-size: 2.2rem; font-weight: 650; line-height: 1.15; }
.tablet-addr { font-size: 1.25rem; margin: 0.75rem 0 1rem; }
.tablet-section {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 1.1rem;
  margin-bottom: 1rem;
}
.tablet-section h3 { font-size: 1.4rem; margin-bottom: 0.35rem; }
.tablet-pin { color: #38bdf8; font-size: 1.3rem; font-weight: 700; margin-top: 0.4rem; }
.tablet-field { display: block; margin-bottom: 0.85rem; min-width: 0; }
.tablet-field span { display: block; color: #94a3b8; font-size: 0.95rem; margin-bottom: 0.3rem; }
.tablet-field input, .tablet-times input {
  width: 100%;
  min-width: 0;
  height: 56px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #f1f5f9;
  padding: 0 0.9rem;
  font-size: 1.15rem;
}
.tablet-times {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
  min-width: 0;
}
.tablet-times.arrive { grid-template-columns: 1fr; }
.tablet-times .row { display: flex; gap: 0.4rem; min-width: 0; align-items: stretch; }
.tablet-times .row input { flex: 1 1 auto; min-width: 0; width: auto; }
.tablet-times .row .tablet-btn { flex: 0 0 auto; white-space: nowrap; }
.tablet-photo {
  width: 100%;
  max-height: 50vh;
  object-fit: contain;
  background: #0f172a;
  border-radius: 12px;
  border: 1px solid #334155;
  margin-bottom: 0.6rem;
}
.tablet-photo-empty {
  height: 7rem;
  border: 1px dashed #334155;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #94a3b8;
  margin-bottom: 0.6rem;
}
.tablet-actions { display: flex; gap: 0.6rem; margin-top: 0.5rem; }
.tablet-actions .tablet-btn { flex: 1; height: 56px; }
.tank-spec { background: #1e293b; border: 1px solid #334155; border-radius: 16px; padding: 1rem; margin-bottom: 0.75rem; }
.tank-spec dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; }
.tank-spec dd { font-size: 1.1rem; margin: 0 0 0.65rem; }

@media (min-width: 1101px) {
  .tablet-job .tank-spec { display: none; }
}

/* Portrait: stack so nothing is clipped */
@media (orientation: portrait) {
  .dispatch-layout {
    flex-direction: column;
  }
  .unscheduled-panel {
    width: 100%;
    height: 32%;
    min-height: 150px;
    max-height: 40%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .unscheduled-list {
    display: flex;
    flex-direction: row;
    gap: 0.6rem;
    padding: 0.6rem;
  }
  .unscheduled-list .load-card {
    min-width: 230px;
    flex-shrink: 0;
  }
  .tablet-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .tablet-jobs {
    display: flex;
    flex-direction: row;
    gap: 0.6rem;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid #334155;
    max-height: 9rem;
  }
  .tablet-job-card {
    min-width: 220px;
    margin-bottom: 0;
    flex-shrink: 0;
  }
  .tablet-tanks {
    border-left: none;
    border-top: 1px solid #334155;
    max-height: 34%;
  }
  .tablet-job .tank-spec { display: none; }
  .top-nav { gap: 0.35rem 0.6rem; }
  .nav-btn { padding: 0.4rem 0.65rem; }
}

@media (orientation: landscape) {
  .dispatch-layout { flex-direction: row; }
  .tablet-body {
    grid-template-columns: minmax(180px, 22vw) minmax(0, 1fr) minmax(200px, 26vw);
    grid-template-rows: minmax(0, 1fr);
  }
  .tablet-tanks { display: block; }
  .tablet-job .tank-spec { display: none; }
}

@media (orientation: landscape) and (max-height: 700px) {
  .tablet-header { padding: 0.35rem 0.9rem; }
  .tablet-driver-name { font-size: 1.05rem; }
  .tablet-btn { height: 40px; font-size: 0.9rem; }
  .tablet-pad button { height: 44px; font-size: 1.2rem; }
  .tablet-h1 { font-size: 1.55rem; }
  .tablet-field input, .tablet-times input { height: 44px; font-size: 1rem; }
  .tablet-login-card { max-width: 560px; }
  .tablet-login { padding: 0.6rem; }
  .tablet-login-card h1 { font-size: 1.3rem; }
  #tablet-pin-display { height: 2.4rem; font-size: 1.6rem; }
}

@media (orientation: landscape) {
  .tablet-times,
  .tablet-times.arrive { grid-template-columns: 1fr; }
  .tablet-job { min-width: 0; }
}

@media (max-width: 700px) {
  .tablet-times { grid-template-columns: 1fr; }
  .tablet-actions { flex-direction: column; }
  .date-nav h2 { min-width: 0; font-size: 0.9rem; }
}

.loads-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.65rem 1.5rem 0;
  background: white;
}
.loads-date-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.loads-date-filter label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.datetime-pair {
  position: relative;
  display: block;
  min-width: 0;
}
.datetime-pair > input[type="date"],
.datetime-pair > input[type="time"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.dt-trigger {
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dt-trigger:hover { border-color: #94a3b8; }
.dt-trigger.empty { color: #94a3b8; }
.loads-date-filter .dt-trigger {
  padding: 0.28rem 0.45rem;
  font-size: 0.8rem;
  min-width: 9.5rem;
}
.date-nav .dt-trigger {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  min-width: 11rem;
}
#contract-lines-table .datetime-pair { min-width: 148px; }
#contract-lines-table .dt-trigger { padding: 0.42rem 0.5rem; font-size: 0.8rem; }
#dt-cal {
  position: fixed;
  z-index: 2400;
  width: 280px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  padding: 0.7rem 0.75rem 0.65rem;
  pointer-events: auto;
}
#dt-cal[hidden] { display: none !important; }
.dt-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}
.dt-cal-head strong { font-size: 0.92rem; }
.dt-cal-head button {
  width: 28px;
  height: 28px;
  border: none;
  background: #f1f5f9;
  border-radius: 6px;
  cursor: pointer;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.dt-cal-head button:hover { background: #e2e8f0; }
.dt-cal-head .chev-btn svg { width: 15px; height: 15px; }
.dt-cal-dow, .dt-cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}
.dt-cal-dow {
  font-size: 0.68rem;
  font-weight: 650;
  color: #94a3b8;
  margin-bottom: 0.2rem;
}
.dt-cal-days button {
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text);
}
.dt-cal-days button:hover { background: #f1f5f9; }
.dt-cal-days button.muted { color: #cbd5e1; }
.dt-cal-days button.today { box-shadow: inset 0 0 0 1px var(--primary); }
.dt-cal-days button.selected { background: var(--primary); color: white; }
.dt-cal-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.7rem;
  padding-top: 0.65rem;
  border-top: 1px solid #e2e8f0;
}
.dt-cal-time label {
  font-size: 0.78rem;
  font-weight: 650;
  color: #64748b;
  margin: 0;
}
.dt-cal-time input[type="time"] {
  flex: 1;
  max-width: 150px;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 7px;
}
.dt-cal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.55rem;
}
.rate-input {
  width: 5.6rem;
  padding: 0.28rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.rate-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.gain-pos { color: #15803d; font-weight: 600; }
.gain-neg { color: #b91c1c; font-weight: 600; }
.gain-zero { color: var(--text-muted); }
.bol-input {
  width: 7.5rem;
  padding: 0.28rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8rem;
}

.tab-count { font-weight: 600; margin-left: 0.15rem; }
.loads-tab-hint {
  padding: 0.15rem 1.5rem 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: white;
}

.board-settings-wrap {
  padding: 1.25rem 1.5rem 2rem;
  overflow: auto;
}
.settings-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.4rem 1.1rem;
  max-width: 760px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.settings-card h2 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}
.settings-card-help {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.1rem;
}
.pricing-hub-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 640px;
}
.pricing-hub-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  text-align: left;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
  cursor: pointer;
  color: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.pricing-hub-item:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}
.pricing-hub-item h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.pricing-hub-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}
.pricing-hub-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-left: auto;
  color: #64748b;
  pointer-events: none;
}
.settings-card.pcc-card {
  max-width: 1100px;
}
.pcc-page .pcc-margin {
  width: 7.5rem;
}
.pcc-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  vertical-align: middle;
}
.pcc-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.pcc-switch span {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.15s;
}
.pcc-switch span:before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
}
.pcc-switch input:checked + span { background: var(--primary); }
.pcc-switch input:checked + span:before { transform: translateX(18px); }
.pcc-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
}
.pcc-badge.win {
  background: #dcfce7;
  color: #166534;
}
.pcc-badge.skip {
  background: #fef3c7;
  color: #92400e;
}
#pcc-supplier-products-table .pcc-term-picker {
  min-width: 220px;
  max-width: 360px;
}
#modal-pcc-supplier .pcc-supplier-modal {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}
#modal-pcc-supplier .pcc-supplier-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem 1.25rem 1rem;
}
#modal-pcc-supplier .modal-footer {
  flex: 0 0 auto;
  padding: 0.85rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
  margin-top: 0;
}
#pcc-supplier-products-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
}
.pc-formula-preview {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.45;
  margin-bottom: 0.85rem;
}
.pc-term-picker { position: relative; }
.pc-term-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
  min-height: 0;
}
.pc-term-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 0.2rem 0.45rem 0.2rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
}
.pc-term-chip-x {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0 0.2rem;
}
.pc-term-search {
  width: 100%;
  padding: 0.45rem 0.6rem;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}
.pc-term-search:disabled {
  background: #f8fafc;
  color: #94a3b8;
}
.pc-term-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 220px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
  z-index: 80;
}
.pc-term-option {
  padding: 0.5rem 0.7rem;
  font-size: 0.86rem;
  cursor: pointer;
}
.pc-term-option:hover,
.pc-term-option.selected {
  background: #eff6ff;
  color: #1d4ed8;
}
.pc-term-option.muted {
  color: var(--text-muted);
  cursor: default;
}
.pc-term-dropdown-float {
  z-index: 5000 !important;
}
.tax-check-list {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem;
  background: #f8fafc;
}
.tax-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.38rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  margin: 0;
}
.tax-check:hover { background: #eef2f7; }
.tax-check input { margin: 0; }
.tank-tax-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 0.28rem 0.4rem 0.28rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
}
.tank-tax-chip-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tank-tax-exempt-lab {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.tank-tax-picker .tank-tax-exempt-lab { color: #1e40af; }
.tank-tax-picker .tank-tax-exempt {
  width: 4.2rem;
  padding: 0.15rem 0.3rem;
  font-size: 0.78rem;
  border-radius: 6px;
  border: 1px solid #bfdbfe;
  background: white;
  color: #0f172a;
}
.bill-tax-block {
  padding: 0.55rem 0.15rem 0.15rem;
}
.bill-tax-block > strong {
  display: block;
  font-size: 0.78rem;
  margin-bottom: 0.3rem;
}
.bill-tax-table {
  margin: 0;
}
.bill-tax-table td {
  padding: 0.25rem 0.4rem;
  font-size: 0.8rem;
}
#pc-formula-form,
#pc-rate-form,
#tax-form,
#tax-schedule-form {
  padding: 0.9rem 1.25rem 1.15rem;
}
.status-color-row {
  display: grid;
  grid-template-columns: 1fr 52px 180px 110px;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
}
.status-color-name { font-weight: 600; }
.status-color-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.1rem; }
.status-color-row input[type="color"] {
  width: 48px; height: 32px; padding: 0;
  border: 1px solid var(--border); border-radius: 6px; background: white; cursor: pointer;
}
.status-color-opt { font-size: 0.82rem; color: var(--text); display: flex; align-items: center; gap: 0.35rem; }
.status-color-preview {
  height: 36px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}
.status-color-actions { padding-top: 0.9rem; border-top: 1px solid var(--border); }

.ms-wrap { position: relative; }
.ms-toggle {
  width: 100%;
  text-align: left;
  padding: 0.55rem 2rem 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 0.7rem center;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
}
.ms-toggle.has-value { color: var(--text); }
.ms-toggle.open { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.ms-menu {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15,23,42,0.12);
  max-height: 220px;
  overflow: auto;
  z-index: 50;
  padding: 0.35rem;
}
.ms-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  font-size: 0.88rem;
  cursor: pointer;
}
.ms-option:hover { background: #f1f5f9; }
.ms-empty { padding: 0.7rem; font-size: 0.85rem; color: var(--text-muted); }
.supplier-pins-heading {
  font-size: 1.15rem;
  margin: 0.15rem 0 0.85rem;
}
.supplier-pin-step-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}
.supplier-pin-row label { font-weight: 600; }

.contract-editor {
  padding: 1rem 1.5rem 2rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.contract-header-card,
.contract-details-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.contract-header-card { max-width: 720px; }
.contract-details-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.contract-details-h h2 { font-size: 1.05rem; font-weight: 650; }
.contract-lines-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}
#contract-lines-table {
  width: 100%;
  min-width: 1380px;
  border-collapse: collapse;
  font-size: 0.85rem;
}
#contract-lines-table thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
}
#contract-lines-table tbody td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  background: white;
}
#contract-lines-table tbody tr:last-child td { border-bottom: none; }
#contract-lines-table tbody tr:hover td { background: #fafbfc; }
#contract-lines-table .cl-name { min-width: 150px; }
#contract-lines-table .cl-product { min-width: 160px; }
#contract-lines-table select,
#contract-lines-table input[type="text"],
#contract-lines-table input[type="number"],
#contract-lines-table input[type="date"] {
  width: 100%;
  padding: 0.42rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.85rem;
  background: white;
  color: var(--text);
}
#contract-lines-table select:focus,
#contract-lines-table input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
#contract-lines-table input[type="number"] {
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 96px;
}
#contract-lines-table input[type="number"]:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}
#contract-lines-table input[type="date"] { min-width: 138px; }
#contract-lines-table .cl-remaining {
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  min-width: 90px;
}
#contract-lines-table .cl-type { min-width: 130px; }
#contract-lines-table .cl-pricing-type { min-width: 140px; }
.cl-pricing-wrap {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.cl-pricing-wrap .cl-pricing-type { flex: 1; }
.cl-edit-lowerof, .cl-edit-pricing { color: var(--primary); flex-shrink: 0; }
#contract-lines-table .cl-tcf-picker { min-width: 190px; }
#contract-lines-table .cl-tcf-search { font-size: 0.8rem; }
.lo-info {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  color: #475569;
  font-size: 0.88rem;
  line-height: 1.45;
}
#contract-lines-table .cl-actions { width: 72px; text-align: center; white-space: nowrap; }
#contract-lines-table .cl-del { color: #94a3b8; }
#contract-lines-table .cl-del:hover { color: var(--danger); background: #fef2f2; }
.clickable-row:hover { background: #f8fafc; }

.supply-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
#supply-panel-pricing.supply-panel {
  overflow: visible;
  display: flex;
  flex-direction: column;
}
.supply-overview-inner {
  padding: 1.15rem 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  max-width: 1100px;
}
.month-ov {
  margin: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.35rem 1.15rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.month-ov-h {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.month-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.2rem;
}
.month-ov-h h2 { margin: 0; font-size: 1.25rem; letter-spacing: -0.02em; }
.month-ov-h p { margin: 0.25rem 0 0; color: #64748b; font-size: 0.82rem; }
.month-ov-total { text-align: right; }
.month-ov-num {
  font-size: 1.9rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: #1d4ed8;
  line-height: 1.05;
}
.month-ov-sub { font-size: 0.75rem; color: #64748b; margin-top: 0.25rem; }
.month-legend {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 0.85rem;
}
.month-legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 0.35rem;
  vertical-align: -1px;
}
.month-legend .swatch.used { background: #94a3b8; }
.month-legend .swatch.left { background: #2563eb; }
.month-chart { display: flex; flex-direction: column; gap: 0.7rem; }
.mc-row {
  display: grid;
  grid-template-columns: minmax(7rem, 9.5rem) minmax(0, 1fr) 6.5rem;
  gap: 0.85rem;
  align-items: center;
}
.mc-name {
  font-size: 0.86rem;
  font-weight: 650;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc-bar {
  display: flex;
  height: 16px;
  background: #eef2f7;
  border-radius: 99px;
  overflow: hidden;
  min-width: 0;
}
.month-used { background: #94a3b8; display: block; height: 100%; }
.month-left { background: linear-gradient(90deg, #3b82f6, #2563eb); display: block; height: 100%; }
.mc-stat {
  text-align: right;
  line-height: 1.15;
}
.mc-stat strong {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  color: #0f172a;
}
.mc-stat small { color: #64748b; font-size: 0.72rem; }
.supply-rata-block h3 {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
}
.supply-rata-caption {
  margin: 0 0 0.75rem;
  color: #94a3b8;
  font-size: 0.78rem;
  line-height: 1.45;
}
.supply-snap-grid { display: block; padding: 0; }
.rata-table-wrap {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: white;
}
.rata-table { width: 100%; border-collapse: collapse; }
.rata-table th {
  background: #f8fafc;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  padding: 0.7rem 0.85rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.rata-table th:first-child { text-align: left; }
.rata-table td {
  padding: 0.85rem;
  border-bottom: 1px solid #f1f5f9;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}
.rata-table td:first-child { text-align: left; }
.rata-table tbody tr:hover td { background: #f8fafc; }
.rata-table tbody tr:last-child td { border-bottom: none; }
.supply-snap-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem 0.95rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  cursor: pointer;
}
.supply-snap-card:hover { border-color: #93c5fd; box-shadow: 0 4px 12px rgba(37,99,235,0.08); }
.supply-snap-prod {
  font-weight: 650;
  font-size: 0.92rem;
  color: #334155;
}
.supply-snap-gal {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0.45rem;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}
.supply-snap-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.7rem;
}
.supply-snap-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}
.supply-snap-bar span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
}
.supply-snap-meta {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #64748b;
}

.pricing-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  overflow: visible;
  position: relative;
  z-index: 5;
}
.pricing-nav {
  display: flex;
  gap: 0.25rem;
  background: #e2e8f0;
  padding: 0.2rem;
  border-radius: 8px;
  position: relative;
  overflow: visible;
}
.pricing-nav-btn {
  border: none;
  background: transparent;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #475569;
  cursor: pointer;
  font-weight: 550;
}
.pricing-nav-btn:hover { color: #0f172a; background: rgba(255,255,255,0.55); }
.pricing-nav-btn.active {
  background: white;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15,23,42,0.08);
}
.pricing-nav-drop {
  position: relative;
}
.pricing-nav-caret {
  margin-left: 0.28rem;
  font-size: 0.68em;
  opacity: 0.7;
}
.pricing-nav-drop::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 10px;
}
.pricing-nav-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 228px;
  padding: 0.35rem;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
  z-index: 80;
}
.pricing-nav-drop:hover .pricing-nav-menu,
.pricing-nav-drop:focus-within .pricing-nav-menu,
.pricing-nav-drop.open .pricing-nav-menu {
  display: block;
}
.pricing-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: none;
  background: transparent;
  color: #cbd5e1;
  border-radius: 6px;
  padding: 0.52rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 550;
  cursor: pointer;
  text-align: left;
}
.pricing-nav-item i {
  width: 1rem;
  text-align: center;
  color: #94a3b8;
}
.pricing-nav-item:hover {
  background: #1e293b;
  color: #fff;
}
.pricing-nav-item:hover i { color: #fff; }
.pricing-nav-item.active {
  background: var(--primary);
  color: #fff;
}
.pricing-nav-item.active i { color: #fff; }
.pricing-nav-sep {
  height: 1px;
  background: #334155;
  margin: 0.28rem 0.2rem;
}
.view-pricing-export {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}
.pricing-subpanel {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.pricing-section-h {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  padding: 1rem 1.25rem 0.4rem;
}
.view-pricing-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.25rem 0.25rem;
  font-size: 0.82rem;
  color: #64748b;
}
.view-pricing-filters {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}
.view-combo {
  position: relative;
  min-width: 230px;
  max-width: 340px;
}
.view-combo-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  min-height: 34px;
  padding: 0.2rem 1.7rem 0.2rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.view-combo-box:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.view-combo-box input {
  flex: 1;
  min-width: 7rem;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  padding: 0.18rem 0.25rem;
}
.view-combo-caret {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  padding: 0.2rem;
}
.view-term-chips {
  display: contents;
}
.view-term-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
  border-radius: 999px;
  padding: 0.12rem 0.45rem 0.12rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
}
.view-term-chip i { font-size: 0.65rem; opacity: 0.7; }
.view-term-chip:hover { background: #dbeafe; }
.view-term-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 260px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15,23,42,0.12);
  z-index: 40;
}
.view-term-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.45rem 0.65rem;
  font-size: 0.84rem;
  color: var(--text);
  cursor: pointer;
}
.view-term-menu button:hover,
.view-term-menu button.active { background: #eff6ff; }
.view-term-menu .empty { padding: 0.55rem 0.65rem; color: #94a3b8; font-size: 0.8rem; }
.rack-compare-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 0.75rem;
}
.rack-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 900px) {
  .rack-compare-grid { grid-template-columns: 1fr; }
}
.rack-compare-col {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.rack-compare-col h4 {
  margin: 0;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  color: #0f172a;
}
.rack-compare-col table { box-shadow: none; border-radius: 0; }
.view-pricing-asof {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.view-pricing-asof .datetime-pair { margin: 0; }
.view-price-asof-note {
  margin: 0.55rem 1.25rem 0.15rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 0.86rem;
  font-weight: 600;
}
.view-price-asof-note.future {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e40af;
}
tr.price-not-live td,
tr.rack-best.price-not-live td {
  background: #fffaf3;
}
tr.price-not-live td:first-child {
  box-shadow: inset 3px 0 0 #fdba74;
}
tr.price-not-live.future td,
tr.rack-best.price-not-live.future td {
  background: #f8fbff;
}
tr.price-not-live.future td:first-child {
  box-shadow: inset 3px 0 0 #93c5fd;
}
tr.price-not-live:hover td { background: #fff7ed; }
tr.price-not-live.future:hover td { background: #eff6ff; }
tr.rack-best td { background: #ecfdf5; }
.rack-delta { color: #64748b; font-variant-numeric: tabular-nums; }
.rack-delta.up { color: #b45309; }
.rack-price-wrap {
  padding: 0.75rem 1.5rem 1.5rem;
  max-width: 1100px;
}
.rack-grid-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.rack-grid { width: 100%; border-collapse: collapse; min-width: 520px; background: white; }
.rack-grid th, .rack-grid td {
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 0.55rem;
  font-size: 0.85rem;
  text-align: left;
}
.rack-grid thead th {
  background: #f8fafc;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  position: sticky;
  top: 0;
}
.rack-grid th:first-child, .rack-grid td:first-child {
  position: sticky;
  left: 0;
  background: white;
  min-width: 150px;
  font-weight: 600;
  z-index: 1;
}
.rack-grid thead th:first-child { background: #f8fafc; z-index: 2; }
.rack-grid .rack-cell {
  width: 110px;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

.tcf-page {
  padding: 1.25rem 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 100%;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 120px, #f8fafc 100%);
}
.tcf-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.25rem;
  flex-wrap: wrap;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.35rem 1.5rem 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.tcf-hero h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}
.tcf-hero p {
  margin: 0;
  max-width: 46rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.tcf-hero-controls {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.tcf-hero-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
.tcf-hero-controls input {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  min-width: 150px;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
}
.tcf-notes-field { min-width: 200px; flex: 1; }
.tcf-notes-field input { min-width: 200px; width: 100%; }
.tcf-hero-controls .btn { height: 42px; padding: 0 1.1rem; white-space: nowrap; }

.tcf-wizard-modal { max-width: 760px; overflow: visible; padding-bottom: 0.5rem; }
.tcf-wizard-modal .modal-header { padding: 1.15rem 1.6rem 0.85rem; }
.tcf-wiz-steps {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 1.75rem 0.85rem;
}
.tcf-wiz-step {
  font-size: 0.8rem;
  font-weight: 650;
  color: #94a3b8;
}
.tcf-wiz-step.active { color: var(--primary); }
.tcf-wiz-line {
  flex: 1;
  height: 2px;
  background: #e2e8f0;
  max-width: 80px;
}
.tcf-wiz-lead {
  margin: 0 1.75rem 1.15rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}
#tcf-wiz-step-1, #tcf-wiz-step-2,
#lo-step-1, #lo-step-2,
#diff-step-1, #diff-step-2,
#rack-step-1 { padding: 0.5rem 1.75rem 1.4rem; }
.tcf-wizard-modal .modal-footer { padding: 0.85rem 0 0.15rem; }
.tcf-wizard-modal .form-row { margin-bottom: 1.05rem; }
.tcf-wiz-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.3rem;
}
.tcf-wiz-label-row label { margin: 0; }
.link-plain {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.link-plain:hover { text-decoration: underline; }
.tcf-wiz-cards {
  max-height: 52vh;
  overflow: auto;
  padding-bottom: 0.25rem;
}
#modal-tcf-wizard .form-row { margin-bottom: 0.95rem; }
.tcf-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.tcf-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.tcf-card header {
  padding: 0.9rem 1.1rem 0.8rem;
  border-bottom: 1px solid #eef2f7;
  background: #f8fafc;
}
.tcf-card header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.tcf-card header span {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  min-height: 1em;
}
.tcf-card-rows { padding: 0.35rem 0.35rem 0.5rem; }
.tcf-row {
  display: grid;
  grid-template-columns: 1fr 108px 1.1rem;
  gap: 0.55rem;
  align-items: center;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
}
.tcf-row:hover { background: #f8fafc; }
.tcf-prod { display: flex; flex-direction: column; min-width: 0; }
.tcf-prod strong { font-size: 0.9rem; font-weight: 600; }
.tcf-prod em {
  font-style: normal;
  font-size: 0.72rem;
  color: #94a3b8;
}
.tcf-row .tcf-cell {
  width: 100%;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  background: white;
}
.tcf-row .tcf-cell:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.tcf-saved {
  color: #16a34a;
  font-size: 0.75rem;
  width: 1.1rem;
  text-align: center;
}
.tcf-empty {
  grid-column: 1 / -1;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
  background: white;
  border: 1px dashed var(--border);
  border-radius: 14px;
}
.supplier-modal { max-width: 520px; overflow: visible; }
#supplier-step-info,
#supplier-step-pins { padding: 1.25rem; }

.billing-layout {
  display: flex;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.billing-queue {
  width: 300px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.billing-tabs { padding: 0.65rem 0.65rem 0; }
.billing-queue .search-box { width: auto; }
.billing-queue-list {
  flex: 1;
  overflow: auto;
  padding: 0.35rem 0.5rem 0.75rem;
}
.bill-q-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  margin-bottom: 0.45rem;
  cursor: pointer;
  color: inherit;
}
.bill-q-item:hover { border-color: #93c5fd; }
.bill-q-item.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
.bill-q-item strong { font-size: 0.88rem; }
.bill-q-item span { font-size: 0.75rem; color: #64748b; }
.billing-sheet {
  flex: 1;
  min-width: 0;
  overflow: auto;
  background: var(--bg);
}
.bill-sheet-inner {
  padding: 1.15rem 1.4rem 1.75rem;
  max-width: 1100px;
}
.bill-sheet-h {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.bill-sheet-h h2 { margin: 0 0 0.2rem; font-size: 1.25rem; }
.bill-sheet-h p { margin: 0; font-size: 0.85rem; color: #475569; }
.bill-muted { font-size: 0.75rem; color: #64748b; }
.bill-sec-h { margin: 1.1rem 0 0.5rem; font-size: 0.92rem; }
.bill-sec-h-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.1rem;
}
.bill-sec-h-row .bill-sec-h { margin: 0; }
.bill-table-wrap {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
}
.bill-table { width: 100%; border-collapse: collapse; }
.bill-table th {
  background: #f8fafc;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  padding: 0.55rem 0.7rem;
  text-align: left;
}
.bill-table td { padding: 0.55rem 0.7rem; border-top: 1px solid #f1f5f9; vertical-align: top; }
.bill-table input, .bill-table select {
  width: 100%;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}
.bill-src { font-size: 0.68rem; color: #64748b; margin-top: 0.2rem; }
.bill-ext { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.bill-totals-row {
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}
.bill-totals {
  margin-top: 0;
  margin-left: 0;
  width: min(300px, 100%);
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  overflow: visible;
}
.bill-totals h4 {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}
.bill-totals-cost {
  background: #f1f5f9;
  border-color: #dbe3ee;
  color: #64748b;
}
.bill-totals-cost h4,
.bill-totals-cost div,
.bill-totals-cost strong {
  color: #64748b;
}
.bill-totals-cost .bill-grand {
  color: #475569;
  border-top-color: #dbe3ee;
}
.bill-totals-price h4 {
  color: #1d4ed8;
}
.bill-tax-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 0.35rem;
  border-radius: 50%;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  padding: 0;
  cursor: default;
  position: relative;
  vertical-align: middle;
  z-index: 2;
}
.bill-totals .bill-tax-tip,
.bill-totals div .bill-tax-tip,
.bill-totals-cost .bill-tax-tip {
  display: none;
  position: absolute;
  right: 0;
  left: auto;
  bottom: calc(100% + 10px);
  transform: none;
  min-width: 220px;
  max-width: 280px;
  background: #0f172a;
  color: #ffffff;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  font-size: 0.84rem;
  font-style: normal;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.4;
  z-index: 80;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
  text-align: left;
  white-space: normal;
}
.bill-totals .bill-tax-tip::after,
.bill-totals div .bill-tax-tip::after {
  content: "";
  position: absolute;
  right: 8px;
  left: auto;
  top: 100%;
  transform: none;
  border: 6px solid transparent;
  border-top-color: #0f172a;
}
.bill-tax-info:hover .bill-tax-tip,
.bill-tax-info:focus .bill-tax-tip {
  display: block;
}
.bill-totals .bill-tax-tip-row,
.bill-totals div .bill-tax-tip-row {
  display: flex;
  justify-content: space-between;
  gap: 1.1rem;
  padding: 0.18rem 0;
  color: #ffffff;
}
.bill-totals .bill-tax-tip-row span,
.bill-totals div .bill-tax-tip span {
  color: #ffffff;
}
.bill-totals div {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.88rem;
  color: #475569;
}
.bill-totals .bill-tax-tip,
.bill-totals div .bill-tax-tip,
.bill-totals-cost .bill-tax-tip,
.bill-totals-price .bill-tax-tip {
  color: #ffffff !important;
  background: #0f172a !important;
}
.bill-totals .bill-tax-tip span,
.bill-totals div .bill-tax-tip span,
.bill-totals-cost .bill-tax-tip span,
.bill-totals-price .bill-tax-tip span {
  color: #ffffff !important;
}
.bill-totals .bill-grand {
  border-top: 1px solid var(--border);
  margin-top: 0.35rem;
  padding-top: 0.5rem;
  font-size: 1rem;
  color: var(--text);
}
.bill-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.bill-product-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.bill-product-card > .bill-table { border-radius: 0; box-shadow: none; }
.bill-bols {
  background: #f8fafc;
  border-top: 1px solid var(--border);
  padding: 0.7rem 0.75rem 0.85rem;
}
.bill-bols-h {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}
.bill-bols-h strong {
  font-size: 0.82rem;
  color: #0f172a;
}
.bill-bols-h .bill-add-bol { margin-left: auto; }
.bill-bols-sum { font-size: 0.75rem; color: #64748b; }
.bill-bols-sum.warn { color: #b45309; font-weight: 600; }
.bill-bol-table {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.bill-bol-table th:nth-child(1),
.bill-bol-table td:nth-child(1) { width: 8.5rem; }
.bill-bol-table th:nth-child(3),
.bill-bol-table td:nth-child(3),
.bill-bol-table th:nth-child(4),
.bill-bol-table td:nth-child(4) { width: 7.5rem; }
.bill-bol-table th:nth-child(5),
.bill-bol-table td:nth-child(5) { width: 6.5rem; }
.bill-bol-table th:last-child,
.bill-bol-table td:last-child { width: 38px; padding-left: 0.25rem; padding-right: 0.35rem; }
.bill-bol-empty td { color: #94a3b8; font-size: 0.82rem; }
.bill-help {
  margin: -0.15rem 0 0.7rem;
  font-size: 0.8rem;
  color: #64748b;
  max-width: 46rem;
}
.email-import-wrap { max-width: 1080px; }
.email-import-wrap.drag .email-drop,
.email-drop.drag { border-color: var(--primary); background: #eff6ff; }
.email-drop {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #fff;
  padding: 0.65rem;
  margin: 0.35rem 0 0.85rem;
}
.email-drop.drag { border-color: var(--primary); background: #eff6ff; }
.email-drop textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
  min-height: 9rem;
}
.email-drop-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.55rem;
  flex-wrap: wrap;
}
.email-import-stats {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0 0 0.55rem;
}
.email-row-warn td { background: #fff7ed; }

.email-field-map {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem 1rem;
  margin: 0 0 0.85rem;
}
.email-field-map h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}
.email-field-lead {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0 0 0.65rem;
  line-height: 1.45;
}
.em-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  align-items: center;
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
}
.email-hl {
  margin: 0;
  max-height: 22rem;
  overflow: auto;
  padding: 0.7rem 0.8rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
  user-select: text;
  cursor: text;
}
.em-chip {
  display: inline;
  border-radius: 4px;
  padding: 0.05rem 0.18rem;
  cursor: pointer;
  font-weight: 600;
}
.em-chip.product { background: #dcfce7; color: #166534; }
.em-chip.terminal { background: #dbeafe; color: #1d4ed8; }
.em-chip.date, .em-chip.time { background: #fef3c7; color: #92400e; }
.em-chip.price { background: #fef9c3; color: #854d0e; cursor: default; font-weight: 500; }
.em-chip.skip {
  background: #e2e8f0;
  color: #64748b;
  text-decoration: line-through;
  font-weight: 500;
}
.email-map-pop {
  position: fixed;
  z-index: 80;
  width: 280px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  padding: 0.75rem 0.85rem 0.8rem;
}
.email-map-pop-raw {
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0 0 0.55rem;
  word-break: break-word;
}
.email-map-pop label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  margin: 0 0 0.2rem;
}
.email-map-pop select {
  width: 100%;
  margin-bottom: 0.5rem;
}
.email-map-pop-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.cheat-modal { max-width: 980px; }
.cheat-sheet-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}
.cheat-sheet-bar h3 { margin: 0; font-size: 0.95rem; flex: 1; }
.cheat-sheet-bar select { max-width: 220px; }
.cheat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
@media (max-width: 900px) {
  .cheat-grid { grid-template-columns: 1fr; }
}

#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
#login-overlay[hidden] { display: none !important; }
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 12px;
  padding: 1.6rem 1.5rem 1.4rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.login-brand {
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 0.85rem;
}
.login-card h1 {
  font-size: 1.35rem;
  margin: 0 0 0.35rem;
}
.login-error {
  color: #b91c1c;
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}
body.login-lock #app { visibility: hidden; pointer-events: none; }

.data-download-list { margin-top: 0.65rem; }
.data-download-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--border);
}
.data-download-row:first-child { border-top: 0; padding-top: 0.15rem; }
.data-download-row .btn { flex-shrink: 0; text-decoration: none; }
