@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
    --bg: #111217;
    --bg-soft: #16181d;
    --surface: #181b1f;
    --surface-2: #22252b;
    --surface-hover: #282b31;
    --border: rgba(204, 204, 220, 0.10);
    --border-strong: rgba(204, 204, 220, 0.16);
    --text: #ccccdc;
    --muted: #9aa0b5;
    --accent: #e87722;
    --accent-dark: #c96318;
    --accent-soft: rgba(232, 119, 34, 0.16);
    --accent-glow: rgba(232, 119, 34, 0.32);
    --success: #34d399;
    --danger: #f87171;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 18px 40px rgba(1, 4, 9, 0.45);
    --sidebar-width: 260px;
    --sidebar-top: #0e0f14;
    --topbar-bg: rgba(17, 18, 23, 0.78);
    --header-glass: rgba(17, 18, 23, 0.90);
    --card-bg: #181b1f;
    --panel-tint: #181b1f;
    --track-bg: rgba(0, 0, 0, 0.32);
    --track-border: rgba(204, 204, 220, 0.08);
    --tab-text: rgba(204, 204, 220, 0.55);
    --tab-text-hover: rgba(204, 204, 220, 0.88);
    --tab-hover-bg: rgba(204, 204, 220, 0.06);
    --tab-active-bg: #4a5568;
    --tab-active-text: #ccccdc;
    --hover-bg: rgba(204, 204, 220, 0.05);
    --active-fill: rgba(204, 204, 220, 0.10);
    --scrollbar: rgba(204, 204, 220, 0.18);
    --scrollbar-hover: rgba(204, 204, 220, 0.28);
    --chart-bar: #4a5568;
    --chart-bar-border: #5b6778;
    --chart-grid: rgba(204, 204, 220, 0.08);
    --chart-tick: #9aa0b5;
    --chart-label: #c8cde0;
    --legend-dot: #4a5568;
    --link-hover: #f08a38;
    --nav-active: #fdba74;
    --on-accent: #fff;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

html[data-theme="light"] {
    color-scheme: light;
    --bg: #f3f5f7;
    --bg-soft: #e8ecf1;
    --surface: #ffffff;
    --surface-2: #f7f8fa;
    --surface-hover: #eef1f5;
    --border: rgba(27, 36, 48, 0.10);
    --border-strong: rgba(27, 36, 48, 0.18);
    --text: #1a2330;
    --muted: #5c6778;
    --accent: #e87722;
    --accent-dark: #c96318;
    --accent-soft: rgba(232, 119, 34, 0.12);
    --accent-glow: rgba(232, 119, 34, 0.28);
    --success: #059669;
    --danger: #dc2626;
    --shadow: 0 12px 32px rgba(27, 36, 48, 0.08);
    --sidebar-top: #eef1f4;
    --topbar-bg: rgba(255, 255, 255, 0.82);
    --header-glass: rgba(243, 245, 247, 0.9);
    --card-bg: #ffffff;
    --panel-tint: #ffffff;
    --track-bg: rgba(27, 36, 48, 0.06);
    --track-border: rgba(27, 36, 48, 0.08);
    --tab-text: rgba(26, 35, 48, 0.55);
    --tab-text-hover: rgba(26, 35, 48, 0.85);
    --tab-hover-bg: rgba(27, 36, 48, 0.06);
    --tab-active-bg: #3d4a5c;
    --tab-active-text: #fff;
    --hover-bg: rgba(27, 36, 48, 0.04);
    --active-fill: rgba(27, 36, 48, 0.08);
    --scrollbar: rgba(27, 36, 48, 0.22);
    --scrollbar-hover: rgba(27, 36, 48, 0.35);
    --chart-bar: #3d4a5c;
    --chart-bar-border: #2f3a49;
    --chart-grid: rgba(27, 36, 48, 0.08);
    --chart-tick: #5c6778;
    --chart-label: #1a2330;
    --legend-dot: #3d4a5c;
    --link-hover: #c96318;
    --nav-active: #c96318;
    --on-accent: #fff;
}

body {
    margin: 0;
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
}

.container {
    width: min(1120px, 92%);
    margin: 0 auto;
}

/* ── Public header ── */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--border);
    background: var(--header-glass);
    backdrop-filter: blur(12px);
}

.header-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-mark {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    box-shadow: 0 0 20px var(--accent-glow);
    flex-shrink: 0;
}

.tenant-badge {
    background: var(--accent-soft);
    color: var(--nav-active);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    border: 1px solid rgba(232, 119, 34, 0.25);
}

nav {
    margin-left: auto;
    display: flex;
    gap: 1rem;
    align-items: center;
}

nav a {
    color: var(--muted);
    font-size: 0.9375rem;
}

nav a:hover {
    color: var(--text);
}

.user-name {
    color: var(--muted);
    font-size: 0.875rem;
}

main {
    padding: 2rem 0 4rem;
}

/* ── Landing ── */

.page-landing .landing-main {
    width: 100%;
    max-width: none;
    padding: 0 0 4rem;
}

.landing-inner {
    width: min(1120px, 92%);
    margin: 0 auto;
}

.landing-hero {
    position: relative;
    padding: 4.5rem 0 3.5rem;
    overflow: hidden;
}

.landing-hero::before {
    content: "";
    position: absolute;
    inset: -30% auto auto 18%;
    width: 640px;
    height: 640px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 68%);
    pointer-events: none;
}

.landing-hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
    gap: 3rem;
    align-items: center;
}

