:root {
    --sidebar-bg: #1e2a3a;
    --sidebar-hover: #2a3d52;
    --sidebar-active: #2563eb;
    --sidebar-text: #c8d4e3;
    --sidebar-muted: #8fa3b8;
    --topbar-bg: #f0f4f8;
    --content-bg: #e8eef4;
    --panel: #ffffff;
    --line: #c5d0db;
    --text: #1a2332;
    --muted: #5a6b7d;
    --accent: #2563eb;
    --accent-light: #dbeafe;
    --success: #15803d;
    --danger: #b91c1c;
    --warning: #b45309;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    --font: 'Segoe UI', Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

body.wms-app {
    margin: 0;
    font-family: var(--font);
    font-size: 13px;
    color: var(--text);
    background: var(--content-bg);
    min-height: 100vh;
}

.wms-layout {
    display: flex;
    min-height: 100vh;
}

.wms-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease;
}

.wms-layout.sidebar-collapsed .wms-sidebar {
    width: 0;
}

.wms-brand {
    padding: 14px 16px;
    font-weight: 800;
    font-size: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
}

.wms-brand span { color: #38bdf8; }

.wms-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

.wms-nav-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: calc(100% - 16px);
    margin: 0 8px 8px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    background: transparent;
    color: var(--sidebar-muted);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    text-align: left;
}

.wms-nav-toggle:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.wms-nav-toggle-icon {
    width: 20px;
    flex-shrink: 0;
    text-align: center;
    line-height: 1;
}

.wms-nav-toggle-label-mobile {
    display: none;
}

.wms-nav-toggle-show {
    flex-shrink: 0;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    line-height: 1;
}

.wms-nav-toggle-show:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

.wms-topbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.wms-nav-section {
    padding: 10px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-muted);
}

.wms-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-left: 3px solid transparent;
}

.wms-nav-emoji {
    font-size: 15px;
    line-height: 1;
    width: 20px;
    flex-shrink: 0;
    text-align: center;
}

.wms-nav a:hover {
    background: var(--sidebar-hover);
}

.wms-nav a.active {
    background: var(--sidebar-hover);
    border-left-color: var(--sidebar-active);
    color: #fff;
}

.wms-sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11px;
    color: var(--sidebar-muted);
}

.wms-sidebar-footer-link {
    display: none;
    margin-top: 10px;
    color: #93c5fd;
    font-weight: 600;
    text-decoration: none;
}

.wms-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wms-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--line);
}

.wms-topbar h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.wms-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.wms-user {
    padding: 6px 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
}

.wms-warehouse-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 12px;
    max-width: min(240px, 40vw);
}

.wms-warehouse-chip-emoji {
    line-height: 1;
    flex-shrink: 0;
}

.wms-warehouse-chip-label {
    color: var(--muted);
    font-weight: 600;
    flex-shrink: 0;
}

.wms-warehouse-chip-name {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.wms-warehouse-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wms-warehouse-type-text {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}

.wms-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition: border-color 0.15s, background 0.15s;
}

.wms-profile-btn:hover {
    border-color: var(--accent);
    background: #fff;
}

.wms-profile-btn-emoji {
    line-height: 1;
}

.wms-dialog-section {
    margin: 0 0 14px;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--line);
}

