:root {
    --bg: #120d0f;
    --bg-soft: #181113;
    --panel: #1a1214;
    --panel-soft: #23181b;
    --stroke: rgba(255, 255, 255, 0.08);
    --text: #f5eeef;
    --muted: #9f8d90;
    --accent: #f46b58;
    --accent-strong: #da4f49;
    --magenta: #cb2f73;
    --cyan: #11c7d9;
    --green: #0fc978;
    --purple: #9081ff;
    --orange: #ff8d63;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

body[data-theme='magenta-light'] {
    --bg: #fff8fc;
    --bg-soft: #fff2f8;
    --panel: #ffffff;
    --panel-soft: #fff3f8;
    --stroke: rgba(182, 25, 105, 0.12);
    --text: #531939;
    --muted: #8f5c78;
    --accent: #df4c8a;
    --accent-strong: #c62d71;
    --magenta: #d8317a;
    --cyan: #0caed0;
    --green: #16a86f;
    --purple: #8b6fff;
    --orange: #f27c64;
    --shadow: 0 20px 50px rgba(198, 45, 113, 0.14);
}

body[data-theme='midnight-magenta'] {
    --bg: #0e1018;
    --bg-soft: #151926;
    --panel: #161b29;
    --panel-soft: #1c2334;
    --stroke: rgba(166, 124, 255, 0.12);
    --text: #edf0ff;
    --muted: #9aa3c8;
    --accent: #d54cff;
    --accent-strong: #8b46ff;
    --magenta: #d54cff;
    --cyan: #2fd3ff;
    --green: #2ed38f;
    --purple: #8b6fff;
    --orange: #ff8d63;
    --shadow: 0 24px 60px rgba(7, 10, 23, 0.42);
}

body[data-theme='windows-11'] {
    --bg: #f4f8ff;
    --bg-soft: #eaf1fb;
    --panel: rgba(255, 255, 255, 0.82);
    --panel-soft: rgba(246, 250, 255, 0.9);
    --stroke: rgba(120, 145, 185, 0.2);
    --text: #18233a;
    --muted: #66748f;
    --accent: #2b7cff;
    --accent-strong: #1d5fd1;
    --magenta: #4f7fff;
    --cyan: #00b7d9;
    --green: #1da66d;
    --purple: #7c6cff;
    --orange: #ff9a57;
    --shadow: 0 20px 55px rgba(97, 128, 182, 0.18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 18%, transparent), transparent 18%),
        radial-gradient(circle at left bottom, color-mix(in srgb, var(--magenta) 18%, transparent), transparent 22%),
        linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 92%, black) 100%);
    font-family: 'Manrope', 'Cairo', sans-serif;
}

body[data-theme='windows-11'] {
    background:
        radial-gradient(circle at top left, rgba(93, 160, 255, 0.18), transparent 24%),
        radial-gradient(circle at right 18%, rgba(148, 202, 255, 0.22), transparent 20%),
        linear-gradient(180deg, #f7fbff 0%, #eef5ff 48%, #e7f0ff 100%);
}

body[dir='rtl'] {
    font-family: 'Cairo', 'Manrope', sans-serif;
}

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

.ember-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 312px 1fr;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(6, 4, 6, 0.62);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 25;
}

.ember-sidebar {
    padding: 0;
    border-inline-end: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--bg) 92%, black);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.ember-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 28px 22px 18px;
    border-bottom: 1px solid var(--stroke);
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    font-weight: 800;
    box-shadow: var(--shadow);
}

.brand strong,
.brand small {
    display: block;
}

.brand small,
.eyebrow,
.panel-headline p,
.list-row p,
.filter-form label span,
.chart-axis,
.data-table th {
    color: var(--muted);
}

.nav-group {
    padding: 18px 14px 0;
}

