:root {
    --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --sidebar-width: 308px;
    --sidebar-collapsed-width: 92px;
    --topbar-height: 84px;
    --content-pad: 24px;
    --radius-sm: 14px;
    --radius-md: 20px;
    --radius-lg: 24px;
    --shadow-soft: 0 14px 34px rgba(0, 0, 0, .16);
    --bg: #050b18;
    --bg-grad-1: #0a1730;
    --bg-grad-2: #050b18;
    --sidebar-bg: #081225;
    --topbar-bg: #081225;
    --panel: #0b1730;
    --panel-soft: #0f1d39;
    --panel-raised: #132548;
    --field-bg: #0b1730;
    --text: #eef4ff;
    --text-soft: #95a6c6;
    --muted: #6e82a8;
    --line: rgba(146, 168, 212, .18);
    --line-strong: rgba(146, 168, 212, .28);
    --accent: #7ebeff;
    --accent-2: #7bdff6;
    --accent-soft: rgba(126, 190, 255, .16);
    --button-primary-text: #081225;
    --button-secondary-bg: transparent;
    --table-head: rgba(255, 255, 255, .05);
    --invoice-accent-default: #18b7d0;
}

html[data-theme="default-light"] {
    --bg: #eef3fb;
    --bg-grad-1: #f8fbff;
    --bg-grad-2: #eef3fb;
    --sidebar-bg: #ffffff;
    --topbar-bg: #ffffff;
    --panel: #ffffff;
    --panel-soft: #f7faff;
    --panel-raised: #eef4ff;
    --field-bg: #f5f8fd;
    --text: #132036;
    --text-soft: #5f6f89;
    --muted: #7c8ba3;
    --line: rgba(19, 32, 54, .10);
    --line-strong: rgba(19, 32, 54, .16);
    --accent: #2f6cff;
    --accent-2: #1ea7ff;
    --accent-soft: rgba(47, 108, 255, .10);
    --button-primary-text: #ffffff;
    --table-head: rgba(20, 40, 80, .04);
}

html[data-theme="latte"] {
    --bg: #eff1f5;
    --bg-grad-1: #f6f7fb;
    --bg-grad-2: #eff1f5;
    --sidebar-bg: #e6e9ef;
    --topbar-bg: #e6e9ef;
    --panel: #ffffff;
    --panel-soft: #edf1f7;
    --panel-raised: #e6e9ef;
    --field-bg: #f7f7fb;
    --text: #4c4f69;
    --text-soft: #6c6f85;
    --muted: #8c8fa1;
    --line: rgba(76, 79, 105, .12);
    --line-strong: rgba(76, 79, 105, .20);
    --accent: #1e66f5;
    --accent-2: #04a5e5;
    --accent-soft: rgba(30, 102, 245, .10);
    --button-primary-text: #ffffff;
    --table-head: rgba(76, 79, 105, .05);
}

html[data-theme="frappe"] {
    --bg: #232634;
    --bg-grad-1: #303446;
    --bg-grad-2: #232634;
    --sidebar-bg: #232634;
    --topbar-bg: #232634;
    --panel: #303446;
    --panel-soft: #2b3040;
    --panel-raised: #414559;
    --field-bg: #2b3040;
    --text: #c6d0f5;
    --text-soft: #a5adce;
    --muted: #8f98bd;
    --line: rgba(198, 208, 245, .10);
    --line-strong: rgba(198, 208, 245, .16);
    --accent: #8caaee;
    --accent-2: #81c8be;
    --accent-soft: rgba(140, 170, 238, .14);
    --button-primary-text: #232634;
    --table-head: rgba(255, 255, 255, .04);
}

html[data-theme="macchiato"] {
    --bg: #181926;
    --bg-grad-1: #24273a;
    --bg-grad-2: #181926;
    --sidebar-bg: #181926;
    --topbar-bg: #181926;
    --panel: #24273a;
    --panel-soft: #1f2233;
    --panel-raised: #363a4f;
    --field-bg: #1f2233;
    --text: #cad3f5;
    --text-soft: #a5adcb;
    --muted: #8d96bf;
    --line: rgba(202, 211, 245, .10);
    --line-strong: rgba(202, 211, 245, .16);
    --accent: #8aadf4;
    --accent-2: #91d7e3;
    --accent-soft: rgba(138, 173, 244, .15);
    --button-primary-text: #1f2233;
    --table-head: rgba(255, 255, 255, .04);
}

html[data-theme="mocha"] {
    --bg: #11111b;
    --bg-grad-1: #1e1e2e;
    --bg-grad-2: #11111b;
    --sidebar-bg: #11111b;
    --topbar-bg: #11111b;
    --panel: #1e1e2e;
    --panel-soft: #181825;
    --panel-raised: #313244;
    --field-bg: #181825;
    --text: #cdd6f4;
    --text-soft: #a6adc8;
    --muted: #8b93b3;
    --line: rgba(205, 214, 244, .10);
    --line-strong: rgba(205, 214, 244, .16);
    --accent: #89b4fa;
    --accent-2: #74c7ec;
    --accent-soft: rgba(137, 180, 250, .15);
    --button-primary-text: #11111b;
    --table-head: rgba(255, 255, 255, .04);
}