.landing-kicker {
    margin: 0 0 0.75rem;
    color: var(--accent);
    font-size: 0.8125rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.landing-hero h1 {
    font-size: clamp(2rem, 5vw, 3.15rem);
    line-height: 1.12;
    letter-spacing: -0.03em;
    max-width: 16ch;
    margin: 0 0 1rem;
}

.landing-hero .lead {
    font-size: 1.125rem;
    color: var(--muted);
    max-width: 48ch;
    margin: 0 0 2rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.landing-media {
    margin: 0;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.landing-media img {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: middle;
}

html[data-theme="light"] .landing-media img {
    filter: saturate(0.92) contrast(0.96);
}

.landing-section,
.landing-close,
.landing-section h2,
.landing-kicker {
    scroll-margin-top: 6.75rem;
}

.landing-section {
    padding: 4rem 0 1rem;
}

.landing-section-alt {
    padding: 3.5rem 0;
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.landing-section h2,
.landing-close h2 {
    margin: 0 0 0.85rem;
    font-size: clamp(1.45rem, 3vw, 2rem);
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.landing-intro {
    margin: 0 0 1.75rem;
    max-width: 62ch;
    color: var(--muted);
    font-size: 1.05rem;
}

.landing-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.landing-card,
.landing-roles article {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem 1.4rem;
    box-shadow: var(--shadow);
}

.landing-card h3,
.landing-roles h3,
.landing-steps h3 {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
}

.landing-card p,
.landing-roles p,
.landing-steps p,
.landing-faq p {
    margin: 0;
    color: var(--muted);
}

.landing-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 2.5rem;
    align-items: center;
}

.landing-split-reverse {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}

.landing-steps {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
    display: grid;
    gap: 1.1rem;
}

.landing-steps li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.9rem;
    align-items: start;
}

.landing-step-num {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 700;
}

.landing-roles {
    display: grid;
    gap: 0.85rem;
    margin-top: 1.5rem;
}

.landing-faq-wrap {
    max-width: 760px;
}

.landing-faq {
    display: grid;
    gap: 0.65rem;
    margin-top: 1.25rem;
}

.landing-faq details {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    padding: 0.35rem 1rem 0.35rem;
}

.landing-faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    list-style: none;
    padding: 0.85rem 0;
    font-weight: 600;
}

.landing-faq summary::after {
    content: "+";
    color: var(--muted);
    font-weight: 500;
}

.landing-faq summary::-webkit-details-marker {
    display: none;
}

.landing-faq details[open] summary {
    color: var(--accent);
}

.landing-faq details[open] summary::after {
    content: "–";
}

.landing-faq details p {
    padding: 0 0 0.95rem;
}

.landing-close {
    padding: 3.5rem 0 0;
    text-align: center;
}

.landing-close p {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.landing-foot {
    margin-top: 0.85rem !important;
    font-size: 0.875rem !important;
}

.page-landing nav {
    gap: 1.25rem;
}

.page-landing nav a[href^="#"] {
    color: var(--muted);
    font-size: 0.875rem;
}

.page-landing nav a[href^="#"]:hover {
    color: var(--text);
}

@media (max-width: 900px) {
    .landing-hero-grid,
    .landing-split,
    .landing-split-reverse,
    .landing-cards {
        grid-template-columns: 1fr;
    }

    .landing-hero {
        padding: 2.5rem 0 2rem;
    }

    .landing-hero h1 {
        max-width: none;
    }

    .page-landing .header-row {
        flex-wrap: wrap;
    }

    .page-landing nav {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .page-landing nav a[href^="#"] {
        white-space: nowrap;
        font-size: 0.8125rem;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    color: #fff;
    box-shadow: 0 10px 30px var(--accent-glow);
}

.btn-primary:hover {
    color: #fff;
    box-shadow: 0 14px 36px var(--accent-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-ghost:hover {
    background: var(--surface);
    color: var(--text);
}

.panel,
.stat-card,
.auth-card {
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem;
    box-shadow: var(--shadow);
}

.panel h2,
.panel h3 {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
}

.panel p {
    margin: 0;
    color: var(--muted);
}

/* ── Auth ── */

.auth-layout {
    min-height: calc(100vh - 80px);
    display: grid;
    place-items: center;
    padding: 2rem 0;
}

.auth-card {
    width: min(420px, 100%);
}

.auth-card h1 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
}

.auth-card label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.auth-card input {
    display: block;
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-soft);
    color: var(--text);
    font: inherit;
}

.auth-card input:focus {
    outline: none;
    border-color: rgba(232, 119, 34, 0.55);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-card button {
    width: 100%;
    margin-top: 0.5rem;
}

button,
.btn[type="submit"] {
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
}

.errorlist {
    color: var(--danger);
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

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

code {
    background: var(--surface-2);
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    font-size: 0.85em;
}

/* ── App shell (dashboard) ── */

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    padding: 1rem 0.85rem 0.85rem;
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, var(--sidebar-top), var(--bg));
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.5rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-meta {
    padding: 0 0.5rem;
    flex-shrink: 0;
}

.sidebar-meta .tenant-name {
    font-weight: 600;
    margin: 0;
}

.sidebar-meta .tenant-sub {
    margin: 0.15rem 0 0;
    font-size: 0.8125rem;
    color: var(--muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    padding: 0 0.5rem 0.25rem;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 8px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-hover);
}

.sidebar-menu-body[hidden] {
    display: none !important;
}

.sidebar-menu-toggle {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    margin: 0 0 0.35rem;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    flex: none;
    font: inherit;
    text-align: left;
    list-style: none;
}

.sidebar-menu-toggle::-webkit-details-marker {
    display: none;
}

.sidebar-menu-toggle-text {
    min-width: 0;
}

.sidebar-menu-kicker {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.sidebar-menu-current {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
}

.sidebar-menu-chevron {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--muted);
    transition: transform 0.15s ease;
}

.sidebar-menu-toggle[aria-expanded="true"] .sidebar-menu-chevron {
    transform: rotate(180deg);
}

.sidebar-menu-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
    min-height: 0;
}

.sidebar-group,
.sidebar-nav-buttons {
    display: contents;
}

.sidebar-group-label {
    margin: 0.45rem 0 0;
    padding: 0 0.35rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    flex: 0 0 auto;
}

.sidebar-menu-body > .sidebar-group-label:first-child,
.sidebar-group:first-child .sidebar-group-label {
    margin-top: 0;
}

.sidebar-link {
    display: flex;
    flex: 1 1 2.75rem;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.65rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--muted);
    text-decoration: none;
    text-align: left;
    position: relative;
    box-sizing: border-box;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-link-label {
    display: block;
    min-width: 0;
    font-size: clamp(0.8125rem, 0.74rem + 0.28vh, 0.9375rem);
    font-weight: 500;
    line-height: 1.25;
}

.sidebar-link:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
    color: var(--text);
}

.sidebar-link.active {
    background: var(--accent-soft);
    border-color: transparent;
    color: var(--nav-active);
}

.sidebar-link.active .sidebar-link-label {
    font-weight: 600;
}

.sidebar-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 2px;
    border-radius: 2px;
    background: var(--accent);
}

.sidebar-link svg {
    width: clamp(1.05rem, 0.9rem + 0.45vh, 1.35rem);
    height: clamp(1.05rem, 0.9rem + 0.45vh, 1.35rem);
    opacity: 0.9;
    flex-shrink: 0;
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.5rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.sidebar-user small {
    display: block;
    color: var(--muted);
}

.theme-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    margin-bottom: 0.85rem;
    padding: 0.2rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--track-bg);
    color: inherit;
    box-shadow: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    font-weight: 600;
}

.theme-toggle:hover {
    transform: none;
}

.theme-toggle-option {
    display: block;
    padding: 0.4rem 0.35rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    transition: background 0.15s, color 0.15s;
}

html:not([data-theme="light"]) .theme-toggle-option[data-theme-option="dark"],
html[data-theme="light"] .theme-toggle-option[data-theme-option="light"] {
    background: var(--tab-active-bg);
    color: var(--tab-active-text);
}

.site-header .theme-toggle {
    width: auto;
    min-width: 11rem;
    margin: 0;
}

@media (max-height: 760px) {
    .sidebar {
        gap: 0.75rem;
        padding: 0.85rem 0.75rem;
    }

    .sidebar-link {
        min-height: 2rem;
        padding: 0.3rem 0.5rem;
    }
}

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

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
}

.topbar h1 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.topbar-sub {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.875rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    border: 1px solid var(--border);
    background: var(--surface);
}

.status-pill.success {
    color: var(--success);
    border-color: rgba(52, 211, 153, 0.25);
    background: rgba(52, 211, 153, 0.08);
}

.status-pill.warning {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.25);
    background: rgba(251, 191, 36, 0.08);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.dashboard-content {
    padding: 1.5rem 1.75rem 2.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.15rem 1.2rem;
}

.stat-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.55;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 0.8125rem;
    margin-bottom: 0.45rem;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-value.stat-small {
    font-size: 1rem;
    font-weight: 600;
}

.stat-foot {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.panel {
    padding: 1.25rem;
}

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

.panel-header h2 {
    margin: 0;
    font-size: 1rem;
}

.chart-wrap {
    position: relative;
    height: 280px;
}

.dish-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.dish-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    border: 1px solid var(--border);
}

.dish-name {
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dish-qty,
.dish-revenue {
    font-size: 0.8125rem;
    color: var(--muted);
    white-space: nowrap;
}

.dish-revenue {
    color: var(--nav-active);
    font-weight: 600;
}

.meta-list {
    display: grid;
    gap: 0.75rem;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.meta-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.meta-row span:last-child {
    color: var(--text);
    font-weight: 500;
}

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

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.report-table th,
.report-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.report-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.report-table tbody tr:last-child td {
    border-bottom: none;
}

.report-table td.num,
.report-table th.num {
    text-align: right;
    white-space: nowrap;
}

.report-table tbody tr:hover td {
    background: var(--panel-tint);
}

.report-section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.report-section-nav a {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.8125rem;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.report-section-nav a:hover {
    color: var(--text);
    border-color: rgba(232, 119, 34, 0.45);
    background: rgba(232, 119, 34, 0.08);
}

.period-filter {
    position: relative;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel-tint);
    overflow: visible;
}

.period-filter-dept {
    display: flex;
    align-items: center;
    min-width: 0;
    margin: 0;
}

.period-filter-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem 1rem;
    min-width: 0;
}

.period-filter.has-dept .period-filter-right {
    margin-left: auto;
}

.period-filter:not(.has-dept) .period-filter-right {
    width: 100%;
    justify-content: space-between;
}

.period-preset-field .period-filter-select {
    min-width: 13.5rem;
}

.period-filter-custom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.period-filter-field {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.8125rem;
}

.period-date-range {
    position: relative;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.period-date-btn {
    display: inline-flex;
    align-items: center;
    min-width: 7.5rem;
    min-height: 2.15rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.period-date-btn:hover,
.period-date-btn[aria-expanded="true"] {
    border-color: rgba(232, 119, 34, 0.55);
    background: rgba(232, 119, 34, 0.08);
}

.period-date-popover {
    position: absolute;
    z-index: 40;
    top: calc(100% + 0.4rem);
    right: 0;
    width: min(18.5rem, calc(100vw - 2rem));
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.period-date-popover[hidden] {
    display: none;
}

.period-date-popover-head {
    display: grid;
    grid-template-columns: 2rem 1fr 2rem;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.55rem;
}

.period-date-title {
    text-align: center;
    font-size: 0.875rem;
    font-weight: 650;
}

.period-date-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-soft);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
}

.period-date-nav:hover {
    border-color: rgba(232, 119, 34, 0.45);
}

.period-date-weekdays,
.period-date-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.2rem;
}

.period-date-weekdays {
    margin-bottom: 0.35rem;
    color: var(--muted);
    font-size: 0.7rem;
    text-align: center;
}

.period-date-day {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
}

.period-date-day.is-empty {
    pointer-events: none;
}

.period-date-day.is-in-range {
    background: rgba(232, 119, 34, 0.12);
}

.period-date-day.is-from,
.period-date-day.is-to,
.period-date-day.is-active {
    background: var(--accent);
    color: #fff;
    font-weight: 650;
}

.period-date-day.is-disabled {
    color: var(--muted);
    opacity: 0.45;
    cursor: not-allowed;
}

.period-date-hint {
    margin: 0.55rem 0 0;
    color: var(--muted);
    font-size: 0.75rem;
    text-align: center;
}

.period-filter-field input[type="date"],
.period-filter-select {
    appearance: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.4rem 0.75rem;
    font: inherit;
    font-size: 0.8125rem;
    line-height: 1.2;
    min-height: 2.15rem;
    color-scheme: inherit;
    box-shadow: inset 0 0 0 1px transparent;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.period-filter-field input[type="date"]:hover,
.period-filter-select:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.period-filter-field input[type="date"]:focus,
.period-filter-select:focus {
    outline: none;
    border-color: rgba(232, 119, 34, 0.55);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.period-filter-select-wrap {
    position: relative;
    display: inline-flex;
    min-width: 0;
    max-width: 22rem;
}

.period-filter-select {
    width: 100%;
    min-width: 14rem;
    padding-right: 2.1rem;
    cursor: pointer;
}

.period-filter-select-wrap::after {
    content: "";
    position: absolute;
    right: 0.85rem;
    top: 50%;
    width: 0.45rem;
    height: 0.45rem;
    border-right: 1.5px solid var(--muted);
    border-bottom: 1.5px solid var(--muted);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

.period-filter-select option {
    background-color: var(--surface-2);
    color: var(--text);
}

.period-dept-wrap {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
}

.period-dept-wrap::after {
    top: 1.075rem;
}

.period-dept-btn {
    display: inline-flex;
    align-items: center;
    text-align: left;
    background: var(--surface);
}

.period-dept-btn.has-value {
    border-color: rgba(232, 119, 34, 0.45);
}

.period-dept-value {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.period-dept-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 0.35rem);
    left: 0;
    right: auto;
    min-width: 100%;
    width: max(100%, 18rem);
    max-height: 22rem;
    display: flex;
    flex-direction: column;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.period-dept-menu[hidden] {
    display: none;
}

.period-dept-search {
    width: 100%;
    margin-bottom: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--hover-bg);
    color: var(--text);
    padding: 0.35rem 0.5rem;
    font: inherit;
    font-size: 0.8125rem;
}

.period-dept-search:focus {
    outline: none;
    border-color: rgba(232, 119, 34, 0.55);
}

.period-dept-options {
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-height: 0;
    flex: 1;
    max-height: 14rem;
}

.period-dept-option {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.35rem 0.2rem;
    color: var(--text);
    font-size: 0.8125rem;
    cursor: pointer;
}

.period-dept-option[hidden] {
    display: none;
}

.period-dept-option input {
    margin: 0.15rem 0 0;
    accent-color: var(--accent);
}

.period-dept-all {
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.35rem;
    padding-bottom: 0.45rem;
    font-weight: 600;
}

.period-dept-error {
    margin: 0.5rem 0 0;
    color: #e08b7a;
    font-size: 0.75rem;
    line-height: 1.35;
}

.period-dept-error[hidden] {
    display: none;
}

.period-dept-apply {
    margin-top: 0.55rem;
    width: 100%;
    text-align: center;
}

.period-filter-apply {
    border: 1px solid rgba(232, 119, 34, 0.45);
    background: rgba(232, 119, 34, 0.12);
    color: var(--text);
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    font-size: 0.8125rem;
    cursor: pointer;
}

.period-filter-apply:hover {
    background: rgba(232, 119, 34, 0.2);
}

@media (max-width: 1100px) {
    .period-filter.has-dept .period-filter-right {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .period-filter-select {
        min-width: 12rem;
    }
}

.dashboard-page-loading {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(14, 15, 20, 0.52);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

html[data-theme="light"] .dashboard-page-loading {
    background: rgba(243, 245, 247, 0.72);
}

.dashboard-page-loading[hidden] {
    display: none !important;
}

.dashboard-page-loading-panel {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.35rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: var(--header-glass);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
}

.dashboard-page-loading-spinner {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    animation: dashboard-page-loading-spin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes dashboard-page-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-page-loading-spinner {
        animation: none;
        border-top-color: var(--accent);
        opacity: 0.85;
    }
}

body.dashboard-is-loading {
    cursor: progress;
}

body.dashboard-is-loading .app-main,
body.dashboard-is-loading .sidebar {
    pointer-events: none;
    user-select: none;
}

.sidebar-link.is-nav-loading {
    color: var(--accent);
}

.sidebar-link.is-nav-loading .sidebar-link-label {
    opacity: 0.85;
}

.dashboard-workspace {
    width: 100%;
}

.dashboard-workspace .report-pane {
    width: 100%;
    padding: 1.25rem 1.35rem;
}

.app-shell.shell-fill {
    height: 100vh;
    overflow: hidden;
}

.app-shell.shell-fill .app-main {
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.app-shell.shell-fill .dashboard-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.75rem 1rem;
    overflow: hidden;
}

.app-shell.shell-fill .dashboard-workspace,
.app-shell.shell-fill .report-pane,
.app-shell.shell-fill #key-indicators-root,
.app-shell.shell-fill #cash-registers-root,
.app-shell.shell-fill #dish-analysis-root,
.app-shell.shell-fill #abc-analysis-root,
.app-shell.shell-fill #period-comparison-root,
.app-shell.shell-fill #week-summary-root,
.app-shell.shell-fill #planning-root {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.app-shell.shell-fill .ki-cards,
.app-shell.shell-fill .cr-top,
.app-shell.shell-fill .ki-metric-tabs,
.app-shell.shell-fill .ki-chart-header,
.app-shell.shell-fill .da-filters,
.app-shell.shell-fill .da-chart-block .ki-metric-tabs,
.app-shell.shell-fill .abc-toolbar,
.app-shell.shell-fill .abc-cards,
.app-shell.shell-fill .pc-toolbar,
.app-shell.shell-fill .pc-cards,
.app-shell.shell-fill .ws-toolbar,
.app-shell.shell-fill .ws-cards,
.app-shell.shell-fill .pl-hint-row,
.app-shell.shell-fill .pl-detail-panel,
.app-shell.shell-fill .pl-metric-tabs {
    flex-shrink: 0;
}

.app-shell.shell-fill .ki-chart-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.app-shell.shell-fill .ki-chart-scroll {
    flex: 1;
    min-height: 0;
}

.app-shell.shell-fill .ki-chart-inner,
.app-shell.shell-fill .ki-chart-wrap {
    height: 100%;
}

.report-pane[hidden] {
    display: none;
}

.ki-cards {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ki-card {
    container-type: inline-size;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 5.5rem;
    padding: 0.9rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    text-align: center;
}

.ki-card-value {
    display: block;
    max-width: 100%;
    font-size: 1.55rem;
    font-size: clamp(0.7rem, 13cqi, 1.55rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    white-space: nowrap;
}

.ki-card-label {
    display: block;
    max-width: 100%;
    margin-top: 0.45rem;
    color: var(--muted);
    font-size: 0.75rem;
    font-size: clamp(0.625rem, 5.2cqi, 0.75rem);
    line-height: 1.3;
}

.ki-metric-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.1rem 0.15rem;
    margin-bottom: 0.65rem;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.ki-metric-tab {
    padding: 0.45rem 0.75rem 0.55rem;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.8125rem;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    box-shadow: none;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.ki-metric-tab:hover {
    color: var(--text);
    background: transparent;
}

.ki-metric-tab.active {
    color: var(--text);
    background: transparent;
    box-shadow: none;
    border-bottom-color: var(--accent);
    font-weight: 650;
}

.ki-chart-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel-tint);
    overflow: hidden;
}

.ki-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--panel-tint);
}

.ki-chart-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
}

.ki-type-tabs,
.ki-hierarchy-tabs {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    border: none;
    border-radius: 0;
    overflow: visible;
    background: transparent;
}

.ki-chart-toolbar .ki-type-tabs,
.ki-chart-toolbar .ki-hierarchy-tabs {
    flex-wrap: nowrap;
    gap: 0;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    background: var(--hover-bg);
}

.ki-type-tab,
.ki-hierarchy-tab {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 0.8125rem;
    cursor: pointer;
    box-shadow: none;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.ki-type-tab:hover,
.ki-hierarchy-tab:hover,
.ki-type-tab.active,
.ki-hierarchy-tab.active {
    color: var(--text);
    border-color: rgba(232, 119, 34, 0.45);
    background: rgba(232, 119, 34, 0.08);
    box-shadow: none;
}

.ki-chart-toolbar .ki-type-tab,
.ki-chart-toolbar .ki-hierarchy-tab {
    border: none;
    border-radius: 999px;
    background: transparent;
    padding: 0.4rem 0.85rem;
}

.ki-chart-toolbar .ki-type-tab:hover,
.ki-chart-toolbar .ki-hierarchy-tab:hover {
    color: var(--text);
    border: none;
    background: transparent;
}

.ki-chart-toolbar .ki-type-tab.active,
.ki-chart-toolbar .ki-hierarchy-tab.active {
    color: #fff;
    border: none;
    background: var(--accent);
}

.ki-chart-toolbar a.ki-hierarchy-tab,
.ki-chart-toolbar a.ki-type-tab {
    color: var(--muted);
}

.ki-chart-toolbar a.ki-hierarchy-tab:hover,
.ki-chart-toolbar a.ki-type-tab:hover {
    color: var(--text);
}

.ki-chart-toolbar a.ki-hierarchy-tab.active,
.ki-chart-toolbar a.ki-type-tab.active,
.ki-chart-toolbar a.ki-hierarchy-tab.active:hover,
.ki-chart-toolbar a.ki-type-tab.active:hover {
    color: #fff;
    background: var(--accent);
}

.ki-chart-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar) transparent;
}

.ki-chart-scroll::-webkit-scrollbar {
    height: 8px;
}

.ki-chart-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.ki-chart-scroll::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 999px;
}

.ki-chart-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-hover);
}