.nav-group-title {
    padding: 0 10px 12px;
    font-size: .86rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.nav-menu {
    display: grid;
    gap: 8px;
}

.database-menu {
    padding: 18px 14px 22px;
    align-content: start;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 14px;
    border-radius: 18px;
    border: 1px solid transparent;
    color: color-mix(in srgb, var(--text) 84%, transparent);
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
    background: color-mix(in srgb, var(--accent) 10%, var(--panel));
    border-color: color-mix(in srgb, var(--accent) 22%, transparent);
    transform: translateY(-1px);
}

.nav-link.locked {
    opacity: .6;
    cursor: not-allowed;
}

.nav-link.locked:hover {
    transform: none;
}

.nav-link-main,
.nav-link-trailing {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.nav-icon {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--stroke) 90%, transparent);
    background: color-mix(in srgb, var(--panel-soft) 86%, transparent);
    color: var(--muted);
    font-size: .75rem;
    font-weight: 800;
}

.nav-icon-svg {
    padding: 0;
}

.nav-icon-svg svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-branch {
    display: grid;
    gap: 8px;
}

.nav-branch summary {
    list-style: none;
}

.nav-branch summary::-webkit-details-marker {
    display: none;
}

.nav-children {
    display: grid;
    gap: 8px;
    margin-inline-start: 14px;
    padding-inline-start: 14px;
    border-inline-start: 1px solid color-mix(in srgb, var(--stroke) 90%, transparent);
}

.nav-branch-arrow {
    width: 10px;
    height: 10px;
    border-inline-end: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform .18s ease, border-color .18s ease;
}

.nav-branch[open] > .nav-branch-toggle .nav-branch-arrow {
    transform: rotate(225deg);
    border-color: var(--accent);
}

.nav-link.level-1,
.nav-branch.level-1 > .nav-branch-toggle {
    padding-block: 12px;
    border-radius: 16px;
}

.nav-link.level-2,
.nav-branch.level-2 > .nav-branch-toggle,
.nav-link.level-3,
.nav-branch.level-3 > .nav-branch-toggle,
.nav-link.level-4,
.nav-branch.level-4 > .nav-branch-toggle {
    padding-block: 11px;
    border-radius: 15px;
}

.nav-lock {
    background: color-mix(in srgb, var(--stroke) 80%, transparent);
    color: var(--muted);
}

.nav-badge {
    display: inline-flex;
    min-width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
    font-size: .82rem;
    font-weight: 700;
}

.sidebar-footer {
    padding: 18px 18px 24px;
    border-top: 1px solid var(--stroke);
}

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

.sidebar-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    font-weight: 800;
}

.ember-main {
    padding: 0;
    position: relative;
    z-index: 1;
}

.ember-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--stroke);
    position: relative;
    z-index: 60;
    overflow: visible;
}

.topbar-leading {
    display: none;
}

.sidebar-toggle {
    width: 48px;
    height: 48px;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 0 12px;
    border-radius: 16px;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    cursor: pointer;
}

.sidebar-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
}

.topbar-search {
    min-width: 320px;
    max-width: 420px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 18px;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
}

.topbar-search input {
    flex: 1;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.45;
}

.search-shortcut {
    padding: 6px 8px;
    border-radius: 10px;
    border: 1px solid var(--stroke);
    font-size: .78rem;
    color: var(--muted);
}

.search-icon {
    color: var(--muted);
    font-size: .8rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 61;
}

.theme-dropdown {
    position: relative;
    z-index: 70;
}

.theme-dropdown-toggle {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: auto;
    padding: 12px 16px;
    border-radius: 16px;
    font-weight: 700;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    color: color-mix(in srgb, var(--text) 86%, transparent);
    cursor: pointer;
}

.theme-dropdown-toggle::-webkit-details-marker {
    display: none;
}

.theme-dropdown-toggle::after {
    content: 'v';
    margin-inline-start: 10px;
    font-size: .72rem;
    color: var(--muted);
}

.theme-dropdown[open] .theme-dropdown-toggle {
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.theme-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    display: grid;
    gap: 8px;
    width: 260px;
    min-width: 190px;
    padding: 12px;
    border-radius: 22px;
    border: 1px solid var(--stroke);
    background: var(--panel);
    box-shadow: var(--shadow);
    z-index: 999;
}

.theme-dropdown-header {
    display: grid;
    gap: 4px;
    padding: 4px 4px 10px;
}

.theme-dropdown-header small,
.theme-option-copy small {
    color: var(--muted);
}

