﻿:root {
            --bg-surface: #f5f6fb;
            --bg-elevated: rgba(255, 255, 255, 0.82);
            --bg-sidebar: linear-gradient(160deg, #101624 0%, #151d2f 100%);
            --bg-sidebar-hover: rgba(255, 255, 255, 0.08);
            --border-soft: rgba(15, 23, 42, 0.08);
            --border-strong: rgba(15, 23, 42, 0.14);
            --text-primary: #0f172a;
            --text-secondary: #475569;
            --text-tertiary: #64748b;
            --accent: #4f46e5;
            --accent-strong: #4338ca;
            --accent-soft: rgba(79, 70, 229, 0.14);
            --danger: #ef4444;
            --radius-lg: 20px;
            --radius-md: 14px;
            --shadow-soft: 0 24px 40px -32px rgba(15, 23, 42, 0.35);
            --shadow-elevated: 0 32px 60px -38px rgba(15, 23, 42, 0.45);
            --sidebar-width: 256px;
        }

        body[data-theme="dark"] {
            --bg-surface: #0b1220;
            --bg-elevated: rgba(17, 25, 40, 0.82);
            --bg-sidebar: linear-gradient(180deg, #080c16 0%, #131b2c 100%);
            --bg-sidebar-hover: rgba(255, 255, 255, 0.08);
            --border-soft: rgba(148, 163, 184, 0.08);
            --border-strong: rgba(148, 163, 184, 0.18);
            --text-primary: #e2e8f0;
            --text-secondary: #cbd5f5;
            --text-tertiary: #94a3b8;
            --accent: #6366f1;
            --accent-strong: #818cf8;
            --accent-soft: rgba(99, 102, 241, 0.18);
            --shadow-soft: 0 32px 60px -40px rgba(0, 0, 0, 0.65);
            --shadow-elevated: 0 40px 70px -36px rgba(0, 0, 0, 0.75);
        }

        /* ── Login screen ── */
        .login-screen {
            position: fixed;
            inset: 0;
            z-index: 9999;
            display: grid;
            place-items: center;
            background: #0b1220;
            background-image: radial-gradient(ellipse at 30% 20%, rgba(79, 70, 229, 0.15) 0%, transparent 60%),
                              radial-gradient(ellipse at 70% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
        }

        .login-card {
            width: min(400px, calc(100vw - 48px));
            padding: 40px 36px 36px;
            border-radius: 24px;
            background: rgba(15, 23, 42, 0.92);
            border: 1px solid rgba(148, 163, 184, 0.12);
            box-shadow: 0 32px 64px rgba(0, 0, 0, 0.4);
            backdrop-filter: blur(20px);
        }

        .login-card__logo {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 32px;
            justify-content: center;
        }

        .login-card__badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 42px;
            height: 42px;
            border-radius: 12px;
            background: linear-gradient(135deg, #4f46e5, #6366f1);
            color: #fff;
            font-weight: 700;
            font-size: 15px;
            letter-spacing: 0.5px;
        }

        .login-card__brand {
            font-size: 20px;
            font-weight: 600;
            color: #e2e8f0;
            letter-spacing: -0.3px;
        }

        .login-card__form {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

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

        .login-card__field label {
            font-size: 13px;
            font-weight: 500;
            color: #94a3b8;
        }

        .login-card__field input {
            padding: 12px 14px;
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, 0.18);
            background: rgba(30, 41, 59, 0.7);
            color: #e2e8f0;
            font-size: 15px;
            font-family: inherit;
            outline: none;
            transition: border-color 0.15s, box-shadow 0.15s;
        }

        .login-card__field input::placeholder {
            color: #475569;
        }

        .login-card__field input:focus {
            border-color: #6366f1;
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
        }

        .login-card__error {
            font-size: 13px;
            color: #f87171;
            min-height: 18px;
            text-align: center;
        }

        .login-card__submit {
            padding: 12px 24px;
            border-radius: 12px;
            border: none;
            background: linear-gradient(135deg, #4f46e5, #6366f1);
            color: #fff;
            font-size: 15px;
            font-weight: 600;
            font-family: inherit;
            cursor: pointer;
            transition: opacity 0.15s, transform 0.1s;
        }

        .login-card__submit:hover {
            opacity: 0.9;
        }

        .login-card__submit:active {
            transform: scale(0.98);
        }

        .login-card__submit:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        html, body {
            height: 100%;
            width: 100%;
        }

        body {
            margin: 0;
            font-family: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
            background: var(--bg-surface);
            color: var(--text-primary);
            min-height: 100vh;
            min-width: 100vw;
            display: flex;
            flex-direction: column;
        }

        * {
            box-sizing: border-box;
        }

        .app-shell {
            flex: 1 1 auto;
            display: flex;
            position: relative;
            min-height: 0;
            overflow: hidden;
        }

        .sidebar-backdrop {
            position: absolute;
            inset: 0;
            background: rgba(2, 6, 23, 0.34);
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s ease;
            z-index: 50;
            display: none;
            border: none;
            padding: 0;
        }

        .sidebar {
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            width: var(--sidebar-width);
            background: var(--bg-sidebar);
            color: rgba(255, 255, 255, 0.92);
            padding: 28px 22px 24px;
            display: flex;
            flex-direction: column;
            gap: 28px;
            box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05), 0 24px 60px -42px rgba(2, 6, 23, 0.75);
            transform: translateX(-100%);
            opacity: 0;
            pointer-events: none;
            transition: transform 0.26s ease, opacity 0.2s ease;
            z-index: 60;
        }

        .app-shell.is-sidebar-open .sidebar {
            transform: translateX(0);
            opacity: 1;
            pointer-events: auto;
        }

        .app-shell.is-sidebar-open .sidebar-backdrop {
            opacity: 1;
            pointer-events: auto;
        }

        .sidebar__logo {
            font-size: 18px;
            font-weight: 700;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            display: inline-flex;
            align-items: center;
            gap: 12px;
        }

        .sidebar__logo-badge {
            width: 42px;
            height: 42px;
            border-radius: 14px;
            background: rgba(255, 255, 255, 0.16);
            display: grid;
            place-items: center;
            font-weight: 700;
            font-size: 15px;
        }
        .sidebar__nav {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .nav-button {
            border: none;
            background: transparent;
            color: inherit;
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 14px;
            border-radius: 14px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: background 0.2s ease, transform 0.15s ease;
        }

        .nav-button:hover,
        .nav-button.is-active {
            background: var(--bg-sidebar-hover);
            transform: translateY(-1px);
        }

        .nav-icon {
            width: 18px;
            height: 18px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            opacity: 0.78;
        }

        .sidebar__add {
            margin-top: auto;
            padding: 14px 18px;
            border-radius: 16px;
            border: none;
            background: linear-gradient(135deg, var(--accent), var(--accent-strong));
            color: white;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            box-shadow: 0 20px 40px -28px rgba(99, 102, 241, 0.75);
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }

        .sidebar__add:hover {
            transform: translateY(-2px);
            box-shadow: 0 24px 50px -28px rgba(99, 102, 241, 0.85);
        }

        .app-main {
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            min-height: 0;
            margin-left: 0;
            transition: margin-left 0.26s ease;
            background: linear-gradient(180deg, rgba(79, 70, 229, 0.06) 0%, transparent 25%);
        }

        .app-shell.is-sidebar-open .app-main {
            margin-left: var(--sidebar-width);
        }

        .topbar {
            height: 72px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 32px;
            border-bottom: 1px solid var(--border-soft);
            backdrop-filter: blur(24px) saturate(140%);
            background: rgba(255, 255, 255, 0.55);
        }

        body[data-theme="dark"] .topbar {
            background: rgba(15, 23, 42, 0.65);
        }

        .topbar__title-row {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .sidebar-toggle {
            width: 34px;
            height: 34px;
            border: 1px solid var(--border-soft);
            border-radius: 12px;
            background: rgba(148, 163, 184, 0.14);
            color: var(--text-secondary);
            display: inline-grid;
            place-items: center;
            cursor: pointer;
            transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
        }

        .sidebar-toggle:hover {
            transform: translateY(-1px);
            border-color: var(--border-strong);
            color: var(--text-primary);
        }

        .sidebar-toggle.is-active {
            border-color: rgba(99, 102, 241, 0.6);
            color: var(--accent-strong);
            background: rgba(99, 102, 241, 0.2);
        }

        .topbar__title h1 {
            margin: 0;
            font-size: 22px;
            font-weight: 700;
            letter-spacing: -0.01em;
        }

        .topbar__title span {
            font-size: 13px;
            color: var(--text-tertiary);
        }

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

.topbar__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.topbar__stats span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.topbar__stats .warn {
    color: #b45309;
    font-weight: 700;
}

        .topbar__theme {
            width: 36px;
            height: 36px;
            border-radius: 14px;
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.72);
            cursor: pointer;
            display: grid;
            place-items: center;
            transition: transform 0.2s ease, border 0.2s ease;
        }

        body[data-theme="dark"] .topbar__theme {
            background: rgba(15, 23, 42, 0.7);
        }

        .topbar__theme:hover {
            transform: translateY(-1px);
            border-color: var(--border-strong);
        }

        .topbar__actions {
            display: flex;
            align-items: center;
            gap: 14px;
        }
        .grouped {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 4px;
            border-radius: 16px;
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.72);
        }
        body[data-theme="dark"] .grouped {
            background: rgba(15, 23, 42, 0.7);
        }
        .zoom-button {
            min-width: 34px;
            height: 34px;
            padding: 0;
            border: none;
            border-radius: 12px;
            background: transparent;
            color: var(--text-primary);
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            transition: background 0.2s ease, transform 0.15s ease;
        }
        .zoom-button:hover {
            background: var(--accent-soft);
            transform: translateY(-1px);
        }
        .zoom-button--reset {
            width: auto;
            padding: 0 10px;
            font-size: 13px;
        }
        .zoom-indicator {
            min-width: 48px;
            text-align: center;
            font-size: 13px;
            font-weight: 600;
            color: var(--text-secondary);
        }
        .pill-button,
        .ghost-button {
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.72);
            color: var(--text-primary);
            padding: 8px 14px;
            border-radius: 14px;
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            transition: background 0.2s ease, border 0.2s ease, color 0.2s ease;
        }

        body[data-theme="dark"] .pill-button,
        body[data-theme="dark"] .ghost-button {
            background: rgba(15, 23, 42, 0.7);
        }

        .ghost-button:hover,
        .pill-button:hover {
            border: 1px solid var(--border-strong);
        }

        .pill-button .avatar {
            width: 32px;
            height: 32px;
            border-radius: 12px;
            display: grid;
            place-items: center;
            background: var(--accent-soft);
            font-weight: 600;
            color: var(--accent-strong);
        }

        .workspace {
            flex: 1 1 auto;
            display: grid;
            grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
            gap: 24px;
            padding: 28px 32px 32px;
            min-height: 0;
        }

        .workspace__panel,
        .workspace__canvas {
            min-height: 0;
        }

        .panel-card {
            background: var(--bg-elevated);
            border-radius: var(--radius-lg);
            border: 1px solid var(--border-soft);
            padding: 16px;
            box-shadow: var(--shadow-soft);
            display: flex;
            flex-direction: column;
            gap: 12px;
            min-height: 0;
            overflow: hidden;
        }

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

        .panel-header h2 {
            margin: 0;
            font-size: 16px;
            font-weight: 700;
        }

        .panel-header p {
            margin: 0;
            font-size: 13px;
            color: var(--text-secondary);
        }

        .panel-scroll {
            display: flex;
            flex-direction: column;
            gap: 22px;
            overflow: auto;
            max-height: calc(100vh - 220px);
            padding-right: 6px;
        }

        .field-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
            gap: 14px;
        }

        .field label {
            display: flex;
            flex-direction: column;
            gap: 8px;
            font-size: 12px;
            font-weight: 600;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: var(--text-tertiary);
        }

        .field input {
            font-size: 15px;
            font-weight: 600;
            padding: 12px 16px;
            border-radius: var(--radius-md);
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.9);
            color: var(--text-primary);
            transition: border 0.2s ease, box-shadow 0.2s ease;
        }

        body[data-theme="dark"] .field input {
            background: rgba(15, 23, 42, 0.65);
        }

        .field input:focus {
            outline: none;
            border: 1px solid var(--accent);
            box-shadow: 0 0 0 3px var(--accent-soft);
        }

        .panel-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
        }

        .panel-actions button {
            border: none;
            border-radius: var(--radius-md);
            padding: 12px 18px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 12px;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }

        .panel-actions button.primary {
            background: var(--accent);
            color: white;
            box-shadow: 0 18px 30px -18px rgba(79, 70, 229, 0.55);
        }

        .panel-actions button.secondary {
            background: rgba(148, 163, 184, 0.14);
            color: var(--text-primary);
        }

        .panel-actions button.danger {
            background: rgba(239, 68, 68, 0.14);
            color: #b91c1c;
        }

        .panel-actions button:hover {
            transform: translateY(-1px);
        }

        .bulk-card {
            background: rgba(148, 163, 184, 0.12);
            border-radius: var(--radius-lg);
            padding: 18px;
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        .bulk-card textarea {
            min-height: 120px;
            resize: vertical;
            border-radius: var(--radius-md);
            border: 1px solid var(--border-soft);
            padding: 14px 16px;
            font-family: inherit;
            font-size: 14px;
            font-weight: 500;
            color: var(--text-primary);
            background: rgba(255, 255, 255, 0.92);
        }

        .bulk-card textarea::placeholder {
            color: var(--text-tertiary);
            opacity: 0.85;
        }

        body[data-theme="dark"] .bulk-card textarea {
            background: rgba(15, 23, 42, 0.72);
            color: #e2e8f0;
            border-color: var(--border-soft);
        }

        body[data-theme="dark"] .bulk-card textarea::placeholder {
            color: #94a3b8;
            opacity: 0.95;
        }

        .bulk-hint {
            margin: 0;
            font-size: 12px;
            color: var(--text-tertiary);
        }

        .bulk-feedback {
            font-size: 13px;
            font-weight: 600;
            min-height: 20px;
        }

        .bulk-feedback.success {
            color: var(--accent-strong);
        }

        .bulk-feedback.error {
            color: var(--danger);
        }

        .workspace__canvas {
            display: flex;
            flex-direction: column;
            gap: 18px;
            min-height: 0;
        }

        .canvas-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 18px;
            padding-right: 8px;
        }

        .canvas-header h2 {
            margin: 0;
            font-size: 20px;
            font-weight: 700;
        }

        .canvas-header p {
            margin: 0;
            font-size: 13px;
            color: var(--text-tertiary);
        }

        .canvas-actions {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .canvas-action {
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.76);
            color: var(--text-secondary);
            width: 36px;
            height: 36px;
            border-radius: 12px;
            display: grid;
            place-items: center;
            cursor: pointer;
            transition: transform 0.2s ease, border 0.2s ease;
        }

        .canvas-action:hover {
            transform: translateY(-1px);
            border-color: var(--accent);
            color: var(--accent);
        }

        .canvas-action.wide {
            width: auto;
            min-width: 44px;
            padding: 0 10px;
            font-size: 11px;
            font-weight: 700;
        }

        body[data-theme="dark"] .canvas-action {
            background: rgba(15, 23, 42, 0.6);
        }

        .zone-switch {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .zone-btn {
            min-width: 42px;
            font-size: 13px;
            font-weight: 700;
            border-color: rgba(129, 140, 248, 0.38);
            background: rgba(99, 102, 241, 0.22);
            color: #e0e7ff;
        }

        .zone-btn.is-active {
            background: rgba(67, 56, 202, 0.52);
            border-color: rgba(165, 180, 252, 0.72);
            color: #ffffff;
            box-shadow: none;
        }

        .zone-btn:hover {
            border-color: rgba(165, 180, 252, 0.65);
            background: rgba(99, 102, 241, 0.30);
            color: #ffffff;
        }

        .zone-btn.is-active:hover {
            background: rgba(67, 56, 202, 0.64);
            border-color: rgba(199, 210, 254, 0.85);
            color: #ffffff;
        }
        .canvas-board {
            flex: 1 1 auto;
            background: var(--bg-elevated);
            border-radius: var(--radius-lg);
            border: 1px solid var(--border-soft);
            position: relative;
            min-height: 0;
            box-shadow: var(--shadow-elevated);
            overflow: hidden;
            display: flex;
        }

        #stage {
            flex: 1 1 auto;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 14px 12px;
            min-height: 0;
            min-width: 0;
        }

        .ruler-frame {
            position: relative;
            --ruler-top: 30px;
            --ruler-left: 56px;
            padding: var(--ruler-top) 0 0 var(--ruler-left);
        }

        .ruler-frame .ruler-corner {
            position: absolute;
            top: 0;
            left: 0;
            width: var(--ruler-left);
            height: var(--ruler-top);
            border-right: 1px solid rgba(148, 163, 184, 0.28);
            border-bottom: 1px solid rgba(148, 163, 184, 0.28);
            border-top-left-radius: 0;
            border-bottom-right-radius: 10px;
            background: rgba(148, 163, 184, 0.05);
            pointer-events: none;
        }

        .ruler-frame .ruler-x {
            position: absolute;
            top: 0;
            left: var(--ruler-left);
            height: var(--ruler-top);
            width: calc(100% - var(--ruler-left));
            pointer-events: none;
        }

        .ruler-frame .ruler-y {
            position: absolute;
            top: var(--ruler-top);
            left: 0;
            width: var(--ruler-left);
            height: calc(100% - var(--ruler-top));
            pointer-events: none;
        }

        #bayCanvas {
            position: relative;
            background: var(--bg-surface);
            border: 1px solid rgba(148, 163, 184, 0.35);
            border-radius: 0 18px 18px 18px;
            min-width: 320px;
            min-height: 280px;
            box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08);
        }

        .pallet {
            position: absolute;
            background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
            border: 1px solid rgba(79, 70, 229, 0.45);
            border-radius: 12px;
            overflow: hidden;
            display: flex;
            justify-content: center;
            align-items: center;
            pointer-events: auto;
            z-index: 2;
        }
        body[data-theme="dark"] .pallet {
            background: linear-gradient(180deg, rgba(99, 102, 241, 0.36) 0%, rgba(99, 102, 241, 0.22) 100%);
            border-color: rgba(129, 140, 248, 0.55);
        }
        .pallet.last {
            box-shadow: 0 0 0 2px var(--accent) inset, 0 10px 20px -12px rgba(79, 70, 229, 0.4);
        }
        .pallet .size,
        .pallet .weight {
            position: absolute;
            padding: 6px 8px;
            font-size: 12px;
            font-weight: 600;
            color: var(--text-secondary);
            background: rgba(255, 255, 255, 0.72);
            border-radius: 8px;
            backdrop-filter: blur(6px) saturate(130%);
        }
        body[data-theme="dark"] .pallet .size,
        body[data-theme="dark"] .pallet .weight {
            background: rgba(15, 23, 42, 0.6);
            color: #cbd5f5;
        }
        .pallet .size { top: 6px; left: 6px; }
        .pallet .weight { bottom: 6px; right: 6px; }

        /* Centered small color index number on each pallet */
        .pallet .color-index {
            position: absolute;
            inset: 0;
            display: grid;
            place-items: center;
            font-size: 36px;
            font-weight: 900;
            line-height: 1;
            color: #ffffff;
            -webkit-text-stroke: 3px rgba(10, 18, 32, 0.85);
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4),
                         1px 0 1px rgba(0, 0, 0, 0.75),
                        -1px 0 1px rgba(0, 0, 0, 0.75),
                         0 1px 1px rgba(0, 0, 0, 0.75),
                         0 -1px 1px rgba(0, 0, 0, 0.75);
            pointer-events: none;
            opacity: 0.9;
            z-index: 1;
        }

        /* Measurement overlay (rulers and distances) */
        #bayCanvas .overlay {
            position: absolute;
            inset: 0;
            pointer-events: none;
            z-index: 5;
        }
        #bayCanvas .gap-layer {
            position: absolute;
            inset: 0;
            pointer-events: none;
            z-index: 1;
        }

        .gap-hotspot {
            position: absolute;
            border: 1px dashed rgba(239, 68, 68, 0.75);
            background: rgba(239, 68, 68, 0.13);
            border-radius: 8px;
            box-shadow: inset 0 0 0 1px rgba(254, 226, 226, 0.65);
        }

        body[data-theme="dark"] .gap-hotspot {
            border-color: rgba(251, 113, 133, 0.7);
            background: rgba(251, 113, 133, 0.12);
            box-shadow: inset 0 0 0 1px rgba(127, 29, 29, 0.45);
        }
        .tick-x, .tick-y {
            position: absolute;
            background: var(--border-strong);
            opacity: 0.6;
        }
        .tick-x { width: 1px; height: 12px; top: calc(var(--ruler-top) - 18px); }
        .tick-y { height: 1px; width: 16px; left: calc(var(--ruler-left) - 22px); }
        .tick--major { background: var(--accent); opacity: 0.8; }
        .label {
            position: absolute;
            font-size: 11px;
            font-weight: 700;
            color: var(--text-secondary);
            background: rgba(255, 255, 255, 0.78);
            border: 1px solid var(--border-soft);
            padding: 2px 6px;
            border-radius: 8px;
            backdrop-filter: blur(6px) saturate(120%);
            white-space: nowrap;
        }
        body[data-theme="dark"] .label {
            background: rgba(15, 23, 42, 0.6);
            color: #cbd5f5;
        }
        .measure-line.h { position: absolute; height: 0; border-top: 2px dashed var(--accent); }
        .measure-line.v { position: absolute; width: 0; border-left: 2px dashed var(--accent); }
        .measure-label { position: absolute; transform: translate(-50%, -50%); }

        /* Color picker UI */
        .color-card {
            background: var(--bg-elevated);
            border: 1px solid var(--border-soft);
            border-radius: var(--radius-lg);
            padding: 16px;
            box-shadow: var(--shadow-soft);
        }
        .color-row {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }
        .color-swatch {
            width: 28px;
            height: 28px;
            border-radius: 999px;
            border: 2px solid rgba(148, 163, 184, 0.45);
            cursor: pointer;
            padding: 0;
            outline: none;
            background-clip: padding-box;
            transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
            display: grid;
            place-items: center;
            font-size: 18px;
            font-weight: 900;
            color: rgba(15, 23, 42, 0.92);
            text-shadow: 0 1px 1px rgba(255,255,255,0.7);
            user-select: none;
        }
        .color-swatch:hover { transform: translateY(-1px); border-color: var(--accent); }
        .color-swatch.is-active { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
        .color-swatch[data-color="blue"] {
            background: linear-gradient(180deg, #bfdbfe 0%, #60a5fa 100%);
        }
        .color-swatch[data-color="green"] {
            background: linear-gradient(180deg, #bbf7d0 0%, #34d399 100%);
        }
        .color-swatch[data-color="amber"] {
            background: linear-gradient(180deg, #fde68a 0%, #f59e0b 100%);
        }
        .color-swatch[data-color="rose"] {
            background: linear-gradient(180deg, #fecdd3 0%, #fb7185 100%);
        }
        .color-swatch[data-color="slate"] {
            background: linear-gradient(180deg, #cbd5e1 0%, #64748b 100%);
            color: #0f172a;
            text-shadow: 0 1px 1px rgba(255,255,255,0.7);
        }

        /* Pallet color variants */
        .pallet.color-blue {
            background: linear-gradient(180deg, #bfdbfe 0%, #60a5fa 100%);
            border-color: rgba(37, 99, 235, 0.6);
        }
        body[data-theme="dark"] .pallet.color-blue {
            background: linear-gradient(180deg, rgba(59, 130, 246, 0.50) 0%, rgba(59, 130, 246, 0.28) 100%);
            border-color: rgba(129, 140, 248, 0.7);
        }
        .pallet.color-green {
            background: linear-gradient(180deg, #bbf7d0 0%, #34d399 100%);
            border-color: rgba(5, 150, 105, 0.6);
        }
        body[data-theme="dark"] .pallet.color-green {
            background: linear-gradient(180deg, rgba(34, 197, 94, 0.45) 0%, rgba(34, 197, 94, 0.24) 100%);
            border-color: rgba(52, 211, 153, 0.7);
        }
        .pallet.color-amber {
            background: linear-gradient(180deg, #fde68a 0%, #f59e0b 100%);
            border-color: rgba(180, 83, 9, 0.65);
        }
        body[data-theme="dark"] .pallet.color-amber {
            background: linear-gradient(180deg, rgba(245, 158, 11, 0.45) 0%, rgba(245, 158, 11, 0.24) 100%);
            border-color: rgba(251, 191, 36, 0.75);
        }
        .pallet.color-rose {
            background: linear-gradient(180deg, #fecdd3 0%, #fb7185 100%);
            border-color: rgba(225, 29, 72, 0.65);
        }
        body[data-theme="dark"] .pallet.color-rose {
            background: linear-gradient(180deg, rgba(244, 63, 94, 0.45) 0%, rgba(244, 63, 94, 0.24) 100%);
            border-color: rgba(248, 113, 113, 0.75);
        }
        .pallet.color-slate {
            background: linear-gradient(180deg, #cbd5e1 0%, #64748b 100%);
            border-color: rgba(71, 85, 105, 0.65);
        }
        body[data-theme="dark"] .pallet.color-slate {
            background: linear-gradient(180deg, rgba(148, 163, 184, 0.50) 0%, rgba(100, 116, 139, 0.30) 100%);
            border-color: rgba(148, 163, 184, 0.8);
        }

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

            .app-shell.is-sidebar-open .app-main {
                margin-left: 0;
            }

            .sidebar-backdrop {
                display: block;
            }
        }

        @media (max-width: 960px) {
            .sidebar {
                width: min(320px, 86vw);
                padding: 24px 18px 20px;
            }

            .workspace {
                padding: 24px 20px 20px;
            }

            .topbar {
                padding: 0 16px;
            }
        }

        @media (max-width: 720px) {
            .workspace {
                padding: 14px;
            }
        }
        /* Views toggling */
        .view { display: none; }
        .view.is-active { display: grid; }

        /* Salary UI */
        .upload-card {
            border: 2px dashed var(--border-soft);
            border-radius: var(--radius-lg);
            padding: 26px;
            background: rgba(148, 163, 184, 0.08);
            cursor: pointer;
            transition: border 0.2s ease, background 0.2s ease;
            text-align: center;
        }
        .upload-card:hover { border-color: var(--accent); }
        .upload-card.is-dragover {
            border-color: var(--accent);
            background: var(--accent-soft);
        }
        .upload-icon { font-size: 28px; margin-bottom: 8px; }
        .upload-hint { margin: 6px 0 0; font-size: 13px; color: var(--text-tertiary); }

        .files-list { display: flex; flex-direction: column; gap: 10px; }
        .file-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 12px 14px;
            border: 1px solid var(--border-soft);
            border-radius: var(--radius-md);
            background: rgba(255,255,255,0.7);
            cursor: pointer;
            transition: border 0.2s ease, transform 0.15s ease;
        }
        body[data-theme="dark"] .file-item { background: rgba(15,23,42,0.6); }
        .file-item:hover { border-color: var(--accent); transform: translateY(-1px); }
        .file-item.is-selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
        .file-item .name { font-weight: 600; }
        .file-item .meta { font-size: 12px; color: var(--text-tertiary); }

        #pdfCanvas {
            /* Рендерим PDF в нативном размере для максимальной чёткости */
            max-width: none;
            width: auto;
            height: auto;
            border-radius: 12px;
            background: #fff;
            image-rendering: optimizeQuality;
            image-rendering: -webkit-optimize-contrast;
        }

        .settings-card {
            background: rgba(148, 163, 184, 0.08);
            border: 1px solid var(--border-soft);
            border-radius: var(--radius-lg);
            padding: 18px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .settings-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
        .settings-row .field input { width: 100%; }
        .small { font-size: 12px; color: var(--text-tertiary); }

        .result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
        @media (max-width: 720px) { .result-grid { grid-template-columns: 1fr; } }

        .copyline {
            display: flex;
            gap: 10px;
            align-items: center;
        }
        .copyline input {
            flex: 1 1 auto;
            font-size: 14px;
            padding: 10px 12px;
            border-radius: var(--radius-md);
            border: 1px solid var(--border-soft);
            background: rgba(255,255,255,0.9);
        }
        body[data-theme="dark"] .copyline input {
            background: rgba(15,23,42,0.65);
        }
        .orders-view {
            flex-direction: column;
            padding: 0;
            gap: 0;
            overflow: hidden;
            background: #f1f5f9;
        }

        body[data-theme="dark"] .orders-view {
            background: #111827;
        }

        .orders-view.is-active {
            display: flex !important;
        }

        .orders-toolbar {
            flex-shrink: 0;
            padding: 12px 24px;
            background: rgba(255, 255, 255, 0.92);
            border-bottom: 1px solid var(--border-soft);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 20px;
            z-index: 10;
        }

        body[data-theme="dark"] .orders-toolbar {
            background: rgba(15, 23, 42, 0.88);
        }

        .orders-toolbar__group {
            display: flex;
            align-items: center;
            gap: 16px;
            flex-wrap: wrap;
            min-width: 0;
        }

        .orders-toolbar__title {
            margin: 0;
            font-size: 1.25rem;
            color: var(--text-primary);
        }

        .orders-upload {
            padding: 8px 16px;
            border: 2px dashed #cbd5e1;
            border-radius: 8px;
            background: #f8fafc;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .orders-upload:hover,
        .orders-upload.is-dragover {
            border-color: #3b82f6;
            background: #eff6ff;
        }

        body[data-theme="dark"] .orders-upload {
            background: rgba(15, 23, 42, 0.72);
            border-color: rgba(148, 163, 184, 0.25);
        }

        .orders-upload__text {
            font-size: 0.9rem;
            color: #475569;
        }

        body[data-theme="dark"] .orders-upload__text {
            color: #cbd5f5;
        }

        .orders-hidden-input {
            display: none;
        }

        .orders-truck {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 10px;
            background: #f8fafc;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
        }

        body[data-theme="dark"] .orders-truck {
            background: rgba(15, 23, 42, 0.72);
            border-color: rgba(148, 163, 184, 0.2);
        }

        .orders-truck__label {
            font-size: 0.85rem;
            color: #64748b;
            font-weight: 600;
        }

        .orders-truck__input {
            width: 88px;
            padding: 6px 8px;
            border: 1px solid #cbd5e1;
            border-radius: 6px;
            font-size: 0.9rem;
            background: white;
            color: inherit;
        }

        body[data-theme="dark"] .orders-truck__input {
            background: rgba(15, 23, 42, 0.9);
            border-color: rgba(148, 163, 184, 0.28);
            color: var(--text-primary);
        }

        .orders-status {
            font-size: 0.9rem;
            font-weight: 500;
            min-height: 1.3em;
        }

        .orders-settings {
            position: relative;
        }

        .orders-settings__summary {
            list-style: none;
            cursor: pointer;
            padding: 6px 12px;
            background: #f1f5f9;
            border-radius: 6px;
            font-size: 0.85rem;
            font-weight: 500;
            color: #64748b;
        }

        .orders-settings__summary::-webkit-details-marker {
            display: none;
        }

        body[data-theme="dark"] .orders-settings__summary {
            background: rgba(15, 23, 42, 0.82);
            color: #cbd5f5;
        }

        .orders-settings__panel {
            position: absolute;
            right: 0;
            top: 100%;
            margin-top: 8px;
            width: 300px;
            background: white;
            padding: 16px;
            border-radius: 8px;
            box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
            border: 1px solid #e2e8f0;
            z-index: 20;
        }

        body[data-theme="dark"] .orders-settings__panel {
            background: rgba(15, 23, 42, 0.96);
            border-color: rgba(148, 163, 184, 0.18);
        }

        .orders-settings__field {
            margin-bottom: 8px;
        }

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

        .orders-settings__input {
            width: 100%;
            padding: 4px;
            border: 1px solid #cbd5e1;
            border-radius: 4px;
            background: white;
            color: inherit;
        }

        body[data-theme="dark"] .orders-settings__input {
            background: rgba(15, 23, 42, 0.9);
            border-color: rgba(148, 163, 184, 0.28);
            color: var(--text-primary);
        }

        .orders-settings__checkbox {
            font-size: 12px;
            color: #475569;
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 0 0 10px;
        }

        body[data-theme="dark"] .orders-settings__checkbox {
            color: #cbd5f5;
        }

        .orders-settings__check {
            width: 100%;
            padding: 6px;
            background: #eff6ff;
            color: #3b82f6;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
        }

        .orders-settings__status {
            margin-top: 8px;
            font-size: 11px;
        }

        .orders-body {
            flex: 1;
            display: flex;
            overflow: hidden;
            min-height: 0;
        }

        .orders-preview {
            flex: 1;
            background: #525659;
            overflow: auto;
            position: relative;
            display: flex;
            justify-content: center;
            padding: 32px;
        }

        .orders-preview__stage {
            margin: auto;
        }

        .orders-preview__canvas {
            box-shadow: 0 4px 20px rgba(0,0,0,0.4);
            max-width: 100%;
        }

        .orders-sidebar {
            width: 420px;
            flex-shrink: 0;
            background: rgba(255, 255, 255, 0.96);
            border-left: 1px solid #e2e8f0;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
        }

        body[data-theme="dark"] .orders-sidebar {
            background: rgba(15, 23, 42, 0.94);
            border-left-color: rgba(148, 163, 184, 0.16);
        }

        .orders-sidebar__inner {
            padding: 20px;
        }

        .orders-fields {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-bottom: 24px;
        }

        .orders-field--span-2 {
            grid-column: span 2;
        }

        .orders-field__label {
            font-size: 12px;
            font-weight: 600;
            color: #64748b;
            display: block;
            margin-bottom: 4px;
        }

        body[data-theme="dark"] .orders-field__label {
            color: #94a3b8;
        }

        .orders-field__input {
            width: 100%;
            padding: 6px;
            border: 1px solid #cbd5e1;
            border-radius: 4px;
            background: white;
            color: inherit;
        }

        body[data-theme="dark"] .orders-field__input {
            background: rgba(15, 23, 42, 0.9);
            border-color: rgba(148, 163, 184, 0.28);
            color: var(--text-primary);
        }

        .orders-copyline {
            margin-bottom: 24px;
            display: flex;
            gap: 8px;
        }

        .orders-copyline__input {
            flex: 1;
            padding: 6px;
            background: #f1f5f9;
            border: 1px solid #e2e8f0;
            border-radius: 4px;
            font-family: monospace;
            font-size: 11px;
            color: inherit;
        }

        body[data-theme="dark"] .orders-copyline__input {
            background: rgba(15, 23, 42, 0.85);
            border-color: rgba(148, 163, 184, 0.18);
        }

        .orders-copyline__button {
            padding: 6px 12px;
            font-size: 12px;
        }

        .orders-divider {
            border: 0;
            border-top: 1px solid #e2e8f0;
            margin: 0 0 24px;
        }

        body[data-theme="dark"] .orders-divider {
            border-top-color: rgba(148, 163, 184, 0.16);
        }

        .orders-driver {
            display: flex;
            flex-direction: column;
            height: 100%;
        }

        .orders-driver__header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            margin-bottom: 8px;
        }

        .orders-driver__label {
            font-size: 13px;
            font-weight: 700;
            color: var(--text-primary);
        }

        .orders-driver__copy {
            font-size: 11px;
            padding: 4px 8px;
            background: #eff6ff;
            color: #3b82f6;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        .orders-driver__textarea {
            width: 100%;
            flex: 1;
            min-height: 300px;
            font-family: "Consolas", "Monaco", monospace;
            font-size: 12px;
            line-height: 1.4;
            padding: 12px;
            border: 1px solid #cbd5e1;
            border-radius: 6px;
            resize: vertical;
            background: white;
            color: inherit;
        }

        body[data-theme="dark"] .orders-driver__textarea {
            background: rgba(15, 23, 42, 0.92);
            border-color: rgba(148, 163, 184, 0.28);
            color: var(--text-primary);
        }

        @media (max-width: 1280px) {
            .orders-body {
                flex-direction: column;
            }

            .orders-sidebar {
                width: 100%;
                border-left: none;
                border-top: 1px solid #e2e8f0;
            }

            body[data-theme="dark"] .orders-sidebar {
                border-top-color: rgba(148, 163, 184, 0.16);
            }

            .orders-preview {
                min-height: 320px;
            }
        }

        @media (max-width: 720px) {
            .orders-toolbar {
                padding: 12px 16px;
                align-items: flex-start;
            }

            .orders-toolbar__group {
                width: 100%;
            }

            .orders-settings {
                width: 100%;
            }

            .orders-settings__panel {
                position: static;
                width: 100%;
                margin-top: 12px;
            }

            .orders-preview {
                padding: 16px;
            }

            .orders-fields {
                grid-template-columns: 1fr;
            }

            .orders-field--span-2 {
                grid-column: auto;
            }

            .orders-copyline {
                flex-direction: column;
            }

            .orders-copyline__button,
            .orders-driver__copy {
                width: 100%;
            }

            .orders-driver__header {
                flex-direction: column;
                align-items: flex-start;
            }
        }

        .orders-view {
            display: none;
            padding: 24px 28px 28px;
            overflow: hidden;
            min-height: 0;
        }

        .orders-view.is-active {
            display: block;
        }

        .orders-crm {
            display: flex;
            flex-direction: column;
            gap: 18px;
            height: 100%;
            min-height: 0;
            position: relative;
        }

        .orders-crm.is-board-drop::after {
            content: 'Отпустите файл — заявка создастся автоматически';
            position: absolute;
            inset: 0;
            z-index: 90;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(var(--accent-rgb, 59, 130, 246), 0.08);
            border: 2px dashed var(--accent, #3b82f6);
            border-radius: 16px;
            font-size: 15px;
            font-weight: 600;
            color: var(--accent, #3b82f6);
            pointer-events: none;
        }

        .orders-toolbar {
            display: flex;
            flex-direction: column;
            gap: 16px;
            padding: 22px 24px;
            border: 1px solid var(--border-soft);
            border-radius: 24px;
            background: var(--bg-elevated);
            box-shadow: var(--shadow-soft);
            backdrop-filter: blur(18px);
        }

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

        .orders-toolbar__title {
            margin: 0;
            font-size: 24px;
            letter-spacing: -0.02em;
        }

        .orders-toolbar__subtitle {
            margin: 0;
            color: var(--text-secondary);
            font-size: 14px;
            line-height: 1.5;
        }

        .orders-toolbar__controls {
            display: flex;
            flex-wrap: wrap;
            gap: 14px;
            align-items: end;
        }

        .orders-filter {
            display: flex;
            flex-direction: column;
            gap: 8px;
            min-width: 180px;
            flex: 1 1 180px;
        }

        .orders-filter__label {
            font-size: 12px;
            font-weight: 700;
            color: var(--text-tertiary);
            text-transform: uppercase;
            letter-spacing: 0.08em;
        }

        .orders-filter__input,
        .orders-form__input,
        .orders-table__filter {
            width: 100%;
            min-height: 42px;
            border-radius: 14px;
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.82);
            color: var(--text-primary);
            padding: 10px 14px;
            font: inherit;
        }

        body[data-theme="dark"] .orders-filter__input,
        body[data-theme="dark"] .orders-form__input,
        body[data-theme="dark"] .orders-table__filter {
            background: rgba(15, 23, 42, 0.9);
        }

        .orders-toolbar__actions {
            display: flex;
            gap: 10px;
            margin-left: auto;
        }

        .orders-notice {
            display: none;
            margin-top: 6px;
            border-radius: 14px;
            padding: 10px 14px;
            font-size: 13px;
            line-height: 1.4;
            color: var(--text-secondary);
            background: rgba(148, 163, 184, 0.08);
            border: 1px solid rgba(148, 163, 184, 0.14);
        }

        .orders-notice.is-visible {
            display: block;
        }

        .orders-notice--default {
            color: #dbe6ff;
            background: rgba(99, 102, 241, 0.14);
            border-color: rgba(129, 140, 248, 0.28);
        }

        .orders-notice--success {
            color: #d1fae5;
            background: rgba(16, 185, 129, 0.14);
            border-color: rgba(52, 211, 153, 0.28);
        }

        .orders-notice--error {
            color: #fecaca;
            background: rgba(239, 68, 68, 0.14);
            border-color: rgba(248, 113, 113, 0.28);
        }

        .orders-layout {
            display: grid;
            grid-template-columns: minmax(0, 1.4fr) minmax(360px, 0.9fr);
            gap: 18px;
            flex: 1 1 auto;
            min-height: 0;
        }

        .orders-table-card,
        .orders-detail-card {
            min-height: 0;
            border: 1px solid var(--border-soft);
            border-radius: 24px;
            background: var(--bg-elevated);
            box-shadow: var(--shadow-soft);
            overflow: hidden;
        }

        .orders-table-card {
            display: flex;
            flex-direction: column;
        }

        .orders-table-wrap {
            flex: 1 1 auto;
            min-height: 0;
            overflow: auto;
        }

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

        .orders-table__head {
            position: sticky;
            top: 0;
            z-index: 2;
            background: rgba(248, 250, 252, 0.98);
            border-bottom: 2px solid var(--border-soft);
            padding: 0 14px;
            height: 40px;
            text-align: left;
            vertical-align: middle;
            white-space: nowrap;
        }

        .orders-table__head[draggable="true"] {
            cursor: grab;
        }

        body[data-theme="dark"] .orders-table__head {
            background: rgba(15, 23, 42, 0.96);
        }

        .orders-table__head--right {
            text-align: right;
        }

        .orders-table__head--left {
            text-align: left;
        }

        .orders-table__head--center {
            text-align: center;
        }

        .orders-table__head--prominent span:first-child,
        .orders-table__cell--prominent {
            font-weight: 700;
        }

        .orders-table__head-label {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            border: none;
            background: transparent;
            color: var(--text-tertiary);
            padding: 0;
            font: inherit;
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 0.06em;
            text-transform: uppercase;
        }

        .orders-table__head.is-dragging {
            opacity: 0.52;
        }

        .orders-table__head.is-drop-before::before,
        .orders-table__head.is-drop-after::after {
            content: '';
            position: absolute;
            top: 8px;
            bottom: 8px;
            width: 2px;
            border-radius: 999px;
            background: var(--accent);
        }

        .orders-table__head.is-drop-before::before {
            left: -1px;
        }

        .orders-table__head.is-drop-after::after {
            right: -1px;
        }

        .orders-table__row {
            cursor: pointer;
            transition: background 0.12s ease;
        }

        .orders-table__row:nth-child(even) {
            background: rgba(148, 163, 184, 0.025);
        }

        .orders-table__row:hover {
            background: rgba(79, 70, 229, 0.055);
        }

        body[data-theme="dark"] .orders-table__row:hover {
            background: rgba(99, 102, 241, 0.1);
        }

        .orders-table__row.is-selected {
            background: rgba(79, 70, 229, 0.1);
            box-shadow: inset 3px 0 0 var(--accent);
        }

        body[data-theme="dark"] .orders-table__row.is-selected {
            background: rgba(99, 102, 241, 0.16);
        }

        .orders-table__row.has-route-group {
            background: rgba(16, 185, 129, 0.03);
        }

        .orders-table__row.has-route-group:hover {
            background: rgba(16, 185, 129, 0.07);
        }

        .orders-table__cell {
            padding: 10px 14px;
            border-bottom: 1px solid rgba(148, 163, 184, 0.06);
            font-size: 13px;
            color: var(--text-primary);
            vertical-align: middle;
            text-align: left;
            line-height: 1.35;
        }

        .orders-table__cell--right {
            text-align: right;
        }

        .orders-table__cell--left {
            text-align: left;
        }

        .orders-table__cell--center {
            text-align: center;
        }

        .orders-table__cell--prominent {
            font-size: 13px;
            font-weight: 700;
        }

        .orders-table__text {
            display: inline-block;
            min-width: 0;
            line-height: 1.4;
        }

        .orders-table__text--clamp {
            max-width: 200px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .orders-table__empty {
            color: var(--text-tertiary);
            font-size: 12px;
        }

        .orders-table__date {
            font-size: 13px;
            font-weight: 500;
            color: var(--text-secondary);
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
        }

        .orders-table__money {
            font-size: 13px;
            font-weight: 700;
            color: var(--text-primary);
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
        }

        .orders-table__km {
            font-size: 12px;
            font-weight: 600;
            color: var(--text-secondary);
            font-variant-numeric: tabular-nums;
        }

        .orders-table__payment-term {
            font-size: 12px;
            color: var(--text-tertiary);
            white-space: nowrap;
        }

        .orders-table__order-num {
            font-size: 13px;
            font-weight: 700;
            color: var(--text-primary);
            white-space: nowrap;
        }

        .orders-table__draft-label {
            display: inline-flex;
            align-items: center;
            height: 22px;
            padding: 0 8px;
            border-radius: 6px;
            background: rgba(148, 163, 184, 0.1);
            color: var(--text-tertiary);
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 0.02em;
        }

        .orders-table__badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            min-height: 26px;
            padding: 0 9px;
            border-radius: 7px;
            font-size: 12px;
            font-weight: 700;
            white-space: nowrap;
        }

        .orders-table__badge svg {
            flex-shrink: 0;
            opacity: 0.7;
        }

        .orders-table__badge--truck {
            background: rgba(79, 70, 229, 0.08);
            color: var(--accent-strong);
        }

        .orders-table__badge--route {
            background: rgba(16, 185, 129, 0.1);
            color: #047857;
        }

        body[data-theme="dark"] .orders-table__badge--route {
            background: rgba(16, 185, 129, 0.18);
            color: #6ee7b7;
        }

        .orders-table__badge--status.orders-table__badge--active {
            background: rgba(22, 163, 74, 0.14);
            color: #15803d;
        }

        .orders-table__badge--status.orders-table__badge--needs_review {
            background: rgba(245, 158, 11, 0.18);
            color: #b45309;
        }

        .orders-table__badge--status.orders-table__badge--draft {
            background: rgba(71, 85, 105, 0.14);
            color: #475569;
        }

        .orders-table__count {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            min-width: 0;
            min-height: 0;
            padding: 0;
            border-radius: 0;
            background: transparent;
            color: var(--text-secondary);
            font-size: 12px;
            font-weight: 600;
        }

        .orders-table__count svg {
            flex-shrink: 0;
            opacity: 0.55;
        }

        .orders-table__link {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            min-height: 26px;
            padding: 0 9px;
            border-radius: 7px;
            border: 1px solid var(--border-soft);
            color: var(--accent-strong);
            text-decoration: none;
            font-size: 12px;
            font-weight: 600;
            transition: border-color 0.15s ease, background 0.15s ease;
        }

        .orders-table__link svg {
            flex-shrink: 0;
            opacity: 0.65;
        }

        .orders-table__link:hover {
            border-color: var(--accent);
            background: rgba(99, 102, 241, 0.06);
        }

        .orders-table__draft-title {
            display: inline-flex;
            align-items: center;
            min-height: 24px;
            padding: 0 8px;
            border-radius: 6px;
            background: rgba(99, 102, 241, 0.1);
            color: var(--accent-strong);
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .orders-empty {
            display: grid;
            place-items: center;
            min-height: 280px;
            padding: 36px;
            text-align: center;
            color: var(--text-secondary);
        }

        .orders-empty[hidden] {
            display: none !important;
        }

        .orders-empty h3 {
            margin: 0 0 8px;
            font-size: 18px;
            color: var(--text-primary);
        }

        .orders-detail {
            height: 100%;
            overflow: hidden;
        }

        .orders-detail__inner {
            display: flex;
            flex-direction: column;
            gap: 16px;
            padding: 20px;
            height: 100%;
            min-height: 0;
        }

        .orders-detail__inner--empty {
            height: 100%;
            justify-content: center;
        }

        .orders-detail__placeholder {
            display: flex;
            flex-direction: column;
            gap: 14px;
            align-items: flex-start;
            padding: 28px;
            border-radius: 24px;
            border: 1px dashed var(--border-strong);
            background: rgba(79, 70, 229, 0.04);
        }

        .orders-detail__placeholder h2 {
            margin: 0;
            font-size: 24px;
            letter-spacing: -0.02em;
        }

        .orders-detail__placeholder p {
            margin: 0;
            color: var(--text-secondary);
            line-height: 1.6;
            max-width: 34ch;
        }

        .orders-detail__header {
            display: flex;
            justify-content: space-between;
            gap: 16px;
            align-items: start;
        }

        .orders-detail__header h2 {
            margin: 0 0 6px;
            font-size: 22px;
            letter-spacing: -0.02em;
        }

        .orders-detail__header p {
            margin: 0;
            color: var(--text-secondary);
            line-height: 1.5;
        }

        .orders-detail__actions {
            display: flex;
            gap: 10px;
            flex-shrink: 0;
        }

        .orders-detail__workspace {
            display: grid;
            grid-template-columns: minmax(0, 1fr) minmax(420px, 540px);
            gap: 16px;
            align-items: start;
            flex: 1 1 auto;
            min-height: 0;
        }

        .orders-detail__preview-column,
        .orders-detail__form-column {
            display: flex;
            flex-direction: column;
            gap: 16px;
            min-width: 0;
            min-height: 0;
        }

        .orders-detail__form-column {
            overflow: auto;
            padding: 18px;
            padding-right: 8px;
            border-radius: 26px;
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.04);
        }

        .orders-detail__danger {
            border-color: rgba(239, 68, 68, 0.24);
            background: rgba(239, 68, 68, 0.08);
            color: #b91c1c;
        }

        .orders-detail__danger:hover {
            border-color: rgba(239, 68, 68, 0.36);
            background: rgba(239, 68, 68, 0.12);
        }

        body[data-theme="dark"] .orders-detail__danger {
            border-color: rgba(248, 113, 113, 0.26);
            background: rgba(127, 29, 29, 0.24);
            color: #fecaca;
        }

        .orders-detail__meta {
            display: flex;
            flex-wrap: wrap;
            gap: 8px 12px;
            align-items: center;
        }

        .orders-status-pill {
            display: none;
            align-items: center;
            min-height: 30px;
            padding: 0 12px;
            border-radius: 999px;
            font-size: 12px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
        }

        .orders-status-pill--active {
            background: rgba(22, 163, 74, 0.12);
            color: #15803d;
        }

        .orders-status-pill--needs_review {
            background: rgba(245, 158, 11, 0.16);
            color: #b45309;
        }

        .orders-status-pill--draft {
            background: rgba(71, 85, 105, 0.14);
            color: #475569;
        }

        .orders-panel {
            display: flex;
            flex-direction: column;
            gap: 14px;
            padding: 18px;
            border-radius: 20px;
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.55);
        }

        body[data-theme="dark"] .orders-panel {
            background: rgba(15, 23, 42, 0.54);
        }

        .orders-panel__header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
        }

        .orders-panel__header h3 {
            margin: 0;
            font-size: 16px;
        }

        .orders-inline-action {
            min-height: 34px;
            padding: 0 12px;
        }

        .orders-form__map-field {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .orders-form__map-field .orders-form__input {
            flex: 1 1 auto;
            min-width: 0;
        }

        .orders-form__map-placeholder {
            flex: 0 0 auto;
            font-size: 12px;
            color: var(--text-secondary);
            white-space: nowrap;
        }

        .orders-form {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 12px;
        }

        .orders-form__field {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .orders-truckline-wrap {
            position: relative;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .orders-truckline {
            width: 100%;
            border: 1px solid var(--border-soft);
            border-radius: 16px;
            background: rgba(255, 255, 255, 0.72);
            color: var(--text-primary);
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 4px;
            padding: 12px 14px;
            text-align: left;
            cursor: pointer;
            transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
        }

        body[data-theme="dark"] .orders-truckline {
            background: rgba(15, 23, 42, 0.88);
        }

        .orders-truckline:hover {
            border-color: var(--border-strong);
        }

        .orders-truckline.is-open {
            border-color: rgba(99, 102, 241, 0.42);
            box-shadow: 0 0 0 3px var(--accent-soft);
        }

        .orders-truckline__value {
            font-size: 15px;
            font-weight: 700;
            line-height: 1.3;
        }

        .orders-truckline__value.is-placeholder {
            color: var(--text-tertiary);
        }

        .orders-truckline__meta {
            font-size: 12px;
            line-height: 1.4;
            color: var(--text-tertiary);
        }

        .orders-truckline__panel {
            display: flex;
            flex-direction: column;
            gap: 10px;
            padding: 12px;
            border-radius: 18px;
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.88);
        }

        body[data-theme="dark"] .orders-truckline__panel {
            background: rgba(10, 18, 32, 0.96);
        }

        .orders-truckline__options {
            display: flex;
            flex-direction: column;
            gap: 6px;
            max-height: 224px;
            overflow: auto;
        }

        .orders-truckline__option {
            width: 100%;
            border: 1px solid transparent;
            border-radius: 14px;
            background: transparent;
            color: var(--text-primary);
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            padding: 10px 12px;
            text-align: left;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
        }

        .orders-truckline__option:hover,
        .orders-truckline__option.is-active {
            background: rgba(79, 70, 229, 0.08);
            border-color: rgba(79, 70, 229, 0.16);
            color: var(--accent-strong);
        }

        .orders-truckline__mark {
            flex: 0 0 auto;
            font-size: 11px;
            font-weight: 700;
            color: var(--text-tertiary);
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .orders-truckline__actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .orders-truckline__actions .ghost-button {
            min-height: 38px;
            padding-inline: 14px;
        }

        .orders-truckline__create {
            align-self: flex-start;
        }

        .orders-form__field--span-2 {
            grid-column: span 2;
        }

        .orders-form__field--checkbox {
            flex-direction: row;
            align-items: center;
            gap: 10px;
            min-height: 42px;
            padding: 10px 12px;
            border-radius: 14px;
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.68);
        }

        body[data-theme="dark"] .orders-form__field--checkbox {
            background: rgba(15, 23, 42, 0.88);
        }

        .orders-form__label,
        .orders-form__checkbox-label {
            font-size: 12px;
            font-weight: 700;
            color: var(--text-tertiary);
            text-transform: uppercase;
            letter-spacing: 0.06em;
        }

        .orders-form__textarea {
            min-height: 96px;
            resize: vertical;
            padding-top: 12px;
            line-height: 1.5;
        }

        .orders-previewbox {
            display: grid;
            grid-template-columns: minmax(0, 1fr);
            grid-template-rows: minmax(0, 1fr) auto;
            gap: 14px;
            flex: 1 1 auto;
            min-height: 0;
        }

        .orders-previewbox.is-active .orders-previewbox__canvas {
            border-color: rgba(79, 70, 229, 0.56);
            box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
            background:
              linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(14, 165, 233, 0.12)),
              linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.82));
        }

        .orders-previewbox__canvas {
            width: 100%;
            min-height: 140px;
            border-radius: 18px;
            border: 1px solid var(--border-soft);
            background:
              linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(14, 165, 233, 0.05)),
              linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.74));
        }

        .orders-previewbox__stage {
            min-height: 0;
            height: 100%;
            overflow: auto;
            padding: 14px;
            border-radius: 18px;
            border: 1px solid var(--border-soft);
            background:
              linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(14, 165, 233, 0.05)),
              linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.74));
        }

        body[data-theme="dark"] .orders-previewbox__canvas {
            background:
              linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(14, 165, 233, 0.09)),
              rgba(15, 23, 42, 0.9);
        }

        body[data-theme="dark"] .orders-previewbox__stage {
            background:
              linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(14, 165, 233, 0.09)),
              rgba(15, 23, 42, 0.9);
        }

        body[data-theme="dark"] .orders-previewbox.is-active .orders-previewbox__canvas {
            border-color: rgba(129, 140, 248, 0.42);
            box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
            background:
              linear-gradient(135deg, rgba(99, 102, 241, 0.24), rgba(14, 165, 233, 0.18)),
              rgba(15, 23, 42, 0.96);
        }

        .orders-previewbox.is-active .orders-previewbox__stage {
            border-color: rgba(79, 70, 229, 0.56);
            box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
            background:
              linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(14, 165, 233, 0.12)),
              linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.82));
        }

        body[data-theme="dark"] .orders-previewbox.is-active .orders-previewbox__stage {
            border-color: rgba(129, 140, 248, 0.42);
            box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
            background:
              linear-gradient(135deg, rgba(99, 102, 241, 0.24), rgba(14, 165, 233, 0.18)),
              rgba(15, 23, 42, 0.96);
        }

        .orders-previewbox__summary {
            display: flex;
            justify-content: space-between;
            gap: 12px;
            align-items: center;
            margin-bottom: 12px;
        }

        .orders-previewbox__summary-main {
            display: flex;
            min-width: 0;
            flex-direction: column;
            gap: 4px;
        }

        .orders-previewbox__summary strong {
            font-size: 14px;
            line-height: 1.4;
            overflow-wrap: anywhere;
        }

        .orders-previewbox__summary span {
            flex: 0 0 auto;
            color: var(--text-tertiary);
            font-size: 12px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .orders-previewbox__pdf-shell {
            width: 100%;
            min-height: clamp(720px, calc(100vh - 240px), 1200px);
            border-radius: 18px;
            overflow: hidden;
            border: 1px solid var(--border-soft);
            background: #fff;
        }

        .orders-previewbox__pdf-frame {
            width: 100%;
            height: clamp(720px, calc(100vh - 240px), 1200px);
            border: 0;
            display: block;
            background: #fff;
        }

        .orders-previewbox__summary-actions {
            display: flex;
            flex-wrap: wrap;
            justify-content: flex-end;
            gap: 8px;
        }

        .orders-previewtext {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 14px;
            padding: 12px;
            border-radius: 16px;
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.72);
        }

        body[data-theme="dark"] .orders-previewtext {
            background: rgba(15, 23, 42, 0.82);
        }

        .orders-previewtext__header {
            display: flex;
            justify-content: space-between;
            gap: 12px;
            align-items: center;
        }

        .orders-previewtext__header strong {
            font-size: 13px;
            letter-spacing: -0.01em;
        }

        .orders-previewtext__header span {
            color: var(--text-tertiary);
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .orders-previewtext__body {
            max-height: 220px;
            overflow: auto;
            padding: 12px 14px;
            border-radius: 12px;
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.82);
            color: var(--text-primary);
            font-size: 13px;
            line-height: 1.55;
            white-space: pre-wrap;
            user-select: text;
            cursor: text;
        }

        body[data-theme="dark"] .orders-previewtext__body {
            background: rgba(8, 13, 24, 0.92);
        }

        .orders-previewbox__pages {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .orders-previewpage {
            margin: 0;
            display: flex;
            flex-direction: column;
            gap: 8px;
            padding: 10px;
            border-radius: 16px;
            background: rgba(255, 255, 255, 0.64);
            border: 1px solid var(--border-soft);
        }

        body[data-theme="dark"] .orders-previewpage {
            background: rgba(15, 23, 42, 0.82);
        }

        .orders-previewpage img {
            width: 100%;
            display: block;
            border-radius: 12px;
            border: 1px solid var(--border-soft);
            background: #fff;
        }

        .orders-previewpage figcaption {
            color: var(--text-tertiary);
            font-size: 12px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .orders-previewbox__empty {
            min-height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            gap: 8px;
            text-align: center;
            padding: 18px;
        }

        .orders-previewbox__empty strong {
            font-size: 16px;
            line-height: 1.4;
        }

        .orders-previewbox__empty span {
            max-width: 38ch;
            color: var(--text-secondary);
            font-size: 14px;
            line-height: 1.6;
        }

        .orders-previewbox__info p {
            margin: 0 0 10px;
            color: var(--text-secondary);
            line-height: 1.5;
        }

        .orders-previewbox__buttons {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }

        .orders-previewbox__thumb-strip {
            display: flex;
            gap: 8px;
            align-items: center;
            padding: 8px 0 4px;
            overflow-x: auto;
        }

        .orders-previewbox__thumb {
            width: 64px;
            height: 80px;
            object-fit: cover;
            border-radius: 6px;
            border: 1px solid var(--border-soft);
            flex: 0 0 auto;
        }

        .orders-previewbox__thumb-more {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 48px;
            height: 80px;
            border-radius: 6px;
            border: 1px dashed var(--border-soft);
            color: var(--text-tertiary);
            font-size: 12px;
            font-weight: 700;
            flex: 0 0 auto;
        }

        .orders-warning-list {
            margin: 0;
            padding-left: 18px;
            color: #b45309;
            line-height: 1.5;
        }

        .orders-documents {
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        .orders-documents__group {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .orders-documents__list {
            margin: 0;
            padding-left: 18px;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .orders-documents__list--cards {
            padding-left: 0;
            list-style: none;
            gap: 10px;
        }

        .orders-documents__list li {
            color: var(--text-secondary);
        }

        .orders-documents__list a {
            color: var(--accent-strong);
            text-decoration: none;
        }

        .orders-dropzone {
            display: grid;
            grid-template-columns: auto minmax(0, 1fr) auto;
            align-items: center;
            gap: 14px;
            padding: 16px 18px;
            border-radius: 18px;
            border: 1.5px dashed rgba(99, 102, 241, 0.2);
            background:
                linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(14, 165, 233, 0.05)),
                rgba(255, 255, 255, 0.48);
            transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
        }

        body[data-theme="dark"] .orders-dropzone {
            background:
                linear-gradient(135deg, rgba(79, 70, 229, 0.14), rgba(14, 165, 233, 0.1)),
                rgba(8, 15, 30, 0.92);
            border-color: rgba(129, 140, 248, 0.28);
        }

        .orders-dropzone.is-active {
            border-color: rgba(79, 70, 229, 0.64);
            background:
                linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(14, 165, 233, 0.1)),
                rgba(255, 255, 255, 0.78);
            box-shadow: 0 18px 42px rgba(79, 70, 229, 0.12);
            transform: translateY(-1px);
        }

        body[data-theme="dark"] .orders-dropzone.is-active {
            background:
                linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(14, 165, 233, 0.14)),
                rgba(8, 15, 30, 0.98);
            box-shadow: 0 20px 40px rgba(15, 23, 42, 0.42);
        }

        .orders-dropzone__icon {
            width: 46px;
            height: 46px;
            border-radius: 14px;
            display: grid;
            place-items: center;
            background: rgba(255, 255, 255, 0.72);
            color: var(--accent-strong);
            font-size: 24px;
            font-weight: 800;
            line-height: 1;
            border: 1px solid rgba(99, 102, 241, 0.12);
        }

        body[data-theme="dark"] .orders-dropzone__icon {
            background: rgba(15, 23, 42, 0.76);
            border-color: rgba(129, 140, 248, 0.16);
        }

        .orders-dropzone__content {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .orders-dropzone__content strong {
            font-size: 14px;
            line-height: 1.4;
        }

        .orders-dropzone__content span {
            color: var(--text-secondary);
            font-size: 13px;
            line-height: 1.5;
        }

        .orders-dropzone__button {
            min-height: 38px;
            padding: 0 14px;
            white-space: nowrap;
        }

        .orders-documents__list span,
        .orders-muted {
            color: var(--text-tertiary);
            font-size: 13px;
        }

        .orders-doc-card {
            display: grid;
            grid-template-columns: 88px minmax(0, 1fr);
            gap: 12px;
            padding: 12px;
            border-radius: 16px;
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.55);
        }

        body[data-theme="dark"] .orders-doc-card {
            background: rgba(15, 23, 42, 0.72);
        }

        .orders-doc-card__thumb {
            width: 88px;
            height: 88px;
            border-radius: 14px;
            overflow: hidden;
            border: 1px solid var(--border-soft);
            background: rgba(79, 70, 229, 0.08);
            display: grid;
            place-items: center;
            text-decoration: none;
            padding: 0;
            cursor: pointer;
        }

        .orders-doc-card__thumb img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .orders-doc-card__thumb--file {
            color: var(--accent-strong);
            font-size: 20px;
            font-weight: 800;
            letter-spacing: 0.08em;
        }

        .orders-doc-card__body {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 6px;
            justify-content: center;
        }

        .orders-doc-card__title {
            color: var(--text-primary);
            text-decoration: none;
            font-weight: 700;
            line-height: 1.4;
            overflow-wrap: anywhere;
            padding: 0;
            border: 0;
            background: transparent;
            text-align: left;
            cursor: pointer;
        }

        .orders-doc-card__meta,
        .orders-doc-card__actions {
            display: flex;
            flex-wrap: wrap;
            gap: 6px 12px;
            align-items: center;
        }

        .orders-doc-card__meta {
            color: var(--text-tertiary);
            font-size: 12px;
        }

        .orders-doc-card__actions a,
        .orders-doc-card__actions button {
            color: var(--accent-strong);
            text-decoration: none;
            font-size: 12px;
            font-weight: 700;
            padding: 0;
            border: 0;
            background: transparent;
            cursor: pointer;
        }

        .orders-panel--preview {
            flex: 1 1 auto;
            min-height: 0;
        }

        .orders-panel--documents {
            max-height: 260px;
            overflow: auto;
        }

        @media (max-width: 820px) {
            .orders-dropzone {
                grid-template-columns: minmax(0, 1fr);
            }

            .orders-dropzone__button {
                width: 100%;
            }
        }

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

            .orders-detail-card {
                min-height: 560px;
            }

            .orders-detail__workspace {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 860px) {
            .orders-view {
                padding: 16px;
            }

            .orders-toolbar {
                padding: 18px;
            }

            .orders-toolbar__actions,
            .orders-detail__actions,
            .orders-previewbox__buttons {
                width: 100%;
                margin-left: 0;
            }

            .orders-toolbar__actions button,
            .orders-detail__actions button,
            .orders-previewbox__buttons button {
                flex: 1 1 0;
            }

            .orders-form {
                grid-template-columns: 1fr;
            }

            .orders-form__field--span-2 {
                grid-column: auto;
            }

            .orders-truckline__actions .ghost-button,
            .orders-truckline__create {
                width: 100%;
                justify-content: center;
            }
        }

        /* Orders CRM: single-board layout with slide-over detail drawer */
        .orders-view {
            padding: 12px 16px 16px;
        }

        .orders-crm {
            display: block;
            position: relative;
            height: 100%;
            min-height: 0;
            overflow: hidden;
            isolation: isolate;
        }

        .orders-board {
            display: flex;
            flex-direction: column;
            gap: 0;
            height: 100%;
            min-height: 0;
            padding: 0;
            border-radius: 20px;
            border: 1px solid var(--border-soft);
            background: var(--bg-elevated);
            box-shadow: var(--shadow-soft);
            overflow: hidden;
        }

        body[data-theme="dark"] .orders-board {
            background: rgba(15, 23, 42, 0.84);
        }

        .orders-board__toolbar {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 14px 20px 12px;
            flex-wrap: wrap;
        }

        .orders-board__titlewrap {
            display: flex;
            flex-direction: column;
            gap: 2px;
            margin-right: auto;
        }

        .orders-board__title {
            margin: 0;
            font-size: 18px;
            font-weight: 800;
            line-height: 1.1;
            letter-spacing: -0.02em;
        }

        .orders-board__subtitle {
            margin: 0;
            font-size: 11px;
            line-height: 1.4;
            color: var(--text-tertiary);
        }

        .orders-board__controls {
            display: flex;
            flex-wrap: wrap;
            justify-content: flex-end;
            align-items: center;
            gap: 8px;
            padding: 0;
            border: none;
            border-radius: 0;
            background: transparent;
        }

        .orders-board__controls .orders-filter {
            flex: 0 1 auto;
            min-width: 0;
            max-width: none;
        }

        .orders-board__controls .orders-filter--search {
            flex: 0 1 280px;
            min-width: 180px;
            max-width: 320px;
        }

        .orders-board__controls .orders-filter--search .orders-filter__label {
            display: none;
        }

        .orders-board__controls .orders-filter--search .orders-filter__input {
            min-height: 38px;
            padding: 7px 14px 7px 36px;
            border-radius: 10px;
            font-size: 13px;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: 12px center;
        }

        .orders-board__actions {
            display: flex;
            gap: 6px;
            flex: 0 0 auto;
        }

        .orders-board__actions .ghost-button,
        .orders-board__actions .primary {
            min-height: 38px;
            padding-inline: 14px;
            white-space: nowrap;
            font-size: 13px;
            border-radius: 10px;
        }

        .orders-board__actions .ghost-button {
            font-size: 12px;
        }

        .orders-board__actions .primary {
            border: none;
            border-radius: 10px;
            background: linear-gradient(135deg, var(--accent), var(--accent-strong));
            color: #fff;
            font-size: 13px;
            font-weight: 700;
            box-shadow: 0 8px 20px -10px rgba(79, 70, 229, 0.55);
            cursor: pointer;
            transition: transform 0.15s ease, box-shadow 0.15s ease;
        }

        .orders-board__actions .primary:hover {
            transform: translateY(-1px);
            box-shadow: 0 12px 24px -10px rgba(79, 70, 229, 0.65);
        }

        .orders-notice {
            margin: 0 20px;
            font-size: 13px;
        }

        .orders-table-wrap {
            flex: 1 1 auto;
            min-height: 0;
            overflow: auto;
            margin: 0;
            padding: 0;
            border-top: 1px solid var(--border-soft);
            border-radius: 0;
            background: transparent;
            scrollbar-width: thin;
            scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
        }

        .orders-table-wrap::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }

        .orders-table-wrap::-webkit-scrollbar-thumb {
            background: rgba(148, 163, 184, 0.3);
            border-radius: 999px;
        }

        .orders-table-wrap::-webkit-scrollbar-track {
            background: transparent;
        }

        .orders-empty {
            flex: 1 1 auto;
            min-height: 220px;
            margin: 20px;
            padding: 28px 20px 40px;
            border: 1px dashed var(--border-soft);
            border-radius: 16px;
            background: rgba(255, 255, 255, 0.02);
        }

        .orders-drawer-backdrop {
            position: absolute;
            inset: 0;
            border: 0;
            border-radius: inherit;
            background: rgba(15, 23, 42, 0.32);
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.22s ease;
            z-index: 20;
        }

        body[data-theme="dark"] .orders-drawer-backdrop {
            background: rgba(2, 6, 23, 0.58);
        }

        .orders-drawer {
            position: absolute;
            top: 12px;
            left: 12px;
            right: 12px;
            bottom: 12px;
            width: auto;
            max-width: 100%;
            border-radius: 28px;
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.98);
            box-shadow: 0 20px 56px rgba(15, 23, 42, 0.18);
            overflow: hidden;
            transform: translateX(calc(100% + 24px));
            transition: transform 0.24s ease;
            visibility: hidden;
            pointer-events: none;
            will-change: transform;
            contain: layout paint;
            z-index: 24;
        }

        body[data-theme="dark"] .orders-drawer {
            border-color: rgba(148, 163, 184, 0.16);
            background: rgba(8, 13, 24, 0.98);
            box-shadow: 0 22px 62px rgba(2, 6, 23, 0.44);
        }

        .orders-crm.is-detail-open .orders-drawer-backdrop {
            opacity: 1;
            pointer-events: auto;
        }

        .orders-crm.is-detail-open .orders-drawer {
            transform: translateX(0);
            visibility: visible;
            pointer-events: auto;
        }

        .orders-modal {
            position: absolute;
            inset: 0;
            z-index: 34;
        }

        .orders-modal__backdrop {
            position: absolute;
            inset: 0;
            border: 0;
            background: rgba(15, 23, 42, 0.54);
        }

        .orders-modal__card {
            position: absolute;
            top: 50%;
            left: 50%;
            width: min(520px, calc(100% - 32px));
            padding: 22px;
            border-radius: 24px;
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.98);
            box-shadow: 0 28px 60px rgba(15, 23, 42, 0.22);
            transform: translate(-50%, -50%);
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        body[data-theme="dark"] .orders-modal__card {
            background: rgba(8, 13, 24, 0.98);
            border-color: rgba(148, 163, 184, 0.16);
            box-shadow: 0 28px 66px rgba(2, 6, 23, 0.58);
        }

        .orders-modal__eyebrow {
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-tertiary);
        }

        .orders-modal__title {
            margin: 0;
            font-size: 28px;
            line-height: 1.05;
            letter-spacing: -0.03em;
        }

        .orders-modal__text {
            margin: 0;
            color: var(--text-secondary);
            line-height: 1.65;
        }

        .orders-modal__user {
            padding: 12px 14px;
            border-radius: 16px;
            border: 1px solid var(--border-soft);
            background: rgba(79, 70, 229, 0.06);
            color: var(--text-secondary);
            font-size: 13px;
            font-weight: 600;
        }

        .orders-modal__input-wrap {
            margin: 4px 0;
        }

        .orders-modal__input-wrap[hidden] {
            display: none;
        }

        .orders-modal__input-wrap input {
            width: 100%;
        }

        .orders-modal__actions {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            margin-top: 6px;
        }

        .orders-modal__actions .primary {
            border: none;
            border-radius: 14px;
            background: linear-gradient(135deg, var(--accent), var(--accent-strong));
            color: #fff;
            min-height: 42px;
            padding: 0 16px;
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
            box-shadow: 0 18px 30px -24px rgba(79, 70, 229, 0.72);
        }

        .orders-modal__actions .orders-modal__danger-btn {
            background: linear-gradient(135deg, #ef4444, #dc2626);
            box-shadow: 0 18px 30px -24px rgba(239, 68, 68, 0.72);
        }

        body.orders-modal-open {
            overflow: hidden;
        }

        .orders-detail {
            height: 100%;
            overflow: hidden;
            overscroll-behavior: contain;
            scrollbar-gutter: stable;
        }

        .orders-detail__inner {
            padding: 22px;
            gap: 18px;
        }

        .orders-detail__header {
            gap: 18px;
        }

        .orders-detail__actions {
            flex-wrap: wrap;
            justify-content: flex-end;
        }

        .orders-detail__placeholder {
            max-width: 420px;
            background: linear-gradient(145deg, rgba(79, 70, 229, 0.08), rgba(14, 165, 233, 0.05));
        }

        body[data-theme="dark"] .orders-detail__placeholder {
            border-color: rgba(99, 102, 241, 0.22);
            background: linear-gradient(145deg, rgba(79, 70, 229, 0.18), rgba(14, 165, 233, 0.12));
        }

        .orders-previewbox__canvas {
            min-height: 180px;
        }

        body[data-theme="dark"] .orders-panel {
            border-color: rgba(148, 163, 184, 0.14);
            background: rgba(11, 18, 32, 0.98);
        }

        body[data-theme="dark"] .orders-detail__form-column {
            border-color: rgba(148, 163, 184, 0.14);
            background: rgba(4, 10, 20, 0.88);
        }

        body[data-theme="dark"] .orders-previewbox__canvas {
            border-color: rgba(148, 163, 184, 0.16);
            background:
              linear-gradient(135deg, rgba(79, 70, 229, 0.18), rgba(14, 165, 233, 0.12)),
              rgba(12, 20, 36, 1);
        }

        body[data-theme="dark"] .orders-detail__header h2,
        body[data-theme="dark"] .orders-panel__header h3 {
            color: #f8fafc;
        }

        body[data-theme="dark"] .orders-detail__header p,
        body[data-theme="dark"] .orders-previewbox__info p,
        body[data-theme="dark"] .orders-detail__placeholder p,
        body[data-theme="dark"] .orders-muted {
            color: #cbd5e1;
        }

        @media (max-width: 1180px) {
            .orders-board__toolbar {
                flex-wrap: wrap;
            }

            .orders-board__controls {
                width: 100%;
                justify-content: flex-start;
            }

            .orders-board__controls .orders-filter--search {
                flex: 1 1 100%;
                max-width: none;
            }
        }

        @media (max-width: 860px) {
            .orders-view {
                padding: 10px;
            }

            .orders-board {
                border-radius: 16px;
            }

            .orders-board__toolbar {
                padding: 12px 14px 10px;
            }

            .orders-board__title {
                font-size: 16px;
            }

            .orders-board__controls {
                gap: 8px;
            }

            .orders-board__controls .orders-filter,
            .orders-board__controls .orders-filter--search {
                flex: 1 1 100%;
                min-width: 0;
                max-width: none;
            }

            .orders-board__actions {
                width: 100%;
            }

            .orders-board__actions .ghost-button,
            .orders-board__actions .primary {
                flex: 1 1 0;
            }

            .orders-machine-tabs {
                padding: 0 14px 8px;
            }

            .orders-empty {
                margin: 14px;
                padding: 20px 14px 28px;
            }

            .orders-drawer {
                top: 0;
                left: auto;
                right: 0;
                bottom: 0;
                width: min(100%, 620px);
                border-radius: 20px 0 0 20px;
            }

            .orders-detail__header {
                flex-direction: column;
                align-items: flex-start;
            }

            .orders-detail__actions {
                width: 100%;
            }

            .orders-detail__actions button {
                flex: 1 1 0;
            }
        }

        @media (max-width: 640px) {
            .orders-board__subtitle {
                display: none;
            }

            .orders-drawer {
                width: 100%;
                border-radius: 0;
            }

            .orders-detail__inner {
                padding: 18px 16px 20px;
            }
        }

        /* Final orders layout: right drawer (2/5) + center document viewer */
        .orders-crm {
            --orders-drawer-ratio: 40%;
        }

        .orders-detail {
            overflow: auto !important;
        }

        .orders-drawer {
            left: auto !important;
            right: 12px !important;
            width: min(var(--orders-drawer-ratio), calc(100% - 24px)) !important;
        }

        /* Document viewer in the center — only visible when document pages exist */
        .orders-screen-preview {
            position: absolute;
            top: 12px;
            left: 12px;
            right: calc(var(--orders-drawer-ratio) + 24px);
            bottom: 12px;
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transform: translateX(-12px);
            transition: opacity 0.24s ease, transform 0.24s ease, visibility 0.24s ease;
            z-index: 22;
        }

        .orders-screen-preview__surface {
            height: 100%;
            display: flex;
            flex-direction: column;
            gap: 16px;
            padding: 18px;
            border-radius: 28px;
            border: 1px solid var(--border-soft);
            background: rgba(255, 255, 255, 0.96);
            box-shadow: 0 20px 56px rgba(15, 23, 42, 0.12);
        }

        .orders-screen-preview__header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 14px;
        }

        .orders-screen-preview__header h3 {
            margin: 0 0 6px;
            font-size: 18px;
            letter-spacing: -0.02em;
        }

        .orders-screen-preview__header p {
            margin: 0;
            color: var(--text-secondary);
            line-height: 1.5;
            max-width: 44ch;
        }

        .orders-screen-preview__status {
            flex: 0 0 auto;
            display: inline-flex;
            align-items: center;
            min-height: 30px;
            padding: 0 12px;
            border-radius: 999px;
            border: 1px solid rgba(99, 102, 241, 0.18);
            background: rgba(99, 102, 241, 0.08);
            color: var(--text-secondary);
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        .orders-screen-preview__body {
            flex: 1 1 auto;
            min-height: 0;
            overflow: auto;
            padding: 14px;
            border-radius: 22px;
            border: 1px solid var(--border-soft);
            background: var(--bg-surface);
            overscroll-behavior: contain;
            --orders-preview-scale: 1;
        }

        .orders-screen-preview__body .orders-previewbox__pages {
            display: flex;
            flex-direction: column;
            gap: 16px;
            align-items: center;
            zoom: var(--orders-preview-scale);
        }

        .orders-screen-preview__body .orders-previewpage {
            width: 100%;
            max-width: 800px;
        }

        .orders-screen-preview__body .orders-previewpage img {
            width: 100%;
            height: auto;
            border-radius: 8px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        }

        .orders-screen-preview__body.is-zoomable {
            cursor: zoom-in;
        }

        .orders-screen-preview__body.is-zoomable img,
        .orders-screen-preview__body.is-zoomable figure {
            cursor: zoom-in;
            user-select: none;
        }

        .orders-screen-preview__body .orders-previewtext,
        .orders-screen-preview__body .orders-previewtext * {
            cursor: text;
            user-select: text;
        }

        .orders-stage-preview__empty {
            min-height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            gap: 8px;
            text-align: center;
            padding: 18px;
        }

        .orders-stage-preview__empty strong {
            font-size: 18px;
            line-height: 1.4;
        }

        .orders-stage-preview__empty span {
            max-width: 44ch;
            color: var(--text-secondary);
            font-size: 14px;
            line-height: 1.6;
        }

        /* Screen preview only shows when document has pages (has-document class) */
        .orders-crm.is-detail-open.has-document .orders-screen-preview {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
            transform: translateX(0);
        }

        body[data-theme="dark"] .orders-screen-preview__surface {
            border-color: rgba(148, 163, 184, 0.16);
            background: rgba(8, 13, 24, 0.98);
        }

        body[data-theme="dark"] .orders-screen-preview__body {
            border-color: rgba(148, 163, 184, 0.16);
            background: rgba(12, 20, 36, 1);
        }

        @media (max-width: 1100px) {
            .orders-crm {
                --orders-drawer-ratio: 50%;
            }
        }

        @media (max-width: 860px) {
            .orders-screen-preview {
                display: none;
            }

            .orders-drawer {
                width: min(100%, 620px) !important;
            }
        }

        @media (max-width: 640px) {
            .orders-drawer {
                width: 100% !important;
            }
        }

        /* Scroll fix for long order cards: attachments must remain reachable */
        .orders-drawer {
            display: flex;
            flex-direction: column;
        }

        .orders-detail {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto !important;
            overflow-x: hidden !important;
            overscroll-behavior: contain;
            -webkit-overflow-scrolling: touch;
        }

.orders-detail__inner {
  height: auto !important;
  min-height: 100%;
  padding-bottom: 56px;
}

.orders-board__actions .ghost-button.is-active {
  border-color: rgba(99, 102, 241, 0.34);
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
}

.orders-machine-tabs {
  display: block;
  padding: 0 20px 10px;
  border-bottom: 1px solid var(--border-soft);
}

.orders-machine-tabs__scroller {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.2) transparent;
}

