:root {
      --bg: #eef3f6;
      --panel: #ffffff;
      --panel-soft: #f8fbfc;
      --ink: #172129;
      --muted: #62717d;
      --line: #d9e3e8;
      --line-strong: #c5d2d8;
      --teal: #0f766e;
      --teal-dark: #0d514f;
      --teal-weak: #e2f2ef;
      --gold: #a76105;
      --gold-weak: #fff3d8;
      --red: #b4232f;
      --red-weak: #fde8ea;
      --green: #257a49;
      --green-weak: #e7f5ec;
      --blue: #286da8;
      --blue-weak: #e6f1fb;
      --shadow: 0 14px 34px rgba(23, 33, 41, .08);
      --shadow-soft: 0 1px 2px rgba(23, 33, 41, .06);
    }

    * { box-sizing: border-box; }

    [hidden] { display: none !important; }

    body {
      margin: 0;
      font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
      color: var(--ink);
      background:
        linear-gradient(180deg, #f7fafb 0, var(--bg) 260px),
        var(--bg);
      letter-spacing: 0;
    }

    button, input, select, textarea {
      font: inherit;
    }

    .app {
      min-height: 100vh;
      display: grid;
      grid-template-columns: 252px minmax(0, 1fr);
    }

    aside {
      background: #132128;
      color: #f7fbfc;
      padding: 20px 14px;
      position: sticky;
      top: 0;
      height: 100vh;
      overflow-y: auto;
      border-right: 1px solid rgba(255,255,255,.08);
      box-shadow: 8px 0 28px rgba(23, 33, 41, .08);
    }

    aside nav {
      max-height: calc(100vh - 150px);
      overflow-y: auto;
      padding-right: 2px;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 4px 8px 18px;
      border-bottom: 1px solid rgba(255,255,255,.12);
      margin-bottom: 18px;
    }

    .brand-mark {
      width: 66px;
      height: 66px;
      border-radius: 8px;
      display: block;
      background: transparent;
      padding: 0;
      object-fit: contain;
      box-shadow: 0 8px 18px rgba(0,0,0,.18);
      flex: 0 0 auto;
    }

    .brand h1 {
      margin: 0;
      font-size: 18px;
      line-height: 1.25;
      font-weight: 700;
    }

    .brand span {
      color: #adc0c8;
      font-size: 12px;
    }

    .settings-shortcuts {
      margin-bottom: 16px;
    }

    .settings-nav {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
    }

    .settings-panel-wrap {
      display: block;
    }

    .section-subhead {
      margin-top: 18px;
      padding-top: 14px;
      border-top: 1px solid var(--line);
    }

    #settingsAccounts,
    #settingsStores,
    #settingsProducts,
    #settingsSpecsBuckets,
    #settingsTicketTemplates {
      scroll-margin-top: 18px;
    }

    nav {
      display: grid;
      gap: 5px;
    }

    .nav-btn {
      width: 100%;
      min-height: 44px;
      border: 0;
      border-radius: 8px;
      background: transparent;
      color: #d7e2e6;
      text-align: left;
      padding: 0 12px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 10px;
      transition: background .16s ease, color .16s ease, transform .16s ease;
    }

    .nav-btn:hover {
      background: rgba(255,255,255,.08);
      color: white;
    }

    .nav-btn.active {
      background: #eaf7f5;
      color: #0e514e;
      box-shadow: var(--shadow-soft);
    }

    .icon {
      width: 22px;
      height: 22px;
      display: inline-grid;
      place-items: center;
      border-radius: 6px;
      background: rgba(255,255,255,.1);
      font-size: 13px;
      font-weight: 700;
      flex: 0 0 auto;
    }

    .nav-btn.active .icon {
      background: var(--teal);
      color: #fff;
    }

    main {
      min-width: 0;
      padding: 24px 28px 38px;
    }

    .topbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 18px;
      margin-bottom: 18px;
      padding: 16px 18px;
      background: rgba(255,255,255,.86);
      border: 1px solid rgba(217, 227, 232, .9);
      border-radius: 8px;
      box-shadow: var(--shadow-soft);
      backdrop-filter: blur(10px);
    }

    .title h2 {
      margin: 0 0 5px;
      font-size: 25px;
      line-height: 1.25;
      letter-spacing: 0;
      font-weight: 800;
    }

    .title p {
      margin: 0;
      color: var(--muted);
      font-size: 14px;
    }

    .toolbar {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .toolbar:empty {
      display: none;
    }

    .user-switch {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 8px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-soft);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
    }

    .user-switch label {
      color: var(--muted);
      font-size: 13px;
      white-space: nowrap;
    }

    .user-switch select {
      min-height: 30px;
      border: 0;
      padding: 0 4px;
      background: transparent;
    }

    .account-note {
      color: var(--muted);
      font-size: 12px;
      width: 100%;
      text-align: right;
    }

    .login-screen {
      position: fixed;
      inset: 0;
      z-index: 20;
      display: none;
      place-items: center;
      padding: 24px;
      background:
        radial-gradient(circle at 18% 14%, rgba(72, 196, 177, .36), transparent 32%),
        linear-gradient(135deg, rgba(14, 83, 78, .84), rgba(19, 33, 40, .9)),
        rgba(21, 33, 41, .72);
    }

    .login-screen.active {
      display: grid;
    }

    .login-card {
      width: min(430px, 100%);
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: 0 24px 70px rgba(0,0,0,.28);
      padding: 26px;
      position: relative;
      overflow: hidden;
    }

    .login-card::before {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      height: 5px;
      background: linear-gradient(90deg, var(--teal), #48c4b1, #8fca50);
    }

    .login-card h2 {
      margin: 0 0 6px;
      font-size: 23px;
      font-weight: 800;
    }

    .login-card p {
      margin: 0 0 18px;
      color: var(--muted);
      font-size: 14px;
    }

    .btn {
      border: 1px solid var(--line);
      background: var(--panel);
      color: var(--ink);
      text-decoration: none;
      min-height: 38px;
      padding: 0 13px;
      border-radius: 8px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      white-space: nowrap;
      box-shadow: var(--shadow-soft);
      transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
    }

    .btn:disabled {
      cursor: not-allowed;
      opacity: .55;
      transform: none;
      box-shadow: none;
    }

    .btn:hover {
      border-color: var(--line-strong);
      background: #f9fbfc;
      box-shadow: 0 4px 12px rgba(23, 33, 41, .08);
      transform: translateY(-1px);
    }

    .btn.primary {
      background: var(--teal);
      border-color: var(--teal);
      color: white;
    }

    .btn.primary:hover {
      background: var(--teal-dark);
      border-color: var(--teal-dark);
    }

    .btn.warn {
      color: var(--red);
      background: #fffafa;
      border-color: #f3c5ca;
    }

    .filters {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      margin-bottom: 18px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255,255,255,.78);
      box-shadow: var(--shadow-soft);
    }

    select, input, textarea {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: white;
      color: var(--ink);
      min-height: 38px;
      padding: 0 10px;
      outline: none;
      transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
    }

    select:disabled, input:disabled, textarea:disabled {
      color: #7a8790;
      background: #f3f6f7;
      cursor: not-allowed;
    }

    textarea {
      padding-top: 9px;
      min-height: 74px;
      resize: vertical;
    }

    select:focus, input:focus, textarea:focus {
      border-color: var(--teal);
      box-shadow: 0 0 0 3px var(--teal-weak);
    }

    .kpi-grid {
      display: grid;
      grid-template-columns: repeat(5, minmax(150px, 1fr));
      gap: 14px;
      margin-bottom: 18px;
    }

    .metric {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 16px;
      box-shadow: var(--shadow);
      min-height: 112px;
      position: relative;
      overflow: hidden;
    }

    .metric::before {
      content: "";
      position: absolute;
      left: 0;
      top: 0;
      width: 4px;
      height: 100%;
      background: var(--teal);
    }

    .metric label {
      display: block;
      color: var(--muted);
      font-size: 13px;
      margin-bottom: 10px;
    }

    .metric strong {
      display: block;
      font-size: 27px;
      line-height: 1.1;
      margin-bottom: 7px;
      font-variant-numeric: tabular-nums;
    }

    .metric small {
      color: var(--muted);
      line-height: 1.45;
    }

    .task-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      gap: 12px;
    }

    .task-card {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      padding: 14px;
      display: grid;
      gap: 10px;
      box-shadow: var(--shadow-soft);
    }

    .task-card-head {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      align-items: flex-start;
    }

    .task-card h4 {
      margin: 0;
      font-size: 16px;
      line-height: 1.3;
    }

    .task-card p {
      margin: 0;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.5;
    }

    .task-meta {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
      font-size: 13px;
    }

    .task-meta span {
      color: var(--muted);
    }

    .view {
      display: none;
    }

    .view.active {
      display: block;
      animation: viewIn .16s ease-out;
    }

    @keyframes viewIn {
      from { opacity: .72; transform: translateY(4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .grid {
      display: grid;
      grid-template-columns: minmax(320px, 420px) 1fr;
      gap: 16px;
      align-items: start;
    }

    .section {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: var(--shadow);
      overflow: hidden;
    }

    .section + .section {
      margin-top: 16px;
    }

    .section-head {
      padding: 14px 16px;
      border-bottom: 1px solid var(--line);
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      background: linear-gradient(180deg, #ffffff, #f9fbfc);
      min-height: 52px;
    }

    .section-head h3 {
      margin: 0;
      font-size: 16px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .section-head h3::before {
      content: "";
      width: 4px;
      height: 16px;
      border-radius: 999px;
      background: var(--teal);
    }

    .section-body {
      padding: 16px;
    }

    .form-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }

    .quick-parse {
      display: grid;
      gap: 10px;
      padding: 12px;
      margin-bottom: 14px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-soft);
    }

    .quick-parse textarea {
      min-height: 92px;
    }

    .field {
      display: grid;
      gap: 6px;
    }

    .field.full {
      grid-column: 1 / -1;
    }

    .field label {
      font-size: 13px;
      color: var(--muted);
      font-weight: 600;
    }

    .field input, .field select, .field textarea {
      width: 100%;
    }

    .table-wrap {
      width: 100%;
      overflow: auto;
      border-top: 1px solid var(--line);
      background: #fff;
    }

    .section-head + .table-wrap {
      border-top: 0;
    }

    .table-wrap::-webkit-scrollbar {
      height: 10px;
      width: 10px;
    }

    .table-wrap::-webkit-scrollbar-thumb {
      background: #c7d5dc;
      border-radius: 999px;
      border: 2px solid #f5f8fa;
    }

    .table-wrap::-webkit-scrollbar-track {
      background: #f5f8fa;
    }

    table {
      width: 100%;
      border-collapse: separate;
      border-spacing: 0;
      font-size: 14px;
    }

    th, td {
      padding: 11px 10px;
      border-bottom: 1px solid var(--line);
      text-align: left;
      vertical-align: middle;
      max-width: 280px;
      overflow-wrap: anywhere;
    }

    th {
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
      background: #f7fafb;
      position: sticky;
      top: 0;
      z-index: 1;
      white-space: nowrap;
      overflow-wrap: normal;
    }

    .inventory-product-table {
      min-width: 1400px;
      table-layout: fixed;
    }

    .inventory-product-table th,
    .inventory-product-table td {
      white-space: nowrap;
      overflow-wrap: normal;
      text-align: center;
      padding-left: 12px;
      padding-right: 12px;
    }

    .inventory-product-table th:first-child,
    .inventory-product-table td:first-child {
      width: 96px;
    }

    .inventory-product-table th:not(:first-child),
    .inventory-product-table td:not(:first-child) {
      width: 104px;
    }

    .inventory-product-table th:nth-child(3),
    .inventory-product-table td:nth-child(3) {
      min-width: 104px;
    }

    .inventory-product-table .stock-low {
      color: #b42318;
      font-weight: 800;
      background: #fff4f2;
    }

    .inventory-product-table .inventory-store-total {
      background: #f0f8f7;
      color: #063a3c;
      font-weight: 800;
    }

    td .btn {
      min-height: 32px;
      padding: 0 10px;
      font-size: 13px;
    }

    tbody tr {
      transition: background .14s ease;
    }

    tbody tr:hover {
      background: #fbfdfd;
    }

    tr:last-child td {
      border-bottom: 0;
    }

    .summary-total-row td {
      background: #f7fafb;
      font-weight: 800;
    }

    .num {
      text-align: right;
      font-variant-numeric: tabular-nums;
    }

    .completed-orders-section {
      width: 100%;
      max-width: none;
    }

    .completed-orders-section .table-wrap {
      overflow-x: auto;
    }

    .completed-orders-section table {
      min-width: 1120px;
      table-layout: auto;
    }

    .completed-orders-section th,
    .completed-orders-section td {
      white-space: nowrap;
      overflow-wrap: normal;
      word-break: keep-all;
      max-width: none;
    }

    .completed-orders-section th:nth-child(5),
    .completed-orders-section td:nth-child(5) {
      min-width: 170px;
    }

    .tag {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 24px;
      padding: 0 9px;
      border-radius: 999px;
      background: #eef2f4;
      color: #34424b;
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
    }

    .tag.green { background: var(--green-weak); color: var(--green); }
    .tag.gold { background: var(--gold-weak); color: var(--gold); }
    .tag.blue { background: var(--blue-weak); color: var(--blue); }
    .tag.red { background: var(--red-weak); color: var(--red); }

    .split {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
    }

    .bar-list {
      display: grid;
      gap: 13px;
    }

    .bar-row {
      display: grid;
      gap: 6px;
    }

    .bar-meta {
      display: flex;
      justify-content: space-between;
      color: var(--muted);
      font-size: 13px;
      gap: 10px;
    }

    .bar {
      height: 10px;
      background: #e8eef1;
      border-radius: 999px;
      overflow: hidden;
    }

    .bar span {
      display: block;
      height: 100%;
      background: var(--teal);
      border-radius: inherit;
    }

    .route-sheet {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fbfdfe;
      overflow: hidden;
      box-shadow: var(--shadow-soft);
    }

    .route-sheet-head {
      display: flex;
      justify-content: space-between;
      gap: 16px;
      padding: 14px 16px;
      border-bottom: 1px solid var(--line);
      background: white;
    }

    .route-sheet-head h4 {
      margin: 0 0 4px;
      font-size: 16px;
    }

    .route-sheet-head p {
      margin: 0;
      color: var(--muted);
      font-size: 13px;
    }

    .route-summary {
      text-align: right;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.7;
    }

    .empty {
      padding: 34px 16px;
      text-align: center;
      color: var(--muted);
      background: #fbfdfe;
      line-height: 1.6;
    }

    .notice {
      margin-top: 12px;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.6;
      padding: 10px 12px;
      border-radius: 8px;
      background: #f6fafb;
      border: 1px solid #e7eef1;
    }

    .driver-alert {
      margin-bottom: 16px;
      padding: 12px 14px;
      border-radius: 8px;
      border: 1px solid #b7e3d8;
      background: #eafaf5;
      color: #125445;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      font-weight: 700;
    }

    .driver-alert.muted {
      background: #f6fafb;
      border-color: #e0ebef;
      color: var(--muted);
      font-weight: 600;
    }

    .quick-actions {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }

    .quick-actions .btn {
      width: 100%;
      justify-content: center;
    }

    .toast {
      position: fixed;
      right: 24px;
      bottom: 24px;
      background: #152129;
      color: white;
      border-radius: 8px;
      padding: 12px 14px;
      box-shadow: 0 18px 42px rgba(23, 33, 41, .24);
      opacity: 0;
      pointer-events: none;
      transform: translateY(12px);
      transition: .2s ease;
      z-index: 5;
    }

    .toast.show {
      opacity: 1;
      transform: translateY(0);
    }

    @media (max-width: 1000px) {
      .app {
        grid-template-columns: 1fr;
      }

      aside {
        position: static;
        height: auto;
        padding: 14px;
        box-shadow: none;
      }

      nav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }

      .brand {
        padding-bottom: 12px;
        margin-bottom: 12px;
      }

      main {
        padding: 18px 14px 28px;
      }

      .topbar {
        padding: 14px;
      }

      .grid, .split {
        grid-template-columns: 1fr;
      }

      .kpi-grid {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
      }
    }

    @media (max-width: 620px) {
      .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
      }

      .toolbar, .filters {
        width: 100%;
      }

      .toolbar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        justify-content: stretch;
      }

      .toolbar .user-switch,
      .toolbar .account-note {
        grid-column: 1 / -1;
      }

      .toolbar .account-note {
        display: none;
      }

      .toolbar .btn, .filters select, .filters input {
        flex: 1 1 150px;
      }

      .toolbar .btn {
        width: 100%;
      }

      nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      .nav-btn {
        min-height: 40px;
        padding: 0 10px;
        font-size: 14px;
      }

      .kpi-grid, .form-grid {
        grid-template-columns: 1fr;
      }

      .title h2 {
        font-size: 23px;
      }

      .title p {
        font-size: 13px;
      }

      .section-head {
        align-items: flex-start;
        flex-direction: column;
      }

      .section-head .toolbar {
        grid-template-columns: 1fr;
      }

      table {
        min-width: 900px;
      }
    }

    @media (max-width: 767px) {
      html, body {
        max-width: 100%;
        overflow-x: hidden;
      }

      body {
        font-size: 14px;
        padding-bottom: calc(76px + env(safe-area-inset-bottom));
      }

      .app {
        display: block;
      }

      aside {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        z-index: 80;
        height: auto;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
        border-right: 0;
        border-top: 1px solid var(--line);
        background: rgba(255,255,255,.98);
        box-shadow: 0 -12px 30px rgba(15, 23, 42, .12);
      }

      .brand, aside .muted, .progress {
        display: none;
      }

      nav {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
      }

      .nav-btn {
        flex: 0 0 auto;
        min-width: 76px;
        min-height: 48px;
        padding: 8px 10px;
        border-radius: 8px;
        font-size: 13px;
        justify-content: center;
      }

      .nav-btn .icon {
        display: none;
      }

      body.driver-mobile-nav nav .nav-btn:not([data-view="orders"]):not([data-view="tickets"]):not([data-view="exceptions"]):not([data-view="drivers"]),
      body.manager-mobile-nav nav .nav-btn:not([data-view="dashboard"]):not([data-view="orders"]):not([data-view="tickets"]):not([data-view="drivers"]):not([data-view="reports"]) {
        display: none;
      }

      body.driver-mobile-nav nav {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        overflow-x: hidden;
        width: 100%;
        padding-bottom: 0;
      }

      body.driver-mobile-nav nav .nav-btn {
        width: auto;
        min-width: 0;
        max-width: 100%;
        min-height: 56px;
        padding: 6px 3px;
        flex: 1 1 0;
        border-radius: 10px;
        color: #29404a;
        background: #f5faf9;
        border: 1px solid rgba(16, 185, 129, .18);
        box-shadow: none;
        white-space: normal;
        overflow: visible;
        text-align: center;
        line-height: 1.15;
        word-break: keep-all;
        flex-direction: column;
        gap: 3px;
      }

      body.driver-mobile-nav nav .nav-btn .icon {
        display: inline-grid;
        width: 22px;
        height: 22px;
        font-size: 12px;
        background: rgba(15, 118, 110, .1);
        color: #0f766e;
      }

      body.driver-mobile-nav nav .nav-btn.active {
        background: #0f766e;
        color: #fff;
        border-color: #0f766e;
        box-shadow: 0 8px 18px rgba(15, 118, 110, .22);
      }

      body.driver-mobile-nav nav .nav-btn.active .icon {
        background: rgba(255,255,255,.18);
        color: #fff;
      }

      body.manager-mobile-nav nav {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 3px;
        overflow-x: hidden;
        width: 100%;
        padding-bottom: 0;
      }

      body.manager-mobile-nav nav .nav-btn {
        width: auto;
        min-width: 0;
        max-width: 100%;
        min-height: 56px;
        padding: 6px 2px;
        flex: 1 1 0;
        border-radius: 10px;
        color: #29404a;
        background: #f7fbfa;
        border: 1px solid rgba(15, 118, 110, .14);
        white-space: normal;
        overflow: visible;
        text-align: center;
        line-height: 1.12;
        word-break: keep-all;
        flex-direction: column;
        gap: 2px;
        font-size: 11px;
      }

      body.manager-mobile-nav nav .nav-btn .icon {
        display: inline-grid;
        width: 20px;
        height: 20px;
        font-size: 11px;
        background: rgba(15, 118, 110, .1);
        color: #0f766e;
      }

      body.manager-mobile-nav nav .nav-btn.active {
        background: #0f766e;
        color: #fff;
        border-color: #0f766e;
        box-shadow: 0 8px 18px rgba(15, 118, 110, .2);
      }

      body.manager-mobile-nav nav .nav-btn.active .icon {
        background: rgba(255,255,255,.18);
        color: #fff;
      }

      main {
        padding: 10px 10px 22px;
      }

      .topbar {
        position: sticky;
        top: 0;
        z-index: 50;
        border-radius: 0 0 8px 8px;
      }

      .toolbar, .filters, .settings-nav, .quick-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
      }

      input, select, textarea, button, .btn {
        min-height: 44px;
        font-size: 15px;
      }

      .form-grid, .grid, .split, .kpi-grid {
        grid-template-columns: 1fr !important;
      }

      .section {
        border-radius: 8px;
        margin-bottom: 12px;
      }

      .section-body {
        padding: 12px;
      }

      .table-wrap {
        overflow-x: visible;
      }

      .table-wrap table {
        min-width: 0;
        width: 100%;
        border-collapse: separate;
        border-spacing: 0 10px;
      }

      .table-wrap thead {
        display: none;
      }

      .table-wrap tbody,
      .table-wrap tr,
      .table-wrap td {
        display: block;
        width: 100%;
      }

      .table-wrap tr {
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
        overflow: hidden;
      }

      .table-wrap td {
        min-height: 38px;
        padding: 9px 12px;
        border: 0;
        border-bottom: 1px solid #eef3f5;
        word-break: break-word;
      }

      .table-wrap td:last-child {
        border-bottom: 0;
      }

      .table-wrap td.num {
        text-align: left;
      }

      .scanner, .camera-box, video, canvas {
        max-width: 100%;
      }

      .login-card {
        width: min(94vw, 420px);
      }

      .toast {
        left: 12px;
        right: 12px;
        bottom: calc(88px + env(safe-area-inset-bottom));
      }
    }

    @media print {
      body * { visibility: hidden; }
      #routeSheet, #routeSheet * { visibility: visible; }
      #routeSheet {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        border: 0;
        background: white;
      }
      #routeSheet table {
        min-width: 0;
        width: 100%;
      }
      #routeSheet th, #routeSheet td {
        font-size: 12px;
        padding: 7px;
      }
      #routeSheet .route-sheet-head {
        padding: 0 0 12px;
      }
    }

.api-load-failure {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--red-weak);
  color: var(--red);
  border-bottom: 1px solid rgba(180, 35, 47, .18);
}

.api-load-failure span {
  color: var(--muted);
  font-size: 13px;
}