html[data-theme="void"] {
    --bg: #080808;
    --bg-grad-1: #0e0e0e;
    --bg-grad-2: #080808;
    --sidebar-bg: #0d0d0d;
    --topbar-bg: #0d0d0d;
    --panel: #141414;
    --panel-soft: #111111;
    --panel-raised: #1e1e1e;
    --field-bg: #111111;
    --text: #f2f0ec;
    --text-soft: #808080;
    --muted: #4a4a4a;
    --line: rgba(255, 255, 255, .07);
    --line-strong: rgba(255, 255, 255, .13);
    --accent: #00e87a;
    --accent-2: #00c8ff;
    --accent-soft: rgba(0, 232, 122, .12);
    --button-primary-text: #080808;
    --button-secondary-bg: transparent;
    --table-head: rgba(255, 255, 255, .03);
    color-scheme: dark
}

html[data-theme="ivory"] {
    --bg: #f5f0e8;
    --bg-grad-1: #faf6ef;
    --bg-grad-2: #f5f0e8;
    --sidebar-bg: #ede8df;
    --topbar-bg: #ede8df;
    --panel: #ffffff;
    --panel-soft: #faf7f2;
    --panel-raised: #f0ebe1;
    --field-bg: #faf7f2;
    --text: #1a1714;
    --text-soft: #6b6560;
    --muted: #a09890;
    --line: rgba(26, 23, 20, .10);
    --line-strong: rgba(26, 23, 20, .18);
    --accent: #d94f1e;
    --accent-2: #e8960a;
    --accent-soft: rgba(217, 79, 30, .10);
    --button-primary-text: #ffffff;
    --button-secondary-bg: transparent;
    --table-head: rgba(26, 23, 20, .04);
    color-scheme: light
}

html[data-theme="default-dark"] {
    color-scheme: dark
}

html[data-theme="default-light"],
html[data-theme="latte"] {
    color-scheme: light
}

* {
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.45;
    background: radial-gradient(circle at top center, rgba(120, 160, 255, .10), transparent 18%), linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
    color: var(--text)
}

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

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

img {
    display: block;
    max-width: 100%
}

.hidden {
    display: none !important
}

.app-shell {
    display: flex;
    min-height: 100vh;
    background: transparent
}

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

.content-shell {
    padding: var(--content-pad);
    display: grid;
    gap: 20px;
    min-width: 0
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg), color-mix(in srgb, var(--sidebar-bg) 86%, #040912));
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    z-index: 30;
    transition: width .18s ease, flex-basis .18s ease
}

.sidebar-brand {
    height: var(--topbar-height);
    padding: 14px 18px 12px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    position: relative;
    flex: 0 0 auto
}

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

.brand-mark,
.brand-app-icon {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    border-radius: 22px;
    object-fit: contain;
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 78%, white), color-mix(in srgb, var(--accent) 56%, white));
    padding: 10px;
    color: #fff;
    font-weight: 900;
    display: grid;
    place-items: center;
    font-size: 1.75rem;
    border: 1px solid rgba(255, 255, 255, .08)
}

.brand-copy {
    min-width: 0
}

.brand-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.brand-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.sidebar-edge-toggle {
    position: absolute;
    right: -13px;
    top: 22px;
    width: 26px;
    height: 40px;
    border-radius: 0 14px 14px 0;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--panel), var(--panel-soft));
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 60;
    box-shadow: var(--shadow-soft)
}

.sidebar-edge-toggle svg {
    width: 16px;
    height: 16px
}

.sidebar-nav {
    display: grid;
    gap: 10px;
    padding: 18px 14px 14px;
    overflow: auto;
    min-height: 0;
    flex: 1 1 auto
}

.sidebar-footer {
    padding: 10px 14px 14px;
    flex: 0 0 auto;
    border-top: 1px solid var(--line)
}

.sidebar-version {
    padding: 14px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02);
    color: var(--text-soft);
    font-weight: 700;
    font-size: 13px
}

.nav-link,
.nav-group-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .01));
    color: var(--text);
    font-weight: 800;
    min-height: 68px;
    cursor: pointer;
    transition: .18s ease
}

.nav-link:hover,
.nav-group-summary:hover,
.nav-link.active,
.nav-group[open]>.nav-group-summary {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
    box-shadow: inset 0 0 0 1px var(--accent-soft)
}

.nav-summary-main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0
}

.nav-icon,
.nav-subicon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--text-soft)
}

.nav-link.active .nav-icon,
.nav-group[open]>.nav-group-summary .nav-icon,
.nav-link:hover .nav-icon,
.nav-group-summary:hover .nav-icon {
    color: var(--accent)
}

.nav-icon svg,
.nav-subicon svg,
.sidebar-edge-toggle svg,
.menu-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round
}

.nav-label {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.nav-caret {
    font-size: 12px;
    color: var(--text-soft)
}

.nav-group {
    position: relative
}

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

.nav-submenu {
    display: grid;
    gap: 6px;
    padding: 8px 6px 4px 50px
}

.nav-sublink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border: none;
    background: none;
    color: var(--text-soft);
    font-weight: 700
}

.nav-sublink:hover,
.nav-sublink.active {
    color: var(--text)
}

.nav-sublink:hover .nav-subicon,
.nav-sublink.active .nav-subicon {
    color: var(--accent)
}

.nav-subtext {
    line-height: 1.3
}

.sidebar.is-collapsed {
    width: var(--sidebar-collapsed-width);
    flex-basis: var(--sidebar-collapsed-width)
}