.orders-machine-tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-tertiary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.orders-machine-tab:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-primary);
}

.orders-machine-tab.is-active {
  border-color: transparent;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
}

.orders-machine-tab--create {
  border: 1px dashed var(--border-soft);
  color: var(--text-tertiary);
  font-size: 12px;
}

.orders-machine-tab--create:hover {
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--accent);
}

.orders-machine-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  font-size: 10px;
  font-weight: 800;
  color: var(--text-tertiary);
}

.orders-machine-tab.is-active .orders-machine-tab-count {
  background: rgba(99, 102, 241, 0.16);
  color: var(--accent);
}

.orders-machine-tab-action {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-tertiary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 4px;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.orders-machine-tab-action:hover {
  background: rgba(148, 163, 184, 0.06);
}

.orders-machine-tab-action--danger {
  color: var(--danger);
  opacity: 0.6;
}

.orders-machine-tab-action--danger:hover {
  background: rgba(239, 68, 68, 0.06);
  opacity: 1;
}

.orders-route-setup__fixed {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
}

body[data-theme="dark"] .orders-route-setup__fixed {
  background: rgba(15, 23, 42, 0.7);
}

.orders-table__row.is-route-selected {
  background: rgba(99, 102, 241, 0.1);
  box-shadow: inset 2px 0 0 var(--accent);
}

.orders-table__route-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.orders-table__route-seq {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.14);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.orders-route-backdrop {
  display: none;
  pointer-events: none;
}

body[data-theme="dark"] .orders-route-backdrop {
  display: none;
}

/* ── Route drawer shell ── */
.orders-route-drawer {
  position: absolute;
  top: 8px;
  right: 8px;
  bottom: 8px;
  width: clamp(480px, 44vw, 720px);
  max-width: calc(100% - 16px);
  border-radius: 20px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.14);
  overflow: hidden;
  z-index: 28;
}