.ki-chart-inner {
    position: relative;
    height: 640px;
    min-width: 100%;
}

.ki-chart-wrap {
    position: relative;
    height: 640px;
    padding: 0.75rem 0.5rem 0.25rem;
}

.ki-chart-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.8125rem;
}

.ki-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    padding: 0.15rem 0.3rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: inherit;
    line-height: 1.3;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, opacity 0.15s;
}

.ki-legend-item:hover {
    color: var(--text);
    background: var(--hover-bg);
}

.ki-legend-item.is-hidden {
    opacity: 0.5;
    text-decoration: line-through;
}

.ki-legend-item.is-hidden .ki-legend-dot {
    background: var(--muted) !important;
}

.ki-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--legend-dot);
}

.pc-toolbar {
    display: block;
    margin-bottom: 0.85rem;
    overflow: visible;
}

.pc-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.85rem;
    min-width: 0;
}

.pc-toolbar-row-main {
    flex-wrap: nowrap;
    gap: 0.65rem;
    overflow: visible;
}

.pc-toolbar-row-main .pc-grain-toolbar {
    flex: 0 0 auto;
}

.pc-toolbar-filter-sep {
    flex: 0 0 1px;
    align-self: stretch;
    min-height: 2rem;
    margin: 0 0.15rem;
    background: var(--border);
}