.sidebar.is-collapsed .brand-copy,
.sidebar.is-collapsed .nav-label,
.sidebar.is-collapsed .nav-caret,
.sidebar.is-collapsed .sidebar-version {
    display: none
}

.sidebar.is-collapsed .brand-link,
.sidebar.is-collapsed .nav-link,
.sidebar.is-collapsed .nav-group-summary {
    justify-content: center;
    padding-left: 0;
    padding-right: 0
}

.sidebar.is-collapsed .sidebar-brand {
    padding-inline: 14px
}

.sidebar.is-collapsed .nav-submenu {
    position: absolute;
    left: calc(100% + 10px);
    top: 0;
    min-width: 248px;
    padding: 14px 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    display: none;
    z-index: 80
}

.sidebar.is-collapsed .nav-group[open] .nav-submenu,
.sidebar.is-collapsed .nav-group:hover .nav-submenu,
.sidebar.is-collapsed .nav-group.flyout-open .nav-submenu {
    display: grid
}

.sidebar.is-collapsed .nav-sublink {
    padding: 10px 0
}

.sidebar.is-collapsed .sidebar-footer {
    padding-inline: 10px
}

.sidebar.is-collapsed .sidebar-version {
    display: grid;
    place-items: center;
    padding: 12px 8px
}

.sidebar.is-collapsed .sidebar-edge-toggle svg {
    transform: rotate(180deg)
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 22px;
    background: linear-gradient(180deg, var(--topbar-bg), color-mix(in srgb, var(--topbar-bg) 92%, #030712));
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0
}

.topbar-title-wrap {
    min-width: 0
}

.topbar h1 {
    margin: 0 0 3px;
    font-size: 18px;
    line-height: 1.1;
    font-weight: 800;
    color: var(--text)
}

.topbar-subtitle {
    font-size: 12px;
    color: var(--text-soft)
}

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

.menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    align-items: center;
    justify-content: center
}

.inline-form {
    margin: 0
}

.top-select-wrap,
.user-chip-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 96%, transparent), color-mix(in srgb, var(--panel-soft) 92%, transparent));
    color: var(--text)
}

.top-select-wrap {
    position: relative
}

.top-select-icon {
    font-size: 15px;
    line-height: 1;
    flex: 0 0 auto
}

.top-select {
    min-width: 0;
    border: none;
    background: transparent;
    color: inherit;
    padding: 0 18px 0 0;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    font-weight: 700
}

.top-pill-label,
.notif-label,
.user-chip-copy strong {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap
}

.user-chip {
    position: relative
}

.user-chip-trigger {
    cursor: pointer
}

.user-chip-trigger.icon-only {
    padding-inline: 14px
}

.notif-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-soft)
}

.notif-badge-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8
}

.user-chip-copy {
    display: grid;
    text-align: left;
    min-width: 0
}

.user-chip-copy small {
    font-size: 12px;
    color: var(--text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px
}

.user-chip-caret {
    font-size: 12px;
    color: var(--text-soft)
}

.avatar {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--button-primary-text);
    font-weight: 900;
    overflow: hidden;
    flex: 0 0 auto
}

.avatar-sm {
    width: 42px;
    height: 42px;
    border-radius: 999px
}

.avatar-xl {
    width: 96px;
    height: 96px;
    border-radius: 26px;
    font-size: 2rem
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    display: none;
    min-width: 240px;
    padding: 8px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow-soft);
    z-index: 120
}

.dropdown-menu.open {
    display: grid
}

.dropdown-menu a,
.notification-row {
    padding: 12px 14px;
    border-radius: 12px
}

.dropdown-menu a:hover {
    background: var(--accent-soft)
}

.dropdown-title {
    padding: 12px 14px 6px;
    font-weight: 800;
    font-size: 13px;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: .06em
}

.dropdown-empty {
    padding: 14px;
    color: var(--text-soft)
}

.notification-row {
    display: grid;
    gap: 2px;
    border-bottom: 1px solid var(--line)
}

.notification-row:last-child {
    border-bottom: none
}

.notification-row strong {
    font-size: 13px
}

.notification-row small,
.notification-row span {
    font-size: 12px;
    color: var(--text-soft)
}

/* General cards, grids, forms */
.stack {
    display: grid;
    gap: 18px
}

.grid {
    display: grid;
    gap: 18px
}

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

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

.field-full {
    grid-column: 1 / -1
}

.card,
.panel-card,
.settings-nav,
.feature-group-card,
.integration-box,
.stat-card {
    background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 98%, transparent), color-mix(in srgb, var(--panel-soft) 96%, transparent));
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft)
}

.card,
.panel-card,
.stat-card {
    padding: 22px
}

.page-intro,
.card-header,
.toolbar,
.actions,
.tabs {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap
}

.page-intro {
    justify-content: space-between
}

.page-intro h2,
.hero-card h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 800
}

.eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px
}

.muted,
.small,
.topbar-subtitle {
    color: var(--text-soft)
}

.small {
    font-size: 12px
}

.card-header {
    justify-content: space-between
}

.card-header h2,
.card-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 800
}

.card-header p {
    margin: 6px 0 0;
    color: var(--text-soft)
}

.compact-header {
    position: relative;
    padding-right: 44px
}

.card-tools {
    position: absolute;
    top: 0;
    right: 0
}