.wms-dialog-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.wms-dialog-section-title {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wms-field input[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
}

.wms-warehouse-select {
    padding: 6px 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    font-family: inherit;
    color: inherit;
    max-width: 200px;
    cursor: pointer;
}

.wms-warehouse-chip-name .wms-warehouse-select {
    padding: 0;
    border: none;
    background: transparent;
    max-width: 140px;
    font-weight: 700;
}

.wms-content {
    flex: 1;
    padding: 16px;
    overflow: auto;
}

.wms-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.wms-panel-head {
    padding: 10px 12px;
    background: linear-gradient(180deg, #f8fafc, #eef2f6);
    border-bottom: 1px solid var(--line);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.wms-panel-body { padding: 12px; }

.wms-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.wms-stat {
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 12px;
    box-shadow: var(--shadow);
}

button.wms-stat {
    width: 100%;
    text-align: left;
    font-family: inherit;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

button.wms-stat:hover {
    border-color: #93c5fd;
    background: #f8fafc;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

button.wms-stat:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button.wms-stat:active {
    background: #eff6ff;
}

.wms-stat-label {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
}

.wms-stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
}

.wms-table-wrap {
    overflow-x: auto;
}

.wms-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.wms-table th,
.wms-table td {
    padding: 6px 10px;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    line-height: 1.25;
}

.wms-table th {
    background: #e2e8f0;
    font-weight: 700;
    font-size: 12px;
}

.wms-table tbody tr:nth-child(even) { background: #f8fafc; }

.wms-table tbody tr:hover { background: #eef4ff; }

.wms-table-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.wms-table-tools-search,
.wms-table-tools-select {
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    color: var(--text);
    font-size: 12px;
    font-family: inherit;
}

.wms-table-tools-search {
    min-width: 240px;
}

.wms-table-tools-search:focus,
.wms-table-tools-select:focus {
    outline: 2px solid var(--accent-light);
    border-color: var(--accent);
}

.wms-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: #f1f5f9;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.wms-btn:hover { background: #e2e8f0; }

.wms-btn.primary {
    background: var(--accent);
    border-color: #1d4ed8;
    color: #fff;
}

.wms-btn.primary:hover { background: #1d4ed8; }

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

.wms-btn.sm { padding: 4px 10px; font-size: 11px; }

.wms-loc-zone-select {
    min-width: 140px;
    max-width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 3px;
    font: inherit;
    font-size: 12px;
    background: #fff;
}

.wms-loc-zone-select:focus {
    outline: 2px solid var(--accent-light);
    border-color: var(--accent);
}

.wms-loc-stock-hint {
    display: inline-block;
    margin-right: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}

.wms-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 12px;
}

.wms-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--muted);
}

.wms-field input,
.wms-field select {
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    font-size: 13px;
    min-width: 140px;
    background: #fff;
}

.wms-field input:focus,
.wms-field select:focus {
    outline: 2px solid var(--accent-light);
    border-color: var(--accent);
}

.wms-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
}

.wms-badge.draft { background: #fef3c7; color: var(--warning); }
.wms-badge.done { background: #dcfce7; color: var(--success); }
.wms-badge.cancelled { background: #fee2e2; color: var(--danger); }

.wms-msg {
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 3px;
    font-weight: 600;
}

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

.wms-msg.success {
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    color: var(--success);
}

.wms-toast-stack {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.wms-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    pointer-events: auto;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.22s ease, transform 0.22s ease;
    cursor: pointer;
}

.wms-toast.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.wms-toast.is-leaving {
    opacity: 0;
    transform: translateX(20px);
}

.wms-toast-icon {
    flex-shrink: 0;
    font-size: 16px;
    line-height: 1.2;
}

.wms-toast-text {
    min-width: 0;
}

.wms-toast--add {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}

.wms-toast--sale {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.wms-toast--writeoff {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #b45309;
}

.wms-toast--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--danger);
}

.wms-doc-detail {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    background: #f8fafc;
}

.wms-empty {
    padding: 24px;
    text-align: center;
    color: var(--muted);
}

/* Dashboard warehouse hero */
.wh-hero {
    background: transparent;
    border: none;
    box-shadow: none;
    margin-bottom: 16px;
}

.wh-warehouses-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.wh-warehouses-bar-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wh-warehouses-bar-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch;
}

/* Склад в панели: кнопка + меню */
.wh-wh-chip {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    max-width: min(360px, 100%);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    transition: border-color 0.15s, background 0.15s;
}

.wh-wh-chip:hover {
    border-color: #93c5fd;
    background: rgba(59, 130, 246, 0.04);
}

.wh-wh-chip.is-active {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.wh-wh-chip-body {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 8px 12px;
    border: none;
    border-radius: 9px 0 0 9px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.wh-wh-chip.is-active .wh-wh-chip-body {
    color: #1e40af;
}

.wh-wh-chip-body:hover {
    background: rgba(59, 130, 246, 0.05);
}

.wh-wh-chip-emoji {
    flex-shrink: 0;
    font-size: 16px;
    line-height: 1;
}

.wh-wh-chip-line {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 6px;
}

.wh-wh-chip-name {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wh-wh-chip-badge {
    flex-shrink: 0;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.07);
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
}

.wh-wh-chip.is-active .wh-wh-chip-badge {
    background: rgba(59, 130, 246, 0.18);
    color: #1d4ed8;
}

.wh-wh-chip .wh-wh-chip-menu {
    position: relative;
    top: auto;
    right: auto;
    display: inline-flex;
    align-items: stretch;
    border-left: 1px solid var(--line);
}

.wh-wh-chip.is-active .wh-wh-chip-menu {
    border-left-color: rgba(59, 130, 246, 0.3);
}

.wh-wh-chip .wh-wh-chip-menu .wh-hero-menu-btn {
    width: 34px;
    height: 100%;
    min-height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 0 9px 9px 0;
    background: transparent;
    color: var(--muted);
    font-size: 16px;
    line-height: 1;
}

.wh-wh-chip .wh-wh-chip-menu .wh-hero-menu-btn:hover,
.wh-wh-chip .wh-wh-chip-menu .wh-hero-menu-btn[aria-expanded="true"] {
    background: rgba(15, 23, 42, 0.07);
    color: var(--text);
}

.wh-wh-chip .wh-wh-chip-menu .wh-hero-menu-popover {
    z-index: 20;
}

.wh-hero-head {
    position: relative;
}

.wh-hero-head-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.wh-hero-head-emoji-row {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px 16px 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}

.wh-hero-head-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 20px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s;
}

.wh-hero-head-toggle--caption {
    padding: 6px 16px 20px;
    gap: 0;
}

.wh-hero-head-add {
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}

.wh-hero-head-add:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

.wh-hero-head-caption {
    text-align: center;
    line-height: 1.35;
}

.wh-hero-head-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.wh-hero-head-name-text {
    font-weight: 700;
}

.wh-hero-head-qty {
    font-weight: 600;
    color: var(--muted);
}

.wh-hero-head-type {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}

.wh-hero-head-sub {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    margin-top: 2px;
}

.wh-hero-head--open .wh-hero-head-toggle {
    padding-bottom: 8px;
}

.wh-hero-head--open .wh-hero-emoji {
    font-size: 48px;
}

.wh-hero-head-toggle:hover,
.wh-hero-head-emoji-row:hover {
    transform: scale(1.02);
}

.wh-hero-head-toggle:hover .wh-hero-emoji,
.wh-hero-head-emoji-row:hover .wh-hero-emoji {
    filter: drop-shadow(0 4px 10px rgba(37, 99, 235, 0.15));
}

.wh-hero-menu {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
}

.wh-hero-menu-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.wh-hero-menu-btn:hover,
.wh-hero-menu-btn[aria-expanded="true"] {
    background: #fff;
    color: var(--text);
    border-color: #94a3b8;
}

.wh-hero-menu-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 190px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.wh-hero-menu-popover[hidden] {
    display: none;
}

.wh-hero-menu-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    text-align: left;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.wh-hero-menu-item:hover {
    background: #f1f5f9;
}

.wh-hero-menu-item--danger {
    color: var(--danger);
}

.wh-hero-menu-item--danger:hover {
    background: #fef2f2;
}

.wh-hero-emoji {
    font-size: 64px;
    line-height: 1;
    display: block;
    transition: filter 0.15s, transform 0.15s;
}

.wh-hero-add-btn {
    display: block;
    width: 100%;
    padding: 10px 20px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    transition: opacity 0.15s;
}

.wh-hero-add-btn:hover {
    opacity: 0.75;
}

.wh-hero-body {
    padding: 8px 0 12px;
    background: transparent;
}

.wh-hero-section + .wh-hero-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.wh-hero-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.wh-hero-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13px;
}

.wh-hero-section-title span:first-child {
    font-size: 18px;
    line-height: 1;
}

.wh-hero-link {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.wh-hero-link:hover {
    text-decoration: underline;
}

.wh-hero-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.wh-hero-products-pane {
    width: 100%;
    max-width: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wh-hero-products-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.wh-hero-products-search,
.wh-hero-products-select {
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    color: var(--text);
    font-size: 12px;
    font-family: inherit;
}

.wh-hero-products-search {
    flex: 1 1 240px;
    min-width: 220px;
}

.wh-hero-products-search:focus,
.wh-hero-products-select:focus {
    outline: 2px solid var(--accent-light);
    border-color: var(--accent);
}

.wh-hero-product-card {
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: none;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.wh-hero-product-card.is-selected {
    border-color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.35);
}

.wh-hero-product-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 8px 10px;
    border: none;
    background: transparent;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}

.wh-hero-product-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.wh-hero-product-meta {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.35;
}

.wh-hero-product-controls {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 6px;
    padding: 6px 8px;
    border-left: 1px solid var(--line);
}

.wh-hero-product-side {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 6px 8px;
    border-left: 1px solid var(--line);
}

.wh-hero-qty-input {
    box-sizing: border-box;
    width: 48px;
    height: 26px;
    padding: 0 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
}

.wh-hero-qty-input::-webkit-outer-spin-button,
.wh-hero-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wh-hero-qty-input:focus {
    outline: 2px solid var(--accent-light);
    border-color: var(--accent);
}

.wh-hero-qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
    font-size: 16px;
    line-height: 1;
    font-family: inherit;
    cursor: pointer;
}

.wh-hero-qty-btn:hover:not(:disabled) {
    background: #e2e8f0;
}

.wh-hero-qty-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.wh-hero-more-btn {
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.wh-hero-more-btn:hover {
    background: #f8fafc;
    color: var(--text);
}

.wh-hero-add-product-btn {
    width: 100%;
    padding: 8px 12px;
    border: 1px dashed #93c5fd;
    border-radius: 12px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}

.wh-hero-add-product-btn:hover {
    background: #dbeafe;
    border-color: #60a5fa;
}

.wh-hero-chip {
    padding: 10px 16px;
    background: #f1f5f9;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    max-width: 100%;
    line-height: 1.3;
}

button.wh-hero-chip {
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

button.wh-hero-chip:hover:not(:disabled) {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

button.wh-hero-chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.wh-hero-chip--selected {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
    box-shadow: 0 0 0 1px #93c5fd;
}

.wh-hero-chip--location:not(.wh-hero-chip--disabled):not(.wh-hero-chip--selected) {
    background: #fff;
}

.wh-hero-chip--disabled:not(.wh-hero-chip--occupied) {
    opacity: 0.55;
    cursor: not-allowed;
}

.wh-hero-chip--disabled.wh-hero-chip--occupied {
    cursor: not-allowed;
}

.wh-hero-chip--occupied:not(.wh-hero-chip--has-stock) {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.wh-hero-chip--has-stock {
    border-color: #86efac;
    background: #f0fdf4;
}

.wh-hero-chip--muted {
    color: var(--muted);
    font-weight: 500;
    border-style: dashed;
    background: #fafbfc;
}

.wh-hero-chip--action {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

button.wh-hero-chip--action:hover:not(:disabled) {
    background: #dbeafe;
    border-color: #93c5fd;
}

.wh-hero-assign {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
}

/* Warehouse tree */
.wh-tree {
    width: 100%;
    max-width: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.wh-tree-root {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.wh-tree-emoji {
    font-size: 56px;
    line-height: 1;
}

.wh-tree-root-caption {
    text-align: center;
    line-height: 1.35;
}

.wh-tree-root-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-right: 4px;
}

.wh-tree-root-sub {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.wh-tree-fork {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

.wh-tree-spine {
    width: 2px;
    height: 18px;
    margin: 0 auto;
    background: linear-gradient(180deg, #60a5fa, #cbd5e1);
    border-radius: 2px;
}

.wh-tree-branches {
    --branch-gap: 40px;
    --branch-drop: 22px;
    display: grid;
    grid-template-columns: repeat(var(--branch-count, 2), 1fr);
    gap: var(--branch-gap);
    width: 100%;
    padding: var(--branch-drop) 0 8px;
    position: relative;
}

/* horizontal rail: first column center → last column center */
.wh-tree-branches:not(.wh-tree-branches--1)::before {
    content: '';
    position: absolute;
    top: 0;
    left: calc((100% - (var(--branch-count) - 1) * var(--branch-gap)) / (var(--branch-count) * 2));
    width: calc(
        (var(--branch-count) - 1) * (
            (100% - (var(--branch-count) - 1) * var(--branch-gap)) / var(--branch-count)
            + var(--branch-gap)
        )
    );
    height: 2px;
    background: linear-gradient(90deg, #cbd5e1, #60a5fa 50%, #cbd5e1);
    border-radius: 2px;
}

.wh-tree-branches::after {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2563eb;
}

.wh-tree-branch {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.wh-tree-zone-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.wh-tree-zone-add {
    flex-shrink: 0;
    align-self: center;
}

.wh-tree-add-zone-row {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.wh-hero-add-zone-btn {
    padding: 6px 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.wh-hero-add-zone-btn:hover {
    background: #f1f5f9;
    color: var(--text);
    border-color: #94a3b8;
}

/* vertical drop: rail → emoji (centered on each grid column) */
.wh-tree-branch::before {
    content: '';
    position: absolute;
    top: calc(-1 * var(--branch-drop));
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: var(--branch-drop);
    background: linear-gradient(180deg, #94a3b8, #cbd5e1);
    border-radius: 2px;
}

.wh-tree-branches--1 .wh-tree-branch::before {
    top: calc(-1 * var(--branch-drop) - 18px);
    height: calc(var(--branch-drop) + 18px);
}

.wh-tree-branches--1::after {
    display: none;
}

.wh-tree-branch-emoji {
    font-size: 52px;
    line-height: 1;
    display: block;
}

.wh-tree-child-spine {
    display: flex;
    justify-content: center;
    margin: 8px 0 4px;
}

.wh-tree-child-spine-svg {
    display: block;
    width: 24px;
    height: 28px;
    overflow: visible;
}

.wh-tree-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    border-radius: 8px;
    transition: background 0.15s, transform 0.15s;
}

.wh-tree-zone:hover {
    background: rgba(37, 99, 235, 0.06);
    transform: translateY(-1px);
}

.wh-tree-zone.is-open {
    background: rgba(37, 99, 235, 0.1);
}

.wh-tree-zone-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.wh-tree-zone-sub {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
}

.wh-tree-children {
    width: 100%;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.wh-tree-children .wh-hero-list {
    justify-content: flex-start;
}

.wh-hero-loc-grid {
    box-sizing: border-box;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.wh-hero-loc-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
}

.wh-hero-loc-row-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-height: 44px;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.wh-hero-loc-row-cells {
    display: grid;
    grid-template-columns: repeat(var(--wh-loc-cols, 4), minmax(0, 1fr));
    gap: 6px;
    min-width: 0;
}

.wh-hero-loc-cell {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.wh-hero-loc-cell--occupied {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.wh-hero-loc-cell:hover:not(:disabled):not(.wh-hero-loc-cell--disabled) {
    background: #f8fafc;
    border-color: #93c5fd;
}

.wh-hero-loc-cell:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.wh-hero-loc-cell--disabled:not(.wh-hero-loc-cell--occupied),
.wh-hero-loc-cell:disabled:not(.wh-hero-loc-cell--occupied) {
    opacity: 0.55;
    cursor: not-allowed;
}

.wh-hero-loc-cell--disabled.wh-hero-loc-cell--occupied,
.wh-hero-loc-cell:disabled.wh-hero-loc-cell--occupied {
    cursor: not-allowed;
}

.wh-hero-loc-cell--has-stock {
    border-color: #86efac;
    background: #f0fdf4;
}

.wh-hero-loc-cell-code {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.wh-hero-loc-cell-stock {
    max-width: 100%;
    font-size: 9px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--muted);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wh-hero-loc-cell-stock.is-selected-product {
    color: var(--success);
}

.wh-hero-loc-cell-qty {
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    line-height: 1.2;
}

.wh-hero-loc-row--other .wh-hero-loc-row-label {
    font-size: 14px;
}

.wh-hero-stock-hint {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

.wh-hero-stock-msg {
    min-height: 1.2em;
    margin-top: 12px;
    font-size: 12px;
    font-weight: 600;
}

.wh-hero-stock-msg.is-success {
    color: #15803d;
}

.wh-hero-stock-msg.is-error {
    color: var(--danger);
}

.dash-empty--below-hero {
    max-width: none;
    margin: 0;
    margin-bottom: 16px;
}

.wms-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.45);
}

.wms-dialog {
    width: min(100%, 380px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.wms-dialog-title {
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 700;
    border-bottom: 1px solid var(--line);
}

.wms-dialog-body {
    padding: 16px;
}

.wms-dialog-text {
    margin: 0 0 12px;
    color: var(--muted);
    line-height: 1.5;
}

.wms-dialog-text--strong {
    margin-bottom: 0;
    color: var(--text);
    font-weight: 600;
}

.wms-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px 16px;
}

.wms-dialog-actions--reason {
    flex-direction: column;
    align-items: stretch;
}

.wms-dialog-actions--reason .wms-btn {
    width: 100%;
    justify-content: center;
}

.wms-bottom-nav,
.wms-mobile-menu-btn,
.wms-mobile-backdrop {
    display: none;
}

.wms-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: var(--panel);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.wms-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    padding: 6px 4px;
    border: none;
    background: transparent;
    color: var(--muted);
    text-decoration: none;
    font: inherit;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.wms-bottom-nav-item.active {
    color: var(--accent);
}

.wms-bottom-nav-emoji {
    font-size: 18px;
    line-height: 1;
}

.wms-bottom-nav-label {
    line-height: 1.2;
    text-align: center;
}

.wms-mobile-menu-btn {
    flex-shrink: 0;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 18px;
    line-height: 1;
}

.wms-mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1240;
    border: none;
    padding: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

body.wms-drawer-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .wms-layout {
        flex-direction: row;
    }

    .wms-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: auto;
        bottom: 0;
        width: min(300px, 88vw);
        height: 100%;
        max-height: 100dvh;
        z-index: 1250;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 8px 0 24px rgba(15, 23, 42, 0.2);
    }

    .wms-layout.mobile-drawer-open .wms-sidebar {
        transform: translateX(0);
    }

    .wms-layout.sidebar-collapsed .wms-sidebar {
        width: min(300px, 88vw);
        height: 100%;
        transform: translateX(-100%);
    }

    .wms-layout.sidebar-collapsed.mobile-drawer-open .wms-sidebar {
        transform: translateX(0);
    }

    .wms-layout.mobile-drawer-open .wms-mobile-backdrop,
    .wms-mobile-backdrop.is-visible {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .wms-nav-toggle-label {
        display: none;
    }

    .wms-nav-toggle-label-mobile {
        display: inline;
    }

    .wms-nav-toggle-icon {
        display: none;
    }

    .wms-nav {
        display: block;
        flex: 1;
        padding: 8px 0;
        overflow-y: auto;
    }

    .wms-nav-section {
        display: block;
    }

    .wms-nav a {
        border-left: 3px solid transparent;
        border-radius: 0;
        padding: 10px 16px;
    }

    .wms-nav-toggle {
        width: calc(100% - 16px);
        margin: 0 8px 8px;
        justify-content: center;
    }

    .wms-main {
        width: 100%;
        min-height: 100dvh;
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0));
    }

    .wms-content {
        padding-bottom: 8px;
    }

    .wms-topbar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .wms-topbar-actions {
        margin-left: auto;
    }

    .wms-topbar-actions #wms-site-link {
        display: none;
    }

    .wms-profile-btn #wms-user-name {
        display: none;
    }

    .wms-nav-toggle-show {
        display: none !important;
    }

    .wms-mobile-menu-btn,
    .wms-bottom-nav {
        display: flex;
    }

    .wms-warehouse-chip-label {
        display: none;
    }

    .wms-sidebar-footer-link {
        display: inline-block;
    }

    .wms-toast-stack {
        top: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
    }

    .wms-btn,
    .wms-bottom-nav-item,
    .wms-mobile-menu-btn {
        min-height: 44px;
        min-width: 44px;
    }

    .wms-table-tools {
        flex-wrap: wrap;
        gap: 8px;
    }

    .wms-io-tools {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .wms-io-btn-wrap {
        display: inline-flex;
    }

    .wms-form-row input,
    .wms-form-row select,
    .wms-form-row button {
        min-height: 44px;
    }
}

.wms-io-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.wms-table-tools .wms-io-tools {
    margin-left: auto;
}

.wms-topbar-actions .wms-org-select {
    max-width: 140px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--wms-line);
    background: var(--wms-panel);
    color: var(--wms-text);
    font-size: 12px;
}