.theme-options {
    display: grid;
    gap: 8px;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--panel-soft) 84%, transparent);
}

.theme-option.active {
    border-color: color-mix(in srgb, var(--accent) 38%, transparent);
    background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}

.theme-option-chip {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.22);
}

.theme-ember-dark {
    background: linear-gradient(135deg, #f46b58, #cb2f73);
}

.theme-magenta-light {
    background: linear-gradient(135deg, #ffffff, #d8317a);
}

.theme-midnight-magenta {
    background: linear-gradient(135deg, #161b29, #d54cff);
}

.theme-windows-11 {
    background: linear-gradient(135deg, #f8fbff, #2b7cff);
}

.theme-option-copy {
    display: grid;
    gap: 3px;
}

body[data-theme='windows-11'] .ember-sidebar,
body[data-theme='windows-11'] .ember-topbar,
body[data-theme='windows-11'] .feature-panel,
body[data-theme='windows-11'] .panel-card,
body[data-theme='windows-11'] .auth-card,
body[data-theme='windows-11'] .auth-spotlight,
body[data-theme='windows-11'] .theme-dropdown-menu {
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

body[data-theme='windows-11'] .ember-sidebar,
body[data-theme='windows-11'] .ember-topbar {
    background: rgba(255, 255, 255, 0.56);
}

body[data-theme='windows-11'] .ember-sidebar {
    border-inline-end-color: rgba(144, 170, 213, 0.22);
}

body[data-theme='windows-11'] .brand-mark,
body[data-theme='windows-11'] .sidebar-avatar,
body[data-theme='windows-11'] .primary-btn,
body[data-theme='windows-11'] .theme-pill.active {
    background: linear-gradient(135deg, #53a5ff, #2b7cff);
}

body[data-theme='windows-11'] .nav-link:hover,
body[data-theme='windows-11'] .nav-link.active,
body[data-theme='windows-11'] .theme-option.active {
    background: rgba(43, 124, 255, 0.1);
    border-color: rgba(43, 124, 255, 0.22);
}

body[data-theme='windows-11'] .nav-icon,
body[data-theme='windows-11'] .secondary-btn,
body[data-theme='windows-11'] .lang-switch,
body[data-theme='windows-11'] .logout-link,
body[data-theme='windows-11'] .theme-dropdown-toggle,
body[data-theme='windows-11'] .topbar-search,
body[data-theme='windows-11'] .sidebar-toggle {
    background: rgba(255, 255, 255, 0.62);
}

body[data-theme='windows-11'] .feature-panel,
body[data-theme='windows-11'] .panel-card,
body[data-theme='windows-11'] .stat-tile,
body[data-theme='windows-11'] .lang-switch,
body[data-theme='windows-11'] .logout-link,
body[data-theme='windows-11'] .auth-card,
body[data-theme='windows-11'] .auth-spotlight {
    border-color: rgba(144, 170, 213, 0.24);
}

body[data-theme='windows-11'] .search-shortcut,
body[data-theme='windows-11'] .status-pill,
body[data-theme='windows-11'] .row-meta span,
body[data-theme='windows-11'] .pill-cloud span,
body[data-theme='windows-11'] .auth-badges span {
    background: rgba(43, 124, 255, 0.08);
}

.theme-dropdown.align-right .theme-dropdown-menu {
    right: 0;
}

.theme-dropdown.align-left .theme-dropdown-menu {
    left: 0;
}

.theme-pill {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
    width: 100%;
}

.theme-pill.active {
    color: #fff;
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.topbar-primary {
    min-width: auto;
}

.page-header {
    padding: 18px 22px 0;
    position: relative;
    z-index: 1;
}

.content-area {
    padding: 18px 22px 22px;
    display: grid;
    gap: 18px;
    position: relative;
    z-index: 1;
}

.feature-panel,
.stat-tile,
.lang-switch,
.logout-link,
.panel-card,
.auth-card,
.auth-spotlight {
    border: 1px solid var(--stroke);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.hero-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px;
    border-radius: 28px;
    border: 1px solid var(--stroke);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.compact-hero h2,
.compact-hero .eyebrow {
    margin: 0;
}

.compact-hero h2 {
    margin-top: 6px;
}

.metrics-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
    padding: 18px 20px;
    border-radius: 22px;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--panel-soft) 84%, transparent);
}

.metric-card p,
.metric-card strong {
    margin: 0;
}

.metric-card strong {
    display: inline-block;
    margin-top: 10px;
    font-size: 1.7rem;
}

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

.stats-strip {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-tile {
    position: relative;
    padding: 18px 20px;
    border-radius: 20px;
    overflow: hidden;
}

.stat-tile::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: 20px;
}

.accent-0::before { background: var(--accent); }
.accent-1::before { background: var(--cyan); }
.accent-2::before { background: var(--green); }
.accent-3::before { background: var(--purple); }

.stat-line {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-line strong {
    font-size: 2rem;
}

.stat-line span {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--green) 16%, transparent);
    color: color-mix(in srgb, var(--green) 76%, white);
    font-size: .82rem;
    font-weight: 700;
}

.feature-panel,
.panel-card,
.auth-card,
.auth-spotlight {
    border-radius: 28px;
    padding: 24px;
}

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

.panel-header h3,
.panel-headline h3 {
    margin: 0;
}

.panel-header span {
    color: var(--muted);
    font-size: .92rem;
}

.content-toolbar,
.panel-headline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.chart-panel {
    padding-bottom: 18px;
}

.chart-canvas {
    margin-top: 10px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0.03));
    padding: 12px 10px 8px;
}

.dashboard-chart {
    width: 100%;
    height: 360px;
}

.chart-line {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
}

.line-magenta { stroke: var(--magenta); }
.line-cyan { stroke: var(--cyan); stroke-dasharray: 10 9; }
.line-orange { stroke: var(--orange); }

.chart-axis {
    display: flex;
    justify-content: space-between;
    padding: 0 18px;
    font-size: .88rem;
}

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

.list-stack {
    display: grid;
    gap: 12px;
}

.report-stack,
.warehouse-report-stack {
    display: grid;
    gap: 18px;
}

.warehouse-report-card {
    padding: 20px;
    border-radius: 24px;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--panel-soft) 88%, transparent);
}