.widget-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--text-soft);
    cursor: grab;
    border-radius: 12px
}

.widget-handle:hover {
    background: var(--accent-soft);
    color: var(--accent)
}

.button,
.segment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid var(--line-strong);
    background: var(--button-secondary-bg);
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
    transition: .16s ease
}

.button:hover,
.segment:hover {
    transform: translateY(-1px)
}

.button.primary {
    background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 80%, white));
    border-color: transparent;
    color: var(--button-primary-text)
}

.button.secondary {
    background: rgba(255, 255, 255, .02)
}

.button.danger {
    color: #ff6d78;
    border-color: rgba(255, 109, 120, .3)
}

.button-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 12px
}

.hero-card {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px
}

.dashboard-hero-actions {
    margin-left: auto;
    justify-content: flex-end
}

.segmented-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02)
}

.segment {
    min-width: 74px;
    border: none;
    background: transparent;
    color: var(--text-soft)
}

.segment.active {
    background: var(--accent-soft);
    color: var(--text)
}

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

.stat-card {
    min-height: 128px;
    display: grid;
    gap: 8px;
    align-content: flex-start
}

.stat-card span {
    font-size: 13px;
    color: var(--text-soft)
}

.stat-card strong {
    font-size: 18px;
    line-height: 1.15;
    font-weight: 800
}

.field {
    display: grid;
    gap: 8px
}

.field span {
    font-size: 13px;
    font-weight: 700
}

.field input,
.field select,
.field textarea,
.search-form input,
table input,
table select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--line-strong);
    background: var(--field-bg);
    color: var(--text);
    outline: none
}


.field input:focus,
.field select:focus,
.field textarea:focus,
.search-form input:focus,
table input:focus,
table select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft)
}

.field textarea {
    min-height: 120px;
    resize: vertical
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700
}

.checkbox-field input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent)
}

.switch-field,
.module-switch-card,
.feature-row,
.quick-action,
.field-info-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02)
}

.switch-field,
.module-switch-card,
.feature-row {
    align-items: flex-start
}

.switch-field input,
.module-switch-card input,
.feature-row input {
    width: 20px;
    height: 20px;
    accent-color: var(--accent)
}

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

.feature-group-card {
    padding: 20px
}

.feature-list {
    display: grid;
    gap: 10px;
    margin-top: 14px
}

.simple-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 6px;
    color: var(--text-soft)
}

.search-form {
    display: flex;
    flex: 1;
    min-width: min(320px, 100%)
}

.search-form input {
    flex: 1
}

.flash {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--panel)
}

.flash-success {
    border-color: rgba(62, 207, 142, .32)
}

.flash-error {
    border-color: rgba(239, 107, 122, .32)
}

.flash-warning {
    border-color: rgba(245, 180, 60, .36)
}

.flash-info {
    border-color: rgba(109, 124, 255, .36)
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, .02)
}

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

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle
}

th {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    background: var(--table-head)
}

tr:last-child td {
    border-bottom: none
}

.list-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line)
}

.list-row:last-child {
    border-bottom: none
}

.tabs a {
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--text-soft);
    font-weight: 700
}

.tabs a.active,
.tabs a:hover {
    background: var(--accent-soft);
    color: var(--text)
}

.media-preview-grid,
.profile-card-grid {
    align-items: start
}

.media-preview-card,
.profile-card-side {
    padding: 18px;
    border: 1px dashed var(--line-strong);
    border-radius: 18px;
    background: rgba(255, 255, 255, .02)
}

.asset-preview {
    max-height: 180px;
    object-fit: contain;
    border-radius: 16px;
    width: 100%
}

.asset-preview-icon {
    max-height: 78px;
    max-width: 78px
}

.asset-placeholder {
    min-height: 120px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--text-soft)
}

.profile-card-grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 20px
}

.profile-card-main,
.profile-card-side {
    display: grid;
    gap: 18px
}

/* Settings */
.settings-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 22px
}

.settings-nav {
    position: sticky;
    top: var(--topbar-height);
    padding: 10px;
    align-self: start
}

.settings-nav-summary {
    display: none
}

.settings-nav-details {
    display: block;
    width: 100%
}

.settings-nav-dropdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%
}

@media (max-width: 1080px) {
    .settings-nav-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px;
        cursor: pointer;
        font-weight: 700;
        list-style: none
    }

    .settings-nav-dropdown {
        padding: 0 0 8px
    }
}

.settings-tab-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 52px;
    padding: 0 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02);
    color: var(--text-soft);
    font-weight: 800;
    cursor: pointer;
    box-sizing: border-box
}

.settings-tab-link.active,
.settings-tab-link:hover {
    background: var(--accent-soft);
    color: var(--text);
    border-color: color-mix(in srgb, var(--accent) 40%, var(--line))
}

.settings-content {
    min-width: 0;
    display: grid;
    gap: 18px
}

.settings-panel:not(.active) {
    display: none
}

.settings-panel.active {
    display: grid
}

.sticky-actions {
    position: sticky;
    bottom: 18px;
    display: flex;
    justify-content: flex-end;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    backdrop-filter: blur(12px)
}

/* Dashboard / reports */
.dashboard-widget {
    position: relative;
    display: flex;
    flex-direction: column
}

.dashboard-widget.is-dragging {
    opacity: .62
}