.pc-toolbar-row-main .abc-filter.pc-period-filter {
    flex: 0 1 auto;
    min-width: 9rem;
    max-width: 20rem;
}

.pc-toolbar-row-main .abc-filter.pc-filter {
    flex: 1 1 9rem;
    min-width: 8.5rem;
    max-width: 15rem;
}

.ws-toolbar.pc-toolbar {
    overflow: visible;
}

.ws-toolbar .pc-toolbar-row-main {
    overflow: visible;
}

.pc-grain-toolbar {
    flex-shrink: 0;
    max-width: 100%;
}

.pc-grain-toolbar .ki-hierarchy-tabs {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
}

.pc-grain-toolbar .ki-hierarchy-tab {
    flex-shrink: 0;
    white-space: nowrap;
}

.pc-grain-toolbar a.ki-hierarchy-tab.pc-grain-tab.active,
.pc-grain-toolbar a.ki-hierarchy-tab.pc-grain-tab.active:visited,
.pc-grain-toolbar a.ki-hierarchy-tab.pc-grain-tab.active:hover {
    color: #fff;
    border: none;
    background: var(--accent);
}

.pc-grain-tab {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 0.8125rem;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.pc-grain-tab:hover,
.pc-grain-tab.active {
    color: var(--text);
    border-color: rgba(232, 119, 34, 0.45);
    background: rgba(232, 119, 34, 0.08);
}

.pc-period-field {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.pc-period-field-custom {
    align-items: flex-end;
}

.pc-period-date-range {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.pc-period-range-sep {
    color: var(--muted);
    font-size: 0.8125rem;
}

.pc-period-caption {
    color: var(--muted);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.pc-toolbar .abc-filter.pc-filter,
.pc-toolbar .abc-filter.pc-period-filter {
    position: relative;
    min-width: 12.5rem;
    flex: 1 1 12.5rem;
    max-width: 20rem;
}

.pc-period-picker-btn .pc-swatch {
    flex: 0 0 auto;
}

.pc-period-picker-options {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    max-height: 14rem;
    overflow: auto;
}

.pc-period-picker-option {
    width: 100%;
    margin: 0;
    padding: 0.45rem 0.55rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.8125rem;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
}

.pc-period-picker-option:hover,
.pc-period-picker-option.is-selected {
    background: rgba(232, 119, 34, 0.12);
}

.pc-period-picker-option[hidden] {
    display: none;
}

.pc-period-date-control {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem 0.55rem;
    width: 100%;
    cursor: default;
}

.pc-period-date-control .period-date-btn {
    min-width: 0;
    min-height: 0;
    padding: 0.15rem 0.35rem;
    border: none;
    border-radius: 6px;
    background: transparent;
}

.pc-period-date-control .period-date-btn:hover,
.pc-period-date-control .period-date-btn[aria-expanded="true"] {
    background: rgba(232, 119, 34, 0.1);
}

.pc-period-date-control .pc-period-date-range {
    flex: 1 1 auto;
    min-width: 0;
}

.pc-filter {
    min-width: 0;
}

.pc-filter-btn,
.pc-filter-clear {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 8px;
    font-size: 0.8125rem;
    cursor: pointer;
}

.pc-filter-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.15rem;
    padding: 0.4rem 0.75rem;
    text-align: left;
}

.pc-filter-btn:hover,
.pc-filter-btn.has-value,
.pc-filter-btn[aria-expanded="true"] {
    border-color: rgba(232, 119, 34, 0.55);
}

.pc-filter-btn.has-value,
.pc-filter-btn[aria-expanded="true"] {
    background: rgba(232, 119, 34, 0.1);
}

.pc-filter-value {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pc-filter-btn:not(.has-value) .pc-filter-value {
    color: var(--muted);
}

.pc-filter-caret {
    flex: 0 0 auto;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 4px 0 4px;
    border-color: var(--muted) transparent transparent transparent;
}

.pc-filter-btn[aria-expanded="true"] .pc-filter-caret {
    transform: rotate(180deg);
}

.pc-filter-menu {
    position: absolute;
    z-index: 80;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-height: 18rem;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.pc-filter-menu[hidden] {
    display: none;
}

.pc-filter-search {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-soft);
    color: var(--text);
    padding: 0.4rem 0.6rem;
    font: inherit;
    font-size: 0.8125rem;
}

.pc-filter-options {
    overflow: auto;
    max-height: 11rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.pc-filter-option {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.25rem 0.15rem;
    color: var(--text);
    font-size: 0.8125rem;
    cursor: pointer;
}

.pc-filter-option[hidden] {
    display: none;
}

.pc-filter-clear {
    align-self: flex-start;
    padding: 0.3rem 0.65rem;
    background: transparent;
    color: var(--muted);
}

.pc-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pc-swatch-a,
.pc-legend-a {
    background: var(--chart-bar);
}

.pc-swatch-b,
.pc-legend-b {
    background: var(--accent);
}

.pc-cards {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pc-card {
    container-type: inline-size;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 6.4rem;
    padding: 0.75rem 0.5rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    text-align: center;
}

.pc-card-values {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    width: 100%;
}

.pc-card-value-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.2rem 0.35rem;
    max-width: 100%;
    min-width: 0;
}

.pc-card-value {
    display: block;
    max-width: 100%;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    white-space: nowrap;
}

.pc-card-value.is-a {
    color: var(--muted);
    font-size: clamp(0.62rem, 9cqi, 0.95rem);
    font-weight: 600;
}

.pc-card-value.is-b {
    font-size: clamp(0.7rem, 12cqi, 1.35rem);
}

.pc-card-delta {
    font-size: clamp(0.625rem, 6cqi, 0.8rem);
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
}

.pc-card-delta.up {
    color: var(--success);
}

.pc-card-delta.down {
    color: var(--danger);
}

.pc-card-delta.flat,
.pc-card-delta.none {
    color: var(--muted);
}

.pc-card-label {
    display: block;
    max-width: 100%;
    margin-top: 0.35rem;
    color: var(--muted);
    font-size: clamp(0.625rem, 5.2cqi, 0.75rem);
    line-height: 1.3;
}

.period-filter.dates-hidden {
    justify-content: flex-start;
}

.cr-top {
    display: grid;
    grid-template-columns: minmax(260px, 0.4fr) minmax(0, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
    min-height: 0;
}

.app-shell.shell-fill .cr-top {
    flex: 0 1 auto;
    max-height: 46%;
}

.cr-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    align-content: start;
    min-width: 0;
}

.cr-card-span {
    grid-column: 1 / -1;
}

.app-shell.shell-fill .cr-table-panel {
    max-height: none;
}

.cr-table-panel {
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel-tint);
}

.cr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.cr-table th,
.cr-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.cr-table th.num,
.cr-table td.num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.cr-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-soft);
}

.cr-group-row {
    cursor: pointer;
}

.cr-group-row td {
    font-weight: 600;
    background: var(--card-bg);
}

.cr-group-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.cr-toggle {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.cr-toggle:hover {
    color: var(--text);
    background: var(--tab-hover-bg);
}

.cr-toggle::before {
    content: "";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 4px 0 4px 6px;
    border-color: transparent transparent transparent currentColor;
    transform: rotate(90deg);
    transform-origin: 30% 50%;
}

.cr-toggle[aria-expanded="false"]::before {
    transform: rotate(0deg);
}

.cr-type-label {
    padding-left: 1.85rem;
    color: var(--muted);
}

.cr-table tfoot td {
    font-weight: 700;
    border-bottom: none;
    background: var(--hover-bg);
}

.cr-chart-panel .ki-chart-header {
    justify-content: flex-end;
}

.cr-chart-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    row-gap: 0.45rem;
    padding: 0.65rem 1rem 0.15rem;
}

.cr-chart-panel {
    min-height: 280px;
}

@media (max-width: 1100px) {
    .cr-top {
        grid-template-columns: 1fr;
        max-height: none;
    }

    .app-shell.shell-fill .cr-top {
        max-height: none;
    }

    .cr-table-panel {
        max-height: 22rem;
    }
}

@media (max-width: 1200px) {
    .ki-cards,
    .pc-cards,
    .ws-cards {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .ki-cards,
    .pc-cards,
    .ws-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ki-chart-header {
        flex-direction: column;
        align-items: stretch;
    }
}

.empty-note {
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--muted);
    font-size: 0.875rem;
}

.da-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem 1rem;
    margin-bottom: 0.85rem;
}

.da-mode-wrap {
    display: flex;
    flex: 0 0 auto;
}

.da-mode-tabs.ki-type-tabs {
    flex-wrap: nowrap;
    padding: 3px;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    background: var(--hover-bg);
}

.da-mode-tabs .ki-type-tab {
    min-width: 0;
    padding: 0.45rem 1rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    color: var(--muted);
    font-weight: 600;
}

.da-mode-tabs .ki-type-tab:hover {
    color: var(--text);
    background: transparent;
    border: none;
}

.da-mode-tabs .ki-type-tab.active {
    color: #fff;
    background: var(--accent);
    box-shadow: none;
    border: none;
}

.da-filter {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 18rem;
    flex: 1 1 18rem;
    max-width: 26rem;
}

.da-filter[hidden] {
    display: none;
}

.da-filter-label {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.da-filter-btn,
.da-filter-clear {
    border: 1px solid var(--border);
    background: var(--hover-bg);
    color: var(--text);
    border-radius: 8px;
    padding: 0.45rem 0.8rem;
    font-size: 0.8125rem;
    cursor: pointer;
}

.da-filter-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 2.75rem;
    padding: 0.45rem 0.75rem 0.45rem 0.7rem;
    text-align: left;
}

.da-filter-btn:hover {
    border-color: rgba(232, 119, 34, 0.55);
}

.da-filter-btn.has-value,
.da-filter-btn[aria-expanded="true"] {
    border-color: rgba(232, 119, 34, 0.7);
    background: rgba(232, 119, 34, 0.1);
}

.da-filter-icon {
    flex: 0 0 auto;
    width: 1.05rem;
    height: 1.05rem;
    opacity: 0.75;
    background: currentColor;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 5h18l-7 8v5l-4 2v-7z'/></svg>") center / contain no-repeat;
}

.da-filter-value {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.da-filter-btn:not(.has-value) .da-filter-value {
    font-weight: 500;
    color: var(--muted);
}

.da-filter-caret {
    flex: 0 0 auto;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 4px 0 4px;
    border-color: var(--muted) transparent transparent transparent;
}

.da-filter-btn[aria-expanded="true"] .da-filter-caret {
    transform: rotate(180deg);
}

.da-filter-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    min-width: 100%;
    max-width: none;
    max-height: 18rem;
    display: flex;
    flex-direction: column;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.da-filter-menu[hidden] {
    display: none;
}

.da-filter-search {
    width: 100%;
    margin-bottom: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--hover-bg);
    color: var(--text);
    padding: 0.35rem 0.5rem;
    font-size: 0.8125rem;
}

.da-filter-options {
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-height: 0;
    flex: 1;
}

.da-filter-option {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.25rem 0.15rem;
    color: var(--text);
    font-size: 0.8125rem;
    cursor: pointer;
}

.da-filter-clear {
    margin-top: 0.5rem;
    width: 100%;
}

.da-chart-panel {
    min-height: 240px;
    overflow: hidden;
}

.da-chart-block {
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    position: relative;
    z-index: 2;
}

.da-chart-block.is-empty .ki-chart-header,
.da-chart-panel .ki-chart-header[hidden] {
    display: none !important;
}

.da-chart-panel .ki-chart-header {
    justify-content: flex-end;
}

.da-chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 180px;
    padding: 1.5rem 1.75rem;
    color: var(--muted);
    text-align: center;
    font-size: 0.875rem;
    line-height: 1.45;
}