body[data-theme="dark"] .orders-route-drawer {
  border-color: rgba(148, 163, 184, 0.14);
  background: rgba(10, 14, 26, 0.98);
  box-shadow: 0 18px 52px rgba(2, 6, 23, 0.5);
}

.orders-route-detail {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.orders-route-drawer__inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 100%;
  padding: 16px;
}

/* ── Header ── */
.orders-route-drawer__header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 10px;
}

.orders-route-drawer__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.orders-route-drawer__header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.orders-route-drawer__desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.orders-route-drawer__actions {
  display: flex;
  gap: 6px;
}

.orders-route-drawer__actions .ghost-button {
  padding: 5px 10px;
  font-size: 12px;
}

/* ── Status ── */
.orders-route-drawer__status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.06);
  color: var(--accent, #6366f1);
  font-size: 12px;
  font-weight: 500;
  margin: 4px 0;
}

/* ── Setup (truck + start) ── */
.orders-route-setup {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: rgba(99, 102, 241, 0.04);
  margin-bottom: 4px;
}

body[data-theme="dark"] .orders-route-setup {
  background: rgba(30, 41, 59, 0.4);
  border-color: rgba(148, 163, 184, 0.12);
}

.orders-route-setup__row {
  display: flex;
  gap: 10px;
}

