  :root {
    /* Continexus palette: bright yellow accent, near-black for primary
       actions and text, clean white surfaces. Yellow is used as a stroke /
       underline / highlight — not as a button fill (since white text on
       yellow is unreadable). Primary buttons are dark instead. */
    --bg-1: #ffffff;
    --bg-2: #f1f2f5;
    --bg-3: #fff0e0;
    --surface: rgba(255, 255, 255, 0.78);
    --surface-strong: rgba(255, 255, 255, 0.96);
    --surface-tint: rgba(255, 255, 255, 0.62);
    --hairline: rgba(20, 24, 32, 0.09);
    --hairline-strong: rgba(20, 24, 32, 0.16);
    --inner-highlight: rgba(255, 255, 255, 0.7);
    --text: #1a1a1a;
    --text-2: #4a4a4a;
    --muted: #888a92;
    --accent: #ff6a1a;
    --accent-2: #f04e10;
    --accent-soft: rgba(255, 106, 26, 0.14);
    --accent-glow: rgba(255, 106, 26, 0.45);
    --primary: #1a1a1a;
    --primary-2: #000000;
    --primary-hover: #2a2a2a;
    --ok: #1f9f56;
    --ok-soft: rgba(31, 159, 86, 0.13);
    --bad: #d33232;
    --bad-soft: rgba(211, 50, 50, 0.13);
    --radius-xs: 8px;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 2px rgba(20,24,32,0.05), 0 1px 1px rgba(20,24,32,0.03);
    --shadow: 0 8px 24px rgba(20,24,32,0.07), 0 2px 6px rgba(20,24,32,0.04);
    --shadow-lg: 0 18px 48px rgba(20,24,32,0.09), 0 4px 12px rgba(20,24,32,0.05);
    --mobile-tabbar-height: calc(64px + env(safe-area-inset-bottom));
  }

  body[data-theme="dark"] {
    --bg-1: #0f1218;
    --bg-2: #171b24;
    --bg-3: rgba(255, 106, 26, 0.08);
    --surface: rgba(21, 25, 34, 0.88);
    --surface-strong: rgba(27, 32, 43, 0.98);
    --surface-tint: rgba(35, 41, 54, 0.74);
    --hairline: rgba(255, 255, 255, 0.1);
    --hairline-strong: rgba(255, 255, 255, 0.18);
    --inner-highlight: rgba(255, 255, 255, 0.08);
    --text: #f3f5f8;
    --text-2: #c2c7d0;
    --muted: #8e96a5;
    --accent-soft: rgba(255, 106, 26, 0.18);
    --primary: #11151d;
    --primary-2: #0b0e14;
    --primary-hover: #1d2430;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.25), 0 1px 1px rgba(0,0,0,0.18);
    --shadow: 0 10px 28px rgba(0,0,0,0.34), 0 2px 8px rgba(0,0,0,0.24);
    --shadow-lg: 0 22px 58px rgba(0,0,0,0.42), 0 6px 16px rgba(0,0,0,0.28);
  }

  * { box-sizing: border-box; }

  html, body {
    margin: 0; padding: 0;
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 14px;
    height: 100%;
    overflow: hidden;
    /* Clean white base with subtle cool + warm tints in the corners */
    background:
      radial-gradient(ellipse at 12% 12%, var(--bg-3) 0%, transparent 45%),
      radial-gradient(ellipse at 88% 88%, #eef0f5 0%, transparent 50%),
      linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  .app {
    display: grid;
    grid-template-columns: 400px 1fr;
    height: 100vh;
    gap: 14px;
    padding: 14px;
  }

  /* ============ SIDEBAR (Glass surface) ============ */
  .sidebar {
    /* Subtilus vertikalus gradient'as — viršuje šviesesnė balta, apačioje
     * šiltesnis cream/peach atspalvis (Cubivo accent palette). Nedominuoja,
     * bet sukuria gylį ir „šiltą" pabaigą, kad sidebar'as nesibaigtų
     * staiga į baltą foną. */
    background:
      linear-gradient(180deg,
        rgba(255, 255, 255, 0.92) 0%,
        rgba(255, 250, 244, 0.88) 50%,
        rgba(255, 241, 226, 0.85) 100%);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xl);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    /* Subtle inner highlight at the top edge */
    position: relative;
  }
  .sidebar::before {
    content: '';
    position: absolute; inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 1px 0 var(--inner-highlight);
  }

  /* ============ HEADER (sticky at top of scrollable sidebar) ============
   * Header lieka matomas net kai vartotojas scroll'ina sidebar žemyn —
   * brand'inimas (logo + Cubivo + alpha + lang) yra svarbus identifikacijai
   * ir turi būti visada akivaizdus. */
  .header {
    padding: 14px 18px 12px;
    border-bottom: 1px solid var(--hairline);
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
  }
  .header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
  }
  .logo {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  .logo-wordmark {
    display: block;
    width: 154px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.08));
  }
  .logo-wordmark-dark,
  .landing-nav-logo-dark,
  .landing-footer-logo-dark {
    display: none;
  }
  .logo-beta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 6px;
    border: 1px solid rgba(255, 106, 26, 0.26);
    border-radius: 999px;
    background: rgba(255, 106, 26, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.1;
    color: var(--accent);
    text-transform: none;
  }
  .logo-beta::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(255, 106, 26, 0.12);
  }
  .logo-img {
    display: none;
    width: 48px;
    height: 48px;
    object-fit: contain;
    /* Soft drop shadow grounds the logo against the glass surface */
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.12));
  }
  .logo-text {
    display: none;
    flex-direction: column;
    line-height: 1.15;
  }
  .logo-name {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text);
  }
  .logo-version {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--accent);
    text-transform: uppercase;
    margin-top: 2px;
  }
  body[data-theme="dark"] .logo-wordmark-light {
    display: none;
  }
  body[data-theme="dark"] .logo {
    gap: 10px;
  }
  body[data-theme="dark"] .logo-wordmark-dark {
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.18));
  }
  body[data-theme="dark"] .logo-img,
  body[data-theme="dark"] .logo-text,
  body[data-theme="dark"] .landing-nav-logo-light,
  body[data-theme="dark"] .landing-footer-logo-light {
    display: none;
  }
  body[data-theme="dark"] .landing-nav-logo-dark,
  body[data-theme="dark"] .landing-footer-logo-dark {
    display: block;
  }
  body[data-theme="dark"] .logo-beta {
    background: rgba(255, 106, 26, 0.12);
    border-color: rgba(255, 106, 26, 0.32);
    box-shadow: none;
  }
  /* Compact one-line tagline directly under logo + lang switch */
  .tagline-only {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
    font-weight: 400;
    letter-spacing: 0.2px;
  }
  /* App title — compact single line above tagline.
   * Mažas, bet aiškiai matomas; padariau accent spalvos pabraukimą po
   * antros frazės kaip pirmojo dizaino reminisencija. */
  .app-title-compact {
    margin-top: 10px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--text);
    line-height: 1.25;
  }
  .app-title-compact span:nth-child(2) {
    position: relative;
    display: inline-block;
  }
  .app-title-compact span:nth-child(2)::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    bottom: 0px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    opacity: 0.85;
  }
  /* Legacy h1/subtitle still kept for fallback but no longer rendered */
  h1 { display: none; }
  .subtitle { display: none; }

  /* ============ LANGUAGE PILL ============ */
  .lang-switch {
    display: flex;
    background: var(--surface-tint);
    border: 1px solid var(--hairline);
    border-radius: 999px;
    padding: 2px;
    backdrop-filter: blur(20px);
  }
  .lang-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.4px;
    cursor: pointer;
    border-radius: 999px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .lang-btn:hover { color: var(--text); }
  .lang-btn.active {
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: var(--shadow-sm);
  }
  .header .lang-switch {
    display: none;
  }

  /* ============ HEADER ACTIONS (lang + user) ============ */
  .header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  /* ============ USER MENU ============ */
  .user-menu {
    position: relative;
  }
  .user-avatar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    background: var(--surface-tint);
    border: 1px solid var(--hairline);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
  }
  .user-avatar-btn:hover {
    background: var(--surface-strong);
    box-shadow: var(--shadow-sm);
  }
  .user-avatar-img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    object-fit: cover;
  }
  .user-avatar-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .user-avatar-chevron {
    color: var(--muted);
    transition: transform 0.2s;
  }
  .user-menu.open .user-avatar-chevron {
    transform: rotate(180deg);
  }
  .user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--hairline);
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
  }
  .user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  .user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--hairline);
    background: #fff;
  }
  .user-dropdown-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    object-fit: cover;
  }
  .user-dropdown-info {
    flex: 1;
    min-width: 0;
  }
  .user-dropdown-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .user-dropdown-status {
    font-size: 10px;
    color: #2eb872;
    margin-top: 2px;
  }
  .user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
  }
  .user-dropdown-item:hover {
    background: var(--surface-tint);
  }
  .user-dropdown-item svg {
    color: var(--muted);
  }
  .user-dropdown-section {
    padding: 10px 14px 12px;
    border-top: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
    background: #fff;
  }
  .user-dropdown-section-title {
    margin-bottom: 8px;
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .user-language-options,
  .user-theme-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .user-language-option,
  .user-theme-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    border: 1px solid var(--hairline);
    border-radius: 10px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
  }
  .user-language-option:hover,
  .user-theme-option:hover {
    border-color: rgba(255, 106, 26, 0.32);
    background: var(--accent-soft);
  }
  .user-language-option.active,
  .user-theme-option.active {
    border-color: rgba(255, 106, 26, 0.45);
    background: rgba(255, 106, 26, 0.1);
    color: var(--accent);
  }
  .user-theme-option svg {
    width: 15px;
    height: 15px;
  }

  body[data-theme="dark"] .sidebar {
    background:
      linear-gradient(180deg,
        rgba(24, 29, 39, 0.96) 0%,
        rgba(22, 26, 36, 0.94) 52%,
        rgba(31, 26, 25, 0.92) 100%);
  }
  body[data-theme="dark"] .header,
  body[data-theme="dark"] .user-dropdown,
  body[data-theme="dark"] .user-dropdown-header,
  body[data-theme="dark"] .user-dropdown-section,
  body[data-theme="dark"] .landing-lang-current,
  body[data-theme="dark"] .landing-lang-menu {
    background: #171b24;
  }
  body[data-theme="dark"] .user-avatar-btn,
  body[data-theme="dark"] .lang-switch,
  body[data-theme="dark"] .tab-add,
  body[data-theme="dark"] .truck-card,
  body[data-theme="dark"] .truck-summary,
  body[data-theme="dark"] .preset-btn,
  body[data-theme="dark"] .cargo-preset-btn,
  body[data-theme="dark"] .cargo-cta-manual,
  body[data-theme="dark"] .cargo-item,
  body[data-theme="dark"] .widget,
  body[data-theme="dark"] .selection-panel,
  body[data-theme="dark"] .edit-toolbar,
  body[data-theme="dark"] .scene-overlay,
  body[data-theme="dark"] .view-buttons,
  body[data-theme="dark"] .kbd-hints,
  body[data-theme="dark"] .mobile-results-toggle {
    background: var(--surface-strong);
    color: var(--text);
  }
  body[data-theme="dark"] input,
  body[data-theme="dark"] textarea,
  body[data-theme="dark"] select,
  body[data-theme="dark"] .user-language-option,
  body[data-theme="dark"] .user-theme-option {
    background: #11151d;
    color: var(--text);
    border-color: var(--hairline);
  }
  body[data-theme="dark"] .viewport {
    background:
      radial-gradient(ellipse at top, rgba(255,255,255,0.05) 0%, transparent 58%),
      linear-gradient(180deg, rgba(255,106,26,0.06) 0%, rgba(14,17,24,0.35) 55%);
  }
  body[data-theme="dark"] .mobile-tabbar {
    background: rgba(17, 21, 29, 0.94);
    border-top-color: var(--hairline);
  }
  body[data-theme="dark"] .mobile-tab {
    color: var(--muted);
  }
  body[data-theme="dark"] .mobile-tab.active {
    color: var(--accent);
  }
  body[data-theme="dark"] .widget-status {
    background: linear-gradient(135deg, rgba(46, 184, 114, 0.16), rgba(27, 32, 43, 0.98));
  }
  body[data-theme="dark"] .widget-bar,
  body[data-theme="dark"] .widget-space-bar {
    background: rgba(255, 255, 255, 0.1);
  }
  body[data-theme="dark"] .modal,
  body[data-theme="dark"] .login-popup {
    background: #171b24;
    color: var(--text);
  }

  /* ============ LANDING PAGE ============ */
  /* ===== Boot splash =====
     Uždengia ekraną, kol tikrinama sesija, kad nesimatytų kaip app'as
     kraunasi fone. z-index aukštesnis nei .login-overlay (9999). */
  .boot-splash {
    position: fixed;
    inset: 0;
    background: #fdf6f0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.35s ease;
  }
  body[data-theme="dark"] .boot-splash {
    background: #14171c;
  }
  .boot-splash-logo {
    height: 46px;
    width: auto;
    animation: bootPulse 1.3s ease-in-out infinite;
  }
  @keyframes bootPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
  }
  /* Kol kraunamasi — paslepiam app'ą, kad neblyksėtų fone */
  body[data-boot="loading"] .app {
    visibility: hidden;
  }
  /* Kai sesija patikrinta — splash'as išnyksta */
  body:not([data-boot="loading"]) .boot-splash {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }

  .login-overlay {
    position: fixed;
    inset: 0;
    background: #fdf6f0;
    z-index: 9999;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
  }
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  /* ===== Navigation ===== */
  .landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 48px;
    height: 84px;
    background: white;
    border-bottom: 1px solid rgba(20, 24, 32, 0.07);
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .landing-nav-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
    margin-right: auto;
  }
  .landing-nav-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
  }
  .landing-nav-logo {
    height: 56px;
    width: auto;
    object-fit: contain;
  }
  /* Tik šviesos variantas rodomas pagal numatytąjį (tamsus lieka paslėptas
     iš .landing-nav-logo-dark { display:none }). Anksčiau ši taisyklė turėjo
     display:block, kuris perrašydavo tamsaus logo paslėpimą → matėsi 2 logo. */
  .landing-nav-logo-light {
    display: block;
  }
  .landing-beta-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #656872;
    background: rgba(255, 106, 26, 0.08);
    border: 1px solid rgba(255, 106, 26, 0.16);
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
  }
  .landing-beta-badge::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 106, 26, 0.14);
  }
  .landing-nav-link {
    font-size: 14px;
    font-weight: 650;
    color: #565a64;
    text-decoration: none;
    border: 0;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 8px;
    transition: background 0.15s;
  }
  .landing-nav-link:hover {
    color: #1a1a1a;
    background: rgba(20, 24, 32, 0.06);
  }
  .landing-nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
    justify-content: flex-end;
  }

  /* ===== Kalbų jungiklis su vėliavomis ===== */
  .landing-lang {
    position: relative;
  }
  .landing-lang-current {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    background: transparent;
    border: 1px solid rgba(20, 24, 32, 0.12);
    cursor: pointer;
    padding: 6px 10px 6px 7px;
    border-radius: 10px;
    transition: all 0.15s;
    user-select: none;
  }
  .landing-lang-current:hover {
    background: rgba(20, 24, 32, 0.04);
    border-color: rgba(20, 24, 32, 0.2);
  }
  .landing-lang.open .landing-lang-current {
    background: rgba(20, 24, 32, 0.04);
  }
  .landing-lang.open .landing-lang-chevron {
    transform: rotate(180deg);
  }
  .landing-lang-chevron {
    transition: transform 0.2s;
  }
  .landing-lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(20, 24, 32, 0.12), 0 0 0 1px rgba(20, 24, 32, 0.06);
    padding: 4px;
    min-width: 100%;
    display: none;
    z-index: 20;
  }
  .landing-lang.open .landing-lang-menu {
    display: block;
    animation: langMenuIn 0.15s ease;
  }
  @keyframes langMenuIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .landing-lang-option {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 7px 10px 7px 7px;
    border-radius: 7px;
    transition: background 0.12s;
    text-align: left;
  }
  .landing-lang-option:hover {
    background: rgba(20, 24, 32, 0.06);
  }

  /* Flag - CSS-only, no external assets */
  .flag {
    display: inline-block;
    width: 22px;
    height: 16px;
    border-radius: 2.5px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(20, 24, 32, 0.08);
    flex-shrink: 0;
    position: relative;
  }
  .flag-stripe {
    display: block;
    width: 100%;
    height: 33.34%;
  }
  .flag-union-jack {
    position: absolute;
    inset: 0;
  }
  .flag-svg {
    display: block;
    width: 100%;
    height: 100%;
  }
  /* Lithuania: yellow / green / red */
  .flag-lt-1 { background: #FDB913; }
  .flag-lt-2 { background: #006A44; }
  .flag-lt-3 { background: #C1272D; }
  /* UK (Union Jack) — simplified using gradients */
  .flag-en {
    background:
      linear-gradient(45deg, transparent 45%, white 45%, white 55%, transparent 55%),
      linear-gradient(-45deg, transparent 45%, white 45%, white 55%, transparent 55%),
      linear-gradient(0deg, transparent 42%, white 42%, white 58%, transparent 58%),
      linear-gradient(90deg, transparent 42%, white 42%, white 58%, transparent 58%),
      linear-gradient(45deg, transparent 47%, #C8102E 47%, #C8102E 53%, transparent 53%),
      linear-gradient(-45deg, transparent 47%, #C8102E 47%, #C8102E 53%, transparent 53%),
      linear-gradient(0deg, transparent 45%, #C8102E 45%, #C8102E 55%, transparent 55%),
      linear-gradient(90deg, transparent 45%, #C8102E 45%, #C8102E 55%, transparent 55%),
      #012169;
  }
  .flag-en .flag-union-jack {
    display: block;
  }
  .landing-btn-cta {
    font-size: 14px;
    font-weight: 700;
    color: white;
    background: var(--accent);
    border: none;
    cursor: pointer;
    padding: 10px 22px;
    border-radius: 12px;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(255, 106, 26, 0.32);
  }
  .landing-btn-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 106, 26, 0.44);
  }

  /* ===== Hero ===== */
  .landing-hero {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    align-items: center;
    gap: 48px;
    padding: 72px 80px 56px;
    max-width: 1320px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
  }
  .landing-hero-left {
    display: flex;
    flex-direction: column;
    gap: 22px;
  }
  .landing-hero-tag {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.8px;
    text-transform: uppercase;
  }
  .landing-hero-title {
    display: block;
    font-size: 50px;
    font-weight: 800;
    color: #1a1a1a;
    line-height: 1.1;
    letter-spacing: -1.5px;
    margin: 0;
  }
  .landing-hero-accent {
    color: var(--accent);
  }
  .landing-hero-desc {
    font-size: 16px;
    color: #4a4a4a;
    line-height: 1.65;
    max-width: 520px;
    margin: 0;
  }
  .landing-hero-cta {
    display: inline-flex;
    align-items: center;
    font-size: 15px;
    font-weight: 700;
    color: white;
    background: var(--accent);
    border: none;
    cursor: pointer;
    padding: 14px 28px;
    border-radius: 14px;
    transition: all 0.2s;
    box-shadow: 0 6px 20px rgba(255, 106, 26, 0.35);
    align-self: flex-start;
    margin-top: 4px;
  }
  .landing-hero-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(255, 106, 26, 0.46);
  }
  .landing-hero-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
  .landing-hero-img {
    width: 100%;
    max-width: 780px;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
  }

  /* ===== Feature cards ===== */
  .landing-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 0 80px 64px;
    max-width: 1320px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
  }
  .landing-feature {
    background: white;
    border: 1px solid rgba(20, 24, 32, 0.08);
    border-radius: 18px;
    padding: 26px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .landing-feature-icon {
    width: 52px;
    height: 52px;
    background: rgba(255, 106, 26, 0.08);
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
  }
  .landing-feature-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
  }
  .landing-feature-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.55;
  }

  .landing-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    max-width: 1320px;
    margin: auto auto 0;
    padding: 24px 80px 34px;
    color: #686a72;
  }
  .landing-footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
  }
  .landing-footer-logo {
    width: 76px;
    height: auto;
    object-fit: contain;
  }
  .landing-footer-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
  }
  .landing-footer-links button {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: #686a72;
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    padding: 7px 9px;
  }
  .landing-footer-links button:hover {
    color: var(--text);
    background: rgba(20, 24, 32, 0.06);
  }

  .legal-modal-bg {
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(20, 24, 32, 0.52);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10002;
  }
  .legal-modal {
    width: min(720px, 100%);
    max-height: min(760px, calc(100vh - 44px));
    overflow: auto;
    background: #fff;
    border: 1px solid rgba(20, 24, 32, 0.08);
    border-radius: 22px;
    box-shadow: 0 30px 90px rgba(20, 24, 32, 0.22);
    padding: 30px 34px 34px;
    position: relative;
  }
  .legal-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: rgba(20, 24, 32, 0.06);
    color: #686a72;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
  }
  .legal-modal-close:hover {
    background: rgba(20, 24, 32, 0.1);
    color: var(--text);
  }
  .legal-modal-kicker {
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
  }
  .legal-modal-title {
    margin: 0 44px 20px 0;
    color: var(--text);
    font-size: 30px;
    line-height: 1.15;
    letter-spacing: -0.6px;
  }
  .legal-modal-body {
    color: #41444d;
    font-size: 14px;
    line-height: 1.65;
  }
  .legal-block + .legal-block {
    margin-top: 18px;
  }
  .legal-modal-body h3 {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.35;
  }
  .legal-modal-body p {
    margin: 0;
  }
  .legal-modal-body ul {
    margin: 6px 0 0;
    padding-left: 20px;
  }
  .legal-modal-body li + li {
    margin-top: 4px;
  }

  .admin-modal-bg {
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(20, 24, 32, 0.52);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10003;
  }
  .admin-modal {
    width: min(920px, 100%);
    max-height: min(820px, calc(100vh - 44px));
    overflow: auto;
    background: #fff;
    border: 1px solid rgba(20, 24, 32, 0.08);
    border-radius: 22px;
    box-shadow: 0 30px 90px rgba(20, 24, 32, 0.22);
    padding: 30px 34px 34px;
    position: relative;
  }
  .admin-create-form {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(150px, 1.2fr) minmax(130px, 1fr) auto;
    gap: 10px;
    margin-bottom: 18px;
  }
  .admin-input {
    min-height: 44px;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    padding: 0 13px;
    font: inherit;
    color: var(--text);
    background: #fff;
  }
  .admin-primary-btn,
  .admin-secondary-btn {
    border: 1px solid rgba(255, 106, 26, 0.34);
    border-radius: 12px;
    background: rgba(255, 106, 26, 0.08);
    color: var(--accent-2);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 0 14px;
    min-height: 38px;
    cursor: pointer;
  }
  .admin-primary-btn {
    min-height: 44px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #ff8442);
    box-shadow: 0 10px 24px rgba(255, 106, 26, 0.22);
  }
  .admin-error {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    color: #b42318;
    background: #fff1f0;
    border: 1px solid rgba(211, 50, 50, 0.2);
    font-size: 13px;
    font-weight: 600;
  }
  .admin-users {
    display: grid;
    gap: 10px;
  }
  .admin-empty {
    padding: 18px;
    border: 1px dashed var(--hairline);
    border-radius: 14px;
    color: var(--muted);
    text-align: center;
  }
  .admin-user-card {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) minmax(170px, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid rgba(20, 24, 32, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
  }
  .admin-user-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }
  .admin-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #ff8848);
    font-weight: 800;
  }
  .admin-user-info {
    min-width: 0;
  }
  .admin-user-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 800;
  }
  .admin-badge,
  .admin-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 800;
  }
  .admin-badge {
    color: var(--accent-2);
    background: rgba(255, 106, 26, 0.1);
  }
  .admin-user-meta,
  .admin-user-stats {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
  }
  .admin-user-stats {
    display: grid;
    gap: 4px;
  }
  .admin-status.online {
    width: fit-content;
    color: #12804c;
    background: rgba(46, 184, 114, 0.12);
  }
  .admin-status.offline {
    width: fit-content;
    color: #6f737c;
    background: rgba(20, 24, 32, 0.06);
  }
  .admin-status.disabled {
    width: fit-content;
    color: #b42318;
    background: rgba(211, 50, 50, 0.1);
  }
  .admin-user-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  /* ===== Login popup (over landing page) ===== */
  .login-popup-bg {
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 32, 0.52);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
  }
  .login-popup {
    background: white;
    border-radius: 24px;
    padding: 44px 44px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.18);
    position: relative;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  @keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .login-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    background: rgba(20, 24, 32, 0.06);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: background 0.15s;
  }
  .login-popup-close:hover {
    background: rgba(20, 24, 32, 0.12);
  }
  .login-popup-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
  }

  /* ===== Login form (shared) ===== */
  .login-logo-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
  }
  .login-brand-text { flex: 1; }
  .login-brand-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.3px;
  }
  .login-brand-tagline {
    font-size: 10px;
    color: var(--muted);
    margin-top: 1px;
  }
  .login-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
  }
  .login-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 22px;
    line-height: 1.4;
  }
  .login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
  }
  .login-input-icon {
    position: absolute;
    left: 14px;
    pointer-events: none;
    z-index: 1;
  }
  .login-input {
    width: 100%;
    padding: 14px 16px 14px 38px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: white;
    border: 1.5px solid var(--hairline);
    border-radius: 11px;
    transition: all 0.2s;
    outline: none;
    box-sizing: border-box;
  }
  .login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(255, 106, 26, 0.1);
  }
  .login-input::placeholder { color: #b0afa9; }
  .login-submit {
    width: 100%;
    padding: 13px 16px;
    font-size: 14px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--accent) 0%, #ff8848 100%);
    border: none;
    border-radius: 11px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
    box-shadow: 0 4px 14px rgba(255, 106, 26, 0.3);
  }
  .login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255, 106, 26, 0.4);
  }
  .login-submit:active { transform: translateY(0); }
  .login-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
  }
  .login-error {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(226, 75, 74, 0.08);
    border: 1px solid rgba(226, 75, 74, 0.2);
    border-radius: 10px;
    color: #c43d3d;
    font-size: 12px;
    font-weight: 500;
  }
  .login-consent {
    margin-top: 14px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
  }
  .login-consent button {
    display: inline;
    font: inherit;
    font-weight: 700;
    color: var(--accent);
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0 1px;
  }
  .login-consent button:hover {
    text-decoration: underline;
  }
  .login-footer {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--hairline);
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    line-height: 1.5;
  }

  /* ===== Landing responsive ===== */
  @media (max-width: 1100px) {
    .landing-hero { padding: 60px 48px 48px; gap: 32px; }
    .landing-hero-title { font-size: 42px; }
    .landing-features { padding: 0 48px 56px; }
    .landing-footer { padding: 22px 48px 32px; }
  }
  @media (max-width: 800px) {
    .landing-nav {
      height: 74px;
      padding: 0 14px;
      gap: 10px;
    }
    .landing-nav-left {
      flex: 0 1 auto;
      gap: 10px;
    }
    .landing-nav-right {
      flex: 0 0 auto;
      gap: 8px;
    }
    .landing-nav-logo { height: 46px; }
    .landing-beta-badge { display: none; }
    .landing-btn-cta {
      padding: 9px 13px;
      font-size: 13px;
    }
    .landing-hero {
      grid-template-columns: 1fr;
      padding: 40px 24px 32px;
      gap: 32px;
    }
    .landing-hero-title { font-size: 34px; letter-spacing: -1px; }
    .landing-hero-right { justify-content: center; }
    .landing-hero-img { max-width: 100%; }
    .landing-features {
      grid-template-columns: 1fr;
      padding: 0 24px 48px;
      gap: 12px;
    }
    .landing-footer {
      align-items: flex-start;
      flex-direction: column;
      padding: 4px 24px 32px;
    }
    .landing-footer-links {
      justify-content: flex-start;
    }
    .login-popup { padding: 32px 24px 28px; }
    .admin-create-form,
    .admin-user-card {
      grid-template-columns: 1fr;
    }
    .admin-user-actions {
      justify-content: stretch;
    }
    .admin-secondary-btn {
      flex: 1 1 130px;
    }
  }
  @media (max-width: 480px) {
    .landing-hero-title { font-size: 28px; }
    .legal-modal-bg { padding: 12px; }
    .admin-modal-bg { padding: 12px; align-items: stretch; }
    .legal-modal {
      max-height: calc(100vh - 24px);
      border-radius: 18px;
      padding: 24px 20px 26px;
    }
    .admin-modal {
      max-height: calc(100vh - 24px);
      border-radius: 18px;
      padding: 24px 18px 26px;
    }
    .legal-modal-title {
      font-size: 24px;
      margin-right: 40px;
    }
  }

  /* ============ MOBILE BOTTOM TAB BAR ============
     iOS-style apatinis navigation bar'as. Matomas tik ≤1024px viewport'e.
     Kai aktyvus tab'as keičiasi, body gauna data-mobile-view atributą,
     pagal kurį CSS slepia/rodo atitinkamas sekcijas (sidebar / scene / results).
  */
  .mobile-tabbar {
    display: none; /* default — paslėpta desktop'e */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 0.5px solid var(--hairline);
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
    z-index: 100;
    justify-content: space-around;
    align-items: stretch;
  }
  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s, transform 0.1s;
  }
  .mobile-tab:active {
    transform: scale(0.94);
  }
  .mobile-tab.active {
    color: var(--accent);
  }
  .mobile-tab-icon {
    width: 24px;
    height: 24px;
    transition: stroke-width 0.15s;
  }
  .mobile-tab.active .mobile-tab-icon {
    stroke-width: 2.3;
  }
  .mobile-tab-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: -0.1px;
  }
  .mobile-tab.active .mobile-tab-label {
    font-weight: 700;
  }

  /* ============ MOBILE/TABLET VIEW SWITCHING ============
     Pagal body[data-mobile-view] atributą rodome tik vieną iš 3 panelių.
     Desktop'e šio atributo nepaisysim — visi paneliai matomi.
  */
  @media (max-width: 1024px) {
    .mobile-tabbar {
      display: flex;
    }
    /* Visiems mobile/tablet — pridedam apatinį padding'ą, kad neuždengtų tab bar'as.
       Pridedam env(safe-area-inset-bottom) iPhone Pro home indicator'ui */
    .app {
      padding-bottom: 0;
    }

    /* Pagal aktyvų view'ą — rodome tik atitinkamą panelį */
    body[data-mobile-view="cargo"] .sidebar { display: flex; }
    body[data-mobile-view="cargo"] .viewport { display: none; }

    body[data-mobile-view="3d"] .sidebar { display: none; }
    body[data-mobile-view="3d"] .viewport { display: flex; }
    body[data-mobile-view="3d"] .results { display: none; }

    body[data-mobile-view="results"] .sidebar { display: none; }
    body[data-mobile-view="results"] .viewport { display: flex; }
    body[data-mobile-view="results"] #canvas-container { display: none; }
    body[data-mobile-view="results"] .scene-overlay { display: none; }
    body[data-mobile-view="results"] .mobile-results-toggle { display: none; }
    body[data-mobile-view="results"] .results {
      display: flex !important;
      position: static !important;
      width: 100% !important;
      height: 100% !important;
      max-height: none !important;
      transform: none !important;
      box-shadow: none !important;
      border-radius: 0 !important;
    }

    /* Sidebar užima visą ekraną cargo view'e */
    body[data-mobile-view="cargo"] .sidebar {
      position: static !important;
      width: 100% !important;
      max-width: none !important;
      /* Full mobile bottom bar clearance, including iPhone safe area */
      height: calc(100vh - var(--mobile-tabbar-height)) !important;
      height: calc(100dvh - var(--mobile-tabbar-height)) !important;
      max-height: none !important;
      transform: none !important;
      border-radius: 0 !important;
      box-shadow: none !important;
      overflow-y: auto;
    }
    body[data-mobile-view="cargo"] .sidebar::after {
      display: none; /* paslepiam drag handle indikatorių */
    }
    body[data-mobile-view="cargo"] .mobile-peek {
      display: none !important;
    }

    body[data-mobile-view="cargo"] .header {
      padding: 9px 14px 8px !important;
      background: #f7f8fa;
      border-bottom: 1px solid rgba(20, 24, 32, 0.08);
    }

    body[data-mobile-view="cargo"] .header-top {
      height: 56px;
      padding: 6px;
      border-radius: 18px;
      background: rgba(255, 255, 255, 0.96);
      backdrop-filter: blur(40px) saturate(180%);
      -webkit-backdrop-filter: blur(40px) saturate(180%);
      border: 1px solid rgba(20, 24, 32, 0.08);
      box-shadow: 0 8px 28px rgba(20, 24, 32, 0.1), 0 2px 6px rgba(20, 24, 32, 0.06);
    }

    body[data-mobile-view="cargo"] .logo {
      flex-direction: row;
      align-items: center;
      gap: 7px;
      min-width: 0;
      padding: 0 6px 0 2px;
    }

    body[data-mobile-view="cargo"] .logo-wordmark,
    body[data-mobile-view="cargo"] .logo-beta {
      display: none;
    }

    body[data-mobile-view="cargo"] .logo-img {
      display: block;
      width: 28px !important;
      height: 28px !important;
      filter: none;
    }

    body[data-mobile-view="cargo"] .logo-text {
      display: flex;
    }

    body[data-mobile-view="cargo"] .logo-name {
      font-size: 12px !important;
      font-weight: 800;
      letter-spacing: 0.07em;
    }

    body[data-mobile-view="cargo"] .logo-version {
      display: none;
      font-size: 7px !important;
      letter-spacing: 0.16em;
      margin-top: 1px;
      white-space: nowrap;
    }

    body[data-mobile-view="cargo"] .header-actions {
      gap: 0;
      margin-left: auto;
    }

    body[data-mobile-view="cargo"] .lang-switch {
      display: none;
    }

    body[data-mobile-view="cargo"] .user-menu {
      display: block;
    }

    body[data-mobile-view="cargo"] .user-avatar-btn {
      min-height: 44px;
      padding: 4px 10px 4px 4px;
      background: transparent;
      border: 0;
      box-shadow: none;
    }

    body[data-mobile-view="cargo"] .user-avatar-img {
      width: 34px;
      height: 34px;
    }

    body[data-mobile-view="cargo"] .user-avatar-name {
      max-width: 96px;
      font-size: 12px;
      font-weight: 700;
    }

    body[data-mobile-view="cargo"] .app-title-compact {
      display: none;
    }

    body[data-mobile-view="cargo"] .tagline-only {
      margin: 8px 2px 0 !important;
      font-size: 11px !important;
      font-weight: 600;
      color: var(--muted);
      letter-spacing: 0.02em;
    }
    /* Mobile cargo view — Calculate Fit mygtukas NE sticky,
       o paprastas inline mygtukas po visomis pallet kortelėmis.
       Sticky pozicija užklotų turinį, todėl mobile išjungiame. */
    body[data-mobile-view="cargo"] .calc-btn-subtle {
      position: static !important;
      bottom: auto !important;
      margin-top: 16px;
      margin-bottom: calc(var(--mobile-tabbar-height) + 16px);
    }

    /* 3D view — pilnas ekranas */
    body[data-mobile-view="3d"] .viewport {
      width: 100%;
      height: calc(100vh - var(--mobile-tabbar-height));
      height: calc(100dvh - var(--mobile-tabbar-height));
    }
    body[data-mobile-view="3d"] #canvas-container {
      width: 100%;
      height: 100%;
    }

  }

  /* Auto-save indicator */
  .save-indicator {
    position: fixed;
    left: 50%;
    bottom: 22px;
    min-width: 168px;
    max-width: calc(100vw - 32px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px 11px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(20, 24, 32, 0.08);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(20, 24, 32, 0.14), 0 2px 8px rgba(20, 24, 32, 0.08);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    z-index: 500;
    opacity: 0;
    transform: translate(-50%, 12px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    overflow: hidden;
  }
  .save-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #2eb872;
    box-shadow: 0 0 0 5px rgba(46, 184, 114, 0.12);
    flex: 0 0 auto;
  }
  .save-indicator::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 5px;
    height: 2px;
    border-radius: 999px;
    background: rgba(46, 184, 114, 0.24);
  }
  .save-indicator.show {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  .save-indicator.saving {
    color: #8c430f;
    border-color: rgba(255, 106, 26, 0.18);
  }
  .save-indicator.saving::before {
    background: var(--accent);
    box-shadow: 0 0 0 5px rgba(255, 106, 26, 0.12);
  }
  .save-indicator.saving::after {
    background: linear-gradient(90deg, rgba(255, 106, 26, 0.12), rgba(255, 106, 26, 0.9), rgba(255, 106, 26, 0.12));
    animation: saveIndicatorSweep 1s linear infinite;
  }
  .save-indicator.error {
    color: #b83332;
    border-color: rgba(226, 75, 74, 0.2);
  }
  .save-indicator.error::before {
    background: #e24b4a;
    box-shadow: 0 0 0 5px rgba(226, 75, 74, 0.12);
  }
  .save-indicator.error::after {
    background: rgba(226, 75, 74, 0.26);
  }
  @keyframes saveIndicatorSweep {
    from { transform: translateX(-70%); }
    to { transform: translateX(70%); }
  }
  @media (max-width: 1024px) {
    .save-indicator {
      bottom: calc(var(--mobile-tabbar-height) + env(safe-area-inset-bottom, 0px) + 10px);
      width: min(360px, calc(100vw - 32px));
      border-radius: 18px;
    }
  }

  /* ============ TAB BAR ============ */
  .tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--hairline);
    align-items: center;
  }
  .tab {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-tint);
    border: 1px solid var(--hairline);
    padding: 6px 8px 6px 12px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 999px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 160px;
    backdrop-filter: blur(10px);
  }
  .tab:hover {
    background: var(--surface-strong);
    transform: translateY(-1px);
  }
  .tab.active {
    background: var(--primary);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  }
  .tab.active.renaming {
    background: var(--primary);
    color: #fff;
  }
  .tab.active .tab-name-input { color: #fff; }
  .tab-name-input {
    background: transparent;
    border: 1px dashed transparent;
    color: inherit;
    font: inherit;
    font-weight: 500;
    width: 110px;
    outline: none;
    padding: 2px 6px;
    border-radius: 6px;
    transition: all 0.15s;
    cursor: text;
  }
  .tab-name-input[readonly] {
    cursor: pointer;
    text-overflow: ellipsis;
  }
  .tab:not(.active) .tab-name-input[readonly] { cursor: pointer; }
  .tab.active .tab-name-input[readonly]:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
  }
  .tab:not(.active) .tab-name-input[readonly]:hover {
    border-color: rgba(255, 106, 26, 0.4);
    background: rgba(255, 106, 26, 0.05);
  }
  /* Kai aktyvus tab'as REDAGAVIMO režime — baltas fonas + JUODAS tekstas.
   * Stipresnis selektorius (su .tab.active) overridoma anksčiau apibrėžtą
   * `color: #fff` ant aktyvaus tab'o input'o. */
  .tab-name-input:not([readonly]),
  .tab.active .tab-name-input:not([readonly]) {
    border-color: var(--accent);
    border-style: solid;
    background: #fff;
    color: var(--text);
    cursor: text;
    caret-color: var(--accent);
  }
  .tab-close {
    opacity: 0.55;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 999px;
    transition: all 0.15s;
  }
  .tab-close:hover { opacity: 1; background: rgba(0,0,0,0.12); }
  .tab.active .tab-close:hover { background: rgba(255,255,255,0.25); }
  .tab-add {
    background: transparent;
    border: 1px dashed var(--hairline-strong);
    color: var(--muted);
    padding: 6px 12px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 999px;
    transition: all 0.2s;
  }
  .tab-add:hover {
    color: var(--accent);
    border-color: var(--accent);
    border-style: solid;
    background: var(--accent-soft);
  }

  /* ============ SECTIONS ============ */
  .section {
    padding: 18px 24px;
    border-bottom: 1px solid var(--hairline);
    position: relative;
    /* Be modifikatoriaus klasės sekcija lieka neutrali; modifikatoriai
       toliau prideda subtilų spalvotą atspalvį, kad vartotojas iš karto
       matytų, kur baigiasi sunkvežimio nustatymai ir kur prasideda
       kroviniai. */
  }
  .section:last-child { border-bottom: none; }
  /* Kairysis spalvotas akcento brūkšnys padeda akiai greitai surasti
     sekciją be jokio "užkimštos meniu" jausmo. */
  .section::before {
    content: '';
    position: absolute;
    left: 0;
    top: 18px;
    bottom: 18px;
    width: 3px;
    border-radius: 0 2px 2px 0;
    opacity: 0;
    transition: opacity 0.2s;
  }
  /* Sunkvežimio sekcija: neutralus fonas (kaip pagrindinis meniu).
     Aiškumą užtikrina tik plonas akcento brūkšnys kairėje. */
  .section-truck {
    background: transparent;
  }
  .section-truck::before {
    background: var(--text-2);
    opacity: 0.35;
  }
  /* View sekcija: minimalus atspalvis, lieka neutrali — pereinama zona. */
  .section-view {
    background: rgba(245, 245, 248, 0.4);
  }
  /* Krovinių sekcija: šiltas smėlio/persikinis atspalvis, dera su
     bendra spalvine tema (Cubivo oranžinė) ir aiškiai skiriasi nuo
     mėlyno sunkvežimio bloko. Gradient'as intensyvėja link apačios,
     kad sekcija jaustųsi „šilta" ir CTA mygtukas atrodytų natūraliai. */
  .section-cargo {
    background: linear-gradient(180deg,
      rgba(253, 240, 226, 0.45) 0%,
      rgba(253, 230, 210, 0.55) 50%,
      rgba(255, 220, 185, 0.65) 100%);
    /* Tegul sekcija užima visą laisvą vietą sidebar'e — kad gradient'as
     * tęstųsi iki pat apačios, o ne sustotų po krovinių sąrašu. */
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  .section-cargo::before {
    background: var(--accent);
    opacity: 0.55;
  }
  .section-title {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-transform: uppercase;
  }
  .section-title-right {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  /* Subtle clear button — small, low-contrast by default, turns red on
     hover so the destructive intent is obvious only at the moment of
     intent. Hidden when there's nothing to clear. */
  /* "Išvalyti visus" mygtukas — raudonas outline danger style. Aiškiai
     matomas iškart, su 🗑 ikona + tekstu. Anksčiau buvo per subtilus
     (pilkas/mažas) — niekas nepastebėdavo. */
  .clear-cargo-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--bad);
    color: var(--bad);
    padding: 6px 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    border-radius: 999px;
    transition: all 0.15s;
  }
  .clear-cargo-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }
  .clear-cargo-btn:hover {
    background: var(--bad);
    color: #fff;
    box-shadow: 0 4px 12px rgba(211, 50, 50, 0.25);
  }
  .clear-cargo-btn[hidden] { display: none; }

  /* ============ FIELDS ============ */
  .field-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }
  .field {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .field label {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 5px;
    font-weight: 500;
  }
  .field input, .field select {
    background: var(--surface-tint);
    border: 1px solid var(--hairline);
    color: var(--text);
    padding: 9px 12px;
    font-size: 14px;
    font-family: 'SF Mono', 'JetBrains Mono', monospace;
    font-weight: 500;
    border-radius: var(--radius-sm);
    outline: none;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    backdrop-filter: blur(8px);
  }
  .field input:focus, .field select:focus {
    border-color: var(--accent);
    background: var(--surface-strong);
    box-shadow: 0 0 0 4px var(--accent-soft);
  }

  /* ============ PRESET BUTTONS ============ */
  .preset-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    margin-bottom: 14px;
    /* Vidinė padding'as 2px viršuje — kad mygtukai gali pakilti
     * 1px translateY animacijoje be tėvinio overflow:hidden apkarpymo. */
    padding-top: 2px;
  }
  .preset-btn {
    background: var(--surface-tint);
    border: 1px solid var(--hairline);
    color: var(--text-2);
    padding: 8px 4px 6px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 58px;
    line-height: 1.15;
    text-align: center;
  }
  .preset-btn svg {
    width: 38px;
    height: 22px;
    color: var(--text-2);
    transition: color 0.2s;
  }
  .preset-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(255, 106, 26, 0.12);
  }
  .preset-btn:hover svg { color: var(--accent); }
  .preset-btn.active {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 2px 8px rgba(255, 106, 26, 0.18);
  }
  .preset-btn.active svg { color: var(--accent); }

  /* ============ CARGO ITEMS (Compact + Expandable) ============
   * Default — kompaktiška ~52px aukščio kortelė su visa info vienoje eilėje.
   * Paspaudus — atsiveria pilno redagavimo laukai (visi įvesties laukai
   * vienoje vietoje, kad nereikėtų skirtinguose dialoguose blaškytis). */
  .cargo-item {
    background: #ffffff;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    margin-bottom: 6px;
    position: relative;
    transition: all 0.2s;
    overflow: hidden;
  }
  .cargo-item:hover {
    border-color: var(--hairline-strong);
  }
  .cargo-item.expanded {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(255, 106, 26, 0.1);
  }

  /* KOMPAKTIŠKA EILUTĖ — visada matoma */
  .cargo-compact-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    user-select: none;
  }
  .cargo-compact-color {
    width: 4px;
    align-self: stretch;
    border-radius: 2px;
    flex-shrink: 0;
  }
  .cargo-compact-index {
    min-width: 24px;
    max-width: 54px;
    height: 24px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    padding: 0 6px;
    background: rgba(20, 24, 32, 0.045);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.2px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cargo-compact-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .cargo-compact-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cargo-compact-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
  }
  .cargo-compact-dims {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 10px;
  }
  .cargo-compact-sep { opacity: 0.5; }
  .cargo-compact-weight { font-weight: 500; }
  .cargo-compact-flags {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 4px;
  }
  .cargo-flag-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
  }
  .cargo-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .cargo-color-current {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 7px 12px 7px 8px;
    border: 1px solid var(--hairline-strong);
    border-radius: 12px;
    background: var(--surface-strong);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(20, 24, 32, 0.05);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  }
  .cargo-color-current:hover {
    border-color: rgba(255, 106, 26, 0.4);
    box-shadow: 0 4px 12px rgba(20, 24, 32, 0.08);
    transform: translateY(-1px);
  }
  .cargo-color-current[aria-expanded="true"] {
    border-color: rgba(255, 106, 26, 0.5);
    background: var(--accent-soft);
    color: var(--accent);
  }
  .cargo-color-current-dot {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    background: var(--cargo-color);
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.7), 0 0 0 1px rgba(20,24,32,0.12);
  }
  .cargo-color-input {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100%;
    min-width: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0;
    cursor: pointer;
  }
  .cargo-color-palette-toggle {
    min-height: 38px;
    padding: 7px 12px;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    background: var(--surface-tint);
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  }
  .cargo-color-palette-toggle:hover,
  .cargo-color-palette-toggle[aria-expanded="true"] {
    border-color: rgba(255, 106, 26, 0.42);
    color: var(--accent);
    background: var(--accent-soft);
  }
  .cargo-color-swatches {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
    min-width: 0;
    padding: 9px;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    background: var(--surface-tint);
  }
  .cargo-color-swatches.open {
    display: flex;
  }
  .cargo-color-swatch {
    width: 26px;
    height: 26px;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    background: var(--cargo-color);
    cursor: pointer;
    padding: 0;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.45), 0 1px 2px rgba(20,24,32,0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  }
  .cargo-color-swatch:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
  }
  .cargo-color-swatch.active {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 3px rgba(255,255,255,0.78), 0 0 0 3px rgba(255,106,26,0.18);
  }
  .cargo-spectrum-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0 10px;
    border: 1px solid rgba(255, 106, 26, 0.32);
    border-radius: 999px;
    background: rgba(255, 106, 26, 0.08);
    color: var(--accent);
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    overflow: hidden;
  }
  .cargo-spectrum-btn:hover {
    background: rgba(255, 106, 26, 0.14);
  }
  body[data-theme="dark"] .cargo-color-current {
    background: rgba(17, 21, 29, 0.84);
    box-shadow: none;
  }
  body[data-theme="dark"] .cargo-compact-index {
    background: rgba(255, 255, 255, 0.075);
    color: var(--text-2);
  }
  body[data-theme="dark"] .cargo-color-palette-toggle,
  body[data-theme="dark"] .cargo-color-swatches,
  body[data-theme="dark"] .cargo-spectrum-btn {
    background: rgba(17, 21, 29, 0.56);
  }
  body[data-theme="dark"] .cargo-color-swatch {
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.22), 0 1px 2px rgba(0,0,0,0.2);
  }
  body[data-theme="dark"] .cargo-color-swatch.active {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 3px rgba(15,18,24,0.6), 0 0 0 3px rgba(255,106,26,0.22);
  }
  .cargo-compact-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }
  .cargo-quick-btn {
    background: transparent;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    transition: all 0.15s;
    padding: 0;
  }
  .cargo-quick-btn:hover {
    background: var(--accent-soft);
    color: var(--accent);
  }
  .cargo-quick-btn svg {
    width: 13px;
    height: 13px;
  }
  /* Delete mygtukas — raudonas hover'as kompaktiškoje eilutėje */
  .cargo-quick-btn.cargo-quick-delete:hover {
    background: rgba(226, 75, 74, 0.1);
    color: #E24B4A;
  }
  .cargo-compact-qty {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    background: var(--surface-tint);
    padding: 3px 8px;
    border-radius: 6px;
    min-width: 32px;
    text-align: center;
    font-variant-numeric: tabular-nums;
  }
  .cargo-toggle-chevron {
    background: transparent;
    border: none;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    padding: 0;
    transition: transform 0.25s;
  }
  .cargo-toggle-chevron svg {
    width: 14px;
    height: 14px;
  }
  .cargo-item.expanded .cargo-toggle-chevron {
    transform: rotate(180deg);
  }

  /* IŠSKLEIDŽIAMAS BLOKAS — pasirodo tik .expanded būsenoje */
  .cargo-expanded-body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.2s ease;
    padding: 0 12px;
    border-top: 1px solid transparent;
  }
  .cargo-item.expanded .cargo-expanded-body {
    max-height: 500px;
    opacity: 1;
    padding: 12px;
    border-top-color: var(--hairline);
  }
  .cargo-expanded-section {
    margin-bottom: 10px;
  }
  .cargo-expanded-section:last-of-type {
    margin-bottom: 8px;
  }
  .cargo-expanded-label {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 4px;
  }
  .cargo-expanded-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .cargo-name-input-expanded {
    width: 100% !important;
    border: 1px solid var(--hairline) !important;
    border-style: solid !important;
    background: #fff !important;
    padding: 7px 10px !important;
    font-size: 12px !important;
    border-radius: 7px !important;
  }
  .cargo-name-input-expanded:focus {
    border-color: var(--accent) !important;
  }
  .cargo-expanded-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
  }
  .cargo-remove-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid var(--hairline);
    color: var(--muted);
    padding: 5px 10px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
  }
  .cargo-remove-btn:hover {
    background: var(--bad-soft, rgba(226,75,74,0.08));
    border-color: rgba(226, 75, 74, 0.3);
    color: var(--bad, #E24B4A);
  }
  .cargo-remove-btn svg {
    width: 12px;
    height: 12px;
  }

  /* Legacy stiliai (kad senas kodas neapsigriūtų, jei kažkur naudoja) */
  .cargo-head { display: flex; }
  .cargo-name { font-size: 13px; font-weight: 600; }
  .cargo-name-input {
    background: transparent;
    border: 1px dashed transparent;
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    outline: none;
    font-family: inherit;
    padding: 2px 6px;
    border-radius: 6px;
    transition: all 0.15s;
    cursor: text;
  }
  .cargo-name-input:hover {
    border-color: rgba(255, 106, 26, 0.4);
    background: rgba(255, 106, 26, 0.05);
  }
  .cargo-name-input:focus {
    border-color: var(--accent);
    border-style: solid;
    background: #fff;
  }
  .cargo-color {
    width: 12px; height: 12px;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1);
  }
  .cargo-actions { display: flex; gap: 4px; }
  .icon-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.15s;
  }
  .icon-btn:hover {
    color: var(--bad);
    background: var(--bad-soft);
  }
  .cargo-dims {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .cargo-dims input {
    background: var(--surface-strong);
    border: 1px solid var(--hairline);
    color: var(--text);
    padding: 7px 8px;
    font-size: 12px;
    font-family: 'SF Mono', 'JetBrains Mono', monospace;
    font-weight: 500;
    border-radius: var(--radius-xs);
    width: 100%;
    outline: none;
    transition: all 0.18s;
  }
  .cargo-dims input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }
  /* Vienodas stilius VISIEMS input'ams expanded body viduje (qty, weight, name) */
  .cargo-expanded-body input[type="number"],
  .cargo-expanded-body input[type="text"]:not(.cargo-name-input-expanded) {
    background: var(--surface-strong);
    border: 1px solid var(--hairline);
    color: var(--text);
    padding: 7px 10px;
    font-size: 12px;
    font-family: 'SF Mono', 'JetBrains Mono', monospace;
    font-weight: 500;
    border-radius: var(--radius-xs);
    width: 100%;
    outline: none;
    transition: all 0.18s;
    box-sizing: border-box;
  }
  .cargo-expanded-body input[type="number"]:focus,
  .cargo-expanded-body input[type="text"]:not(.cargo-name-input-expanded):focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }
  /* iOS-stiliaus checkbox'ai cargo flags'ams — aiškiai matomi, su pill fonu.
   * Naudojami expanded režime tarp matmenų ir Pašalinti mygtuko.
   * Optimizuoti, kad telpa vienoje eilutėje net ir su LT vertimais. */
  .cargo-flags {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    margin-top: 10px;
    margin-bottom: 4px;
    width: 100%;
  }
  .cargo-flags label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    background: var(--surface-tint);
    border: 1px solid var(--hairline);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 500;
    transition: all 0.15s;
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    white-space: nowrap;
  }
  .cargo-flags label:hover {
    border-color: var(--hairline-strong);
    color: var(--text);
  }
  /* Aktyvus (checked) — accent border ir tekstas */
  .cargo-flags label:has(input:checked) {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
  }
  .cargo-flags input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
    width: 13px;
    height: 13px;
    margin: 0;
    flex-shrink: 0;
  }
  .cargo-flags label span {
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* "Užbaigti" mygtukas — aiški iOS-stiliaus CTA. Užima visą eilutę,
   * kad vartotojas iškart suprastų: paspaudus uždaroma redagavimo kortelė. */
  .cargo-done-btn {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    background: var(--accent);
    border: none;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
  }
  .cargo-done-btn:hover {
    background: #E55A0F;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 106, 26, 0.25);
  }
  .cargo-done-btn:active {
    transform: translateY(0);
  }
  .cargo-done-btn svg {
    width: 14px;
    height: 14px;
  }

  /* ============ ADD / CALCULATE BUTTONS ============ */
  .cargo-presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 8px;
  }
  .cargo-preset-btn {
    background: var(--surface-tint);
    border: 1px solid var(--hairline);
    color: var(--text);
    padding: 8px 10px;
    font-family: inherit;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .cargo-preset-btn:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
  }
  .cargo-preset-btn .cp-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
  }
  .cargo-preset-btn .cp-dims {
    font-size: 10px;
    font-family: 'SF Mono', 'JetBrains Mono', monospace;
    color: var(--muted);
    font-weight: 500;
  }

  .add-btn {
    width: 100%;
    background: var(--surface-tint);
    border: 1px dashed var(--hairline-strong);
    color: var(--muted);
    padding: 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s;
    margin-top: 4px;
  }
  .add-btn:hover {
    border-style: solid;
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
  }
  /* Smart Import mygtukas — išsiskiria nuo įprasto add-btn */
  .smart-import-btn {
    background: linear-gradient(135deg, #ff6a1a 0%, #ff8d4a 100%);
    color: #fff;
    border: none;
    margin-top: 6px;
    font-weight: 600;
  }
  .smart-import-btn:hover {
    background: linear-gradient(135deg, #e85f15 0%, #ff7d3a 100%);
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(255, 106, 26, 0.3);
  }

  /* ============ MODAL ============ */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: modal-fade-in 0.2s ease-out;
  }
  @keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  .modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modal-slide-in 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }
  @keyframes modal-slide-in {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
  .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--hairline);
  }
  .modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
  }
  .modal-close {
    background: transparent;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0 8px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
  }
  .modal-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
  }
  .modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
  }
  .modal-hint {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 12px;
    line-height: 1.5;
  }
  .modal-examples {
    background: var(--surface-tint);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
  }
  .examples-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 6px;
  }
  .examples-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .examples-list code {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.04);
    padding: 4px 8px;
    border-radius: 6px;
  }
  .smart-import-option {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    background: rgba(255, 106, 26, 0.045);
    cursor: pointer;
    user-select: none;
  }
  .smart-import-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }
  .smart-import-option-toggle {
    position: relative;
    flex: 0 0 auto;
    width: 38px;
    height: 22px;
    border-radius: 999px;
    background: #d6d8dd;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
    transition: background 0.18s ease;
  }
  .smart-import-option-toggle::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.18s ease;
  }
  .smart-import-option input:checked + .smart-import-option-toggle {
    background: var(--accent);
  }
  .smart-import-option input:checked + .smart-import-option-toggle::before {
    transform: translateX(16px);
  }
  .smart-import-option-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }
  .smart-import-option-copy strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
  }
  .smart-import-option-copy small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.25;
  }
  #smart-import-text {
    width: 100%;
    min-height: 140px;
    padding: 12px 14px;
    border: 1px solid var(--hairline-strong);
    border-radius: 10px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    background: #fff;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.15s;
  }
  #smart-import-text:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 106, 26, 0.15);
  }
  .modal-preview {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--surface-tint);
    border-radius: 8px;
    font-size: 13px;
  }
  .preview-item.preview-error {
    background: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
  }
  .preview-item .preview-icon {
    font-size: 16px;
  }
  .preview-item .preview-name {
    font-weight: 600;
    color: var(--text);
  }
  .preview-item .preview-dims {
    color: var(--muted);
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12px;
  }
  .preview-item .preview-qty {
    margin-left: auto;
    font-weight: 600;
    color: var(--accent);
  }
  .modal-footer {
    display: flex;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--hairline);
    background: var(--surface-tint);
  }
  .modal-footer .edit-btn {
    flex: 1;
    padding: 11px;
    font-size: 13px;
  }
  .smart-import-confirm {
    background: var(--accent) !important;
    color: #fff !important;
  }
  .smart-import-confirm:disabled {
    background: var(--hairline-strong) !important;
    color: var(--muted) !important;
    cursor: not-allowed;
  }
  .calc-btn {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 15px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    border-radius: var(--radius);
    margin-top: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.1);
  }
  .calc-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
  }
  .calc-btn:active { transform: translateY(0); }

  /* ============ VIEW SECTION ============ */
  .label-mode-row {
    display: flex;
    background: var(--surface-tint);
    border: 1px solid var(--hairline);
    border-radius: 999px;
    padding: 3px;
    backdrop-filter: blur(10px);
  }
  .label-mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 7px 10px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 999px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .label-mode-btn:hover { color: var(--text); }
  .label-mode-btn.active {
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: var(--shadow-sm);
  }
  .view-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-size: 12px;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
    font-weight: 500;
  }
  .view-toggle input {
    accent-color: var(--accent);
    cursor: pointer;
    width: 16px; height: 16px;
  }

  /* ============ VIEWPORT (3D area) ============ */
  .viewport {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background:
      radial-gradient(ellipse at top, rgba(255,255,255,0.6) 0%, transparent 60%),
      linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    border: 1px solid var(--hairline);
    box-shadow: var(--shadow);
  }
  #canvas-container { width: 100%; height: 100%; }
  #canvas-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
  }

  /* ============ FLOATING GLASS PANELS ============ */
  .results, .selection-panel {
    position: absolute;
    background: var(--surface-strong);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }
  .results::before, .selection-panel::before {
    content: '';
    position: absolute; inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 1px 0 var(--inner-highlight);
  }
  .results {
    top: 20px;
    right: 20px;
    padding: 18px 22px;
    min-width: 270px;
    font-size: 12px;
    /* Ribojam aukštį, kad nepasislinktume už ekrano kai krovinių daug.
     * Apačios 20px paliekam view-buttons mygtukams + 80px buffer'ui. */
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    overflow-x: hidden;
    /* Smooth scroll'as kai vartotojas naviguoja per ilgą sąrašą */
    scroll-behavior: smooth;
    /* Plonas iOS stiliaus scroll bar — nedominuoja UI */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
  }
  .results::-webkit-scrollbar {
    width: 6px;
  }
  .results::-webkit-scrollbar-track {
    background: transparent;
  }
  .results::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
  }
  .results::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
  }
  .results-title {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--hairline);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
  }
  .stat-label { color: var(--muted); font-weight: 500; }
  .stat-value {
    color: var(--text);
    font-weight: 600;
    font-family: 'SF Mono', 'JetBrains Mono', monospace;
  }
  .stat-value.ok { color: var(--ok); }
  .stat-value.bad { color: var(--bad); }
  .verdict {
    margin-top: 14px;
    padding: 12px;
    font-size: 13px;
    text-align: center;
    font-weight: 600;
    border-radius: var(--radius);
  }
  .verdict.ok {
    background: var(--ok-soft);
    color: var(--ok);
  }
  .verdict.bad {
    background: var(--bad-soft);
    color: var(--bad);
  }
  .legend {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--hairline);
    max-height: 200px;
    overflow-y: auto;
  }
  .legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 500;
  }
  .legend-swatch {
    width: 14px; height: 14px;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1);
  }

  /* ============ SELECTION PANEL ============ */
  .selection-panel {
    top: 24px;
    left: 24px;
    width: min(330px, calc(100% - 48px));
    padding: 12px 12px 11px;
    border-radius: 18px;
    font-size: 12px;
    box-shadow:
      0 16px 40px rgba(20, 24, 32, 0.14),
      0 3px 10px rgba(20, 24, 32, 0.07);
  }
  .selection-panel .results-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
    padding: 1px 1px 9px;
    border-bottom: 1px solid var(--hairline);
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.1px;
    line-height: 1.15;
    text-transform: none;
  }
  /* Spalvos taškas — atitinka pažymėtos dėžės spalvą 3D scenoje */
  .sel-color-dot {
    flex: 0 0 auto;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(20, 24, 32, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  }
  #sel-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sel-clear {
    flex: 0 0 auto;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--hairline);
    font-size: 10px;
    font-weight: 700;
    text-transform: lowercase;
    color: var(--muted);
    letter-spacing: 0;
    box-shadow: var(--shadow-sm);
    transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  }
  .sel-clear:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
  }
  .sel-dims {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 10.5px;
    margin-bottom: 11px;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--hairline);
    font-family: inherit;
    line-height: 1.2;
  }
  .sel-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(20, 24, 32, 0.045);
    color: var(--text-2);
    font-size: 10px;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
  }
  /* Matmenų chip'as — pagrindinis "spec" akcentas: monospace skaičiai +
     švelnus oranžinis atspalvis, kad būtų pirmas dalykas, kurį pamatai.
     Dėžės ikona — ne tik vizualiai, bet ir suvienodina vertikalią lygiuotę
     su kitais chip'ais (tekstiniai be ikonos centruojasi 2px žemiau). */
  .sel-meta-dims {
    background: var(--accent-soft);
    color: var(--accent-2);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-weight: 600;
    letter-spacing: -0.2px;
  }
  .sel-meta-dims::before {
    content: '';
    width: 11px;
    height: 11px;
    flex: 0 0 auto;
    background: currentColor;
    opacity: 0.7;
    -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z'/%3E%3Cpath d='M3.3 7 12 12l8.7-5'/%3E%3Cpath d='M12 22V12'/%3E%3C/svg%3E");
    mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z'/%3E%3Cpath d='M3.3 7 12 12l8.7-5'/%3E%3Cpath d='M12 22V12'/%3E%3C/svg%3E");
  }
  /* Svorio chip'as — neutralus, su mažu svarstyklių glyph'u */
  .sel-meta-weight {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
  }
  .sel-meta-weight::before {
    content: '';
    width: 11px;
    height: 11px;
    flex: 0 0 auto;
    background: currentColor;
    opacity: 0.55;
    -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='5' r='2'/%3E%3Cpath d='M6.5 21h11l1.5-11H5z'/%3E%3C/svg%3E");
    mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='5' r='2'/%3E%3Cpath d='M6.5 21h11l1.5-11H5z'/%3E%3C/svg%3E");
  }
  /* Apribojimų chip'ai (nekraunamas / neapverčiamas) — geltonas "locked"
     stilius su spynos glyph'u, kad iškart skaitytųsi kaip apribojimas. */
  .sel-meta-flag {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    font-weight: 700;
  }
  .sel-meta-flag::before {
    content: '';
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    background: currentColor;
    -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
    mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
  }
  .sel-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 0;
  }
  .sel-btn {
    min-height: 34px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--hairline);
    color: var(--text);
    padding: 7px 10px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 750;
    cursor: pointer;
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
    transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease, transform 0.16s ease;
  }
  .sel-btn::before {
    content: '';
    width: 15px;
    height: 15px;
    display: inline-block;
    flex: 0 0 auto;
    margin-right: 6px;
    vertical-align: -2px;
    background: currentColor;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
  }
  .sel-color-btn {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .sel-color-btn[aria-expanded="true"] {
    border-color: rgba(255, 106, 26, 0.42);
    color: var(--accent);
    background: var(--accent-soft);
  }
  .sel-color-btn::before {
    display: none;
  }
  .sel-color-preview {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    margin-right: 6px;
    border-radius: 5px;
    background: var(--accent);
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.68), 0 0 0 1px rgba(20,24,32,0.14);
  }
  .sel-color-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    border: 0;
    padding: 0;
    cursor: pointer;
  }
  .sel-color-menu {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
  }
  .sel-color-menu.open {
    display: flex;
  }
  .sel-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    min-width: 0;
  }
  .sel-color-swatch {
    width: 23px;
    height: 23px;
    padding: 0;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    background: var(--cargo-color);
    cursor: pointer;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.48), 0 1px 2px rgba(20,24,32,0.08);
  }
  .sel-color-swatch.active {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 3px rgba(255,255,255,0.78), 0 0 0 3px rgba(255,106,26,0.18);
  }
  .sel-spectrum-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid rgba(255, 106, 26, 0.32);
    border-radius: 999px;
    background: rgba(255, 106, 26, 0.08);
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    overflow: hidden;
  }
  #sel-rotate::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-3-6.7'/%3E%3Cpath d='M21 3v6h-6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-3-6.7'/%3E%3Cpath d='M21 3v6h-6'/%3E%3C/svg%3E");
  }
  #sel-flip::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16'/%3E%3Cpath d='M4 17h16'/%3E%3Cpath d='M12 7v10'/%3E%3Cpath d='m8 11 4-4 4 4'/%3E%3Cpath d='m8 13 4 4 4-4'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16'/%3E%3Cpath d='M4 17h16'/%3E%3Cpath d='M12 7v10'/%3E%3Cpath d='m8 11 4-4 4 4'/%3E%3Cpath d='m8 13 4 4 4-4'/%3E%3C/svg%3E");
  }
  #sel-delete::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 15H6L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 15H6L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3C/svg%3E");
  }
  .sel-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
  }
  .sel-btn-danger:hover {
    border-color: var(--bad);
    color: var(--bad);
    background: var(--bad-soft);
  }
  .sel-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
  }
  .sel-btn[disabled]:hover { border-color: var(--hairline); color: var(--text); background: rgba(255, 255, 255, 0.72); }
  .sel-hint {
    display: none;
  }

  /* ===== DESKTOP-ONLY selection mygtukų patobulinimai =====
     Apgaubta min-width:801px, kad mobile (ikonų-only mygtukai) liktų
     visiškai nepaliesta. */
  @media (min-width: 801px) {
    .sel-actions {
      gap: 7px;
    }
    .sel-btn {
      min-height: 38px;
      border-radius: 11px;
      font-size: 11.5px;
      font-weight: 700;
      background: rgba(255, 255, 255, 0.85);
    }
    .sel-btn::before {
      width: 14px;
      height: 14px;
      margin-right: 5px;
    }
    .sel-color-preview {
      width: 14px;
      height: 14px;
      margin-right: 5px;
    }
    /* "Šalinti" — raudonas atspalvis JAU iš pradžių (ne tik hover'inant),
       kad destrukcinis veiksmas būtų aiškiai atskirtas nuo Sukti/Apversti. */
    .sel-btn-danger {
      color: var(--bad);
      border-color: rgba(211, 50, 50, 0.28);
      background: rgba(211, 50, 50, 0.05);
    }
    .sel-btn-danger:hover {
      background: var(--bad);
      color: #fff;
      border-color: var(--bad);
      box-shadow: 0 4px 12px rgba(211, 50, 50, 0.28);
    }
    .sel-btn-danger:hover::before {
      /* ikona tampa balta kartu su tekstu (currentColor) */
      opacity: 1;
    }
    body[data-theme="dark"] .sel-btn-danger {
      background: rgba(211, 50, 50, 0.14);
    }
  }

  body[data-theme="dark"] .selection-panel {
    box-shadow:
      0 20px 48px rgba(0, 0, 0, 0.42),
      0 4px 12px rgba(0, 0, 0, 0.24);
  }
  body[data-theme="dark"] .sel-clear,
  body[data-theme="dark"] .sel-btn {
    background: rgba(17, 21, 29, 0.76);
    box-shadow: none;
  }
  body[data-theme="dark"] .sel-color-menu,
  body[data-theme="dark"] .sel-spectrum-btn {
    background: rgba(17, 21, 29, 0.82);
  }
  body[data-theme="dark"] .sel-meta-chip {
    background: rgba(255, 255, 255, 0.075);
    color: var(--text-2);
  }
  body[data-theme="dark"] .sel-btn[disabled]:hover {
    background: rgba(17, 21, 29, 0.76);
  }

  /* ============ EDIT TOOLBAR ============ */
  .edit-toolbar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 0.5px solid var(--hairline);
    padding: 4px;
    border-radius: 14px;
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    align-items: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    width: max-content;
    max-width: none;
    justify-content: center;
  }
  .edit-toolbar::before {
    content: '';
    position: absolute; inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 1px 0 var(--inner-highlight);
  }
  .mobile-toolbar-brand,
  .mobile-3d-header,
  .mobile-results-brand,
  .toolbar-brand,
  .toolbar-results-title,
  .toolbar-sep {
    display: none;
  }
  .edit-btn {
    background: transparent;
    border: none;
    color: var(--text);
    padding: 7px 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }
  .edit-btn:hover {
    background: var(--accent-soft);
    color: var(--accent);
  }
  .edit-btn:active {
    transform: scale(0.97);
  }
  .edit-btn-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
  }
  .edit-btn-pdf {
    padding: 7px 14px;
    border-radius: 10px;
    background: var(--primary) !important;
    color: #fff !important;
    font-weight: 600;
  }
  .edit-btn-pdf:hover {
    background: #333 !important;
    color: #fff !important;
  }

  /* ============ SCENE OVERLAY — Floating UI virš 3D scenos ============
   * iOS toggle stiliaus mygtukai apačioje kairėje (etikečių rodymas, LDM).
   * Tai pakeičia sidebar'o "Rodymas" sekciją, kad valdikliai būtų arčiau
   * vietos, kur veikia (3D scenoje). */
  .scene-overlay {
    position: absolute;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 0.5px solid var(--hairline);
    border-radius: 14px;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    gap: 2px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    z-index: 5;
    font-family: inherit;
  }
  .scene-overlay-view {
    bottom: 20px;
    left: 20px;
  }
  .scene-overlay-divider {
    width: 1px;
    height: 22px;
    background: var(--hairline);
    margin: 0 2px;
  }

  /* iOS-stiliaus toggle switch — pilkas kai išjungtas, oranžinis kai įjungtas */
  .scene-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    cursor: pointer;
    user-select: none;
    border-radius: 10px;
    transition: background 0.15s;
  }
  .scene-toggle:hover {
    background: rgba(0, 0, 0, 0.03);
  }
  .scene-toggle input[type="checkbox"] {
    /* Slepiam tikrą checkbox'ą — vaizduojam savo switch'ą */
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
  }
  .scene-toggle-switch {
    position: relative;
    display: inline-block;
    width: 30px;
    height: 18px;
    background: rgba(120, 120, 128, 0.32);
    border-radius: 999px;
    transition: background 0.2s ease;
    flex-shrink: 0;
  }
  .scene-toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  }
  .scene-toggle input:checked + .scene-toggle-switch {
    background: var(--accent);
  }
  .scene-toggle input:checked + .scene-toggle-switch::before {
    transform: translateX(12px);
  }
  .scene-toggle-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
  }

  /* "More" mygtukas — atveria popover su label mode pasirinkimu */
  .scene-overlay-more {
    background: transparent;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    transition: all 0.15s;
    padding: 0;
    margin-left: 2px;
  }
  .scene-overlay-more:hover {
    background: var(--accent-soft);
    color: var(--accent);
  }
  .scene-overlay-more svg {
    width: 14px;
    height: 14px;
  }
  .scene-overlay-more.active {
    background: var(--accent-soft);
    color: var(--accent);
  }

  /* Label mode popover — atveriasi virš more mygtuko */
  .scene-label-mode-popover {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 4px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 0.5px solid var(--hairline);
    border-radius: 10px;
    padding: 4px;
    display: none;
    flex-direction: column;
    gap: 1px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 130px;
  }
  .scene-label-mode-popover.visible {
    display: flex;
  }
  .scene-popover-item {
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background 0.12s;
  }
  .scene-popover-item:hover {
    background: var(--surface-tint);
  }
  .scene-popover-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
  }

  /* ============ KEYBOARD SHORTCUTS HINT ============
   * Floating chip 3D scenos apačios centre. Vartotojui leidžia atrasti
   * klaviatūros valdymo galimybes — neperkrauna UI, bet visada matomas.
   * Stilius: glass-morphism kapsulė (matches scene-overlay), o klavišų
   * chip'ai turi 3D pressable look (Linear / macOS stilius). */
  .kbd-hints {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    /* Aukštas z-index — virš 3D scenos CSS2DRenderer label'ių (LDM,
       krovinių pavadinimų), kad popover'as jų neperskrostų. */
    z-index: 100;
    font-family: inherit;
  }
  .kbd-hints-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 12px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 0.5px solid var(--hairline);
    border-radius: 999px;
    color: var(--text);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: -0.1px;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    user-select: none;
  }
  .kbd-hints-trigger:hover {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
  }
  .kbd-hints-trigger:active { transform: translateY(0); }
  .kbd-hints-icon {
    width: 18px;
    height: 18px;
    color: var(--text-2);
    flex-shrink: 0;
  }
  .kbd-hints.has-selection .kbd-hints-trigger {
    /* Kai krovinys pasirinktas — akcentuojame, kad dabar klaviatūra veikia */
    background: linear-gradient(135deg, rgba(255, 106, 26, 0.10), rgba(255, 255, 255, 0.95));
    border-color: rgba(255, 106, 26, 0.32);
    color: var(--accent-2);
  }
  .kbd-hints.has-selection .kbd-hints-icon {
    color: var(--accent);
  }
  .kbd-hints.open .kbd-hints-trigger {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  }

  /* Subtilus pulsavimas, kai pirmą kartą pasirenkamas krovinys */
  .kbd-hints-pulse {
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
  }
  .kbd-hints.pulse .kbd-hints-pulse {
    animation: kbdPulse 1.6s ease-out 2;
  }
  @keyframes kbdPulse {
    0%   { opacity: 0.55; box-shadow: 0 0 0 0 rgba(255, 106, 26, 0.55); }
    100% { opacity: 0;    box-shadow: 0 0 0 14px rgba(255, 106, 26, 0); }
  }

  /* Popover panel */
  .kbd-hints-panel {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    width: 320px;
    /* SVARBU: pilnai nepermatomas fonas, kad 3D scenos LDM etiketės
       (CSS2DRenderer overlay'us) neprasimuštų pro popover'ą. */
    background: #ffffff;
    border: 0.5px solid var(--hairline);
    border-radius: 16px;
    padding: 14px 14px 12px;
    box-shadow: 0 18px 48px rgba(20, 24, 32, 0.14), 0 4px 12px rgba(20, 24, 32, 0.06);
    /* z-index aukštesnis nei CSS2DRenderer label'iai (default 0/1) */
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }
  .kbd-hints.open .kbd-hints-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
  }
  /* Maža rodyklėle nukreipta į trigger'į */
  .kbd-hints-panel::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-right: 0.5px solid var(--hairline);
    border-bottom: 0.5px solid var(--hairline);
  }
  .kbd-hints-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 0.5px solid var(--hairline);
  }
  .kbd-hints-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
  }
  .kbd-hints-subtitle {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--muted);
  }
  .kbd-hints-section + .kbd-hints-section {
    margin-top: 12px;
  }
  .kbd-hints-section-title {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    margin-bottom: 6px;
    padding-left: 2px;
  }
  .kbd-hints-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 2px;
    min-height: 32px;
  }
  .kbd-desc {
    font-size: 12.5px;
    color: var(--text-2);
    flex: 1;
    line-height: 1.3;
  }

  /* Klavišų chip'ai — Linear/macOS stilius */
  .kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f5f7 100%);
    border: 0.5px solid var(--hairline-strong);
    border-bottom-width: 1.5px;
    border-radius: 5px;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text);
    box-shadow: 0 1px 0 rgba(20, 24, 32, 0.04), inset 0 -1px 0 rgba(20, 24, 32, 0.06);
    line-height: 1;
    letter-spacing: 0;
    user-select: none;
  }
  .kbd.kbd-mod {
    font-family: inherit;
    font-weight: 600;
    padding: 0 7px;
  }
  .kbd.kbd-arrow {
    min-width: 22px;
    width: 22px;
    padding: 0;
  }
  .kbd.kbd-arrow svg {
    width: 12px;
    height: 12px;
    color: var(--text);
  }
  .kbd.kbd-danger {
    color: var(--bad);
    border-color: rgba(211, 50, 50, 0.28);
  }
  .kbd-combo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  .kbd-plus {
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
  }
  /* Rodyklės klavišų grupė — kryžiaus išdėstymas */
  .kbd-arrows {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }
  .kbd-arrows-row {
    display: inline-flex;
    gap: 2px;
  }

  /* Slepiame mobile/tablet'e — klaviatūros valdymas neaktualus */
  @media (max-width: 1024px) {
    .kbd-hints { display: none; }
  }

  /* ============ VIEW BUTTONS ============
   * Tekstiniai mygtukai vietoj ViewCube. Apačioje dešinėje, segmentinis
   * iOS-style indikatorius — vienu paspaudimu perjungia kamerą į norimą
   * vaizdą (3D, iš viršaus, iš šono, iš priekio). */
  .view-buttons {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 0.5px solid var(--hairline);
    border-radius: 12px;
    padding: 3px;
    gap: 1px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    z-index: 5;
  }
  .view-btn {
    background: transparent;
    border: none;
    padding: 7px 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    border-radius: 9px;
    transition: all 0.15s;
    white-space: nowrap;
  }
  .view-btn:hover {
    color: var(--text);
  }
  .view-btn.active {
    background: #fff;
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-weight: 600;
  }
  .view-btn:active {
    transform: scale(0.97);
  }

  .edit-toggle {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    cursor: pointer;
    user-select: none;
  }
  .edit-toggle input { accent-color: var(--accent); width: 14px; height: 14px; }

  /* ============ TOAST ============ */
  .toast {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(20px);
    color: #fff;
    padding: 12px 22px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 999px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 100;
    box-shadow: var(--shadow-lg);
  }
  .toast.visible { opacity: 1; }

  /* ============ HINTS at bottom ============ */
  .controls-hint {
    position: absolute;
    background: var(--surface-tint);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: 10px 16px;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
    bottom: 20px;
    right: 20px;
  }

  /* ============ BOX & LDM LABELS ============ */
  .box-label {
    background: rgba(20, 20, 20, 0.82);
    backdrop-filter: blur(10px);
    color: #fff;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    padding: 4px 10px;
    border-radius: 999px;
    pointer-events: none;
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    transform: translate(-50%, -50%);
    user-select: none;
    box-shadow: var(--shadow-sm);
  }
  .box-label.selected {
    background: var(--accent);
    color: var(--text);
    box-shadow: 0 4px 12px var(--accent-glow);
  }
  .ldm-marker {
    color: var(--text-2);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 10px;
    font-weight: 600;
    pointer-events: none;
    transform: translate(-50%, -50%);
    user-select: none;
    opacity: 0.75;
    letter-spacing: 0.2px;
  }
  .cab-label {
    background: var(--primary);
    color: var(--accent);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 5px 12px;
    border-radius: 999px;
    pointer-events: none;
    white-space: nowrap;
    transform: translate(-50%, -50%);
    user-select: none;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.1);
  }

  /* ============ FLASH ANIMATION ============ */
  .invalid-flash { animation: flashRed 0.4s ease; }
  @keyframes flashRed {
    0%, 100% { }
    50% { background: var(--bad-soft); }
  }

  /* ============ SCROLLBARS ============ */
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
  }
  ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); background-clip: padding-box; border: 2px solid transparent; }

  /* ============ iOS-STYLE TRUCK SUMMARY CELL ============
   * iOS Settings.app inspired: balta kortelė pilkame fone, su accent ikona
   * dėžutėje, pavadinimu, metrikomis ir chevron rodykle. Visa eilutė yra
   * paspaudžiama — atveria pilną sunkvežimio redagavimo formą.
   *
   * Vizualinė hierarchija:
   *   [orange icon box]  Standartinis            >
   *                      L 1360 · W 245 · H 270 · 24t
   */
  .section-title-compact {
    padding: 0 !important;
    margin: 0 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--text) !important;
    display: block !important;
  }
  .section-title-compact::before { display: none !important; }
  .truck-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    padding: 10px 12px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--hairline);
    transition: all 0.2s ease;
    user-select: none;
  }
  .truck-summary:hover {
    border-color: var(--hairline-strong);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  }
  .truck-summary:active {
    transform: translateY(0);
    background: var(--surface-tint);
  }
  /* Accent ikona dėžutėje, iOS Settings.app stiliumi */
  .truck-name-badge {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: var(--accent-soft);
    border-radius: 8px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    gap: 0 !important;
  }
  .truck-name-badge svg {
    width: 16px; height: 16px;
    color: var(--accent);
  }
  /* Tekstinis dalies blokas — pavadinimas + matmenys eile žemiau */
  .truck-name-badge > span {
    display: none; /* tekstas perkeliamas į kitur (truck-info) */
  }
  .truck-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .truck-info-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .truck-dims-inline {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
  }
  /* Chevron > rodyklė dešinėje (iOS stilius) */
  .truck-collapse-btn {
    flex-shrink: 0;
    background: transparent;
    border: none;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #c0c0c0;
    transition: transform 0.25s ease, color 0.2s;
    padding: 0;
  }
  .truck-summary:hover .truck-collapse-btn {
    color: var(--muted);
  }
  .truck-collapse-btn svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
  }
  .truck-body.collapsed {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.2s ease, padding 0.2s ease;
    margin: 0;
    padding: 0;
  }
  .truck-body {
    max-height: 2000px;
    opacity: 1;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    overflow: hidden;
    margin-top: 12px;
  }
  /* Kai atverta — chevron pasisuka 90° (> tampa ^) */
  .section-title-compact.expanded .truck-collapse-btn svg {
    transform: rotate(90deg);
  }
  /* Sekcijos truck section padding'as su iOS-style "inset" jausmu */
  .section-truck {
    padding: 14px 16px !important;
  }
  .section-truck::before { display: none !important; }

  /* ============ CARGO DUAL CTA GRID ============
   * Du mygtukai šalia — paprastas pridėjimas ir Smart importas.
   * Vartotojui aiškiai parodo, kad yra du būdai. */
  .cargo-cta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
  }
  .cargo-cta-btn {
    padding: 11px 10px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .cargo-cta-manual {
    background: var(--surface-tint);
    color: var(--text);
    border: 1px dashed var(--hairline-strong);
  }
  .cargo-cta-manual:hover {
    border-style: solid;
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft, rgba(255,106,26,0.06));
  }
  .cargo-cta-smart {
    background: linear-gradient(135deg, #ff6a1a 0%, #ff8d4a 100%);
    color: #fff;
  }
  .cargo-cta-smart:hover {
    background: linear-gradient(135deg, #e85f15 0%, #ff7d3a 100%);
    box-shadow: 0 2px 8px rgba(255, 106, 26, 0.3);
  }

  /* ============ CARGO PRESETS — Collapsible ============
   * Greitos paletės dabar yra "details" elementas — paslėpta pagal default.
   * Vartotojas paspaudžia "Greitos paletės ▼" kad išskleistų. */
  .cargo-presets-collapse {
    margin-top: 10px;
  }
  .cargo-presets-summary {
    cursor: pointer;
    list-style: none;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 500;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
  }
  .cargo-presets-summary::-webkit-details-marker { display: none; }
  .cargo-presets-summary::after {
    content: '▾';
    font-size: 9px;
    transition: transform 0.2s;
    color: var(--muted);
  }
  .cargo-presets-collapse[open] .cargo-presets-summary::after {
    transform: rotate(180deg);
  }
  .cargo-presets-collapse .cargo-presets {
    margin-top: 6px;
  }

  /* ============ SECTION LABELS ============
   * Maži pilki UPPERCASE label'ai tarp blokų (greitos paletės, kroviniai)
   * — vizualinė hierarchija be pertekliaus. */
  .cargo-presets-label,
  .cargo-list-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 600;
    margin-top: 14px;
    margin-bottom: 8px;
  }
  /* Header su label kairėje + pack mode toggle dešinėje */
  .cargo-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    margin-bottom: 8px;
  }
  .cargo-list-header .cargo-list-label {
    margin: 0;
  }
  /* Pack mode toggle — du iconinai mygtukai iOS-style segmented control */
  .pack-mode-toggle {
    display: inline-flex;
    background: var(--surface-tint);
    border-radius: 8px;
    padding: 2px;
    gap: 1px;
  }
  .pack-mode-btn {
    background: transparent;
    border: none;
    width: 28px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    transition: all 0.15s;
    padding: 0;
  }
  .pack-mode-btn svg {
    width: 13px; height: 13px;
  }
  .pack-mode-btn:hover { color: var(--text); }
  .pack-mode-btn.active {
    background: #fff;
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }

  /* ============ SUBTLE STICKY CALCULATE BUTTON ============
   * Apačios "Apskaičiuoti pakrovimą" mygtukas visada matomas (sticky),
   * bet švelnus — oranžinis outline, ne juoda dėmė. Hover'as užpildo
   * oranžine spalva. Vartotojui visada matomas, bet nekrenta į akis. */
  .calc-btn-subtle {
    margin-top: auto; /* Tegul mygtukas spaudžiamas link sekcijos apačios,
                         o ne klajoja viduryje kai krovinių mažai. */
    background: rgba(255, 255, 255, 0.92) !important;
    color: var(--accent) !important;
    border: 1px solid var(--accent) !important;
    font-weight: 600;
    transition: all 0.2s;
    position: sticky;
    bottom: 12px;
    z-index: 3;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* Switlus accent glow, kad mygtukas atrodytų kaip galutinis CTA, ne
     * neutralus dar vienas elementas. */
    box-shadow: 0 0 0 4px rgba(255, 106, 26, 0.06);
  }
  .calc-btn-subtle:hover {
    background: var(--accent) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(255, 106, 26, 0.25);
  }

  /* ============ CALCULATE PAIR BUTTONS ============
   * Du lygiaverčiai mygtukai šalia vienas kito:
   *   KAIRĖJE — Optimalus išdėstymas (pilnas auto-pack)
   *   DEŠINĖJE — Pridėti naujus į galą (esami kroviniai nejuda)
   * Abu veiksmai iškart matomi — vartotojas mato pasirinkimą be paslėpto UI. */
  .calc-btn-pair {
    position: sticky;
    bottom: 12px;
    z-index: 3;
    margin-top: auto;
    display: flex;
    align-items: stretch;
    gap: 8px;
  }
  .calc-pair-btn {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 10px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: var(--accent);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.1px;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 0 0 4px rgba(255, 106, 26, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .calc-pair-btn:hover {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 106, 26, 0.25);
    transform: translateY(-1px);
  }
  .calc-pair-btn:active {
    transform: translateY(0);
  }
  .calc-pair-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }
  .calc-pair-label {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Vizualus skirtumas tarp veiksmų:
       PRIMARY (kairėje) — pagrindinis veiksmas, švelnus accent fonas
       SECONDARY (dešinėje) — alternatyvus, baltas fonas + outline */
  .calc-pair-btn-primary {
    background: linear-gradient(135deg, rgba(255, 106, 26, 0.10), rgba(255, 255, 255, 0.95));
  }
  .calc-pair-btn-secondary {
    background: rgba(255, 255, 255, 0.92);
  }

  /* Kai 3D scenoje JAU yra įdėtų krovinių, "Pridėti naujus" yra aktualesnis —
     jis subtiliai paryškinamas, kad vartotojas pamatytų aktualų pasirinkimą. */
  .calc-btn-pair.has-existing .calc-pair-btn-secondary {
    background: linear-gradient(135deg, rgba(255, 106, 26, 0.10), rgba(255, 255, 255, 0.95));
    box-shadow: 0 0 0 4px rgba(255, 106, 26, 0.12);
  }

  /* Siaurame sidebar'e (<200px) — paliekam tik ikonas, kad netilptų tekstas */
  @container (max-width: 280px) {
    .calc-pair-label { display: none; }
    .calc-pair-btn { padding: 13px 8px; }
  }

  /* ============ COLLAPSED CARGO CARDS ============
   * Krovinių kortelės — visada matomos su matmenimis, bet kompaktiškesnės.
   * Detalūs nustatymai (svoris, stack, rotate) atveriami paspaudus kortelę. */
  /* Note: čia tik papildomi tweaks, pagrindinis cargo-item stilius lieka */

  /* ============ SMART WIDGET PANEL ============
   * Pakeičia statinę Pakrovimo analizės lentelę į iOS stiliaus widget'us.
   * Kiekvienas widget'as — atskira kortelė su aiškiu pavadinimu, dideliu
   * skaičiumi ir vizualiniu indikatorium (progress bar arba badge).
   *
   * Spalvos:
   *   Žalia (<70%) — saugu, daug vietos
   *   Geltona (70-90%) — beveik užimta
   *   Raudona (>90% / >100%) — pilna arba per pilna
   */

  /* Sekcijos antraštė */
  .results-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 8px;
    padding: 0 4px;
  }
  .results-section-title svg {
    width: 12px;
    height: 12px;
  }

  /* Pamatinis widget'o stilius — visi widget'ai paveldi */
  .widget {
    background: #ffffff;
    border-radius: 14px;
    border: 0.5px solid var(--hairline);
    padding: 12px 14px;
    margin-bottom: 10px;
    transition: all 0.2s;
  }
  .widget-header {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    margin-bottom: 6px;
  }
  .widget-header > svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
  }
  .widget-header > span:first-of-type {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
  }
  .widget-footer {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 4px;
    font-size: 9px;
  }
  .widget-footer-left {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
  }
  .widget-footer-right {
    font-size: 10px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  /* Bendras horizontal bar (per visą plotį) */
  .widget-bar {
    height: 4px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 6px;
  }
  .widget-bar-fill {
    height: 100%;
    width: 0%;
    background: #97C459;
    border-radius: 999px;
    transition: width 0.3s, background 0.3s;
  }

  /* Spalvų klasės (pridedamos JS) */
  .widget-bar-fill.warn { background: #EF9F27; }
  .widget-bar-fill.danger { background: #E24B4A; }
  .widget-footer-right.warn { color: #BA7517; }
  .widget-footer-right.danger { color: #C73C3A; }
  .widget-footer-right.ok { color: #639922; }

  /* ----- STATUS WIDGET ----- */
  .widget-status {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(151, 196, 89, 0.08), rgba(99, 153, 34, 0.04));
    border-color: rgba(99, 153, 34, 0.2);
  }
  .widget-status.warn {
    background: linear-gradient(135deg, rgba(239, 159, 39, 0.1), rgba(186, 117, 23, 0.05));
    border-color: rgba(186, 117, 23, 0.25);
  }
  .widget-status.danger {
    background: linear-gradient(135deg, rgba(226, 75, 74, 0.1), rgba(199, 60, 58, 0.05));
    border-color: rgba(199, 60, 58, 0.25);
  }
  .widget-status.empty {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0.01));
    border-color: var(--hairline);
  }
  .widget-status-icon {
    width: 32px;
    height: 32px;
    background: #1D9E75;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
  }
  .widget-status.warn .widget-status-icon { background: #EF9F27; }
  .widget-status.danger .widget-status-icon { background: #E24B4A; }
  .widget-status.empty .widget-status-icon { background: #aaa; }
  .widget-status-icon svg {
    width: 18px;
    height: 18px;
  }
  .widget-status-text {
    flex: 1;
    min-width: 0;
  }
  .widget-status-title {
    font-size: 13px;
    font-weight: 600;
    color: #157A5A;
    line-height: 1.2;
  }
  .widget-status.warn .widget-status-title { color: #93590F; }
  .widget-status.danger .widget-status-title { color: #B83332; }
  .widget-status.empty .widget-status-title { color: var(--text); }
  .widget-status-sub {
    font-size: 10px;
    color: #6B8678;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
  }
  .widget-status.warn .widget-status-sub { color: #6B5C2C; }
  .widget-status.danger .widget-status-sub { color: #8B4847; }
  .widget-status.empty .widget-status-sub { color: var(--muted); }

  /* ----- PAIR (2 widget'ai šalia) ----- */
  .widget-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
  }
  .widget-pair .widget {
    margin-bottom: 0;
  }

  /* ----- METRIC widget (Svoris, Tūris) ----- */
  .widget-big-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    display: flex;
    align-items: baseline;
  }
  .widget-unit {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    margin-left: 2px;
  }

  /* ----- LDM widget ----- */
  .widget-ldm .widget-header {
    margin-bottom: 8px;
  }
  .widget-badge {
    margin-left: auto;
    background: rgba(99, 153, 34, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    color: #639922;
    font-variant-numeric: tabular-nums;
  }
  .widget-badge.warn {
    background: rgba(186, 117, 23, 0.1);
    color: #BA7517;
  }
  .widget-badge.danger {
    background: rgba(199, 60, 58, 0.1);
    color: #C73C3A;
  }
  .widget-ldm-main {
    display: flex;
    align-items: baseline;
    gap: 6px;
  }
  .widget-ldm-big {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
  }
  .widget-ldm-divider {
    font-size: 14px;
    color: var(--muted);
  }
  .widget-ldm-total {
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
  }
  .widget-ldm-subs {
    display: flex;
    gap: 14px;
    margin-top: 8px;
    font-size: 10px;
  }
  .widget-ldm-sub {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }
  .widget-ldm-sub-label {
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
  }
  .widget-ldm-sub-value {
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
  }
  .widget-ldm-sub-value.widget-ldm-sub-accent {
    color: var(--accent);
  }

  /* ----- SPACE widget ----- */
  .widget-space .widget-header {
    margin-bottom: 8px;
  }
  /* Kai progress bar yra SUJUNGTAS LDM widget'o apačioje, pridedam viršuje
   * tarpą atskirti nuo sub-rodiklių (Teorinis/Praktinis/Laisva) */
  .widget-ldm .widget-space-bar.widget-ldm-bar {
    margin-top: 12px;
  }
  .widget-space-pct {
    margin-left: auto;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
  }
  .widget-space-bar {
    height: 28px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 4px;
  }
  .widget-space-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(180deg, #D85A30, #993C1D);
    border-radius: 6px;
    transition: width 0.3s, background 0.3s;
  }
  .widget-space-fill.ok { background: linear-gradient(180deg, #97C459, #639922); }
  .widget-space-fill.warn { background: linear-gradient(180deg, #EF9F27, #BA7517); }
  .widget-space-fill.danger { background: linear-gradient(180deg, #E24B4A, #C73C3A); }

  /* ----- TYPES widget ----- */
  .widget-types .widget-header {
    margin-bottom: 10px;
  }
  .widget-types-count {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-secondary, var(--muted));
    font-weight: 500;
    font-variant-numeric: tabular-nums;
  }
  .widget-types-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* Kai krovinių tipų daug (10+), sąrašas auga ir gali per daug išsiplėsti.
     * Ribojam aukštį iki ~8 eilučių (apie 200px), o likusieji scroll'inami. */
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Plonas scroll bar — nedominuoja UI */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
    /* Mažas padding dešinėje, kad scrollbar'as neperdengtų teksto */
    padding-right: 4px;
    margin-right: -4px;
  }
  .widget-types-list::-webkit-scrollbar {
    width: 4px;
  }
  .widget-types-list::-webkit-scrollbar-track {
    background: transparent;
  }
  .widget-types-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 2px;
  }
  .widget-types-list .legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    background: transparent;
    border: none;
    padding: 0;
  }
  .widget-types-list .legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
  }

  /* ============ TABLET BREAKPOINT (801-1280px) ============
   * Tablet režime — sidebar siauresnis, toolbar kompaktiškesnis.
   * Widget panel'is dešinėje lieka matomas (jis nebe per platus, dabar
   * yra iOS widget'ai, ne lentelė kaip anksčiau). */
  @media (min-width: 801px) and (max-width: 1280px) {
    /* Sidebar IŠLAIKO desktop plotį (400px) — vartotojo prašymas:
       siaurėjant nesusispausti, nes turinys tampa per ankštas. */
    /* Toolbar nesutraukinėjam — laikome desktop dydį iki mobile breakpoint'o.
       Vartotojo prašymas: mygtukai turi išlikti vienodi, kol netelpa, tada
       perjungia į mobile layout. */

    /* Loading Analysis tablet'e — virsta "chip" mygtuku dešinėje.
       Užstodavo 3D vaizdą, todėl slepiam ir atidarom per toggle. */
    .results {
      display: none !important;
    }
    .results.mobile-visible {
      display: block !important;
      position: absolute;
      top: 72px;
      right: 20px;
      left: auto;
      width: 320px;
      max-width: calc(100% - 40px);
      max-height: calc(100vh - 110px);
      overflow-y: auto;
      z-index: 90;
      border-radius: 16px;
      box-shadow: 0 12px 40px rgba(0,0,0,0.18);
      animation: results-slide-in 0.22s cubic-bezier(0.32, 0.72, 0, 1);
    }
    @keyframes results-slide-in {
      from { opacity: 0; transform: translateY(-6px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    /* Toggle "chip" mygtukas — dešinėje viršuje, su ikona + tekstu */
    .mobile-results-toggle {
      display: inline-flex !important;
      position: absolute;
      top: 20px;
      right: 20px;
      width: auto;
      height: 38px;
      padding: 0 14px;
      gap: 7px;
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.92);
      backdrop-filter: blur(40px) saturate(180%);
      -webkit-backdrop-filter: blur(40px) saturate(180%);
      border: 0.5px solid var(--hairline);
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
      align-items: center;
      justify-content: center;
      color: var(--text);
      cursor: pointer;
      z-index: 95;
      font-family: inherit;
      font-size: 12px;
      font-weight: 600;
      transition: background 0.15s, transform 0.15s, color 0.15s, border-color 0.15s;
    }
    .mobile-results-toggle::after {
      content: 'Analysis';
      font-family: inherit;
    }
    body[data-lang="lt"] .mobile-results-toggle::after,
    html[lang="lt"] .mobile-results-toggle::after {
      content: 'Analizė';
    }
    .mobile-results-toggle svg {
      width: 15px;
      height: 15px;
      flex-shrink: 0;
    }
    .mobile-results-toggle:hover {
      background: rgba(255, 255, 255, 1);
      color: var(--accent);
      border-color: var(--accent-soft);
    }
    .mobile-results-toggle:active {
      transform: scale(0.97);
    }
    .mobile-results-toggle.active {
      background: var(--primary);
      color: #fff;
      border-color: var(--primary);
    }
  }

  /* ============ RESPONSIVE — Mobile bottom sheet layout ============
   *
   * Mobile strategija: 3D scena užima pilną ekraną, sidebar paslepiamas
   * kaip "bottom sheet" (slenkantis panelis iš apačios). Vartotojas
   * paspaudžia floating action mygtuką, kad atvertų / uždarytų panelį.
   *
   * Tai įprasta paradigma iš Google Maps, Figma mobile ir kt. — leidžia
   * 3D ekvivalentui užimti pilną ekraną, kuomet sidebar reikia tik
   * periodiškai (keičiant nustatymus ar pridedant krovinį).
   */
  @media (max-width: 800px) {
    .app {
      grid-template-columns: 1fr;
      grid-template-rows: 1fr;
      padding: 0;
      gap: 0;
    }
    /* Sidebar tampa bottom sheet — slankojantis panelis iš apačios */
    .sidebar {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      top: auto;
      width: 100%;
      max-height: 75vh;
      height: 75vh;
      border-radius: 20px 20px 0 0;
      transform: translateY(calc(100% - 56px));
      transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
      z-index: 100;
      box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
    }
    .sidebar.mobile-open {
      transform: translateY(0);
    }
    /* "Drag handle" indikatorius viršuje — vizualinė užuomina, kad
       panelį galima patempti / paliesti */
    .sidebar::after {
      content: '';
      position: absolute;
      top: 8px;
      left: 50%;
      transform: translateX(-50%);
      width: 40px;
      height: 5px;
      background: rgba(0,0,0,0.18);
      border-radius: 3px;
      pointer-events: none;
    }
    /* Mobile peek tab — paslėpta, nes naudojame iOS bottom tab bar */
    .mobile-sheet-peek {
      display: none !important;
    }
    /* Bottom sheet turinys turi turėti scroll'ą */
    .sidebar > *:not(.mobile-sheet-peek) {
      padding-left: 16px;
      padding-right: 16px;
    }
    /* 3D scena užima pilną ekraną */
    .main {
      border-radius: 0;
      height: 100vh;
    }
    /* Edit toolbar mobile — kompaktinis. JS pakeičia mygtuko tekstą į
       ikoną (data-mobile atributas), todėl CSS čia tik mažina paddings. */
    .edit-toolbar {
      max-width: calc(100% - 80px);
      left: 12px;
      right: 60px;
      top: 12px;
      transform: none;
      padding: 5px;
      gap: 2px;
      font-size: 14px;
      justify-content: flex-start;
      flex-wrap: nowrap;
      overflow: hidden;
    }
    .edit-btn {
      padding: 8px 10px !important;
      font-size: 15px !important;
      min-width: 36px;
    }
    /* Gravitacijos toggle mobile — paslepiame label tekstą, paliekam tik
       checkbox (oranžinis kvadratėlis) */
    .edit-toggle {
      padding: 4px 6px !important;
      gap: 0 !important;
    }
    .edit-toggle span {
      display: none;
    }
    /* Mažesnis header mobile */
    .header { padding: 10px 14px 8px 14px !important; }
    .logo-img { width: 40px !important; height: 40px !important; }
    .logo-name { font-size: 15px !important; }
    .logo-version { font-size: 9px !important; }
    .tagline-only { font-size: 10px !important; margin-top: 4px !important; }
    .app-title-compact { font-size: 14px !important; margin-top: 8px !important; }
    h1 { font-size: 22px !important; }
    .tagline { font-size: 11px !important; }
    /* Preset mygtukai mobile — kompaktiškesnis */
    .preset-btn { padding: 8px 6px !important; font-size: 11px !important; }
    .preset-btn svg { width: 28px !important; height: 28px !important; }
  }
  /* Desktop — paslėpiam mobile peek juostą */
  .mobile-sheet-peek {
    display: none;
  }
  /* Desktop — paslėpiam mobile results toggle mygtuką */
  .mobile-results-toggle {
    display: none;
  }
  /* ============ RESPONSIVE — Loading Analysis ant mobile ============
   *
   * Mobile režime analizės panelis užima ekrane vietos. Paslepiam jį
   * po toggle mygtuku (apvalus mygtukas viršuje dešinėje). Vartotojas
   * paspaudžia — panelis išplaukia, vėl paspaudžia — paslepiama.
   */
  @media (max-width: 800px) {
    /* Pagal default — analizės panelis paslėptas */
    .results {
      display: none !important;
    }
    /* Paspaudus toggle mygtuką — pakeičiame į display: block */
    .results.mobile-visible {
      display: block !important;
      position: fixed;
      top: 70px;
      right: 12px;
      left: auto;
      max-width: calc(100% - 24px);
      max-height: 60vh;
      overflow-y: auto;
      z-index: 90;
      border-radius: 14px;
      box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    }
    /* Selection panel taip pat slepiasi mobile pagal default */
    .selection-panel {
      position: fixed !important;
      top: auto;
      right: 12px;
      bottom: calc(var(--mobile-tabbar-height) + 152px);
      left: 12px;
      width: auto;
      max-width: none;
      min-width: 0;
      padding: 7px;
      border-radius: 15px;
      z-index: 91;
    }
    .selection-panel .results-title {
      display: none;
      margin-bottom: 8px;
      padding-bottom: 8px;
      font-size: 10px;
    }
    .sel-clear {
      padding: 3px 8px;
      font-size: 9px;
    }
    .sel-dims {
      display: none;
      margin-bottom: 8px;
      padding-bottom: 8px;
      font-size: 10px;
      line-height: 1.45;
    }
    .sel-actions {
      gap: 5px;
      margin-bottom: 0;
    }
    .sel-btn {
      min-height: 32px;
      padding: 6px 5px;
      border-radius: 10px;
      font-size: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .sel-btn::before {
      width: 18px;
      height: 18px;
      display: block;
      margin-right: 0;
      vertical-align: 0;
    }
    .sel-color-btn::before {
      content: none;
      display: none !important;
    }
    .sel-color-preview {
      width: 18px;
      height: 18px;
      margin-right: 0;
      border-radius: 6px;
    }
    .sel-color-btn span:not(.sel-color-preview) {
      display: none;
    }
    .sel-hint {
      display: none;
    }
    /* Mobile toggle mygtukas — apvalus, viršuje dešinėje */
    .mobile-results-toggle {
      display: flex !important;
      position: fixed;
      top: 12px;
      right: 12px;
      width: 44px;
      height: 44px;
      border-radius: 50%;
      background: var(--surface);
      border: 1px solid var(--hairline);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      box-shadow: 0 2px 8px rgba(0,0,0,0.12);
      align-items: center;
      justify-content: center;
      color: var(--text);
      cursor: pointer;
      z-index: 95;
      transition: background 0.2s, transform 0.2s;
    }
    .mobile-results-toggle svg {
      width: 20px;
      height: 20px;
    }
    .mobile-results-toggle.active {
      background: var(--accent);
      color: white;
    }
  }

  /* Mobile 3D controls: bottom dock layout.
     Keeps the scene readable and avoids unclear side panels on small phones. */
  @media (max-width: 800px) {
    body[data-mobile-view="3d"] .mobile-results-toggle {
      display: none !important;
    }

    body[data-mobile-view="3d"] .app {
      padding-bottom: 0;
    }

    body[data-mobile-view="3d"]::after {
      content: '';
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      height: calc(var(--mobile-tabbar-height) + 122px);
      background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.94) 36%,
        rgba(255, 255, 255, 0.98) 100%
      );
      pointer-events: none;
      z-index: 80;
    }

    body[data-mobile-view="3d"] .mobile-3d-header {
      display: none;
    }

    body[data-mobile-view="3d"] .edit-toolbar {
      position: fixed;
      top: calc(10px + env(safe-area-inset-top));
      left: 14px;
      right: 14px;
      width: auto;
      max-width: none;
      height: 56px;
      transform: none;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      gap: 0;
      padding: 6px;
      border-radius: 18px;
      overflow: visible;
      z-index: 92;
      background: rgba(255, 255, 255, 0.96);
      backdrop-filter: blur(40px) saturate(180%);
      -webkit-backdrop-filter: blur(40px) saturate(180%);
      border: 1px solid rgba(20, 24, 32, 0.08);
      box-shadow: 0 8px 28px rgba(20, 24, 32, 0.1), 0 2px 6px rgba(20, 24, 32, 0.06);
    }

    body[data-mobile-view="3d"] .toolbar-brand {
      display: flex;
      align-items: center;
      gap: 7px;
      padding: 0 6px 0 2px;
      flex-shrink: 0;
    }

    body[data-mobile-view="3d"] .toolbar-brand-icon {
      width: 28px;
      height: 28px;
    }

    body[data-mobile-view="3d"] .toolbar-brand-name {
      font-size: 12px;
      font-weight: 800;
      letter-spacing: 0.07em;
      color: var(--text);
      font-family: inherit;
    }

    body[data-mobile-view="3d"] .toolbar-results-title {
      display: none !important;
    }

    body[data-mobile-view="3d"] .toolbar-sep {
      display: block;
      width: 1px;
      height: 28px;
      background: rgba(20, 24, 32, 0.1);
      flex-shrink: 0;
      margin: 0 4px;
    }

    body[data-mobile-view="3d"] .edit-btn {
      height: 44px;
      min-width: 0;
      padding: 0 !important;
      border-radius: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex: 1 1 0;
      background: transparent !important;
      border: 0 !important;
      border-left: 0.5px solid rgba(20, 24, 32, 0.09) !important;
      color: var(--text);
      box-shadow: none !important;
      transition: background 0.12s;
    }

    body[data-mobile-view="3d"] .edit-btn:first-of-type {
      border-left: 0 !important;
    }

    body[data-mobile-view="3d"] .edit-btn:active {
      background: rgba(20, 24, 32, 0.06) !important;
      transform: scale(0.91);
    }

    body[data-mobile-view="3d"] .edit-btn-label {
      display: none;
    }

    body[data-mobile-view="3d"] .edit-btn-icon {
      width: 19px;
      height: 19px;
    }

    body[data-mobile-view="3d"] .edit-btn-pdf {
      flex: 0.85 1 0;
      background: rgba(255, 106, 26, 0.07) !important;
      color: var(--accent) !important;
      border: 1.5px solid rgba(255, 106, 26, 0.22) !important;
      border-radius: 12px !important;
      margin-left: 5px;
      font-weight: 700;
    }

    body[data-mobile-view="3d"] .edit-btn-pdf:active {
      background: rgba(255, 106, 26, 0.14) !important;
      transform: scale(0.91);
    }

    body[data-mobile-view="3d"] .viewport {
      height: 100vh;
      height: 100dvh;
    }

    body[data-mobile-view="3d"] .scene-overlay-view {
      position: fixed !important;
      top: auto;
      bottom: calc(var(--mobile-tabbar-height) + 74px);
      left: 18px;
      right: 18px;
      transform: none;
      flex-direction: row;
      justify-content: center;
      align-items: center;
      padding: 10px 12px;
      gap: 10px;
      border-radius: 18px 18px 0 0;
      border-bottom: 0;
      z-index: 90;
      background: rgba(255, 255, 255, 0.94);
      box-shadow: 0 -8px 28px rgba(20, 24, 32, 0.08);
    }

    body[data-mobile-view="3d"] .scene-overlay-divider {
      width: 1px;
      height: 24px;
      margin: 0 2px;
    }

    body[data-mobile-view="3d"] .scene-toggle {
      justify-content: center;
      padding: 8px 10px;
      gap: 6px;
      min-height: 38px;
      flex: 1 1 0;
    }

    body[data-mobile-view="3d"] .scene-toggle-label {
      font-size: 13px;
      font-weight: 650;
      line-height: 1;
    }

    body[data-mobile-view="3d"] .scene-overlay-more {
      margin-left: 2px;
      align-self: center;
    }

    body[data-mobile-view="3d"] .scene-label-mode-popover {
      left: auto;
      right: 4px;
      bottom: calc(100% + 8px);
    }

    body[data-mobile-view="3d"] .view-buttons {
      position: fixed !important;
      top: auto;
      bottom: calc(var(--mobile-tabbar-height) + 10px);
      left: 18px;
      right: 18px;
      transform: none;
      flex-direction: row;
      align-items: stretch;
      padding: 0 12px 8px;
      gap: 0;
      border-radius: 0 0 18px 18px;
      border-top: 1px solid rgba(20, 24, 32, 0.08);
      z-index: 90;
      background: rgba(255, 255, 255, 0.94);
      box-shadow: 0 10px 30px rgba(20, 24, 32, 0.1);
    }

    body[data-mobile-view="3d"] .view-btn {
      width: auto;
      min-width: 0;
      flex: 1 1 0;
      min-height: 48px;
      padding: 10px 4px 8px;
      font-size: 13px;
      font-weight: 650;
      text-align: center;
      border-radius: 0;
      position: relative;
      box-shadow: none;
    }

    body[data-mobile-view="3d"] .view-btn.active {
      background: transparent;
      box-shadow: none;
    }

    body[data-mobile-view="3d"] .view-btn.active::after {
      content: '';
      position: absolute;
      left: 18px;
      right: 18px;
      bottom: 0;
      height: 3px;
      border-radius: 999px 999px 0 0;
      background: var(--accent);
    }
  }

  @media (max-width: 380px) {
    body[data-mobile-view="3d"] .scene-toggle-label {
      font-size: 10px;
    }

    body[data-mobile-view="3d"] .scene-toggle {
      padding: 6px 5px;
    }

    body[data-mobile-view="3d"] .view-btn {
      font-size: 10px;
    }
  }

  /* ============ MOBILE TAB LAYOUT FIX ============
   * The desktop app shell uses a 400px sidebar column plus the viewport.
   * On phones that left the Results tab in the second grid column, creating
   * the narrow sliced view seen in mobile Safari. Mobile tabs should each own
   * the full available screen width. */
  @media (max-width: 1024px) {
    html,
    body {
      width: 100%;
      overflow: hidden;
    }

    .app {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      grid-template-rows: minmax(0, 1fr);
      width: 100%;
      height: 100vh;
      height: 100dvh;
      gap: 0;
      padding: 0;
      overflow: hidden;
    }

    .sidebar,
    .viewport {
      grid-column: 1;
      grid-row: 1;
      min-width: 0;
      width: 100%;
      height: calc(100vh - var(--mobile-tabbar-height));
      height: calc(100dvh - var(--mobile-tabbar-height));
      border-radius: 0;
    }

    body[data-mobile-view="results"] .viewport {
      display: block;
      width: 100%;
      height: calc(100vh - var(--mobile-tabbar-height));
      height: calc(100dvh - var(--mobile-tabbar-height));
      overflow: hidden;
      border: 0;
      box-shadow: none;
    }

    body[data-mobile-view="results"] .mobile-results-toggle,
    body[data-mobile-view="results"] .view-buttons {
      display: none !important;
    }

    body[data-mobile-view="results"] .edit-toolbar {
      position: fixed;
      top: calc(10px + env(safe-area-inset-top));
      left: 14px;
      right: 14px;
      width: auto;
      max-width: none;
      height: 56px;
      transform: none;
      display: flex !important;
      justify-content: space-between;
      align-items: center;
      gap: 0;
      padding: 6px;
      border-radius: 18px;
      overflow: visible;
      z-index: 92;
      background: rgba(255, 255, 255, 0.96);
      backdrop-filter: blur(40px) saturate(180%);
      -webkit-backdrop-filter: blur(40px) saturate(180%);
      border: 1px solid rgba(20, 24, 32, 0.08);
      box-shadow: 0 8px 28px rgba(20, 24, 32, 0.1), 0 2px 6px rgba(20, 24, 32, 0.06);
    }

    body[data-mobile-view="results"] .toolbar-brand {
      display: flex;
      align-items: center;
      gap: 7px;
      padding: 0 6px 0 2px;
      flex-shrink: 0;
    }

    body[data-mobile-view="results"] .toolbar-brand-icon {
      width: 28px;
      height: 28px;
    }

    body[data-mobile-view="results"] .toolbar-brand-name {
      font-size: 12px;
      font-weight: 800;
      letter-spacing: 0.07em;
      color: var(--text);
      font-family: inherit;
    }

    body[data-mobile-view="results"] .toolbar-results-title {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      min-width: 0;
      margin-left: auto;
      padding: 0 4px 0 12px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      white-space: nowrap;
    }

    body[data-mobile-view="results"] .toolbar-sep,
    body[data-mobile-view="results"] .edit-btn {
      display: none !important;
    }

    body[data-mobile-view="results"] .results {
      display: flex !important;
      flex-direction: column;
      position: static !important;
      width: 100% !important;
      min-width: 0 !important;
      height: 100% !important;
      max-height: none !important;
      padding: calc(82px + env(safe-area-inset-top)) 16px 24px;
      background: #f7f8fa;
      overflow-y: auto;
      overflow-x: hidden;
      border: 0 !important;
      border-radius: 0 !important;
      box-shadow: none !important;
    }

    body[data-mobile-view="results"] .mobile-results-brand {
      display: none;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin: 0 0 12px;
      padding: 2px 2px 12px;
      border-bottom: 1px solid rgba(20, 24, 32, 0.08);
    }

    body[data-mobile-view="results"] .mobile-results-brand img {
      width: 176px;
      height: 54px;
      object-fit: contain;
      flex: 0 0 auto;
    }

    body[data-mobile-view="results"] .mobile-results-brand div {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      min-width: 0;
    }

    body[data-mobile-view="results"] .mobile-results-brand span {
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.08em;
      color: var(--muted);
      text-transform: uppercase;
      white-space: nowrap;
    }

    body[data-mobile-view="results"] .results-section-title {
      margin: 0 0 8px;
      padding: 0 2px;
      font-size: 10px;
      letter-spacing: 0.09em;
    }

    body[data-mobile-view="results"] .widget {
      margin-bottom: 10px;
      padding: 12px 14px;
      border: 1px solid rgba(20, 24, 32, 0.1);
      border-radius: 12px;
      box-shadow: none;
    }

    body[data-mobile-view="results"] .widget-status {
      min-height: 58px;
      align-items: center;
      gap: 10px;
      background: linear-gradient(135deg, rgba(151, 196, 89, 0.1), rgba(255, 255, 255, 0.96));
      border-color: rgba(99, 153, 34, 0.24);
    }

    body[data-mobile-view="results"] .widget-status-icon {
      width: 36px;
      height: 36px;
      border-radius: 9px;
    }

    body[data-mobile-view="results"] .widget-status-title {
      font-size: 13px;
      line-height: 1.15;
    }

    body[data-mobile-view="results"] .widget-status-sub {
      font-size: 10px;
    }

    body[data-mobile-view="results"] .widget-pair {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 10px;
      margin-bottom: 10px;
    }

    body[data-mobile-view="results"] .widget-pair .widget {
      margin-bottom: 0;
      min-width: 0;
    }

    body[data-mobile-view="results"] .widget-header {
      gap: 5px;
      margin-bottom: 6px;
    }

    body[data-mobile-view="results"] .widget-header > span:first-of-type {
      font-size: 10px;
      letter-spacing: 0.05em;
    }

    body[data-mobile-view="results"] .widget-big-value {
      font-size: 23px;
      line-height: 1;
    }

    body[data-mobile-view="results"] .widget-unit {
      font-size: 12px;
    }

    body[data-mobile-view="results"] .widget-footer {
      margin-top: 5px;
      font-size: 9px;
    }

    body[data-mobile-view="results"] .widget-footer-right {
      font-size: 10px;
    }

    body[data-mobile-view="results"] .widget-bar {
      height: 4px;
      margin-top: 6px;
    }

    body[data-mobile-view="results"] .widget-ldm {
      padding-bottom: 13px;
    }

    body[data-mobile-view="results"] .widget-ldm .widget-header {
      margin-bottom: 10px;
    }

    body[data-mobile-view="results"] .widget-badge {
      padding: 2px 8px;
      border-radius: 6px;
      font-size: 10px;
    }

    body[data-mobile-view="results"] .widget-ldm-main {
      gap: 6px;
      align-items: baseline;
    }

    body[data-mobile-view="results"] .widget-ldm-big {
      font-size: 28px;
    }

    body[data-mobile-view="results"] .widget-ldm-divider,
    body[data-mobile-view="results"] .widget-ldm-total {
      font-size: 12px;
    }

    body[data-mobile-view="results"] .widget-ldm-subs {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
      margin-top: 10px;
    }

    body[data-mobile-view="results"] .widget-ldm-sub-label {
      font-size: 9px;
      line-height: 1.1;
    }

    body[data-mobile-view="results"] .widget-ldm .widget-space-bar.widget-ldm-bar {
      height: 28px;
      margin-top: 12px;
      border-radius: 6px;
    }

    body[data-mobile-view="results"] .widget-space-fill {
      border-radius: 6px;
    }

    body[data-mobile-view="results"] .widget-types .widget-header {
      margin-bottom: 10px;
    }

    body[data-mobile-view="results"] .widget-types-list {
      gap: 8px;
      max-height: none;
      padding-right: 0;
      margin-right: 0;
    }

    body[data-mobile-view="results"] .widget-types-list .legend-item {
      font-size: 12px;
      gap: 8px;
    }

    body[data-mobile-view="results"] .widget-types-list .legend-swatch {
      width: 10px;
      height: 10px;
      border-radius: 3px;
    }
  }

  @media (max-width: 360px) {
    body[data-mobile-view="results"] .results {
      padding: 14px 12px 20px;
    }

    body[data-mobile-view="results"] .widget {
      padding: 11px 12px;
    }

    body[data-mobile-view="results"] .widget-big-value {
      font-size: 21px;
    }
  }

  /* ============ DARK MODE FINAL OVERRIDES ============ */
  body[data-theme="dark"] .header,
  body[data-theme="dark"] .user-dropdown,
  body[data-theme="dark"] .user-dropdown-header,
  body[data-theme="dark"] .user-dropdown-section,
  body[data-theme="dark"] .user-language-option,
  body[data-theme="dark"] .user-theme-option,
  body[data-theme="dark"] .truck-card,
  body[data-theme="dark"] .truck-summary,
  body[data-theme="dark"] .preset-btn,
  body[data-theme="dark"] .cargo-preset-btn,
  body[data-theme="dark"] .cargo-cta-manual,
  body[data-theme="dark"] .cargo-item,
  body[data-theme="dark"] .widget,
  body[data-theme="dark"] .edit-toolbar,
  body[data-theme="dark"] .scene-overlay,
  body[data-theme="dark"] .view-buttons,
  body[data-theme="dark"] .calc-btn-subtle,
  body[data-theme="dark"] .calc-pair-btn,
  body[data-theme="dark"] .modal,
  body[data-theme="dark"] .login-popup,
  body[data-theme="dark"] .admin-modal,
  body[data-theme="dark"] .admin-user-card {
    background: var(--surface-strong) !important;
    color: var(--text);
    border-color: var(--hairline);
  }

  body[data-theme="dark"] .sidebar,
  body[data-theme="dark"][data-mobile-view="cargo"] .sidebar,
  body[data-theme="dark"][data-mobile-view="results"] .results {
    background:
      linear-gradient(180deg,
        rgba(24, 29, 39, 0.96) 0%,
        rgba(22, 26, 36, 0.95) 52%,
        rgba(31, 26, 25, 0.92) 100%) !important;
  }

  body[data-theme="dark"][data-mobile-view="cargo"] .header,
  body[data-theme="dark"][data-mobile-view="cargo"] .header-top,
  body[data-theme="dark"][data-mobile-view="3d"] .edit-toolbar,
  body[data-theme="dark"][data-mobile-view="3d"] .scene-overlay-view,
  body[data-theme="dark"][data-mobile-view="3d"] .view-buttons,
  body[data-theme="dark"][data-mobile-view="results"] .edit-toolbar {
    background: rgba(27, 32, 43, 0.96) !important;
    border-color: var(--hairline);
  }

  body[data-theme="dark"] .mobile-tabbar {
    background: rgba(17, 21, 29, 0.96) !important;
    border-top-color: var(--hairline);
  }

  body[data-theme="dark"][data-mobile-view="3d"]::after {
    background: linear-gradient(
      180deg,
      rgba(15, 18, 24, 0) 0%,
      rgba(15, 18, 24, 0.88) 36%,
      rgba(15, 18, 24, 0.98) 100%
    ) !important;
  }

  body[data-theme="dark"] input,
  body[data-theme="dark"] textarea,
  body[data-theme="dark"] select,
  body[data-theme="dark"] .admin-input,
  body[data-theme="dark"] .tab-add,
  body[data-theme="dark"] .tab:not(.active),
  body[data-theme="dark"] .cargo-expanded-body {
    background: #11151d !important;
    color: var(--text);
    border-color: var(--hairline);
  }

  body[data-theme="dark"] .widget-status {
    background: linear-gradient(135deg, rgba(46, 184, 114, 0.16), rgba(27, 32, 43, 0.98)) !important;
    border-color: rgba(46, 184, 114, 0.26) !important;
  }

  body[data-theme="dark"] .widget-bar,
  body[data-theme="dark"] .widget-space-bar,
  body[data-theme="dark"] .progress-track {
    background: rgba(255, 255, 255, 0.1) !important;
  }

  body[data-theme="dark"] .section-view,
  body[data-theme="dark"] .section-cargo {
    background: rgba(15, 18, 24, 0.36) !important;
  }

  body[data-theme="dark"] .save-indicator {
    background: rgba(27, 32, 43, 0.96) !important;
    color: var(--text);
    border-color: var(--hairline);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
  }

  body[data-theme="dark"] .save-indicator.saving {
    color: #ffb58a;
  }

  body[data-theme="dark"] .save-indicator.error {
    color: #ff9a98;
  }

  body[data-theme="dark"] .kbd-hints {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
  }

  body[data-theme="dark"] .kbd-hints-trigger,
  body[data-theme="dark"] .kbd-hints.open .kbd-hints-trigger,
  body[data-theme="dark"] .kbd-hints.has-selection .kbd-hints-trigger {
    background: rgba(27, 32, 43, 0.96) !important;
    color: var(--text) !important;
    border-color: var(--hairline) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  }

  body[data-theme="dark"] .kbd-hints-trigger:hover {
    background: rgba(32, 38, 51, 0.98) !important;
  }

  body[data-theme="dark"] .kbd-hints-icon {
    color: var(--muted) !important;
  }

  body[data-theme="dark"] .kbd-hints-panel,
  body[data-theme="dark"] .kbd-hints-panel::after {
    background: #171b24 !important;
    border-color: var(--hairline) !important;
  }

  body[data-theme="dark"] .kbd {
    background: linear-gradient(180deg, #252b38 0%, #171b24 100%) !important;
    color: var(--text) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.28);
  }

  body[data-theme="dark"] .cargo-preset-btn .cp-name,
  body[data-theme="dark"] .truck-info-name,
  body[data-theme="dark"] .cargo-compact-name,
  body[data-theme="dark"] .admin-user-name {
    color: var(--text) !important;
  }

  body[data-theme="dark"] .admin-status.offline {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.08);
  }

  /* ============ PWA ĮDIEGIMO BANERIS ============
   * Plūduriuojanti kortelė apačios centre — kviečia įdiegti app. Rodoma tik
   * kai aplikaciją galima įdiegti (Android) arba iOS Safari su instrukcija. */
  .pwa-install {
    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    width: calc(100% - 32px);
    max-width: 420px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.98);
    border: 0.5px solid var(--hairline);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(20, 24, 32, 0.18), 0 4px 12px rgba(20, 24, 32, 0.08);
    animation: pwaSlideUp 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .pwa-install[hidden] { display: none; }
  @keyframes pwaSlideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
  }
  .pwa-install-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(20, 24, 32, 0.12);
  }
  .pwa-install-text {
    flex: 1;
    min-width: 0;
  }
  .pwa-install-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
  }
  .pwa-install-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 1px;
    line-height: 1.3;
  }
  .pwa-install-btn {
    flex-shrink: 0;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 9px 18px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 2px 8px rgba(255, 106, 26, 0.3);
  }
  .pwa-install-btn:hover { background: var(--accent-2); }
  .pwa-install-btn:active { transform: scale(0.97); }
  .pwa-install-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s;
  }
  .pwa-install-close:hover {
    background: rgba(20, 24, 32, 0.06);
    color: var(--text);
  }
  body[data-theme="dark"] .pwa-install {
    background: rgba(34, 38, 46, 0.98);
    border-color: rgba(255, 255, 255, 0.1);
  }
