/* Tayyabi Auto Parts product interface */

:root {
    color-scheme: dark;

    --bg-dark: #0b0e12;
    --bg-raised: #0f1318;
    --sidebar-bg: #0d1218;
    --panel-bg: #151a21;
    --panel-raised: #1a2028;
    --panel-hover: #1d242d;
    --panel-solid: #171c23;

    --border-color: rgba(226, 232, 240, 0.10);
    --border-strong: rgba(226, 232, 240, 0.18);
    --border-focus: rgba(218, 151, 100, 0.72);

    --text-primary: #f1eee9;
    --text-secondary: #aeb5bf;
    --text-muted: #747e8b;
    --text-inverse: #111318;

    --accent: #ca8652;
    --accent-strong: #dea06f;
    --accent-soft: rgba(202, 134, 82, 0.13);
    --navy: #1b2c42;
    --navy-soft: rgba(51, 77, 108, 0.28);

    --color-blue: var(--accent-strong);
    --color-cyan: #8aa9c8;
    --color-indigo: #8492b8;
    --color-emerald: #6cc79a;
    --color-amber: #d8a45f;
    --color-rose: #e27e78;

    --gradient-accent: var(--accent);
    --gradient-glow: var(--accent-soft);
    --gradient-danger: #b85c59;
    --gradient-success: #367c5c;

    --font-main: "Segoe UI Variable", "Segoe UI", Aptos, system-ui, -apple-system, sans-serif;
    --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;

    --shadow-sm: 0 1px 2px rgba(3, 6, 10, 0.18);
    --shadow-md: 0 16px 34px rgba(4, 7, 11, 0.16);
    --shadow-lg: 0 24px 64px rgba(4, 7, 11, 0.34);
    --shadow-neon: none;

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 999px;

    --rail-width: 76px;
    --sidebar-width: 252px;
    --header-height: 66px;
    --transition-fast: 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-normal: 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-width: 320px;
    background: var(--bg-dark);
}

body {
    min-height: 100dvh;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 78% -15%, rgba(45, 70, 99, 0.16), transparent 34rem),
        var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

button,
input,
select,
textarea {
    color: inherit;
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent-strong);
    outline-offset: 3px;
}

::selection {
    background: rgba(202, 134, 82, 0.32);
    color: var(--text-primary);
}

::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    background: rgba(174, 181, 191, 0.24);
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(174, 181, 191, 0.42);
    background-clip: padding-box;
}

/* Application shell */
.app-container {
    min-height: 100dvh;
    padding-left: var(--rail-width);
    transition: padding-left var(--transition-normal);
}

.app-container.sidebar-pinned {
    padding-left: var(--sidebar-width);
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 120;
    width: var(--rail-width);
    pointer-events: none;
    transition: width var(--transition-normal);
}

.app-container.sidebar-pinned .sidebar {
    width: var(--sidebar-width);
    pointer-events: auto;
}

.sidebar-surface {
    position: relative;
    display: flex;
    width: var(--rail-width);
    height: 100%;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border-color);
    background:
        linear-gradient(180deg, rgba(30, 50, 74, 0.16), transparent 180px),
        rgba(13, 18, 24, 0.96);
    box-shadow: 16px 0 48px rgba(3, 7, 12, 0);
    pointer-events: auto;
    transition:
        width var(--transition-normal),
        box-shadow var(--transition-normal);
}

.sidebar:hover .sidebar-surface,
.sidebar:focus-within .sidebar-surface,
.app-container.sidebar-pinned .sidebar-surface {
    width: var(--sidebar-width);
    box-shadow: 22px 0 62px rgba(3, 7, 12, 0.42);
}