.stats-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: .95rem;
}

.compact-metrics {
    margin-bottom: 18px;
}

.report-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 18px 0 22px;
}

.report-filter-bar .crud-form {
    width: min(360px, 100%);
}

.column-search-row th {
    padding-top: 10px;
    background: color-mix(in srgb, var(--panel-soft) 96%, transparent);
}

.column-search-input {
    width: 100%;
    min-width: 90px;
    border: 1px solid var(--stroke);
    border-radius: 12px;
    background: var(--panel-soft);
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
}

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

.unit-family-card {
    padding: 22px;
}

.warehouse-hierarchy-wrap {
    overflow-x: auto;
}

.warehouse-tree,
.warehouse-tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.warehouse-tree {
    display: grid;
    gap: 16px;
}

.warehouse-tree ul {
    display: grid;
    gap: 14px;
    margin-top: 14px;
    margin-inline-start: 22px;
    padding-inline-start: 18px;
    border-inline-start: 1px dashed color-mix(in srgb, var(--accent) 28%, transparent);
}

.warehouse-tree-card {
    display: grid;
    gap: 12px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--panel-soft) 88%, transparent);
}

.warehouse-tree-head,
.warehouse-tree-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.warehouse-tree-meta span {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, white 5%, transparent);
    color: color-mix(in srgb, var(--text) 90%, transparent);
    font-size: .85rem;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--panel-soft);
}

.row-meta,
.pill-cloud,
.hero-actions,
.record-actions,
.form-actions,
.auth-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.row-meta span,
.pill-cloud span,
.status-pill,
.auth-badges span {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, white 6%, transparent);
    color: color-mix(in srgb, var(--text) 92%, transparent);
    font-size: .86rem;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.lang-switch,
.logout-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 130px;
    padding: 12px 16px;
    border-radius: 16px;
    font-weight: 700;
}

.primary-btn {
    color: #fff7f4;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.secondary-btn {
    color: color-mix(in srgb, var(--text) 86%, transparent);
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
}