.da-chart-empty[hidden] {
    display: none;
}

.da-chart-empty-title {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
    font-weight: 650;
}

.da-chart-empty p {
    margin: 0;
    max-width: 36rem;
}

.app-shell.shell-fill .da-table-panel {
    flex: 1.15;
    min-height: 180px;
    overflow: auto;
}

.app-shell.shell-fill .da-chart-block {
    flex: 0.95;
    min-height: 240px;
    overflow: hidden;
}

.app-shell.shell-fill .da-chart-panel {
    flex: 1;
    min-height: 180px;
    overflow: hidden;
}

.app-shell.shell-fill .da-chart-panel .ki-chart-scroll {
    min-height: 0;
}

.app-shell.shell-fill .da-chart-panel .ki-chart-inner {
    height: 100%;
}

.da-table-panel {
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel-tint);
}

.da-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.da-table th,
.da-table td {
    padding: 0.45rem 0.65rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.da-table th.num,
.da-table td.num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.da-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-soft);
    padding: 0;
}

.da-sort {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.5rem 0.65rem;
    cursor: pointer;
    text-align: inherit;
}

.da-table th.num .da-sort {
    text-align: right;
}

.da-sort:hover,
.da-sort.sorted {
    color: var(--text);
}

.da-sort.sorted.desc::after {
    content: " ↓";
}