.sidebar-header {
    display: flex;
    min-height: var(--header-height);
    width: var(--sidebar-width);
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-close-btn {
    display: none;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar:hover .sidebar-close-btn,
.sidebar:focus-within .sidebar-close-btn,
.app-container.sidebar-pinned .sidebar-close-btn {
    display: grid;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.brand-link {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    object-fit: contain;
}

.brand-copy {
    min-width: 150px;
    opacity: 0;
    transform: translateX(-5px);
    transition:
        opacity var(--transition-fast),
        transform var(--transition-fast);
}

.sidebar:hover .brand-copy,
.sidebar:focus-within .brand-copy,
.app-container.sidebar-pinned .brand-copy {
    opacity: 1;
    transform: translateX(0);
}

.brand-name {
    display: block;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 720;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.brand-subtitle {
    display: block;
    margin-top: 1px;
    color: var(--accent-strong);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sidebar-menu {
    display: flex;
    width: var(--sidebar-width);
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 10px 20px;
    list-style: none;
    scrollbar-width: none;
}

.sidebar-menu::-webkit-scrollbar {
    display: none;
}

.menu-item a {
    position: relative;
    display: flex;
    width: 230px;
    min-height: 43px;
    align-items: center;
    gap: 13px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 590;
    white-space: nowrap;
    transition:
        color var(--transition-fast),
        background-color var(--transition-fast),
        border-color var(--transition-fast),
        transform var(--transition-fast);
}

.menu-item a::before {
    position: absolute;
    inset: 10px auto 10px 2px;
    width: 2px;
    border-radius: var(--radius-full);
    background: var(--accent);
    content: "";
    opacity: 0;
    transform: scaleY(0.35);
    transition:
        opacity var(--transition-fast),
        transform var(--transition-fast);
}

.menu-item a:hover {
    border-color: rgba(226, 232, 240, 0.07);
    background: rgba(241, 238, 233, 0.045);
    color: var(--text-primary);
    transform: translateX(1px);
}

.menu-item.active a {
    border-color: rgba(202, 134, 82, 0.20);
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.menu-item.active a::before {
    opacity: 1;
    transform: scaleY(1);
}

.menu-item svg {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    stroke-width: 1.65;
}

.menu-item span {
    opacity: 0;
    transform: translateX(-5px);
    transition:
        opacity var(--transition-fast),
        transform var(--transition-fast);
}

.sidebar:hover .menu-item span,
.sidebar:focus-within .menu-item span,
.app-container.sidebar-pinned .menu-item span {
    opacity: 1;
    transform: translateX(0);
}

.sidebar-footer {
    display: flex;
    width: var(--sidebar-width);
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(11, 14, 18, 0.44);
}

.user-badge {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border: 1px solid rgba(202, 134, 82, 0.30);
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.82rem;
    font-weight: 760;
}

.user-info {
    display: flex;
    min-width: 128px;
    flex-direction: column;
    opacity: 0;
    transform: translateX(-5px);
    transition:
        opacity var(--transition-fast),
        transform var(--transition-fast);
}

.sidebar:hover .user-info,
.sidebar:focus-within .user-info,
.app-container.sidebar-pinned .user-info {
    opacity: 1;
    transform: translateX(0);
}

.username {
    overflow: hidden;
    font-size: 0.84rem;
    font-weight: 650;
    text-overflow: ellipsis;
}

.user-role {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.btn-logout {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    padding: 0;
    background: transparent;
    cursor: pointer;
    transition:
        color var(--transition-fast),
        border-color var(--transition-fast),
        background-color var(--transition-fast);
}

.logout-form {
    margin: 0;
}

.btn-logout:hover {
    border-color: rgba(226, 126, 120, 0.20);
    background: rgba(226, 126, 120, 0.08);
    color: var(--color-rose);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: none;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(5, 8, 12, 0.68);
    backdrop-filter: blur(4px);
}

/* Header and workspace */
.main-content {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 100dvh;
    flex-direction: column;
}

.main-header {
    position: sticky;
    top: 0;
    z-index: 90;
    display: grid;
    min-height: var(--header-height);
    grid-template-columns: minmax(150px, 1fr) minmax(260px, 520px) minmax(150px, 1fr);
    align-items: center;
    gap: 18px;
    padding: 0 clamp(18px, 2.5vw, 34px);
    border-bottom: 1px solid var(--border-color);
    background: rgba(11, 14, 18, 0.82);
    backdrop-filter: blur(18px) saturate(115%);
}

.header-leading,
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-actions {
    justify-content: flex-end;
}

.shell-icon-button,
.mobile-menu-btn,
.desktop-menu-btn,
.back-btn {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        color var(--transition-fast),
        border-color var(--transition-fast),
        background-color var(--transition-fast),
        transform var(--transition-fast);
}

.shell-icon-button:hover,
.mobile-menu-btn:hover,
.desktop-menu-btn:hover,
.back-btn:hover {
    border-color: var(--border-color);
    background: rgba(241, 238, 233, 0.045);
    color: var(--text-primary);
}

.shell-icon-button:active,
.mobile-menu-btn:active,
.desktop-menu-btn:active,
.back-btn:active {
    transform: translateY(1px) scale(0.98);
}

.desktop-menu-btn .icon-open {
    display: block;
}

.desktop-menu-btn .icon-close {
    display: none;
}

.app-container.sidebar-pinned .desktop-menu-btn .icon-open {
    display: none;
}

.app-container.sidebar-pinned .desktop-menu-btn .icon-close {
    display: block;
}

.header-divider {
    display: block;
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 4px;
}

.shell-icon-button svg,
.mobile-menu-btn svg,
.desktop-menu-btn svg,
.back-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.7;
}

.mobile-menu-btn {
    display: none;
}

.page-context {
    display: flex;
    min-width: 0;
    flex-direction: column;
    margin-left: 2px;
}

.page-context small {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.page-context strong {
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-search {
    width: 100%;
}

.header-search form {
    position: relative;
    display: flex;
    align-items: center;
}

.header-search input {
    width: 100%;
    height: 40px;
    padding: 0 68px 0 42px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    background: rgba(241, 238, 233, 0.035);
    color: var(--text-primary);
    font-size: 0.84rem;
    transition:
        border-color var(--transition-fast),
        background-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.header-search input::placeholder {
    color: #7f8996;
}

.header-search input:focus {
    border-color: var(--border-focus);
    background: rgba(241, 238, 233, 0.055);
    box-shadow: 0 0 0 3px rgba(202, 134, 82, 0.10);
}

.header-search svg {
    position: absolute;
    left: 14px;
    z-index: 1;
    width: 17px;
    height: 17px;
    color: var(--text-muted);
    stroke-width: 1.7;
}

.search-shortcut {
    position: absolute;
    right: 10px;
    display: inline-flex;
    min-width: 44px;
    height: 22px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(241, 238, 233, 0.035);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    box-shadow: inset 0 -1px 0 rgba(241, 238, 233, 0.06);
    pointer-events: none;
}

.content-body {
    width: 100%;
    max-width: 1680px;
    flex: 1;
    margin: 0 auto;
    padding: clamp(22px, 2.8vw, 38px);
    animation: content-enter 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Shared page and controls */
.page-title-area {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

/* Shared by the newer operations pages (accounting, health and backups). */
.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.page-heading h1 {
    color: var(--text-primary);
    font-size: clamp(1.55rem, 2.2vw, 2rem);
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1.08;
}

.page-heading .muted,
.page-heading > div:first-child > .muted {
    max-width: 62ch;
    margin-top: 7px;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.page-heading-actions,
.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
}

.muted { color: var(--text-muted); }

.page-title {
    color: var(--text-primary);
    font-size: clamp(1.55rem, 2.2vw, 2rem);
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1.08;
}

.page-subtitle {
    max-width: 62ch;
    margin-top: 7px;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--radius-md);
    padding: 9px 16px;
    font-size: 0.85rem;
    font-weight: 680;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition:
        transform var(--transition-fast),
        border-color var(--transition-fast),
        background-color var(--transition-fast),
        color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.btn-primary {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--text-inverse) !important;
    box-shadow: inset 0 1px 0 rgba(241, 238, 233, 0.20), var(--shadow-sm);
}

.btn-primary:hover {
    border-color: var(--accent-strong);
    background: var(--accent-strong);
    box-shadow: inset 0 1px 0 rgba(241, 238, 233, 0.24), 0 8px 18px rgba(8, 10, 14, 0.22);
    transform: translateY(-1px);
}

.btn-secondary {
    border: 1px solid var(--border-color);
    background: rgba(241, 238, 233, 0.035);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--border-strong);
    background: rgba(241, 238, 233, 0.07);
    transform: translateY(-1px);
}

.btn-danger {
    border: 1px solid rgba(226, 126, 120, 0.50);
    background: rgba(184, 92, 89, 0.88);
    color: var(--text-primary);
}

.btn-danger:hover {
    border-color: var(--color-rose);
    background: #c76762;
    transform: translateY(-1px);
}

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
    transform: translateY(1px) scale(0.985);
}

.btn-primary svg,
.btn-secondary svg,
.btn-danger svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.7;
}

.btn-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        border-color var(--transition-fast),
        background-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
}

.btn-icon:hover {
    border-color: var(--border-color);
    background: rgba(241, 238, 233, 0.05);
    color: var(--text-primary);
}

.btn-icon:active {
    transform: translateY(1px) scale(0.98);
}

.panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--panel-bg);
    box-shadow: inset 0 1px 0 rgba(241, 238, 233, 0.025);
    padding: 22px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: -2px 0 18px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2:not(.panel-title) {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 690;
    letter-spacing: -0.012em;
}

.panel-title {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 690;
    letter-spacing: -0.012em;
}

.grid-4,
.grid-3,
.grid-2 {
    display: grid;
    gap: 18px;
}

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

.card-grid,
.content-grid {
    display: grid;
    gap: 18px;
}

.card-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.content-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card-grid .metric-card,
.content-grid .panel,
.accounting-metrics .metric-card {
    min-width: 0;
}

.accounting-metrics .metric-card {
    grid-column: span 3;
    display: grid;
    align-content: start;
    gap: 6px;
}

.accounting-metrics .metric-value { margin-top: 12px; }

.metric-helper,
.metric-hint {
    display: block;
    margin-top: 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.metric-card-success { border-color: rgba(108, 199, 154, 0.34); }
.metric-card-warning { border-color: rgba(216, 164, 95, 0.34); }
.metric-card-danger { border-color: rgba(226, 126, 120, 0.34); }

.stat-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--panel-bg);
    padding: 19px;
    transition:
        transform var(--transition-fast),
        border-color var(--transition-fast),
        background-color var(--transition-fast);
}

.stat-card:hover {
    border-color: var(--border-strong);
    background: var(--panel-raised);
    transform: translateY(-1px);
}

.stat-card::after {
    display: none;
}

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

.stat-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 660;
    letter-spacing: 0.02em;
}

.stat-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(241, 238, 233, 0.035);
}

.stat-icon.blue,
.stat-icon.cyan,
.stat-icon.emerald,
.stat-icon.amber {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.stat-value {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 1.7rem;
    font-variant-numeric: tabular-nums;
    font-weight: 720;
    letter-spacing: -0.045em;
}

.stat-meta {
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 0.76rem;
}

/* Tables */
.table-container {
    max-width: 100%;
    overflow-x: auto;
    border-radius: 11px;
    -webkit-overflow-scrolling: touch;
}

table.custom-table {
    width: 100%;
    min-width: 880px;
    border-collapse: collapse;
    color: var(--text-secondary);
    text-align: left;
}

table.custom-table th {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-strong);
    background: rgba(241, 238, 233, 0.025);
    color: #909aa6;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 650;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    white-space: nowrap;
}

table.custom-table td {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.075);
    color: var(--text-secondary);
    font-size: 0.84rem;
    vertical-align: middle;
}

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

table.custom-table tbody tr {
    transition:
        background-color var(--transition-fast),
        color var(--transition-fast);
}

table.custom-table tbody tr:hover {
    background: rgba(241, 238, 233, 0.035);
}

/* Compact evidence tables used by finance and operational control pages. */
.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.data-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    color: var(--text-secondary);
    text-align: left;
}