.orders-route-setup__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.orders-route-setup__field--grow {
  flex: 1 1 0%;
}

.orders-route-setup__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.orders-route-setup__field input,
.orders-route-setup__field select {
  width: 100%;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
}

body[data-theme="dark"] .orders-route-setup__field input,
body[data-theme="dark"] .orders-route-setup__field select {
  background: rgba(15, 23, 42, 0.7);
}

.orders-route-setup__field input:focus,
.orders-route-setup__field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.orders-route-setup__hint {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

/* ── Sections (available / pickup / delivery) ── */
.orders-route-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
}

.orders-route-section + .orders-route-section {
  border-top: 1px solid var(--border-soft);
}

.orders-route-section__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.orders-route-section__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.orders-route-section--pickup .orders-route-section__title {
  color: #6366f1;
}

.orders-route-section--delivery .orders-route-section__title {
  color: #10b981;
}

.orders-route-section__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.orders-route-section--delivery .orders-route-section__count {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.orders-route-section__hint {
  color: var(--text-secondary);
  font-size: 11px;
}

.orders-route-section__empty {
  color: var(--text-secondary);
  font-size: 12px;
  padding: 8px 0;
}

/* ── Available orders (compact rows) ── */
.orders-route-avail-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.orders-route-avail {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.orders-route-avail:hover {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.15);
}

.orders-route-avail.is-selected {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.1);
}