.da-sort.sorted.asc::after {
    content: " ↑";
}

.da-group-row {
    cursor: pointer;
}

.da-group-row td {
    font-weight: 600;
    background: var(--card-bg);
}

.da-group-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.da-dish-label {
    padding-left: 1.85rem;
    color: var(--muted);
}

@media (max-width: 900px) {
    .da-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .da-mode-tabs.ki-type-tabs {
        width: 100%;
    }

    .da-mode-tabs .ki-type-tab {
        flex: 1 1 0;
        text-align: center;
    }
}

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

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

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

    .sidebar {
        position: relative;
        height: auto;
        max-height: none;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-nav {
        max-height: none;
        overflow: visible;
    }

    .sidebar-menu-toggle {
        display: flex;
    }

    .sidebar-menu-body,
    .sidebar-group,
    .sidebar-nav-buttons,
    .sidebar-link {
        flex: none;
        height: auto;
    }

    .sidebar-link {
        min-height: 2.75rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .topbar,
    .dashboard-content {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .app-shell.shell-fill {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .app-shell.shell-fill .app-main,
    .app-shell.shell-fill .dashboard-content,
    .app-shell.shell-fill .dashboard-workspace,
    .app-shell.shell-fill .report-pane,
    .app-shell.shell-fill #key-indicators-root,
    .app-shell.shell-fill #cash-registers-root,
    .app-shell.shell-fill #period-comparison-root,
    .app-shell.shell-fill .ki-chart-panel,
    .app-shell.shell-fill .ki-chart-scroll {
        height: auto;
        overflow: visible;
    }

    .app-shell.shell-fill .ki-chart-inner,
    .app-shell.shell-fill .ki-chart-wrap {
        height: 360px;
    }

    .report-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Alliance B report ── */

.report-note {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(232, 119, 34, 0.25);
    background: var(--accent-soft);
    color: var(--nav-active);
    font-size: 0.875rem;
}

.report-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1rem;
}

.report-panel {
    padding: 1rem;
}

.report-section-title {
    margin: 0 0 0.85rem;
    font-size: 0.95rem;
    color: var(--nav-active);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

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

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.report-table th,
.report-table td {
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}

.report-table th:first-child,
.report-table td:first-child,
.report-table thead th:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--surface-2);
}

.report-table thead th {
    color: var(--muted);
    font-weight: 600;
    background: var(--bg-soft);
}

.report-table tbody th {
    color: var(--text);
    font-weight: 500;
}

.report-table tbody tr:hover td,
.report-table tbody tr:hover th {
    background: var(--panel-tint);
}

.report-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.report-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.report-list li:last-child {
    border-bottom: none;
}

.report-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── TZ report ── */

.tz-report-shell {
    margin-top: 0;
}

.tz-report-tables {
    --tz-label-pct: 22%;
    --tz-data-col-pct: calc(
        (100% - var(--tz-label-pct)) / (var(--tz-month-cols, 3) + var(--tz-week-cols, 5))
    );
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.tz-report-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tz-report-table {
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
    box-shadow: var(--shadow);
    overflow: visible;
    width: 100%;
    min-width: 100%;
    scrollbar-color: rgba(232, 119, 34, 0.45) var(--surface);
}

.tz-report-table:focus-within {
    border-color: rgba(232, 119, 34, 0.35);
    box-shadow: var(--shadow), 0 0 0 1px rgba(232, 119, 34, 0.12);
}

.tz-grid {
    --tz-label-bg: #1c2028;
    --tz-label-bg-alt: #181c24;
    --tz-head-bg: #22252b;
    --tz-value-bg: #181b1f;
    --tz-value-bg-alt: #15181c;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
    table-layout: fixed;
}

.tz-grid col.col-label-left {
    width: var(--tz-label-pct);
}

.tz-grid col.col-label-right {
    width: var(--tz-label-pct);
}

.tz-grid col.col-month {
    width: var(--tz-data-col-pct);
}

.tz-grid col.col-week {
    width: var(--tz-data-col-pct);
}

.tz-grid col.col-gap {
    width: 18px;
}

.tz-grid col.col-gap-small {
    width: 10px;
}

.tz-grid th,
.tz-grid td {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0.65rem;
    vertical-align: middle;
}

.tz-grid tr > :last-child {
    border-right: none;
}

.tz-grid tbody tr:last-child > * {
    border-bottom: none;
}

.tz-grid .tz-label {
    position: sticky;
    left: 0;
    z-index: 2;
    text-align: left;
    font-weight: 500;
    background: var(--tz-label-bg);
    color: var(--text);
    white-space: normal;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.18);
}

.tz-grid .tz-label-right {
    background: #232833;
}

.tz-grid .tz-head-month {
    background: linear-gradient(180deg, #2a303a 0%, var(--tz-head-bg) 100%);
    color: #ffc285;
}

.tz-grid .tz-head-week {
    background: linear-gradient(180deg, #1a1e26 0%, #16191f 100%);
    color: #9aa0b5;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.tz-week-start {
    border-left: 2px solid rgba(232, 119, 34, 0.5) !important;
    box-shadow: inset 3px 0 8px rgba(232, 119, 34, 0.08);
}

.tz-row-section .tz-head-week {
    border-bottom: 1px solid rgba(143, 168, 199, 0.2);
}

.tz-grid .tz-value-month {
    background: var(--tz-value-bg);
    color: #ccccdc;
}

.tz-grid .tz-value-week {
    background: #14171c;
    color: #9aa0b5;
}

.tz-grid tbody tr:nth-child(even):not(.tz-row-section):not(.tz-row-title):not(.tz-row-spacer) .tz-value-month {
    background: var(--tz-value-bg-alt);
}

.tz-grid tbody tr:nth-child(even):not(.tz-row-section):not(.tz-row-title):not(.tz-row-spacer) .tz-value-week {
    background: #12151a;
}

.tz-row-data:hover .tz-value-month {
    background: #282b31;
    color: #fff;
}

.tz-row-data:hover .tz-value-week {
    background: #22252b;
    color: #ccccdc;
}

.tz-grid tbody tr:nth-child(even).tz-row-data:hover .tz-value-month {
    background: #252830;
}

.tz-grid tbody tr:nth-child(even).tz-row-data:hover .tz-value-week {
    background: #1c2028;
}

.tz-grid .tz-head {
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    color: #ffc285;
    background: var(--tz-head-bg);
    white-space: nowrap;
}

.tz-grid .tz-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.tz-grid .tz-gap,
.tz-grid .tz-gap-small {
    border: none !important;
    background: transparent !important;
    padding: 0;
    width: 18px;
}

.tz-row-spacer td {
    height: 1.1rem;
    border: none !important;
    background: transparent !important;
    padding: 0;
    line-height: 0;
}

.tz-row-section .tz-label {
    z-index: 3;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.8125rem;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(90deg, rgba(232, 119, 34, 0.28) 0%, var(--tz-head-bg) 42%);
    box-shadow: inset 3px 0 0 var(--accent);
}

.tz-row-section .tz-head {
    background: linear-gradient(180deg, #2a303a 0%, var(--tz-head-bg) 100%);
    border-bottom: 1px solid rgba(232, 119, 34, 0.22);
}

.tz-row-title th,
.tz-row-title td {
    background: var(--tz-head-bg);
    font-weight: 700;
    text-align: left;
}

.tz-row-title .tz-gap {
    border: none !important;
    background: transparent !important;
}

.tz-row-title th:first-child {
    font-size: 0.95rem;
    letter-spacing: 0.05em;
}

.tz-row-subheader .tz-label,
.tz-row-subheader .tz-value {
    background: #1c2028;
    font-weight: 600;
}

.tz-row-data {
    transition: background 0.15s ease;
}

.tz-row-data:hover .tz-label {
    background: var(--surface-hover);
}

.tz-grid tbody tr:nth-child(even):not(.tz-row-section):not(.tz-row-title):not(.tz-row-spacer) .tz-label {
    background: var(--tz-label-bg-alt);
}

.tz-grid tbody tr:nth-child(even).tz-row-data:hover .tz-label {
    background: #282b31;
}

.tz-report-chart {
    padding: 0 1rem 1rem;
    width: 100%;
}

.tz-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
}

.tz-chart-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
}

.tz-chart-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tz-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8125rem;
    color: var(--muted);
}

.tz-chart-legend-item::before {
    content: "";
    width: 1.75rem;
    height: 0;
    border-top: 2.5px solid transparent;
}

.tz-chart-legend-fact::before {
    border-top-color: #e87722;
}

.tz-chart-legend-plan::before {
    border-top-color: #6ea8e8;
    border-top-style: dashed;
}

.tz-chart-wrap {
    position: relative;
    height: 320px;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
    box-shadow: var(--shadow);
    padding: 1rem 1rem 0.5rem;
}

.tz-grid-slots {
    --tz-slot-label-pct: 14%;
    --tz-metric-label-pct: 16%;
    --tz-data-col-pct: calc(
        (100% - var(--tz-slot-label-pct) - var(--tz-metric-label-pct) - 12%) /
        var(--tz-slots-week-cols, 5)
    );
    --tz-slots-week-cols: 5;
}

.tz-grid-slots col.col-label-slot {
    width: var(--tz-slot-label-pct);
}

.tz-grid-slots col.col-label-metric {
    width: var(--tz-metric-label-pct);
}

.tz-grid-slots col.col-dynamics {
    width: 12%;
}

.tz-grid-slots .tz-label-slot {
    vertical-align: middle;
    text-align: center;
    font-weight: 700;
    line-height: 1.35;
}

.tz-grid-slots .tz-label-metric {
    font-weight: 500;
    color: #c8cde0;
}

.tz-grid-slots .tz-head-dynamics {
    font-size: 0.6875rem;
    line-height: 1.25;
    white-space: normal;
}

.tz-grid-slots .tz-value-dynamics {
    vertical-align: middle;
    text-align: center;
    padding: 0.5rem 0.65rem;
    min-width: 7rem;
}

.tz-row-guest-fact .tz-label-metric,
.tz-row-guest-fact .tz-value-week {
    background: rgba(110, 168, 232, 0.14);
}

.tz-row-guest-fact .tz-label-slot {
    background: rgba(110, 168, 232, 0.18);
}

.tz-sparkline-chart {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 7.5rem;
}

.tz-sparkline-chart polyline {
    fill: none;
    stroke: #6ea8e8;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tz-sparkline-chart circle {
    fill: #6ea8e8;
    stroke: #ffffff;
    stroke-width: 1;
}

.tz-report-row-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    width: 100%;
    align-items: stretch;
}

.tz-report-table-placeholder {
    display: none;
}

.tz-grid-months-only {
    --tz-label-pct: 28%;
    --tz-data-col-pct: calc((100% - var(--tz-label-pct)) / 3);
}

.tz-grid-kitchen-bar {
    --tz-label-pct: 42%;
    --tz-kitchen-col-pct: 29%;
    --tz-bar-col-pct: 29%;
}

.tz-grid-kitchen-bar col.col-label-left {
    width: var(--tz-label-pct);
}

.tz-grid-kitchen-bar col.col-kitchen {
    width: var(--tz-kitchen-col-pct);
}

.tz-grid-kitchen-bar col.col-bar {
    width: var(--tz-bar-col-pct);
}

html[data-theme="light"] .tz-grid {
    --tz-label-bg: #eef1f5;
    --tz-label-bg-alt: #e6eaef;
    --tz-head-bg: #e2e7ee;
    --tz-value-bg: #ffffff;
    --tz-value-bg-alt: #f7f8fa;
}

html[data-theme="light"] .tz-grid .tz-label-right {
    background: #e8edf3;
}

html[data-theme="light"] .tz-grid .tz-head-month,
html[data-theme="light"] .tz-row-section .tz-head {
    background: linear-gradient(180deg, #edf1f6 0%, var(--tz-head-bg) 100%);
    color: #c96318;
}

html[data-theme="light"] .tz-grid .tz-head-week {
    background: linear-gradient(180deg, #e8eef5 0%, #dce4ee 100%);
    color: #3d5570;
}

html[data-theme="light"] .tz-grid .tz-value-month {
    color: #1a2330;
}

html[data-theme="light"] .tz-grid .tz-value-week {
    background: #f3f6f9;
    color: #3d5570;
}

html[data-theme="light"] .tz-grid tbody tr:nth-child(even):not(.tz-row-section):not(.tz-row-title):not(.tz-row-spacer) .tz-value-week {
    background: #edf1f6;
}

html[data-theme="light"] .tz-row-data:hover .tz-value-month,
html[data-theme="light"] .tz-grid tbody tr:nth-child(even).tz-row-data:hover .tz-value-month {
    background: #e8edf5;
    color: #1a2330;
}

html[data-theme="light"] .tz-row-data:hover .tz-value-week,
html[data-theme="light"] .tz-grid tbody tr:nth-child(even).tz-row-data:hover .tz-value-week {
    background: #dce6f2;
    color: #1a2330;
}

html[data-theme="light"] .tz-grid .tz-head {
    color: #c96318;
}

html[data-theme="light"] .tz-row-section .tz-label {
    color: #1a2330;
}

html[data-theme="light"] .tz-row-subheader .tz-label,
html[data-theme="light"] .tz-row-subheader .tz-value {
    background: #e4e9f0;
}

html[data-theme="light"] .tz-grid tbody tr:nth-child(even).tz-row-data:hover .tz-label {
    background: #dfe6ef;
}

html[data-theme="light"] .tz-grid-slots .tz-label-metric {
    color: #3d5570;
}

html[data-theme="light"] .tz-sparkline-chart circle {
    stroke: #ffffff;
}

.app-shell.shell-fill .abc-table-panel {
    flex: 1;
    min-height: 180px;
    overflow: auto;
}

.abc-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.85rem;
    margin-bottom: 0.85rem;
}

.abc-thresholds {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.abc-filter {
    position: relative;
    min-width: 12.5rem;
    flex: 1 1 12.5rem;
    max-width: 18rem;
}

.abc-filter-btn,
.abc-filter-clear {
    border: 1px solid var(--border);
    background: var(--hover-bg);
    color: var(--text);
    border-radius: 8px;
    padding: 0.45rem 0.8rem;
    font-size: 0.8125rem;
    cursor: pointer;
}

.abc-filter-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    min-height: 2.5rem;
    padding: 0.4rem 0.75rem;
    text-align: left;
}

.abc-filter-btn:hover,
.abc-filter-btn.has-value,
.abc-filter-btn[aria-expanded="true"] {
    border-color: rgba(232, 119, 34, 0.55);
}

.abc-filter-btn.has-value,
.abc-filter-btn[aria-expanded="true"] {
    background: rgba(232, 119, 34, 0.1);
}

.abc-filter-value {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.abc-filter-caret {
    flex: 0 0 auto;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 4px 0 4px;
    border-color: var(--muted) transparent transparent transparent;
}

.abc-filter-btn[aria-expanded="true"] .abc-filter-caret {
    transform: rotate(180deg);
}

.abc-filter-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    max-height: 18rem;
    display: flex;
    flex-direction: column;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.abc-filter-menu[hidden] {
    display: none;
}

.abc-filter-search {
    width: 100%;
    margin-bottom: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--hover-bg);
    color: var(--text);
    padding: 0.35rem 0.5rem;
    font-size: 0.8125rem;
}

.abc-filter-options {
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-height: 0;
    flex: 1;
}

.abc-filter-option {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.25rem 0.15rem;
    color: var(--text);
    font-size: 0.8125rem;
    cursor: pointer;
}

.abc-filter-clear {
    margin-top: 0.5rem;
    width: 100%;
}

.abc-class-tabs {
    flex: 0 0 auto;
    margin-left: auto;
}

.abc-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.abc-card {
    min-width: 0;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.abc-card-a {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.28);
}

.abc-card-b {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.28);
}

.abc-card-c {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.28);
}