.danger-btn {
    color: white;
    border: 0;
    background: linear-gradient(135deg, #b2375e, #8f294e);
    cursor: pointer;
}

.lang-switch,
.logout-link {
    min-width: auto;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
}

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

.matrix-wrap {
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 14px 12px;
    text-align: start;
    border-bottom: 1px solid var(--stroke);
}

.data-table td {
    color: color-mix(in srgb, var(--text) 92%, transparent);
}

.filter-form,
.crud-form,
.form-grid,
.order-items,
.auth-form,
.auth-main {
    display: grid;
    gap: 16px;
}

.filter-form {
    grid-template-columns: minmax(240px, 360px) auto;
    align-items: end;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-form label,
.crud-form label {
    display: grid;
    gap: 8px;
}

.auth-form input,
.crud-form input,
.crud-form select,
.crud-form textarea,
.filter-form select {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--bg-soft) 74%, black 26%);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: .01em;
}

.auth-form input::placeholder,
.crud-form input::placeholder,
.crud-form textarea::placeholder,
.topbar-search input::placeholder,
.search-select-field > .search-select > input::placeholder {
    color: color-mix(in srgb, var(--muted) 88%, transparent);
    font-weight: 500;
}

.crud-form textarea {
    min-height: 110px;
    resize: vertical;
}

.page-content-grid {
    align-items: start;
}

.page-content-textarea {
    min-height: 320px;
}

.page-content-copy {
    display: grid;
    gap: 14px;
    line-height: 1.8;
    color: color-mix(in srgb, var(--text) 94%, transparent);
    white-space: normal;
}

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

.checkbox-card {
    position: relative;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--panel-soft) 84%, transparent);
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.checkbox-card:hover {
    border-color: color-mix(in srgb, var(--accent) 28%, transparent);
    transform: translateY(-1px);
}

.checkbox-card input[type='checkbox'] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.checkbox-indicator {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--stroke) 90%, transparent);
    background: color-mix(in srgb, var(--bg-soft) 80%, black 20%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.checkbox-indicator::after {
    content: '';
    width: 10px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translateY(-1px);
    opacity: 0;
    transition: opacity .18s ease;
}

.checkbox-copy {
    display: grid;
    gap: 3px;
}

.checkbox-copy strong {
    font-size: .95rem;
}

.checkbox-copy small {
    color: var(--muted);
}

.checkbox-card input[type='checkbox']:checked + .checkbox-indicator {
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 22%, transparent);
}

.checkbox-card input[type='checkbox']:checked + .checkbox-indicator::after {
    opacity: 1;
}

.checkbox-card input[type='checkbox']:focus-visible + .checkbox-indicator {
    outline: 2px solid color-mix(in srgb, var(--accent) 55%, white);
    outline-offset: 3px;
}

.search-select {
    position: relative;
}

.search-select-results {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline: 0;
    display: none;
    max-height: 280px;
    overflow-y: auto;
    border-radius: 18px;
    border: 1px solid var(--stroke);
    background: var(--panel);
    box-shadow: var(--shadow);
    z-index: 90;
}

.search-select.open .search-select-results {
    display: grid;
}

.search-select-option,
.search-select-empty {
    width: 100%;
    padding: 13px 14px;
    text-align: start;
    border: 0;
    background: transparent;
    color: var(--text);
}

.search-select-option {
    display: grid;
    gap: 5px;
    cursor: pointer;
    border-bottom: 1px solid color-mix(in srgb, var(--stroke) 72%, transparent);
}

.search-select-option:last-child {
    border-bottom: 0;
}

.search-select-option:hover {
    background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.search-select-option small,
.search-select-empty {
    color: var(--muted);
}

.order-item-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border-radius: 18px;
    background: var(--panel-soft);
}

.order-item-row select,
.order-item-row input,
.order-item-row textarea,
.search-select-field > .search-select > input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--bg-soft) 74%, black 26%);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: .01em;
}

.search-select-field {
    display: grid;
    gap: 8px;
}

.search-select-field > span,
.auth-form label > span,
.crud-form label > span {
    color: var(--muted);
    font-size: .92rem;
    font-weight: 700;
    letter-spacing: .01em;
}