.widget-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--widget-gap, 18px);
    align-items: start;
    position: relative
}

.widget-grid-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--widget-gap, 18px);
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    transition: opacity .15s
}

.widget-grid-overlay.is-visible {
    opacity: 1
}

.widget-grid-cell {
    border: 1.5px dashed var(--border-soft, rgba(128,128,128,.25));
    border-radius: var(--radius, 10px);
    background: var(--surface-raised, rgba(128,128,128,.04))
}

.widget-ghost {
    position: absolute;
    border-radius: var(--radius, 10px);
    background: var(--accent, #5c6ef8);
    opacity: .18;
    pointer-events: none;
    z-index: 51;
    transition: all .08s ease;
    display: none
}

.widget-ghost.is-visible {
    display: block
}

.widget-drag-clone {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    opacity: .72;
    box-shadow: 0 16px 48px rgba(0,0,0,.22);
    border-radius: var(--radius, 10px);
    transform: scale(1.03);
    transition: box-shadow .1s
}

.chart-panel,
.report-chart-panel {
    min-height: 390px
}

.chart-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-soft);
    font-weight: 700
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    display: inline-block
}

.legend-dot.income {
    background: var(--accent-2)
}

.legend-dot.expense {
    background: #f7b267
}

.year-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02)
}

.year-filter span {
    font-size: 12px;
    color: var(--text-soft);
    font-weight: 800
}

.year-filter select {
    min-height: auto;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text);
    outline: none
}

.chart-summary-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px
}

.chart-summary-strip>div {
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02)
}

.chart-summary-strip span {
    display: block;
    font-size: 13px;
    color: var(--text-soft);
    margin-bottom: 8px
}

.chart-summary-strip strong {
    font-size: 15px
}

.svg-chart-wrap {
    flex: 1;
    display: flex;
    align-items: flex-end
}

.bar-chart {
    width: 100%;
    height: 100%
}

.chart-grid {
    stroke: var(--line);
    stroke-dasharray: 3 4
}

.chart-bar.income {
    fill: var(--accent-2)
}

.chart-bar.expense {
    fill: #f7b267
}

.chart-label {
    fill: var(--muted);
    font-size: 12px
}

.chart-y-label {
    fill: var(--text-soft);
    font-size: 10px
}

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

.dashboard-widget .stack,
.dashboard-widget .table-wrap,
.dashboard-widget .svg-chart-wrap {
    flex: 1
}

.compact-stack {
    align-content: start
}

/* Invoice preview */
.invoice-detail-shell {
    display: grid;
    gap: 18px
}

.invoice-template-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px
}

.invoice-template-sheet {
    --invoice-accent: var(--invoice-accent-default);
    max-width: 1100px;
    margin: 0 auto;
    background: #ffffff;
    color: #101828;
    padding: 34px 40px 26px;
    border-radius: 26px;
    box-shadow: 0 18px 48px rgba(4, 9, 18, .22)
}

.invoice-hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 42px;
    position: relative
}

.invoice-hero-grid::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #d9dee8
}

.invoice-hero-side {
    position: relative;
    display: grid;
    gap: 18px;
    padding-left: 34px
}

.invoice-section-tag {
    position: absolute;
    left: 0;
    top: 8px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: .16em;
    color: var(--invoice-accent);
    text-transform: uppercase
}

.invoice-logo-hero {
    max-width: 220px;
    max-height: 64px;
    object-fit: contain
}

.invoice-logo-wordmark {
    font-size: 30px;
    line-height: 1.05;
    font-weight: 800;
    color: var(--invoice-accent);
    max-width: 220px
}

.invoice-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px
}

.invoice-title-text {
    font-size: 16px;
    font-weight: 800;
    padding-top: 4px
}

.invoice-number-box {
    min-width: 170px;
    border: 1px solid #d7dee8;
    padding: 18px 18px 14px;
    text-align: center
}

.invoice-number-box strong {
    display: block;
    font-size: 16px;
    margin-bottom: 14px
}

.barcode-line {
    height: 18px;
    background: repeating-linear-gradient(90deg, #111 0, #111 2px, transparent 2px, transparent 4px)
}

.invoice-party-block {
    display: grid;
    gap: 6px;
    font-size: 14px
}

.invoice-party-block h3 {
    margin: 0 0 2px;
    font-size: 15px;
    font-weight: 800
}

.invoice-party-block strong {
    font-size: 15px
}

.invoice-inline-meta {
    padding-top: 4px
}

.invoice-legal-note {
    margin-top: 8px;
    font-size: 12px;
    color: #616b7c
}

.invoice-dates-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    padding: 18px 0;
    border-top: 1px solid #d9dee8;
    border-bottom: 1px solid #d9dee8;
    margin-top: 20px;
    font-size: 13px
}

.invoice-dates-grid strong {
    font-size: 15px
}

.invoice-payment-strip,
.invoice-items-block,
.invoice-summary-block {
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 18px;
    margin-top: 18px;
    align-items: start
}

.invoice-payment-strip .invoice-section-tag,
.invoice-items-block .invoice-section-tag,
.invoice-summary-block .invoice-section-tag {
    position: static;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    padding: 10px 0;
    background: transparent
}

.invoice-payment-main {
    background: var(--invoice-accent);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 128px;
    gap: 18px;
    padding: 18px 18px 16px;
    color: #fff
}