.abc-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.abc-card-letter {
    font-size: 1.15rem;
    font-weight: 700;
}

.abc-card-a .abc-card-letter {
    color: #34d399;
}

.abc-card-b .abc-card-letter {
    color: #fbbf24;
}

.abc-card-c .abc-card-letter {
    color: #f87171;
}

.abc-card-range {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.abc-card-count,
.abc-card-money {
    margin: 0;
}

.abc-card-count {
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 650;
}

.abc-card-money {
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.8125rem;
}

.abc-table-panel {
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel-tint);
}

.abc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.abc-table th,
.abc-table td {
    padding: 0.45rem 0.65rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.abc-table th.num,
.abc-table td.num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.abc-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-soft);
    padding: 0;
}

.abc-table tfoot td {
    position: sticky;
    bottom: 0;
    background: var(--bg-soft);
    font-weight: 650;
}

.abc-col-index {
    width: 2.5rem;
    color: var(--muted);
}

.abc-col-class {
    width: 3.2rem;
    text-align: center;
}

.abc-col-class .abc-sort {
    text-align: center;
}

.abc-sort {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.5rem 0.65rem;
    cursor: pointer;
    text-align: inherit;
}

.abc-table th.num .abc-sort {
    text-align: right;
}

.abc-sort:hover,
.abc-sort.sorted {
    color: var(--text);
}