.small-btn {
    min-width: auto;
    padding: 10px 14px;
    font-size: .92rem;
}

.admin-stats {
    margin-bottom: 4px;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mini-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    font-weight: 800;
}

.muted-line {
    color: var(--muted);
    font-size: .85rem;
    margin-top: 2px;
}

.matrix-table th,
.matrix-table td {
    min-width: 160px;
    vertical-align: top;
}

.matrix-table th:first-child,
.matrix-table td:first-child {
    min-width: 280px;
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--panel);
}

.matrix-user-head small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-weight: 500;
}

.matrix-cell {
    text-align: center;
}

.matrix-check {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.matrix-check input {
    width: 18px;
    height: 18px;
}

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

.selection-panel {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--panel-soft) 84%, transparent);
}

.selection-panel h4 {
    margin: 0;
}

.stock-movement-form {
    gap: 22px;
}

.form-section-card {
    display: grid;
    gap: 18px;
    padding: 20px;
    border-radius: 22px;
    border: 1px solid color-mix(in srgb, var(--stroke) 94%, transparent);
    background: color-mix(in srgb, var(--panel-soft) 90%, transparent);
    box-shadow: inset 0 1px 0 color-mix(in srgb, white 6%, transparent);
}

.section-heading {
    display: grid;
    gap: 6px;
}

.section-heading h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: .92rem;
}

.stock-items-panel {
    gap: 18px;
}

.stock-items-toolbar {
    align-items: start;
}

.stock-items-toolbar span {
    color: var(--muted);
    font-size: .92rem;
}

.stock-order-item-row {
    grid-template-columns: minmax(0, 2.2fr) minmax(140px, .9fr) auto;
    align-items: end;
    padding: 16px;
    border: 1px solid color-mix(in srgb, var(--stroke) 90%, transparent);
    background:
        linear-gradient(180deg, color-mix(in srgb, white 3%, transparent), transparent),
        color-mix(in srgb, var(--panel) 92%, transparent);
    box-shadow: 0 12px 24px color-mix(in srgb, black 10%, transparent);
}

.stock-order-item-row > label {
    align-self: end;
}

.stock-order-item-row .record-actions {
    align-self: end;
    display: flex;
    align-items: end;
    padding-bottom: 0;
}

.stock-order-item-row .search-select {
    min-height: 56px;
}

.stock-order-item-row .search-select > input {
    background: color-mix(in srgb, var(--bg-soft) 78%, black 22%);
}

.stock-order-item-row .search-select-field {
    gap: 6px;
}

.stock-order-item-row .search-select-field .helper-text {
    display: none;
}

.stock-order-item-row input[type='number'],
.stock-order-item-row .search-select > input,
.stock-order-item-row .danger-btn.small-btn {
    min-height: 56px;
}

.stock-order-item-row .danger-btn.small-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-inline: 16px;
}

.order-lines-panel {
    gap: 18px;
}

.order-lines-toolbar {
    align-items: start;
}

.order-lines-toolbar span {
    color: var(--muted);
    font-size: .92rem;
}

.order-line-row {
    grid-template-columns: minmax(0, 2.1fr) minmax(130px, .85fr) minmax(130px, .9fr) auto;
    align-items: end;
    padding: 16px;
    border: 1px solid color-mix(in srgb, var(--stroke) 90%, transparent);
    background:
        linear-gradient(180deg, color-mix(in srgb, white 3%, transparent), transparent),
        color-mix(in srgb, var(--panel) 92%, transparent);
    box-shadow: 0 12px 24px color-mix(in srgb, black 10%, transparent);
}

.order-line-row select,
.order-line-row input,
.order-line-row .danger-btn.small-btn {
    min-height: 56px;
}

.order-line-row .danger-btn.small-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-inline: 16px;
}

.sales-order-form,
.purchase-order-form,
.transfer-order-form {
    gap: 22px;
}

.checkbox-list {
    display: grid;
    gap: 12px;
}

.checkbox-list.three-col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--panel) 86%, transparent);
}

.check-card input {
    width: auto;
    margin-top: 4px;
}

.check-card span {
    display: grid;
    gap: 4px;
}