.invoice-bank-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px 28px;
    align-items: start
}

.invoice-bank-grid span {
    display: block;
    font-size: 13px;
    opacity: .9;
    margin-bottom: 8px
}

.invoice-bank-grid strong {
    font-size: 15px;
    line-height: 1.35
}

.invoice-amount-due strong {
    font-size: 22px;
    font-weight: 800;
    white-space: nowrap
}

.invoice-qr-box {
    display: grid;
    justify-items: center;
    align-content: start;
    padding-left: 8px
}

.invoice-qr-image {
    width: 98px;
    height: 98px;
    border: 1px solid #d7dee8;
    background: #fff;
    padding: 6px
}

.qr-caption {
    color: #8e98af;
    font-size: 12px;
    text-align: center;
    margin-top: 8px
}

.invoice-table-wrap {
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: visible
}

.invoice-table-modern {
    min-width: 0
}

.invoice-table-modern th {
    background: #616b84;
    color: #fff;
    font-size: 12px;
    border-bottom: none;
    padding: 14px 16px
}

.invoice-table-modern th:first-child {
    border-top-left-radius: 18px
}

.invoice-table-modern th:last-child {
    border-top-right-radius: 18px
}

.invoice-table-modern td {
    font-size: 14px;
    border-bottom: 1px solid #e7ebf0
}

.invoice-note-line {
    margin-top: 12px;
    font-size: 13px;
    color: #5f6a7b
}

.invoice-summary-grid {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 28px
}

.invoice-stamp-panel h3 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 800
}

.invoice-stamp-image {
    max-width: 210px;
    max-height: 120px;
    object-fit: contain
}

.invoice-stamp-blank {
    width: 180px;
    height: 92px;
    border: 1px solid #cfd6e2;
    background: transparent
}

.invoice-summary-table table {
    min-width: 0
}

.invoice-summary-table th,
.invoice-summary-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e6eaf0
}

.invoice-summary-table th {
    background: transparent;
    color: #596273
}

.invoice-total-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 18px;
    margin-top: 16px;
    background: var(--invoice-accent);
    color: #fff;
    font-weight: 800;
    font-size: 16px
}

.invoice-footer-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    padding-top: 22px;
    margin-top: 22px;
    border-top: 1px solid #edf0f4;
    font-size: 12px;
    color: #616b7c
}

/* Auth / installer */
.guest-surface {
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(109, 124, 255, .24), transparent 36%), radial-gradient(circle at bottom right, rgba(56, 189, 248, .14), transparent 34%), linear-gradient(145deg, #08111f, #101c31)
}

.guest-surface::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at center, black 46%, transparent 88%);
    -webkit-mask-image: radial-gradient(circle at center, black 46%, transparent 88%)
}

.guest-shell {
    width: min(1240px, 100%);
    margin: 0 auto;
    padding: 36px
}

.auth-layout {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 22px;
    min-height: calc(100vh - 72px)
}

.auth-panel {
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 30px;
    background: rgba(255, 255, 255, .04);
    backdrop-filter: blur(16px);
    overflow: hidden;
    position: relative
}

.auth-panel-hero {
    padding: 40px;
    display: flex;
    align-items: flex-end;
    min-height: 720px
}

.auth-glow {
    position: absolute;
    right: -120px;
    bottom: -90px;
    width: 380px;
    height: 380px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(137, 180, 250, .34), transparent 70%)
}

.auth-hero-copy {
    position: relative;
    display: grid;
    gap: 16px;
    max-width: 560px;
    color: #fff
}

.auth-badge {
    display: inline-flex;
    width: fit-content;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .08);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase
}

.auth-hero-copy h1 {
    margin: 0;
    font-size: 3rem;
    line-height: 1.02
}

.auth-hero-copy p,
.auth-points {
    color: rgba(255, 255, 255, .8)
}

.auth-points {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px
}

.auth-panel-form {
    display: grid;
    align-items: center;
    padding: 26px
}

.auth-card {
    max-width: 480px;
    margin: 0 auto;
    padding: 34px;
    border-radius: 28px;
    background: rgba(7, 17, 34, .74);
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: var(--shadow-soft)
}

.auth-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    color: rgba(255, 255, 255, .66);
    font-size: 13px
}

.auth-footer img {
    height: 18px;
    width: auto
}

/* ── Login / Register page (osma.sk style) ───────────────────────────────── */
.lp-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 72px);
    position: relative;
    z-index: 1
}

.lp-card {
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 460px;
    padding: 40px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015));
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 30px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .46)
}

.lp-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top center, rgba(109, 124, 255, .18), transparent 44%);
    pointer-events: none
}

.lp-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .05);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .75);
    margin-bottom: 18px
}

.lp-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6d7cff;
    box-shadow: 0 0 8px rgba(109, 124, 255, .75);
    flex-shrink: 0
}

.lp-title {
    font-size: 2rem;
    font-weight: 800;
    color: #f4f7ff;
    margin: 0 0 6px;
    line-height: 1.15
}

.lp-subtitle {
    color: rgba(255, 255, 255, .5);
    font-size: 14px;
    margin: 0 0 28px
}

.lp-tabs {
    display: flex;
    gap: 4px;
    padding: 5px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .07);
    margin-bottom: 26px
}

.lp-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, .45);
    font-family: inherit;
    transition: color .2s, background .2s, box-shadow .2s
}