body[data-theme="dark"] .orders-route-avail.is-selected {
  background: rgba(99, 102, 241, 0.12);
}

.orders-route-avail__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 7px;
  border: 2px solid rgba(148, 163, 184, 0.3);
  font-size: 12px;
  font-weight: 800;
  color: transparent;
  background: transparent;
  transition: all 0.14s ease;
}

body[data-theme="dark"] .orders-route-avail__check {
  border-color: rgba(148, 163, 184, 0.25);
}

.orders-route-avail:hover .orders-route-avail__check {
  border-color: var(--accent);
}

.orders-route-avail.is-selected .orders-route-avail__check {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.orders-route-avail__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.orders-route-avail__body strong {
  font-size: 12px;
  font-weight: 600;
}

.orders-route-avail__body span {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Route list (pickup / delivery items) ── */
.orders-route-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.orders-route-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: var(--bg-surface);
  cursor: grab;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.orders-route-item:hover {
  border-color: rgba(99, 102, 241, 0.2);
}

.orders-route-item:active {
  cursor: grabbing;
}

.orders-route-item.is-route-dragging {
  opacity: 0.45;
}

.orders-route-item.is-drop-before {
  border-top-color: var(--accent);
  box-shadow: inset 0 2px 0 var(--accent);
}

.orders-route-item.is-drop-after {
  border-bottom-color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.orders-route-item__seq {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.orders-route-item__seq--pickup {
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
}

.orders-route-item__seq--delivery {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.orders-route-item__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.orders-route-item__number {
  font-size: 12px;
  font-weight: 600;
}

.orders-route-item__addr {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orders-route-item__addr-full {
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.3;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orders-route-item__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.orders-route-item__drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--text-secondary);
  opacity: 0.5;
  cursor: grab;
  user-select: none;
  transition: opacity 0.12s ease;
}

.orders-route-item:hover .orders-route-item__drag {
  opacity: 1;
}

.orders-route-item__remove {
  padding: 3px 8px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.orders-route-item__remove:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

/* ── Result banner ── */
.orders-route-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  margin-bottom: 4px;
}

body[data-theme="dark"] .orders-route-result {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.18);
}

.orders-route-result__badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.14);
  color: #10b981;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.orders-route-result__km {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.orders-route-result__map {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.orders-route-result__map:hover {
  text-decoration: underline;
}

.orders-route-result .ghost-button {
  margin-left: auto;
  padding: 5px 10px;
  font-size: 11px;
}

/* ── Footer ── */
.orders-route-drawer__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  margin-top: 4px;
}

.orders-route-drawer__footer .ghost-button {
  font-size: 12px;
  padding: 6px 12px;
}

.orders-route-drawer__footer .primary {
  padding: 8px 18px;
  border-radius: 10px;
  border: none;
  background: var(--accent, #6366f1);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.14s ease;
}

.orders-route-drawer__footer .primary:hover {
  opacity: 0.88;
}

.orders-route-drawer__footer .primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Responsive ── */
@media (max-width: 860px) {
  .orders-route-drawer {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: min(420px, calc(100% - 16px));
    border-radius: 18px;
  }

  .orders-route-drawer__titlebar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .orders-route-drawer__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .orders-route-result {
    flex-wrap: wrap;
  }

  .orders-route-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .orders-route-item__actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .orders-route-setup__row {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .orders-route-drawer {
    left: 4px;
    right: 4px;
    bottom: 4px;
    max-height: min(440px, calc(100% - 8px));
    border-radius: 16px;
  }
}

  /* Account drawer */
  .account-drawer-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
  z-index: 84;
}

.account-drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Account drawer shell ── */
.account-drawer {
  position: fixed;
  top: var(--account-drawer-top, 88px);
  right: var(--account-drawer-right, 24px);
  bottom: auto;
  width: min(320px, calc(100vw - 24px));
  max-height: var(--account-drawer-max-height, calc(100vh - 104px));
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 40px -8px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.04);
  transform-origin: top right;
  transform: translateY(-8px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.12s ease;
  z-index: 85;
  overflow: hidden;
}

body[data-theme="dark"] .account-drawer {
  background: rgba(15, 20, 32, 0.98);
  border-color: rgba(148, 163, 184, 0.12);
  box-shadow: 0 16px 48px -8px rgba(0, 0, 0, 0.5);
}

.account-drawer.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.account-drawer__content {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 6px;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* ── Profile header ── */
.account-drawer__profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.account-drawer__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent, #6366f1);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.account-drawer__info {
  flex: 1;
  min-width: 0;
}

.account-drawer__name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-drawer__email {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-drawer__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.account-drawer__close:hover {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-primary);
}

/* ── Sections ── */
.account-drawer__section {
  padding: 4px 0;
}

.account-drawer__section + .account-drawer__section {
  border-top: 1px solid var(--border-soft);
}

.account-drawer__section-label {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

/* ── Theme toggle (segmented control) ── */
.account-theme-toggle {
  display: flex;
  gap: 2px;
  padding: 4px 8px 6px;
}

.account-theme-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.account-theme-btn:hover {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-primary);
}

.account-theme-btn.is-active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent, #6366f1);
  font-weight: 600;
}

.account-theme-btn svg {
  flex-shrink: 0;
}

/* ── Action rows ── */
.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease;
}

.account-row:hover {
  background: rgba(148, 163, 184, 0.1);
}

body[data-theme="dark"] .account-row:hover {
  background: rgba(148, 163, 184, 0.08);
}

.account-row__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-secondary);
}

.account-row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.account-row__title {
  font-size: 13px;
  font-weight: 500;
}

.account-row__desc {
  font-size: 11px;
  color: var(--text-secondary);
}

.account-row__chevron {
  flex-shrink: 0;
  color: var(--text-secondary);
  opacity: 0.5;
}

/* ── Notice ── */
.account-drawer__notice {
  margin: 4px 8px 6px;
  border-radius: 10px;
  padding: 8px 12px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent, #6366f1);
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 980px) {
  .account-drawer {
    width: min(320px, calc(100vw - 16px));
  }
}