.abc-sort.sorted.desc::after {
    content: " ↓";
}

.abc-sort.sorted.asc::after {
    content: " ↑";
}

.abc-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.abc-badge-a {
    background: rgba(16, 185, 129, 0.2);
    color: #059669;
}

.abc-badge-b {
    background: rgba(245, 158, 11, 0.22);
    color: #d97706;
}

.abc-badge-c {
    background: rgba(248, 113, 113, 0.2);
    color: #dc2626;
}

html[data-theme="dark"] .abc-badge-a {
    color: #34d399;
}

html[data-theme="dark"] .abc-badge-b {
    color: #fbbf24;
}

html[data-theme="dark"] .abc-badge-c {
    color: #f87171;
}

.abc-profit-plus {
    color: #059669;
}

.abc-profit-minus {
    color: #dc2626;
}

html[data-theme="dark"] .abc-profit-plus {
    color: #34d399;
}

html[data-theme="dark"] .abc-profit-minus {
    color: #f87171;
}

@media (max-width: 900px) {
    .abc-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .abc-filter,
    .abc-class-tabs {
        max-width: none;
        margin-left: 0;
    }

    .abc-cards {
        grid-template-columns: 1fr;
    }
}

.ws-cards {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ws-cards .ki-card-delta {
    display: block;
    margin-top: 0.3rem;
}

.ws-delta.up {
    color: var(--success);
}

.ws-delta.down {
    color: var(--danger);
}

.ws-delta.flat,
.ws-delta.none {
    color: var(--muted);
}

.ws-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.45rem;
    min-width: 0;
}

.ws-crumb {
    padding: 0;
    border: none;
    background: transparent;
    color: var(--accent);
    font-size: 0.8125rem;
    cursor: pointer;
}

.ws-crumb.is-current,
.ws-crumb[hidden] + .ws-crumb-sep {
    color: var(--text);
    cursor: default;
}

button.ws-crumb:hover {
    text-decoration: underline;
}

.ws-crumb-sep {
    color: var(--muted);
}

.ws-chart-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.75rem;
}

.ws-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(20rem, 0.85fr);
    gap: 1rem;
}

.app-shell.shell-fill .ws-body,
.app-shell.shell-fill .ws-chart-panel,
.app-shell.shell-fill .ws-table-panel {
    min-height: 0;
}

.app-shell.shell-fill .ws-body {
    flex: 1;
}

.app-shell.shell-fill .ws-chart-panel {
    display: flex;
    flex-direction: column;
}

.ws-table-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel-tint);
    overflow: hidden;
}

.ws-table-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.ws-table-head-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    min-width: 0;
}

.ws-table-card-deltas {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem 0.65rem;
    margin: 0;
    max-width: min(100%, 28rem);
}

.ws-table-card-delta-item {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    font-size: 0.7rem;
    line-height: 1.25;
}

.ws-table-card-delta-label {
    color: var(--muted);
    white-space: nowrap;
}

.ws-table-card-delta-item .ki-card-delta {
    display: inline;
    margin: 0;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.ws-table-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 650;
}

.ws-table-scope {
    margin: 0;
    color: var(--muted);
    font-size: 0.75rem;
}

.ws-table-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.ws-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.ws-table th,
.ws-table td {
    padding: 0.45rem 0.65rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.ws-table th.num,
.ws-table td.num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.ws-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-soft);
}

.ws-col-index {
    width: 2.25rem;
    color: var(--muted);
}

.ws-table-empty {
    margin: 0;
    padding: 1rem;
    color: var(--muted);
    font-size: 0.8125rem;
}

@media (max-width: 1100px) {
    .ws-body {
        grid-template-columns: 1fr;
    }

    .ws-table-panel {
        min-height: 18rem;
        max-height: 24rem;
    }
}

/* Planning report (.pl-*) */
.pl-hint-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.pl-hint {
    margin: 0;
    flex: 1 1 16rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--muted);
}

.pl-help-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.pl-help-btn:hover {
    border-color: var(--accent, #e87722);
    background: var(--bg-soft);
}

.pl-help-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    background: var(--accent, #e87722);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.pl-help-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(0, 0, 0, 0.55);
}

.pl-help-dialog {
    position: fixed;
    z-index: 1201;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(32rem, calc(100vw - 2rem));
    max-height: min(85vh, 40rem);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.pl-help-dialog[hidden],
.pl-help-overlay[hidden] {
    display: none !important;
}

.pl-help-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.pl-help-dialog-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.pl-help-close {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

.pl-help-close:hover {
    color: var(--text);
    background: var(--bg-soft);
}

.pl-help-dialog-body {
    padding: 0.85rem 1rem 1.1rem;
    overflow-y: auto;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text);
}

.pl-help-lead {
    margin: 0 0 0.85rem;
    color: var(--muted);
}

.pl-help-section {
    margin-bottom: 0.85rem;
}

.pl-help-section-muted {
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
}

.pl-help-section h3 {
    margin: 0 0 0.35rem;
    font-size: 0.875rem;
    font-weight: 650;
}

.pl-help-section p {
    margin: 0;
    color: var(--muted);
}

.pl-help-list {
    margin: 0.35rem 0 0;
    padding-left: 1.15rem;
    color: var(--muted);
}

.pl-help-list li {
    margin-bottom: 0.35rem;
}

.pl-help-note {
    margin-top: 0.5rem !important;
    font-size: 0.75rem;
}

.pl-hint strong {
    color: var(--text);
    font-weight: 600;
}

.pl-cards {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pl-card {
    container-type: inline-size;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    min-height: 7rem;
    padding: 0.75rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
}

.pl-card-label {
    font-size: 0.75rem;
    color: var(--muted);
    text-align: center;
}

.pl-card-values {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pl-card-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.35rem;
}

.pl-card-tag {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.pl-card-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    white-space: nowrap;
}

.pl-card-value-plan {
    color: var(--muted);
    font-size: clamp(0.65rem, 8cqi, 0.85rem);
    font-weight: 600;
}

.pl-card-value-fact {
    font-size: clamp(0.72rem, 11cqi, 1.05rem);
}

.pl-card-delta {
    margin-top: auto;
    text-align: center;
}

.pl-metric-tabs {
    margin-top: 0.25rem;
}

.pl-chart-panel {
    margin-top: 0.75rem;
}

.pl-legend-dot-plan {
    background: #94a3b8;
}

.pl-legend-dot-fact {
    background: #e87722;
}

.pl-detail-panel {
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    overflow: hidden;
}

.pl-detail-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.pl-detail-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
}

.pl-detail-scope {
    margin: 0;
    font-size: 0.75rem;
    color: var(--muted);
}

.pl-detail-scroll {
    overflow: auto;
}

.pl-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.pl-detail-table th,
.pl-detail-table td {
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--border);
}

.pl-detail-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--card-bg);
    color: var(--muted);
    font-weight: 500;
    text-align: left;
}

.pl-detail-table th.num,
.pl-detail-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pl-detail-table tbody th {
    font-weight: 500;
    text-align: left;
}

.pl-cell-plan {
    color: var(--muted);
}

.pl-cell-fact {
    font-weight: 600;
}

.pl-delta {
    font-weight: 650;
    white-space: nowrap;
}

.app-shell.shell-fill .pl-hint,
.app-shell.shell-fill .pl-cards,
.app-shell.shell-fill .pl-detail-panel {
    flex-shrink: 0;
}

@media (max-width: 1200px) {
    .pl-cards {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .pl-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