.lp-tab.active {
    background: linear-gradient(135deg, #6d7cff, #83b3ff);
    color: #fff;
    box-shadow: 0 4px 14px rgba(109, 124, 255, .32)
}

.lp-pane {
    display: none
}

.lp-pane.active {
    display: grid;
    gap: 14px
}

.lp-form {
    display: contents
}

.lp-field {
    display: grid;
    gap: 7px
}

.lp-field label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, .65)
}

.lp-field input {
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 15px;
    color: #f4f7ff;
    font-family: inherit;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s
}

.lp-field input::placeholder {
    color: rgba(255, 255, 255, .22)
}

.lp-field input:focus {
    border-color: rgba(109, 124, 255, .55);
    box-shadow: 0 0 0 3px rgba(109, 124, 255, .12)
}

.lp-btn {
    width: 100%;
    padding: 15px 20px;
    background: linear-gradient(135deg, #6d7cff, #83b3ff);
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    box-shadow: rgba(109, 124, 255, .3) 0 12px 28px 0;
    transition: transform .15s, box-shadow .15s;
    margin-top: 4px
}

.lp-btn:hover {
    transform: translateY(-1px);
    box-shadow: rgba(109, 124, 255, .45) 0 16px 32px 0
}

.lp-btn:active {
    transform: translateY(0);
    box-shadow: rgba(109, 124, 255, .2) 0 8px 16px 0
}

.lp-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: #9faed2;
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase
}

.lp-footer-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 128px;
    opacity: .92
}

.lp-footer-logo img {
    display: block;
    max-height: 22px;
    max-width: 128px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .28))
}

/* ── End login page ───────────────────────────────────────────────────────── */

.series-row {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .02)
}

.series-row-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px
}

.series-default-label {
    font-weight: 600
}

.series-row-header .button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
    margin-left: auto
}

@media (max-width: 1280px) {

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

    .dashboard-draggable-grid,
    .settings-layout,
    .profile-card-grid,
    .grid.two,
    .grid.three,
    .module-grid,
    .settings-feature-groups {
        grid-template-columns: 1fr
    }

    .invoice-hero-grid,
    .invoice-summary-grid,
    .invoice-payment-main {
        grid-template-columns: 1fr
    }

    .invoice-hero-grid::after {
        display: none
    }

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

@media (max-width: 1100px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow-soft)
    }

    .sidebar.open {
        transform: translateX(0)
    }

    .sidebar.is-collapsed {
        width: var(--sidebar-width);
        flex-basis: var(--sidebar-width)
    }

    .sidebar.is-collapsed .brand-copy,
    .sidebar.is-collapsed .nav-label,
    .sidebar.is-collapsed .nav-caret,
    .sidebar.is-collapsed .sidebar-version {
        display: block
    }

    .sidebar.is-collapsed .nav-submenu {
        position: static;
        display: grid;
        min-width: 0;
        padding: 8px 6px 4px 50px;
        border: none;
        box-shadow: none;
        background: none
    }

    .sidebar.is-collapsed .nav-group[open] .nav-submenu,
    .sidebar.is-collapsed .nav-group:hover .nav-submenu {
        display: grid
    }

    .sidebar-edge-toggle {
        display: none
    }

    .menu-toggle {
        display: inline-flex
    }

    .topbar {
        padding: 0 16px
    }

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

@media (max-width: 760px) {
    .content-shell {
        padding: 16px
    }

    .topbar {
        height: auto;
        min-height: var(--topbar-height);
        padding: 12px 14px;
        align-items: flex-start;
        flex-wrap: wrap
    }

    .topbar-actions {
        width: 100%
    }

    .top-select-wrap,
    .user-chip-trigger {
        min-height: 46px;
        padding-inline: 12px
    }

    .topbar h1 {
        font-size: 17px
    }

    .stats-grid,
    .stats-grid-compact,
    .chart-summary-strip,
    .invoice-dates-grid,
    .invoice-bank-grid,
    .invoice-footer-row {
        grid-template-columns: 1fr
    }

    .invoice-template-sheet {
        padding: 24px 18px
    }

    .auth-layout {
        grid-template-columns: 1fr
    }

    .auth-panel-hero {
        min-height: 420px
    }

    .card-header > div:first-child {
        width: 100%;
        min-width: 0
    }

    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch
    }

    .plans-grid {
        grid-template-columns: 1fr
    }

    .period-control {
        flex-wrap: wrap
    }
}

@media print {

    .sidebar,
    .topbar,
    .flash,
    .no-print,
    .sticky-actions {
        display: none !important
    }

    .content-shell {
        padding: 0
    }

    body,
    html {
        background: #fff;
        color: #000
    }

    .invoice-template-sheet {
        box-shadow: none;
        border-radius: 0;
        max-width: none;
        margin: 0;
        padding: 0
    }
}