.check-card small,
.helper-text {
    color: var(--muted);
}

.success-box,
.alert-box {
    border-radius: 18px;
    padding: 14px 16px;
}

.success-box {
    background: color-mix(in srgb, var(--green) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--green) 18%, transparent);
    color: color-mix(in srgb, var(--green) 74%, white);
}

.alert-box {
    background: rgba(229, 74, 92, 0.12);
    border: 1px solid rgba(229, 74, 92, 0.2);
    color: #ffa9b6;
}

.inline-product-tool {
    display: inline-flex;
}

.inline-product-modal[hidden] {
    display: none;
}

.inline-product-modal {
    position: fixed;
    inset: 0;
    z-index: 140;
}

.inline-product-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 5, 8, 0.62);
}

.inline-product-dialog {
    position: relative;
    z-index: 1;
    width: min(760px, calc(100vw - 32px));
    margin: 6vh auto;
    padding: 24px;
    border-radius: 28px;
    border: 1px solid var(--stroke);
    background: var(--panel);
    box-shadow: var(--shadow);
    pointer-events: auto;
}

.auth-shell {
    min-height: 100vh;
    padding: 24px;
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(320px, 520px);
    justify-content: center;
    align-items: center;
    gap: 24px;
}

.auth-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

@media (max-width: 1200px) {
    .stats-strip,
    .dashboard-grid,
    .metrics-grid,
    .panel-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .ember-shell {
        grid-template-columns: 1fr;
    }

    .ember-sidebar {
        position: fixed;
        inset-block: 0;
        width: min(86vw, 320px);
        z-index: 30;
        border-inline-end: 1px solid var(--stroke);
        transform: translateX(-102%);
        transition: transform .22s ease;
        overflow-y: auto;
    }

    body[dir='rtl'] .ember-sidebar {
        right: 0;
        left: auto;
        transform: translateX(102%);
    }

    body:not([dir='rtl']) .ember-sidebar {
        left: 0;
        right: auto;
    }

    body.sidebar-open .ember-sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .topbar-leading {
        display: flex;
        align-items: center;
    }
}

@media (max-width: 800px) {
    .ember-topbar,
    .content-toolbar,
    .panel-headline,
    .filter-form,
    .form-grid,
    .settings-grid,
    .order-item-row,
    .stats-strip,
    .dashboard-grid,
    .metrics-grid,
    .panel-grid,
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .ember-topbar,
    .content-toolbar,
    .panel-headline {
        display: grid;
        align-items: stretch;
    }

    .topbar-search {
        min-width: 0;
        max-width: none;
    }

    .topbar-leading {
        order: -1;
    }

    .stats-strip,
    .dashboard-grid,
    .metrics-grid,
    .panel-grid {
        display: grid;
    }

    .theme-dropdown {
        width: 100%;
    }

    .theme-dropdown-toggle {
        width: 100%;
    }

    .theme-dropdown-menu {
        position: static;
        margin-top: 10px;
        min-width: 0;
        width: 100%;
    }

    .checkbox-list.three-col {
        grid-template-columns: 1fr;
    }
}

@media print {
    body * {
        visibility: hidden;
    }

    body[data-print-target] .report-section.print-target-active,
    body[data-print-target] .report-section.print-target-active * {
        visibility: visible;
    }

    body[data-print-target] .report-section {
        display: none;
    }

    body[data-print-target] .report-section.print-target-active {
        display: block;
        position: absolute;
        inset: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border: 0;
        background: #fff;
        color: #000;
    }

    body[data-print-target] .secondary-btn,
    body[data-print-target] .hero-panel,
    body[data-print-target] .page-header,
    body[data-print-target] .ember-sidebar,
    body[data-print-target] .ember-topbar,
    body[data-print-target] .sidebar-overlay {
        display: none !important;
    }

    body[data-print-target] .table-wrap {
        overflow: visible;
    }

    body[data-print-target] .data-table th,
    body[data-print-target] .data-table td {
        color: #000;
        border-color: #cfcfcf;
    }

    body[data-print-target] .status-pill,
    body[data-print-target] .warehouse-tree-meta span {
        background: #f2f2f2;
        color: #000;
    }
}