table.data-table th {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-strong);
    background: rgba(241, 238, 233, 0.025);
    color: #909aa6;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 650;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    white-space: nowrap;
}

table.data-table td {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.075);
    color: var(--text-secondary);
    font-size: 0.84rem;
    vertical-align: middle;
}

table.data-table tbody tr { transition: background-color var(--transition-fast); }
table.data-table tbody tr:hover { background: rgba(241, 238, 233, 0.035); }
table.data-table tbody tr:last-child td { border-bottom: 0; }
table.data-table tfoot th { border-top: 1px solid var(--border-strong); border-bottom: 0; color: var(--text-primary); }

.data-table .numeric,
.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.table-secondary {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.35;
}

.data-table td small {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.stack-list { display: grid; gap: 0; }

.stack-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.stack-row:last-child { border-bottom: 0; }
.stack-row > div:last-child { text-align: right; }

.panel-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 17px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.76rem;
}

.panel-footer a { color: var(--accent-strong); }
.panel-footer a:hover { color: var(--text-primary); }

.health-list { display: grid; gap: 10px; }

.health-row {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(241, 238, 233, 0.025);
}

.health-indicator {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--text-muted);
    box-shadow: 0 0 0 3px rgba(116, 126, 139, 0.12);
}

.health-ok .health-indicator { background: var(--color-emerald); box-shadow: 0 0 0 3px rgba(108, 199, 154, 0.12); }
.health-warning .health-indicator { background: var(--color-amber); box-shadow: 0 0 0 3px rgba(216, 164, 95, 0.12); }
.health-error .health-indicator { background: var(--color-rose); box-shadow: 0 0 0 3px rgba(226, 126, 120, 0.12); }
.health-copy { min-width: 0; }
.health-copy h3 { color: var(--text-primary); font-size: 0.86rem; font-weight: 680; }
.health-copy p { margin-top: 3px; color: var(--text-secondary); font-size: 0.78rem; line-height: 1.45; }
.health-copy small { display: block; margin-top: 5px; color: var(--text-muted); font-size: 0.70rem; }

