/* LogiFlow Design System – Styles.css */
  /* ═══════════════════════════════════════════════════════════
   LogiFlow Design System  –  Styles.html
   Based on DESIGN.md  ·  Inter font  ·  Material 3-inspired
═══════════════════════════════════════════════════════════ */

  /* ── Design Tokens ────────────────────────────────────────── */
  :root {
    --primary: #091426;
    --primary-light: #1e293b;
    --secondary: #0058be;
    --secondary-hover: #2170e4;
    --surface: #fbf8fa;
    --surface-low: #f5f3f4;
    --surface-mid: #f0edef;
    --surface-high: #eae7e9;
    --surface-white: #ffffff;
    --border: #c5c6cd;
    --border-light: #e4e2e3;
    --text-on: #1b1b1d;
    --text-sub: #45474c;
    --text-muted: #75777d;
    --error: #ba1a1a;
    --error-bg: #ffdad6;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --info: #0058be;
    --info-bg: #d8e2ff;
    --purple: #7c3aed;
    --purple-bg: #ede9fe;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .07), 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .08), 0 2px 4px rgba(0, 0, 0, .05);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, .12), 0 4px 10px rgba(0, 0, 0, .06);
    --sidebar-w: 248px;
    --topbar-h: 60px;
    --r: 8px;
    --r-sm: 5px;
    --r-lg: 12px;
    --ease: 0.15s ease;
  }

  /* ── Reset ────────────────────────────────────────────────── */
  *,
  *::before,
  *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  body {
    font-family: 'Inter', 'Noto Sans Thai', -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text-on);
    background: var(--surface);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
  }

  button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
  }

  input,
  select,
  textarea {
    font-family: inherit;
    font-size: 14px;
  }

  table {
    border-collapse: collapse;
    width: 100%;
  }

  a {
    text-decoration: none;
    color: inherit;
  }

  /* ── App Layout ───────────────────────────────────────────── */
  .app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
  }

  /* ── Sidebar ──────────────────────────────────────────────── */
  .sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .sidebar-header {
    padding: 20px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
  }

  .sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .sidebar-logo-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2170e4, #0058be);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
  }

  .sidebar-brand {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1;
  }

  .sidebar-ver {
    font-size: 10px;
    color: rgba(255, 255, 255, .38);
    margin-top: 3px;
    letter-spacing: .04em;
  }

  .sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .sidebar-nav::-webkit-scrollbar {
    width: 4px;
  }

  .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .1);
    border-radius: 2px;
  }

  .sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--r);
    color: rgba(255, 255, 255, .55);
    transition: all var(--ease);
    width: 100%;
    text-align: left;
  }

  .sidebar-item:hover {
    background: rgba(255, 255, 255, .07);
    color: rgba(255, 255, 255, .9);
  }

  .sidebar-item--active {
    background: rgba(33, 112, 228, .22);
    color: #fff;
    border-left: 3px solid #adc6ff;
    padding-left: 9px;
  }

  .sidebar-icon {
    font-size: 20px;
    flex-shrink: 0;
  }

  .sidebar-item-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .sidebar-item-label {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
  }

  .sidebar-item-sub {
    font-size: 10px;
    opacity: .55;
    font-weight: 400;
  }

  .sidebar-footer {
    padding: 10px 14px 14px;
    border-top: 1px solid rgba(255, 255, 255, .08);
  }

  .sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2170e4, #0058be);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
  }

  .sidebar-uname {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
  }

  .sidebar-urole {
    font-size: 10px;
    color: rgba(255, 255, 255, .38);
    text-transform: uppercase;
    letter-spacing: .05em;
  }

  /* ── Main Container ───────────────────────────────────────── */
  .main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* ── Topbar ───────────────────────────────────────────────── */
  .topbar {
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--surface-white);
    border-bottom: 1px solid var(--border-light);
    z-index: 5;
  }

  .topbar-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
  }

  .topbar-l,
  .topbar-r {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .topbar-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    transition: all var(--ease);
  }

  .topbar-btn:hover {
    background: var(--surface-mid);
    color: var(--text-on);
  }

  .topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--r);
    background: var(--surface-low);
    border: 1px solid var(--border-light);
  }

  .topbar-user-email {
    font-size: 12px;
    color: var(--text-sub);
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ── Page Content ─────────────────────────────────────────── */
  .page-content {
    flex: 1;
    overflow-y: auto;
    background: var(--surface);
  }

  .page-content::-webkit-scrollbar {
    width: 6px;
  }

  .page-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
  }

  .page {
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  /* ── Loading / Error States ───────────────────────────────── */
  .app-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
  }

  .loading-logo {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #2170e4, #0058be);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 8px 24px rgba(33, 112, 228, .35);
  }

  .page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60vh;
  }

  .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-light);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
  }

  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }

  .error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 50vh;
    gap: 12px;
    color: var(--error);
    text-align: center;
  }

  .error-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
    text-align: center;
    padding: 24px;
  }

  .error-msg {
    color: var(--error);
    font-size: 13px;
    padding: 10px 14px;
    background: var(--error-bg);
    border-radius: var(--r-sm);
  }

  /* ── Cards ────────────────────────────────────────────────── */
  .card {
    background: var(--surface-white);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }

  .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
    flex-wrap: wrap;
  }

  .card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
  }

  /* ── Stats Grid ───────────────────────────────────────────── */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  @media (max-width:1200px) {
    .stats-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  .stat-card {
    background: var(--surface-white);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--ease);
  }

  .stat-card:hover {
    box-shadow: var(--shadow-md);
  }

  .stat-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
  }

  .stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
  }

  .stat-sub {
    font-size: 11px;
    color: var(--text-muted);
  }

  /* ── Dashboard Grid ───────────────────────────────────────── */
  .dash-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 20px;
  }

  @media (max-width:1280px) {
    .dash-grid {
      grid-template-columns: 1fr;
    }
  }

  /* ── Tables (Compacted Safe Version) ──────────────────────── */
  .table-wrap {
    overflow-x: auto;
  }

  .data-table {
    width: 100%;
    border-collapse: collapse;
  }

  .data-table th {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    background: var(--surface-low);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
    text-align: left;
  }

  .data-table th.sortable {
    cursor: pointer;
    transition: background var(--ease);
  }

  .data-table th.sortable:hover {
    background: var(--surface-mid);
  }

  .th-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    user-select: none;
  }

  .th-sort-icon {
    font-size: 13px;
    opacity: 0.3;
    transition: opacity var(--ease);
    font-weight: normal;
  }

  .th-sort-icon.active {
    opacity: 1;
    color: var(--secondary);
    font-weight: bold;
  }

  .th-filter-input {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 500;
    border: 1px solid var(--border-light);
    border-radius: var(--r-sm);
    background: var(--surface-white);
    color: var(--text-on);
    outline: none;
    transition: all var(--ease);
    box-sizing: border-box;
    text-transform: none;
    letter-spacing: normal;
  }

  .th-filter-input::placeholder {
    color: var(--text-muted);
    font-weight: normal;
  }

  .th-filter-input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 2px rgba(0, 88, 190, .15);
    opacity: 1;
  }

  .sorted-column-td {
    background-color: rgba(33, 112, 228, 0.02) !important;
  }

  /* เนื้อหาตารางมาตรฐานเวอร์ชัน Compacted */
  .data-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    font-size: 12px;
    line-height: 1.3;
  }

  .trow {
    transition: background var(--ease);
  }

  .trow:hover {
    background: var(--surface-low);
  }

  .trow:last-child td {
    border-bottom: none;
  }

  .tid {
    font-size: 12px;
    font-weight: 700;
    color: var(--secondary);
    cursor: pointer;
    white-space: nowrap;
  }

  .tid:hover {
    text-decoration: underline;
  }

  .empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 48px 16px !important;
    font-size: 12px;
  }

  /* ควบคุมขนาดสัดส่วนข้อมูลรองเฉพาะเจาะจงภายในตาราง */
  .t-sm {
    font-size: 11px !important;
  }

  .data-table td span,
  .t-muted {
    font-size: 10px !important;
  }

  .data-table .badge {
    font-size: 10px;
    padding: 2px 6px;
  }

  .data-table .material-symbols-outlined {
    font-size: 15px !important;
  }

  /* ── Badges ───────────────────────────────────────────────── */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
  }

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

  .badge--closed {
    background: #f1f5f9;
    color: #475569;
  }

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

  .badge--draft {
    background: #fef3c7;
    color: #92400e;
  }

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

  .badge--warning {
    background: #fef3c7;
    color: #92400e;
  }

  .badge--primary {
    background: #d8e2ff;
    color: #001a42;
  }

  .badge--arriving {
    background: #ede9fe;
    color: #4c1d95;
  }

  .badge--export {
    background: #d8e2ff;
    color: #001a42;
  }

  .badge--import {
    background: #fadfb8;
    color: #271902;
  }

  .badge--neutral {
    background: var(--surface-high);
    color: var(--text-sub);
  }

  /* ── Buttons ──────────────────────────────────────────────── */
  .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--r);
    font-size: 13px;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    transition: all var(--ease);
    white-space: nowrap;
  }

  .btn-primary:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow-sm);
  }

  .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--r);
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    color: var(--secondary);
    border: 1.5px solid var(--secondary);
    transition: all var(--ease);
    white-space: nowrap;
  }

  .btn-secondary:hover {
    background: var(--info-bg);
  }

  .btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--r);
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    color: var(--text-sub);
    transition: all var(--ease);
  }

  .btn-ghost:hover {
    background: var(--surface-mid);
    color: var(--text-on);
  }

  .btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--r);
    font-size: 13px;
    font-weight: 600;
    background: var(--error);
    color: #fff;
    transition: all var(--ease);
  }

  .btn-danger:hover {
    background: #991b1b;
  }

  .btn-icon {
    width: 30px;
    height: 30px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    transition: all var(--ease);
    flex-shrink: 0;
  }

  .btn-icon:hover {
    background: var(--surface-mid);
    color: var(--text-on);
  }

  .btn-icon--danger:hover {
    background: var(--error-bg);
    color: var(--error);
  }

  .btn-icon .material-symbols-outlined,
  .btn-primary .material-symbols-outlined,
  .btn-secondary .material-symbols-outlined,
  .btn-ghost .material-symbols-outlined,
  .btn-danger .material-symbols-outlined {
    font-size: 16px;
  }

  .action-btns {
    display: flex;
    gap: 4px;
  }

  /* ── Filter Bar ───────────────────────────────────────────── */
  .filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }

  .f-select {
    padding: 7px 28px 7px 10px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--r);
    background: var(--surface-white);
    color: var(--text-on);
    font-size: 13px;
    cursor: pointer;
    transition: border-color var(--ease);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2375777d' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
  }

  .f-select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(0, 88, 190, .1);
  }

  .search-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 380px;
  }

  .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
    pointer-events: none;
  }

  .search-input {
    width: 100%;
    padding: 7px 12px 7px 36px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--r);
    background: var(--surface-white);
    color: var(--text-on);
    font-size: 13px;
    transition: border-color var(--ease);
  }

  .search-input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(0, 88, 190, .1);
  }

  .search-input::placeholder {
    color: var(--text-muted);
  }

  /* ── Forms ────────────────────────────────────────────────── */
  .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .fgroup {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .fgroup--full {
    grid-column: 1/-1;
  }

  .flabel {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: .04em;
  }

  .fctrl {
    padding: 9px 12px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--r);
    font-size: 13px;
    color: var(--text-on);
    background: var(--surface-white);
    transition: border-color var(--ease), box-shadow var(--ease);
    width: 100%;
  }

  .fctrl:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(0, 88, 190, .1);
  }

  .fctrl::placeholder {
    color: var(--text-muted);
  }

  select.fctrl {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2375777d' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
  }

  textarea.fctrl {
    resize: vertical;
    min-height: 64px;
  }

  /* ── Modal ────────────────────────────────────────────────── */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 20, 38, .55);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    backdrop-filter: blur(3px);
  }

  .modal-overlay--open {
    opacity: 1;
    pointer-events: all;
  }

  .modal {
    background: var(--surface-white);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 660px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(10px) scale(.98);
    transition: transform .2s ease;
  }

  .modal-overlay--open .modal {
    transform: translateY(0) scale(1);
  }

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

  .modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
  }

  .modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--ease);
  }

  .modal-close:hover {
    background: var(--surface-mid);
    color: var(--text-on);
  }

  .modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
  }

  .modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--surface-low);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
  }

  /* ── Drawer (right-side panel) ────────────────────────────── */
  .drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 20, 38, .4);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    backdrop-filter: blur(2px);
  }

  .drawer-overlay--open {
    opacity: 1;
    pointer-events: all;
  }

  .drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 500px;
    max-width: 92vw;
    background: var(--surface-white);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .25s ease;
  }

  .drawer-overlay--open .drawer {
    transform: translateX(0);
  }

  .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
  }

  .drawer-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
  }

  .drawer-body {
    flex: 1;
    overflow-y: auto;
  }

  .drawer-body::-webkit-scrollbar {
    width: 4px;
  }

  .drawer-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
  }

  /* ── Shipment Detail (in drawer) ──────────────────────────── */
  .detail-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
  }

  .detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .dlabel {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
  }

  .dvalue {
    font-size: 13px;
    color: var(--text-on);
    font-weight: 500;
  }

  .detail-notes {
    margin-top: 12px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    color: var(--text-sub);
    background: var(--surface-low);
    padding: 8px 12px;
    border-radius: var(--r-sm);
  }

  .section-hd {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-bottom: 12px;
  }

  .detail-actions {
    padding: 16px 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--surface-low);
  }

  /* ── Freight Stages ───────────────────────────────────────── */
  .stages-list {
    display: flex;
    flex-direction: column;
  }

  .stage-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
  }

  .stage-item:last-child {
    border-bottom: none;
  }

  .stage-item--done .stage-name {
    color: var(--text-muted);
    text-decoration: line-through;
  }

  .stage-cb {
    color: var(--border);
    transition: color var(--ease), transform var(--ease);
    flex-shrink: 0;
    padding: 4px;
    border-radius: 4px;
  }

  .stage-cb:hover {
    transform: scale(1.15);
  }

  .stage-cb--done {
    color: var(--success);
  }

  .stage-cb .material-symbols-outlined {
    font-size: 24px;
  }

  .stage-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
  }

  .stage-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-on);
  }

  .stage-date {
    font-size: 11px;
    color: var(--text-muted);
  }

  /* ── Finance ──────────────────────────────────────────────── */
  .fin-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
  }

  .fin-mini:last-child {
    border-bottom: none;
  }

  .fin-mini-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
  }

  .fin-mini-val {
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }

  .fc-revenue {
    color: var(--secondary);
  }

  .fc-cost {
    color: var(--warning);
  }

  .fc-margin {
    color: var(--success);
  }

  .fin-totals {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
  }

  .fin-total-item {
    font-size: 13px;
    color: var(--text-sub);
  }

  /* ── Tab Group ────────────────────────────────────────────── */
  .tab-group {
    display: flex;
    gap: 3px;
    background: var(--surface-low);
    border: 1px solid var(--border-light);
    border-radius: var(--r);
    padding: 3px;
  }

  .tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: var(--r-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    transition: all var(--ease);
  }

  .tab-btn:hover {
    background: var(--surface-white);
    color: var(--text-on);
  }

  .tab-btn--active {
    background: var(--surface-white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
  }

  .tab-btn .material-symbols-outlined {
    font-size: 16px;
  }

  /* ── Toast ────────────────────────────────────────────────── */
  .toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface-white);
    border: 1px solid var(--border-light);
    border-radius: var(--r);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-on);
    min-width: 260px;
    max-width: 400px;
    transform: translateX(110%);
    transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
  }

  .toast--show {
    transform: translateX(0);
  }

  .toast-close {
    margin-left: auto;
    color: var(--text-muted);
    padding: 2px;
    border-radius: 4px;
    flex-shrink: 0;
  }

  .toast-close:hover {
    background: var(--surface-mid);
  }

  /* ── Misc Utilities ───────────────────────────────────────── */
  .t-on {
    color: var(--text-on);
  }

  .t-sub {
    color: var(--text-sub);
  }

  .t-muted {
    color: var(--text-muted);
  }

  .t-bold {
    font-weight: 700;
  }

  .t-sm {
    font-size: 12px;
  }

  .t-ok {
    color: var(--success);
  }

  .t-err {
    color: var(--error);
  }

  .divider {
    border: none;
    border-top: 1px solid var(--border-light);
  }

  .flex-1 {
    flex: 1;
  }

  /* ── Operation Milestone Tracker ─────────────────────────── */
  .ms-group {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .ms-row-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 72px;
    flex-shrink: 0;
  }

  .ms-track {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
  }

  .ms-step {
    display: flex;
    align-items: center;
    position: relative;
  }

  .ms-bubble {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--surface-mid);
    border: 2px solid var(--border-light);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--ease), border-color var(--ease);
  }

  .ms-step--done .ms-bubble {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
  }

  .ms-label {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    margin: 0 3px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--ease);
  }

  .ms-step--done .ms-label {
    color: var(--success);
    font-weight: 600;
  }

  .ms-line {
    width: 20px;
    height: 2px;
    background: var(--border-light);
    flex-shrink: 0;
    margin: 0 1px;
  }

  .ms-step--done+.ms-step .ms-line,
  .ms-step--done .ms-line {
    background: var(--success);
    opacity: 0.5;
  }

  /* ── Multi-Select Checkbox Box ─────────────────────────────── */
  .multi-select-box {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px;
    max-height: 180px;
    overflow-y: auto;
    background: var(--surface-white);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
  }

  .multi-select-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-on);
    transition: background 0.15s;
    user-select: none;
  }

  .multi-select-item:hover {
    background: var(--surface-low);
  }

  .multi-select-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--secondary);
    cursor: pointer;
    flex-shrink: 0;
  }

  .multi-select-item:has(input:checked) {
    background: var(--info-bg);
    color: var(--secondary);
    font-weight: 600;
  }

  /* --- Modern Toggle Switch --- */
  .switch-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-white);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    margin-bottom: 8px;
  }

  .switch-label-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .switch-label-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-on);
  }

  .switch-label-desc {
    font-size: 11px;
    color: var(--text-muted);
  }

  .switch-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
  }

  .switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  .switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: .2s ease-in-out;
    border-radius: 24px;
  }

  .switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s ease-in-out;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  }

  .switch-toggle input:checked+.switch-slider {
    background-color: var(--secondary);
  }

  .switch-toggle input:checked+.switch-slider:before {
    transform: translateX(16px);
  }