/* ── Toast notifications (also used on guest pages) ─────────────── */
@keyframes toast-in {
    from { transform: translateX(calc(100% + 28px)); opacity: 0 }
    to   { transform: translateX(0);                  opacity: 1 }
}
@keyframes toast-out {
    to { transform: translateX(calc(100% + 28px)); opacity: 0 }
}
@keyframes toast-progress {
    from { transform: scaleX(1) }
    to   { transform: scaleX(0) }
}
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 340px;
    pointer-events: none
}
.toast {
    --toast-accent: #60a5fa;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 13px 20px 14px;
    background: color-mix(in srgb, var(--toast-accent) 6%, var(--panel, #141414));
    border: 1px solid color-mix(in srgb, var(--toast-accent) 30%, var(--line, rgba(255,255,255,.08)));
    border-radius: 18px;
    box-shadow: 0 8px 28px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.2);
    overflow: hidden;
    pointer-events: all;
    animation: toast-in .32s cubic-bezier(.22,1,.36,1) both
}
.toast.is-leaving {
    animation: toast-out .22s ease-in forwards;
    pointer-events: none
}
.toast.is-leaving .toast-progress-bar { animation: none }
.toast-success { --toast-accent: #3ecf8e }
.toast-error   { --toast-accent: #ef6b7a }
.toast-warning { --toast-accent: #f5a523 }
.toast-info    { --toast-accent: #60a5fa }
.toast-icon {
    flex: 0 0 auto;
    width: 19px;
    height: 19px;
    margin-top: 1px;
    color: var(--toast-accent)
}
.toast-message {
    flex: 1;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text);
    min-width: 0
}
.toast-close {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    margin: -3px -3px 0 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    transition: background .14s, color .14s
}
.toast-close:hover {
    background: var(--line, rgba(255,255,255,.08));
    color: var(--text)
}
.toast-close svg { width: 14px; height: 14px }
.toast-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: color-mix(in srgb, var(--toast-accent) 65%, transparent);
    transform-origin: left;
    animation: toast-progress 10s linear forwards
}
.toast:not(.is-leaving):hover .toast-progress-bar {
    animation-play-state: paused
}

/* ── Subscription / Pricing page ──────────────────────────────── */

.plan-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap
}

.plan-hero-left {
    display: flex;
    align-items: center;
    gap: 20px
}

.plan-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    flex: 0 0 56px;
    background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent-2) 12%, transparent));
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 900;
    color: var(--accent)
}

.plan-hero-name {
    font-size: 20px;
    font-weight: 900
}

.plan-hero-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-soft);
    margin-top: 3px
}

.plan-hero-price {
    color: var(--accent);
    font-weight: 800
}

.badge-green {
    background: rgba(74, 222, 128, .15);
    color: #4ade80
}

.badge-discount {
    background: rgba(74, 222, 128, .15);
    color: #4ade80;
    font-size: 11px;
    padding: 3px 7px
}

.section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap
}

.section-title {
    font-size: 15px;
    font-weight: 800
}

.section-sub {
    font-size: 13px;
    color: var(--text-soft);
    margin-top: 2px
}

.period-control {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02)
}

.period-seg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 13px;
    border: none;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    font-family: inherit;
    transition: .15s ease;
    white-space: nowrap
}

.period-seg.active {
    background: var(--accent-soft);
    color: var(--text)
}

.period-seg:hover:not(.active) {
    color: var(--text);
    background: rgba(255, 255, 255, .04)
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: start
}

.plan-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .015));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color .18s, box-shadow .18s
}

.plan-card:hover {
    border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
    box-shadow: var(--shadow-soft)
}

.plan-card.featured {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft), var(--shadow-soft)
}

.plan-card.is-current {
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--accent) 7%, transparent),
        color-mix(in srgb, var(--accent) 3%, transparent))
}

.plan-ribbon {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: var(--button-primary-text);
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 6px 0
}

.plan-ribbon-placeholder {
    height: 29px
}

.plan-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column
}

.plan-name {
    font-size: 16px;
    font-weight: 900;
    margin-bottom: 4px
}

.plan-tagline {
    font-size: 12px;
    color: var(--text-soft);
    margin-bottom: 16px;
    min-height: 34px
}

.plan-price-block {
    margin-bottom: 18px
}

.plan-price {
    font-size: 30px;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
    letter-spacing: -.02em
}

.plan-price.free {
    color: var(--text)
}

.plan-price-period {
    font-size: 13px;
    color: var(--text-soft);
    font-weight: 600;
    margin-top: 4px
}

.plan-divider {
    height: 1px;
    background: var(--line);
    margin: 0 0 16px
}

.plan-features {
    list-style: none;
    display: grid;
    gap: 9px;
    flex: 1;
    margin: 0 0 18px;
    padding: 0
}

.plan-features li {
    font-size: 13px;
    color: var(--text-soft);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.35
}

.plan-features .check {
    color: var(--accent);
    font-weight: 900;
    flex: 0 0 auto;
    line-height: 1.35
}

.plan-features .dash {
    color: var(--muted);
    flex: 0 0 auto;
    line-height: 1.35
}

.plan-features li.dim {
    opacity: .45
}

.plan-footer {
    padding: 0 20px 20px
}

.button.sm {
    min-height: 36px;
    padding: 0 14px;
    font-size: 12px;
    border-radius: 12px
}

.button.block {
    width: 100%;
    display: flex
}

.button.disabled,
button.button:disabled {
    opacity: .45;
    cursor: default;
    pointer-events: none
}

.button.current-plan {
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--accent);
    background: var(--accent-soft);
    cursor: default
}

.button.current-plan:hover {
    transform: none
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800
}

.status-paid {
    background: rgba(74, 222, 128, .12);
    color: #4ade80
}

.status-pending {
    background: rgba(251, 191, 36, .12);
    color: #fbbf24
}