.status-success { background: rgba(108, 199, 154, 0.14); color: #8dd9b2; }
.status-warning { background: rgba(216, 164, 95, 0.14); color: #e2b878; }
.status-danger { background: rgba(226, 126, 120, 0.14); color: #ec9a95; }

table.custom-table tbody tr:hover td {
    color: var(--text-primary);
}

/* Status and form elements */
.badge {
    display: inline-flex;
    min-height: 23px;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
}

.badge.success { border-color: rgba(108, 199, 154, 0.20); background: rgba(108, 199, 154, 0.10); color: #8dd9b2; }
.badge.warning { border-color: rgba(216, 164, 95, 0.20); background: rgba(216, 164, 95, 0.10); color: #e2b878; }
.badge.danger { border-color: rgba(226, 126, 120, 0.22); background: rgba(226, 126, 120, 0.10); color: #ec9a95; }
.badge.info { border-color: rgba(138, 169, 200, 0.20); background: rgba(138, 169, 200, 0.10); color: #a6bfd6; }

.form-group {
    min-width: 0;
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 7px;
    color: #bdc3cb;
    font-size: 0.78rem;
    font-weight: 620;
}

.form-control,
.form-input,
input,
textarea,
select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    background: rgba(241, 238, 233, 0.035);
    color: var(--text-primary);
    transition:
        border-color var(--transition-fast),
        background-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.form-control {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    font-size: 0.86rem;
}

.form-input {
    min-height: 34px;
    padding: 6px 9px;
}

.form-control::placeholder,
.form-input::placeholder,
input::placeholder,
textarea::placeholder {
    color: #77818e;
}

.form-control:focus,
.form-input:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: var(--border-focus);
    background: rgba(241, 238, 233, 0.055);
    box-shadow: 0 0 0 3px rgba(202, 134, 82, 0.10);
}

select.form-control,
select.form-input,
select {
    background-color: var(--panel-solid) !important;
    color: var(--text-primary) !important;
}

select option {
    background: var(--panel-solid);
    color: var(--text-primary);
}

input[type="checkbox"],
input[type="radio"],
input[type="range"],
input[type="color"],
input[type="file"] {
    background: initial;
    accent-color: var(--accent);
}

textarea { resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 11px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    animation: alert-enter 280ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.alert-danger { border-color: rgba(226, 126, 120, 0.24); background: rgba(226, 126, 120, 0.09); color: #ecaaa6; }
.alert-success { border-color: rgba(108, 199, 154, 0.22); background: rgba(108, 199, 154, 0.09); color: #98deb9; }
.alert-warning { border-color: rgba(216, 164, 95, 0.22); background: rgba(216, 164, 95, 0.09); color: #e2b878; }

.empty-state,
.loading-state,
.error-state {
    display: grid;
    min-height: 190px;
    place-items: center;
    align-content: center;
    gap: 9px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state strong,
.error-state strong {
    color: var(--text-secondary);
    font-size: 0.94rem;
}

.skeleton-line {
    width: min(100%, 280px);
    height: 12px;
    overflow: hidden;
    border-radius: 5px;
    background: rgba(241, 238, 233, 0.06);
}

.skeleton-line::after {
    display: block;
    width: 45%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(241, 238, 233, 0.08), transparent);
    content: "";
    transform: translateX(-120%);
    animation: skeleton-shift 1.4s ease-in-out infinite;
}

/* Dashboard cockpit */
.dashboard-page { display: grid; gap: 18px; }

.dashboard-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.dashboard-kicker {
    margin-bottom: 6px;
    color: var(--accent-strong);
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dashboard-title {
    font-size: clamp(1.7rem, 2.8vw, 2.4rem);
    font-weight: 760;
    letter-spacing: -0.045em;
    line-height: 1.05;
}

.dashboard-summary {
    max-width: 52ch;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.dashboard-actions { display: flex; align-items: center; gap: 9px; }

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

.metric-card {
    position: relative;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--panel-bg);
    padding: 18px 20px;
    box-shadow: inset 0 1px 0 rgba(241, 238, 233, 0.025);
    transition:
        transform var(--transition-fast),
        border-color var(--transition-fast),
        background-color var(--transition-fast);
}

.metric-card:hover { border-color: var(--border-strong); background: var(--panel-raised); transform: translateY(-1px); }
.metric-card--catalog { grid-column: span 4; }
.metric-card--stock { grid-column: span 3; }
.metric-card--value { grid-column: span 3; }
.metric-card--alert { grid-column: span 2; }

.metric-card--catalog {
    border-color: rgba(202, 134, 82, 0.18);
    background:
        radial-gradient(circle at 104% -20%, rgba(202, 134, 82, 0.12), transparent 52%),
        var(--panel-bg);
}

.metric-card--alert.has-alerts { border-color: rgba(226, 126, 120, 0.22); }
.metric-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-value {
    display: block;
    margin: 8px 0;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.metric-value--status {
    font-size: 1.45rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.metric-value-healthy,
.metric-value-ok,
.metric-value-live {
    color: var(--color-emerald);
}

.metric-value-warning {
    color: var(--color-amber);
}

.metric-value-danger {
    color: var(--color-rose);
}

.metric-card--alert.has-alerts .metric-value { color: #ec9a95; }

.metric-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 13px;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.metric-card--interactive {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.metric-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-card-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(241, 238, 233, 0.04);
    color: var(--text-muted);
    font-size: 0.76rem;
    transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.metric-card:hover .metric-card-arrow {
    background: var(--accent-soft);
    color: var(--accent-strong);
    transform: translate(2px, -2px);
}

/* Store Operating Lifecycle Stepper (Beginner Guided Onboarding) */
.workflow-guide {
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--panel-bg);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

.workflow-guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(241, 238, 233, 0.02);
}

.workflow-guide-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.workflow-guide-title h3 {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.workflow-guide-title p {
    margin: 0;
    font-size: 0.74rem;
    color: var(--text-muted);
}

.workflow-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: rgba(241, 238, 233, 0.03);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.workflow-toggle-btn:hover {
    border-color: var(--accent-strong);
    color: var(--text-primary);
    background: var(--accent-soft);
}

.workflow-stepper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 1px solid var(--border-color);
}

.workflow-step {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-color);
    color: var(--text-muted);
    text-align: left;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.workflow-step:last-child {
    border-right: none;
}

.workflow-step:hover {
    background: rgba(241, 238, 233, 0.03);
    color: var(--text-primary);
}

.workflow-step.is-active {
    background: rgba(202, 134, 82, 0.06);
    color: var(--text-primary);
}

.workflow-step.is-active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-strong);
}

.workflow-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(241, 238, 233, 0.04);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-strong);
    flex-shrink: 0;
}

.workflow-step.is-active .workflow-step-num {
    border-color: rgba(202, 134, 82, 0.4);
    background: var(--accent-soft);
    color: #fff;
}

.workflow-step-text strong {
    display: block;
    font-size: 0.8rem;
    font-weight: 680;
}

.workflow-step-text small {
    display: block;
    margin-top: 1px;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.workflow-card-body {
    display: none;
    padding: 20px 24px;
    animation: content-enter 220ms ease both;
}

.workflow-card-body.is-active {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
    gap: 24px;
    align-items: start;
}

.workflow-desc h4 {
    margin: 0 0 6px 0;
    font-size: 0.94rem;
    color: var(--text-primary);
}

.workflow-desc p {
    margin: 0 0 14px 0;
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.workflow-concepts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.workflow-concept-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: rgba(241, 238, 233, 0.04);
    border: 1px solid var(--border-color);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.workflow-concept-tag strong {
    color: var(--text-secondary);
}

.workflow-actions-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: rgba(241, 238, 233, 0.025);
    border: 1px solid var(--border-color);
}

.workflow-actions-panel h5 {
    margin: 0;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.workflow-actions-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.workflow-actions-btns .btn-primary,
.workflow-actions-btns .btn-secondary {
    width: 100%;
    justify-content: center;
    font-size: 0.78rem;
    padding: 8px 12px;
}

@media (max-width: 900px) {
    .workflow-stepper {
        grid-template-columns: repeat(2, 1fr);
    }
    .workflow-card-body.is-active {
        grid-template-columns: 1fr;
    }
}

.quick-launch {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--panel-bg);
}

.quick-launch a {
    display: flex;
    min-height: 74px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 16px;
    border-right: 1px solid var(--border-color);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.quick-launch a:last-child { border-right: 0; }
.quick-launch a:hover { background: var(--accent-soft); }
.quick-launch strong { display: block; color: var(--text-primary); font-size: 0.84rem; font-weight: 670; }
.quick-launch small { display: block; margin-top: 2px; color: var(--text-muted); font-size: 0.69rem; }
.quick-arrow { color: var(--accent-strong); font-size: 1.05rem; transition: transform var(--transition-fast); }
.quick-launch a:hover .quick-arrow { transform: translateX(2px); }

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(290px, 0.72fr);
    align-items: start;
    gap: 18px;
}

.activity-panel { min-width: 0; padding: 0; }
.activity-panel .panel-header { margin: 0; padding: 17px 19px 15px; }
.panel-header-copy p { margin-top: 3px; color: var(--text-muted); font-size: 0.73rem; }

/* Stage 8 reporting centre -------------------------------------------------
   Reports reuse the established dashboard cards but get a compact filter
   rail and horizontally scrollable evidence tables on smaller shop-floor
   screens. */
.reports-page .dashboard-intro { align-items: end; }
.reports-page .dashboard-intro .btn-secondary { white-space: nowrap; }
.report-filter-bar { display: grid; grid-template-columns: minmax(150px, 1.2fr) repeat(2, minmax(130px, .8fr)) minmax(160px, 1fr) minmax(150px, 1fr) auto; gap: 10px; align-items: end; margin: 0 0 18px; padding: 14px; }
.report-filter-bar label { display: grid; gap: 5px; color: var(--text-muted); font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; }
.report-filter-bar input, .report-filter-bar select { width: 100%; min-height: 38px; border: 1px solid var(--border-color); border-radius: 9px; background: var(--panel-raised); color: var(--text-primary); padding: 0 10px; font: inherit; font-size: .82rem; }
.report-filter-bar .btn-primary { min-height: 38px; }
.report-hero-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.report-help-panel { margin-bottom: 18px; border-left: 3px solid var(--color-blue); }
.report-comparison-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.report-comparison-grid > div { display: grid; gap: 4px; min-width: 150px; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--panel-solid); }
.report-comparison-grid span { color: var(--text-muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }
.report-comparison-grid strong { color: var(--text-primary); font-size: 1rem; }
.report-table-panel { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.report-table-panel .data-table { min-width: 720px; }
.report-table-panel .data-table td small { display: block; margin-top: 3px; color: var(--text-muted); }
.report-table-panel .data-table a { color: var(--color-blue); text-decoration: none; }
.report-table-panel .data-table a:hover { text-decoration: underline; }
@media (max-width: 1100px) {
    .report-filter-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .report-filter-bar .btn-primary { grid-column: span 1; }
    .report-hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .report-filter-bar { grid-template-columns: 1fr; }
    .report-hero-grid { grid-template-columns: 1fr; }
    .reports-page .dashboard-intro { align-items: start; }
}
.activity-feed { max-height: 488px; overflow: auto; }

.activity-row {
    display: grid;
    grid-template-columns: minmax(72px, 0.65fr) 78px minmax(190px, 2.4fr) minmax(126px, 0.95fr);
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 10px 18px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.075);
    transition: background-color var(--transition-fast);
}

.activity-row:last-child { border-bottom: 0; }
.activity-row:hover { background: rgba(241, 238, 233, 0.03); }
.activity-user { overflow: hidden; color: var(--text-secondary); font-size: 0.78rem; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.activity-detail { overflow: hidden; color: var(--text-secondary); font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.activity-detail a { color: var(--accent-strong); font-family: var(--font-mono); font-size: 0.72rem; font-weight: 650; }
.activity-time { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.65rem; font-variant-numeric: tabular-nums; text-align: right; }

.attention-stack { display: grid; gap: 14px; }
.attention-panel { padding: 17px; }

.attention-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}

.attention-heading h2,
.attention-heading h3 { color: var(--text-primary); font-size: 0.93rem; font-weight: 690; }
.attention-heading p { margin-top: 3px; color: var(--text-muted); font-size: 0.70rem; }
.stock-alert-list,
.candidate-list { display: grid; gap: 7px; list-style: none; }

.stock-alert-item,
.candidate-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid rgba(226, 232, 240, 0.07);
    border-radius: 10px;
    background: rgba(241, 238, 233, 0.025);
    transition:
        border-color var(--transition-fast),
        background-color var(--transition-fast),
        transform var(--transition-fast);
}

.stock-alert-item:hover,
.candidate-item:hover { border-color: var(--border-strong); background: rgba(241, 238, 233, 0.05); transform: translateX(1px); }

.stock-alert-item strong,
.candidate-item strong { display: block; overflow: hidden; color: var(--accent-strong); font-family: var(--font-mono); font-size: 0.69rem; text-overflow: ellipsis; white-space: nowrap; }
.stock-alert-item small,
.candidate-item small { display: block; overflow: hidden; margin-top: 2px; color: var(--text-muted); font-size: 0.66rem; text-overflow: ellipsis; white-space: nowrap; }
.stock-count { color: #ec9a95; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 680; white-space: nowrap; }
.panel-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 12px; color: var(--accent-strong); font-size: 0.72rem; font-weight: 650; }
.panel-link:hover { color: var(--text-primary); }

.signal-clear {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(108, 199, 154, 0.16);
    border-radius: 10px;
    background: rgba(108, 199, 154, 0.07);
    color: #98deb9;
    font-size: 0.74rem;
}

.signal-clear::before { display: block; width: 7px; height: 7px; flex: 0 0 7px; margin-top: 4px; border-radius: 50%; background: var(--color-emerald); content: ""; }

.peek-panel { position: relative; z-index: 5; min-height: 78px; padding: 0; cursor: default; }
.peek-panel__summary { display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 17px; }
.peek-panel__summary strong { display: block; color: var(--text-primary); font-size: 0.86rem; }
.peek-panel__summary small { display: block; margin-top: 3px; color: var(--text-muted); font-size: 0.68rem; }
.peek-hint { display: inline-flex; align-items: center; gap: 5px; color: var(--accent-strong); font-family: var(--font-mono); font-size: 0.61rem; white-space: nowrap; }

.peek-panel__detail {
    position: absolute;
    top: calc(100% - 7px);
    right: -1px;
    left: -1px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(202, 134, 82, 0.22);
    border-top-color: var(--border-color);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: rgba(23, 28, 35, 0.98);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.peek-panel:hover .peek-panel__detail,
.peek-panel:focus-within .peek-panel__detail,
.peek-panel:focus .peek-panel__detail { opacity: 1; pointer-events: auto; transform: translateY(0); }

.network-url-label { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.59rem; letter-spacing: 0.05em; text-transform: uppercase; }
.network-url { display: block; overflow: hidden; margin-top: 4px; color: var(--accent-strong); font-family: var(--font-mono); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.network-note { margin-top: 7px; color: var(--text-muted); font-size: 0.64rem; line-height: 1.4; }
.network-qr { width: 74px; height: 74px; border: 5px solid #e7e2db; border-radius: 8px; background: #e7e2db; }

/* AI assistant */
.assistant-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 100;
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border: 1px solid rgba(202, 134, 82, 0.52);
    border-radius: 50%;
    background: var(--accent);
    color: var(--text-inverse);
    box-shadow: 0 14px 34px rgba(3, 6, 10, 0.34), inset 0 1px 0 rgba(241, 238, 233, 0.22);
    cursor: pointer;
    transition: transform var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.assistant-toggle:hover { background: var(--accent-strong); box-shadow: 0 18px 40px rgba(3, 6, 10, 0.40), inset 0 1px 0 rgba(241, 238, 233, 0.26); transform: translateY(-2px); }
.assistant-toggle:active { transform: translateY(1px) scale(0.98); }
.assistant-toggle svg { width: 23px; height: 23px; stroke-width: 1.8; }

.assistant-window {
    position: fixed;
    right: 24px;
    bottom: 90px;
    z-index: 105;
    display: flex;
    width: min(390px, calc(100vw - 32px));
    height: min(540px, calc(100dvh - 126px));
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: rgba(18, 23, 29, 0.98);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px) scale(0.97);
    transform-origin: bottom right;
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.assistant-window.is-open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.assistant-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 15px; border-bottom: 1px solid var(--border-color); background: var(--navy-soft); }
.assistant-title { display: flex; align-items: center; gap: 10px; }
.assistant-mark { display: grid; width: 33px; height: 33px; place-items: center; border: 1px solid rgba(202, 134, 82, 0.22); border-radius: 9px; background: var(--accent-soft); color: var(--accent-strong); font-family: var(--font-mono); font-size: 0.72rem; font-weight: 720; }
.assistant-title h2 { font-size: 0.87rem; font-weight: 690; }
.assistant-title p { margin-top: 1px; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.58rem; }
.assistant-close { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text-muted); cursor: pointer; }
.assistant-close:hover { border-color: var(--border-color); background: rgba(241, 238, 233, 0.045); color: var(--text-primary); }

.assistant-messages { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 10px; overflow-y: auto; padding: 14px; font-size: 0.8rem; line-height: 1.48; }
.assistant-message { max-width: 86%; padding: 9px 11px; border: 1px solid var(--border-color); border-radius: 11px; background: var(--panel-raised); color: var(--text-secondary); overflow-wrap: anywhere; white-space: pre-wrap; }
.assistant-message--user { align-self: flex-end; border-color: rgba(202, 134, 82, 0.26); background: var(--accent-soft); color: var(--text-primary); }
.assistant-message--loading { color: var(--text-muted); font-style: italic; }

.assistant-suggestions { display: flex; gap: 6px; overflow-x: auto; padding: 9px 12px; border-top: 1px solid var(--border-color); scrollbar-width: none; }
.assistant-suggestions::-webkit-scrollbar { display: none; }
.assistant-chip { min-height: 29px; flex: 0 0 auto; padding: 5px 9px; border: 1px solid var(--border-color); border-radius: var(--radius-full); background: rgba(241, 238, 233, 0.025); color: var(--text-secondary); font-size: 0.67rem; cursor: pointer; transition: border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast); }
.assistant-chip:hover { border-color: rgba(202, 134, 82, 0.30); background: var(--accent-soft); color: var(--text-primary); }

.assistant-composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 11px; border-top: 1px solid var(--border-color); background: var(--bg-raised); }
.assistant-composer input { width: 100%; min-height: 39px; padding: 8px 11px; }
.assistant-composer button { min-width: 62px; }
.ai-table-wrap { width: 100%; overflow-x: auto; }
.ai-table { width: 100%; border-collapse: collapse; font-size: 0.68rem; }
.ai-table th,
.ai-table td { padding: 6px 7px; border-bottom: 1px solid var(--border-color); color: var(--text-secondary); text-align: left; white-space: nowrap; }
.ai-table th { color: var(--text-primary); font-family: var(--font-mono); font-size: 0.61rem; }
.ai-query { margin-top: 8px; color: var(--text-muted); font-size: 0.62rem; }
.ai-query code { color: var(--accent-strong); font-family: var(--font-mono); }

/* Inventory catalog */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; }
.filter-panel { margin-bottom: 16px; padding: 16px; }
.catalog-filter-form { display: grid; grid-template-columns: minmax(280px, 1.7fr) repeat(2, minmax(180px, 0.75fr)) auto; align-items: end; gap: 12px; }
.catalog-filter-form .form-group { margin-bottom: 0; }
.filter-actions { display: flex; gap: 8px; }
.catalog-panel { min-width: 0; overflow: hidden; padding: 18px; contain: inline-size; }
.catalog-panel .table-container { width: 100%; contain: inline-size; }
.catalog-table { table-layout: fixed; }
.catalog-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-table th:nth-child(1) { width: 135px; }
.catalog-table th:nth-child(2) { width: 105px; }
.catalog-table th:nth-child(3) { width: 220px; }
.catalog-table th:nth-child(4) { width: 130px; }
.catalog-table th:nth-child(5) { width: 135px; }
.catalog-table th:nth-child(6) { width: 95px; }
.catalog-table th:nth-child(7) { width: 85px; }
.catalog-table th:nth-child(8) { width: 80px; }
.catalog-table th:nth-child(9) { width: 60px; }
.catalog-table td:nth-child(3) { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-code,
.numeric-cell { font-family: var(--font-mono); font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.part-code,
.part-number { color: var(--accent-strong); font-weight: 670; }
.part-number:hover { color: var(--text-primary); }
.part-location { color: var(--text-secondary); font-weight: 600; }
.stock-normal { color: var(--text-primary); font-family: var(--font-mono); font-size: 0.74rem; font-weight: 650; }
.stock-reference { color: var(--text-muted); font-size: 0.72rem; }
.table-action { text-align: right; }
.table-action .btn-secondary { min-height: 31px; padding: 6px 10px; font-size: 0.72rem; }

/* Inventory pagination */
.catalog-meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 13px; color: var(--text-muted); font-size: 0.75rem; }
.catalog-meta strong { color: var(--text-secondary); font-family: var(--font-mono); font-weight: 650; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; }
.pagination-status { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.69rem; }
.pagination-actions { display: flex; gap: 8px; }
.pagination .is-disabled { opacity: 0.42; pointer-events: none; }

/* Login */
.login-container {
    display: grid;
    min-height: 100dvh;
    place-items: center;
    padding: clamp(20px, 4vw, 56px);
    background:
        radial-gradient(circle at 16% 24%, rgba(38, 61, 88, 0.23), transparent 33rem),
        radial-gradient(circle at 82% 88%, rgba(202, 134, 82, 0.10), transparent 30rem),
        var(--bg-dark);
}

.login-shell { display: grid; width: min(940px, 100%); min-height: 560px; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr); overflow: hidden; border: 1px solid var(--border-color); border-radius: 18px; background: var(--panel-bg); box-shadow: 0 38px 100px rgba(3, 6, 10, 0.38); }

.login-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: clamp(32px, 5vw, 58px);
    border-right: 1px solid var(--border-color);
    background: linear-gradient(150deg, rgba(48, 73, 102, 0.28), transparent 62%), var(--sidebar-bg);
}

.login-brand-panel::after { position: absolute; right: -80px; bottom: -120px; width: 310px; height: 310px; border: 1px solid rgba(202, 134, 82, 0.12); border-radius: 50%; box-shadow: 0 0 0 42px rgba(202, 134, 82, 0.025), 0 0 0 84px rgba(202, 134, 82, 0.018); content: ""; pointer-events: none; }
.login-logo { position: relative; z-index: 1; display: flex; align-items: center; gap: 13px; }
.login-logo img { width: 62px; height: 62px; object-fit: contain; }
.login-logo strong { display: block; font-size: 0.94rem; letter-spacing: 0.02em; }
.login-logo small { color: var(--accent-strong); font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.07em; text-transform: uppercase; }
.login-brand-copy { position: relative; z-index: 1; max-width: 420px; }
.login-brand-copy h1 { max-width: 10ch; font-size: clamp(2rem, 4vw, 3.55rem); font-weight: 760; letter-spacing: -0.055em; line-height: 0.98; }
.login-brand-copy p { max-width: 40ch; margin-top: 17px; color: var(--text-secondary); font-size: 0.91rem; }
.login-brand-footer { position: relative; z-index: 1; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.62rem; }

.login-card { display: flex; width: auto; flex-direction: column; justify-content: center; padding: clamp(30px, 5vw, 56px); border: 0; border-radius: 0; background: var(--panel-bg); box-shadow: none; }
.login-form-header { margin-bottom: 28px; }
.login-title { font-size: 1.55rem; font-weight: 740; letter-spacing: -0.035em; text-align: left; }
.login-subtitle { margin: 7px 0 0; color: var(--text-muted); font-size: 0.82rem; text-align: left; }
.login-card .form-control { min-height: 45px; }
.login-card .btn-primary { width: 100%; min-height: 45px; margin-top: 6px; }
.login-help { margin-top: 18px; color: var(--text-muted); font-size: 0.69rem; text-align: center; }

/* Tooltip */
.tooltip { position: relative; display: inline-flex; align-items: center; justify-content: center; }

.tooltip .tooltiptext {
    position: absolute;
    bottom: 135%;
    left: 50%;
    z-index: 1000;
    width: min(280px, calc(100vw - 40px));
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--panel-raised);
    box-shadow: var(--shadow-lg);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    text-align: left;
    transform: translate(-50%, 4px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    visibility: hidden;
}

.tooltip:hover .tooltiptext,
.tooltip:focus-within .tooltiptext { opacity: 1; transform: translate(-50%, 0); visibility: visible; }

@keyframes content-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes alert-enter { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes skeleton-shift { to { transform: translateX(280%); } }

/* Responsive layout */
@media (max-width: 1180px) {
    .main-header { grid-template-columns: auto minmax(260px, 1fr) auto; }
    .page-context { display: none; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-card--catalog,
    .metric-card--stock,
    .metric-card--value,
    .metric-card--alert { grid-column: auto; }
    .accounting-metrics .metric-card { grid-column: auto; }
    .metric-card { min-height: 136px; }
    .dashboard-layout { grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.8fr); }
    .catalog-filter-form { grid-template-columns: minmax(260px, 1.5fr) repeat(2, minmax(170px, 0.8fr)); }
    .filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (max-width: 960px) {
    .grid-4,
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .card-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-grid.two-col { grid-template-columns: 1fr; }
    .dashboard-layout { grid-template-columns: 1fr; }
    .attention-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .peek-panel { grid-column: 1 / -1; }
    .quick-launch { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quick-launch a:nth-child(2) { border-right: 0; }
    .quick-launch a:nth-child(-n+2) { border-bottom: 1px solid var(--border-color); }
    .login-shell { grid-template-columns: minmax(0, 0.95fr) minmax(340px, 1.05fr); }
    .login-brand-copy h1 { font-size: 2.4rem; }
}

@media (max-width: 768px) {
    .app-container { padding-left: 0; }
    .sidebar { width: min(286px, calc(100vw - 28px)); transform: translateX(-105%); transition: transform var(--transition-normal); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-surface,
    .sidebar:hover .sidebar-surface,
    .sidebar:focus-within .sidebar-surface,
    .app-container.sidebar-pinned .sidebar-surface { width: min(286px, calc(100vw - 28px)); box-shadow: 22px 0 62px rgba(3, 7, 12, 0.50); }

    .brand-copy,
    .menu-item span,
    .user-info,
    .sidebar:hover .brand-copy,
    .sidebar:focus-within .brand-copy,
    .app-container.sidebar-pinned .brand-copy,
    .sidebar:hover .menu-item span,
    .sidebar:focus-within .menu-item span,
    .app-container.sidebar-pinned .menu-item span,
    .sidebar:hover .user-info,
    .sidebar:focus-within .user-info,
    .app-container.sidebar-pinned .user-info { opacity: 1; transform: none; }

    .sidebar-overlay.open { display: block; }
    .main-header { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 0 13px; }
    .mobile-menu-btn { display: grid; }
    .desktop-menu-btn,
    .back-btn,
    .hidden-on-mobile,
    .search-shortcut { display: none !important; }
    .header-actions .btn-primary span { display: none; }
    .header-actions .btn-primary { width: 40px; min-width: 40px; padding: 0; }
    .header-search input { padding-right: 12px; }
    .content-body { padding: 20px 16px 96px; }
    .catalog-filter-form { grid-template-columns: 1fr; }
    .filter-actions { grid-column: auto; }
    .filter-actions > * { flex: 1; }
    .page-title-area,
    .page-heading,
    .dashboard-intro { align-items: flex-start; flex-direction: column; }
    .page-title-area > div:last-child,
    .page-heading > div:last-child,
    .page-heading > .action-row,
    .dashboard-actions { width: 100%; }
    .page-title-area .btn-primary,
    .dashboard-actions .btn-primary,
    .dashboard-actions .btn-secondary { flex: 1; }
    .grid-4,
    .grid-3,
    .grid-2,
    .metric-grid,
    .card-grid,
    .stats-grid,
    .attention-stack { grid-template-columns: 1fr; }
    .content-grid.two-col { grid-template-columns: 1fr; }
    .pos-layout { grid-template-columns: minmax(0, 1fr) !important; }
    .pos-layout > .panel:first-child { min-height: 430px !important; }
    .pos-layout #cart-table { min-width: 520px; }
    .pos-layout > .panel:first-child > div:last-child { overflow-x: auto; }
    table.custom-table.catalog-table { min-width: 0; table-layout: fixed; }
    .catalog-table th:nth-child(1),
    .catalog-table td:nth-child(1),
    .catalog-table th:nth-child(4),
    .catalog-table td:nth-child(4),
    .catalog-table th:nth-child(5),
    .catalog-table td:nth-child(5),
    .catalog-table th:nth-child(6),
    .catalog-table td:nth-child(6),
    .catalog-table th:nth-child(8),
    .catalog-table td:nth-child(8),
    .catalog-table th:nth-child(9),
    .catalog-table td:nth-child(9) { display: none; }
    .catalog-table th:nth-child(2) { width: 34%; }
    .catalog-table th:nth-child(3) { width: 44%; }
    .catalog-table th:nth-child(7) { width: 22%; }
    table.custom-table.catalog-table th,
    table.custom-table.catalog-table td { padding-right: 9px; padding-left: 9px; }
    .metric-card { min-height: 126px; }
    .metric-value { margin-top: 18px; }
    .activity-row { grid-template-columns: minmax(58px, 0.55fr) 70px minmax(160px, 2fr); }
    .activity-time { display: none; }

    .peek-panel__detail { position: static; grid-template-columns: minmax(0, 1fr) auto; border: 0; border-top: 1px solid var(--border-color); border-radius: 0 0 var(--radius-lg) var(--radius-lg); box-shadow: none; opacity: 1; pointer-events: auto; transform: none; }
    .peek-hint { display: none; }
    .pagination { align-items: flex-start; flex-direction: column; }
    .pagination-actions { width: 100%; }
    .pagination-actions a { flex: 1; }
    .assistant-toggle { right: 16px; bottom: 16px; }
    .assistant-window { right: 16px; bottom: 82px; height: min(560px, calc(100dvh - 108px)); }
    .login-container { padding: 16px; }
    .login-shell { min-height: 0; grid-template-columns: 1fr; }
    .login-brand-panel { min-height: 210px; padding: 24px; border-right: 0; border-bottom: 1px solid var(--border-color); }
    .login-brand-copy h1 { max-width: 14ch; font-size: 1.8rem; }
    .login-brand-copy p,
    .login-brand-footer { display: none; }
    .login-card { padding: 28px 24px 30px; }
}

@media (max-width: 520px) {
    .quick-launch { grid-template-columns: 1fr; }
    .quick-launch a,
    .quick-launch a:nth-child(2),
    .quick-launch a:nth-child(-n+2) { border-right: 0; border-bottom: 1px solid var(--border-color); }
    .quick-launch a:last-child { border-bottom: 0; }
    .activity-row { grid-template-columns: 68px minmax(0, 1fr); gap: 8px; }
    .activity-user { display: none; }
    .activity-detail { white-space: normal; }
    .catalog-meta { align-items: flex-start; flex-direction: column; }
    .network-qr { width: 64px; height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-reduced-transparency: reduce) {
    .main-header,
    .sidebar-surface,
    .assistant-window {
        background: var(--panel-solid);
        backdrop-filter: none;
    }
}

/* Stage 9 import review */
.form-stack { display: grid; gap: 14px; }
.form-stack label { display: grid; gap: 6px; color: var(--text-secondary); font-size: .86rem; }
.form-stack input, .form-stack select, .button-row select { min-height: 40px; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.text-muted { color: var(--text-muted); }
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: .72rem; font-weight: 650; letter-spacing: .02em; background: rgba(148,163,184,.14); color: var(--text-secondary); }
.status-approved, .status-committed, .status-valid { background: rgba(52,211,153,.14); color: #6ee7b7; }
.status-review, .status-staged, .status-committing, .status-queued, .status-running { background: rgba(96,165,250,.14); color: #93c5fd; }
.status-error, .status-failed, .status-rejected, .status-dead_letter, .status-disabled { background: rgba(248,113,113,.14); color: #fca5a5; }
.status-partial, .status-retry { background: rgba(251,191,36,.14); color: #fcd34d; }
.callout { padding: 12px 14px; border: 1px solid var(--border-color); border-radius: var(--radius-md); font-size: .84rem; }
.callout-info { background: rgba(96,165,250,.08); }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-grid > div { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: rgba(255,255,255,.025); }
.stat-grid strong { font-size: 1.25rem; }
.stat-grid span { color: var(--text-muted); font-size: .74rem; }
@media (max-width: 720px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
