*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --font: "DM Sans", system-ui, -apple-system, sans-serif;
    --sidebar-width: 252px;
    --topbar-height: 60px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
    --shadow-accent: 0 8px 24px color-mix(in srgb, var(--accent) 14%, transparent);
    --text: #0f172a;
    --text-muted: #64748b;
    --sidebar-active: #ffffff;
    --sidebar-active-bg: rgba(255, 255, 255, 0.08);
}

html {
    color-scheme: light;
    --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
    --accent-border: color-mix(in srgb, var(--accent) 22%, transparent);
    --accent-border-strong: color-mix(in srgb, var(--accent) 38%, transparent);
    --accent-ring: color-mix(in srgb, var(--accent) 18%, transparent);
    --accent-focus: color-mix(in srgb, var(--accent) 55%, transparent);
    --accent-sidebar-bg: color-mix(in srgb, var(--accent) 18%, transparent);
    --income-bg: color-mix(in srgb, var(--income) 12%, transparent);
    --income-border: color-mix(in srgb, var(--income) 24%, transparent);
    --income-sidebar-bg: color-mix(in srgb, var(--income) 16%, transparent);
    --expense-bg: color-mix(in srgb, var(--expense) 12%, transparent);
    --expense-border: color-mix(in srgb, var(--expense) 24%, transparent);
    --expense-sidebar-bg: color-mix(in srgb, var(--expense) 18%, transparent);
    --brand-gradient: var(--accent);
    --sidebar-gradient: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-deep) 100%);
    --auth-panel-gradient: linear-gradient(
        160deg,
        var(--auth-gradient-start) 0%,
        var(--auth-gradient-mid) 52%,
        var(--brand-gradient-end) 100%
    );
    --panel-header-bg: var(--surface-2);
}

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

[data-theme="dark"] {
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-accent: 0 10px 28px color-mix(in srgb, var(--accent) 22%, transparent);
    --panel-header-bg: var(--surface-2);
}

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

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

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

/* App shell */
.app-body {
    min-height: 100vh;
}

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

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-gradient);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 200;
    transition: transform 0.25s ease;
    border-right: 1px solid var(--sidebar-border);
    max-height: 100dvh;
    overflow: hidden;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.app-brand-user-only {
    padding: 16px 14px;
}

.app-brand-profile-only {
    width: 100%;
    margin-top: 0;
    margin-left: 0;
    padding: 10px 12px;
    gap: 12px;
}

.app-brand-profile-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.app-brand-meta {
    font-size: 11px;
    color: var(--sidebar-text);
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.app-brand-access {
    display: inline-block;
    align-self: flex-start;
    max-width: 100%;
    margin-top: 5px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-brand-access-trial {
    color: color-mix(in srgb, var(--accent) 65%, #fff);
    background: var(--accent-sidebar-bg);
}

.app-brand-access-active {
    color: color-mix(in srgb, var(--income) 70%, #fff);
    background: var(--income-sidebar-bg);
}

.app-brand-access-expired {
    color: color-mix(in srgb, var(--expense) 70%, #fff);
    background: var(--expense-sidebar-bg);
}

.app-brand-profile-only .app-brand-user {
    max-width: none;
    font-size: 14px;
    font-weight: 600;
    color: #f8fafc;
}

.app-brand-profile-only .user-avatar-md {
    width: 44px;
    height: 44px;
}

.app-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-brand-icon svg {
    width: 20px;
    height: 20px;
    color: #fff;
}

.app-brand-name {
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    line-height: 1.2;
}

.app-brand-user {
    font-size: 12px;
    color: var(--sidebar-text);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.app-brand-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 0;
    padding: 6px 8px;
    margin-left: 0;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.app-brand-profile:hover {
    background: var(--sidebar-hover-bg);
}

.app-brand-profile.is-active {
    background: var(--sidebar-active-bg);
    box-shadow: inset 3px 0 0 var(--accent);
}

.app-brand-profile .app-brand-user {
    margin-top: 0;
    max-width: 130px;
    color: #e2e8f0;
    font-weight: 500;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--brand-gradient);
}

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

.user-avatar-sm {
    width: 28px;
    height: 28px;
}

.user-avatar-md {
    width: 40px;
    height: 40px;
}

.user-avatar-lg {
    width: 88px;
    height: 88px;
}

.user-avatar-initials {
    font-weight: 600;
    color: #fff;
    line-height: 1;
    user-select: none;
}

.user-avatar-sm .user-avatar-initials {
    font-size: 11px;
}

.user-avatar-md .user-avatar-initials {
    font-size: 14px;
}

.user-avatar-lg .user-avatar-initials {
    font-size: 28px;
}

.profile-avatar-panel {
    margin-bottom: 20px;
}

.profile-avatar-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.profile-avatar-name {
    margin: 0 0 4px;
    font-size: 20px;
}

.profile-avatar-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.profile-avatar-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.profile-avatar-upload {
    position: relative;
    cursor: pointer;
}

.profile-avatar-upload.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.profile-avatar-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
}

.profile-avatar-remove {
    display: inline;
    margin-left: 4px;
}

.copy-field {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.copy-field-input {
    flex: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}

.btn-icon-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding-inline: 12px;
}

.btn-icon-only.is-copied {
    color: var(--income);
    border-color: color-mix(in srgb, var(--income) 35%, var(--border));
}

.btn-icon-only .btn-icon svg {
    width: 16px;
    height: 16px;
}

.app-nav {
    padding: 12px 10px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}

.app-nav-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-active);
}

.app-nav-link.is-active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
    box-shadow: inset 3px 0 0 var(--accent);
}

.app-nav-link-muted {
    opacity: 0.85;
}

.app-nav-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-nav-icon svg {
    width: 18px;
    height: 18px;
}

.app-sidebar-footer {
    padding: 12px 10px 16px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}

.app-topbar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-topbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.app-topbar-title h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.app-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 8px;
}

.app-menu-btn,
.app-icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    padding: 0;
}

.app-icon-btn {
    display: inline-flex;
}

.app-menu-btn svg,
.app-icon-btn svg {
    width: 18px;
    height: 18px;
}

.app-content {
    padding: 24px;
    flex: 1;
    background: var(--bg);
}

.app-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 150;
}

@media (min-width: 769px) {
    .app-menu-btn {
        display: inline-flex;
    }

    html[data-sidebar-collapsed="true"] .app-sidebar {
        transform: translateX(-100%);
    }

    html[data-sidebar-collapsed="true"] .app-main {
        margin-left: 0;
    }
}

/* Stats */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    opacity: 0.45;
}

.stat-card-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-card-label-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.stat-card-label-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.stat-card-label-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.stat-card-value.income { color: var(--income); }
.stat-card-value.expense { color: var(--expense); }
.stat-card-value.balance.positive { color: var(--income); }
.stat-card-value.balance.negative { color: var(--expense); }

.dashboard-ledger-summary {
    margin-bottom: 24px;
}

.dashboard-ledger-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.dashboard-ledger-summary-meta {
    margin: 0;
    font-size: 13px;
}

.dashboard-ledger-stats {
    margin-bottom: 0;
}

.financial-summary-hero {
    margin-bottom: 20px;
}

.financial-summary-hero-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.financial-summary-hero-title {
    margin: 0 0 6px;
    font-size: 22px;
}

.financial-summary-hero-meta {
    margin: 0;
    font-size: 13px;
}

.financial-summary-hero-net {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-size: 13px;
}

.financial-summary-hero-net strong {
    font-size: 28px;
    line-height: 1.1;
}

.financial-summary-stat-grid {
    margin-bottom: 0;
}

.financial-summary-stat-meta {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.financial-summary-panels {
    margin-bottom: 20px;
}

.financial-summary-table td {
    vertical-align: middle;
}

.financial-summary-table-total td {
    border-top: 2px solid var(--border);
    background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}

.financial-summary-table-note {
    padding: 12px 20px 16px;
    margin: 0;
}

.financial-summary-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.financial-summary-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.financial-summary-metric-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.financial-summary-metric-value {
    font-size: 20px;
    line-height: 1.2;
}

.financial-summary-metric-hint {
    font-size: 12px;
}

/* Dashboard charts */
.dashboard-today-panel {
    margin-bottom: 20px;
}

.dashboard-today-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: center;
}

.dashboard-today-stats {
    display: grid;
    gap: 12px;
}

.mini-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.mini-stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.mini-stat-value {
    font-size: 18px;
    font-weight: 700;
}

.mini-stat-value.income { color: var(--income); }
.mini-stat-value.expense { color: var(--expense); }

.dashboard-today-chart,
.dashboard-month-chart-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.dashboard-overview {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
    align-items: stretch;
}

.dashboard-month-stats {
    margin-bottom: 0;
    grid-template-columns: 1fr;
    height: 100%;
}

.dashboard-month-chart-panel {
    margin-bottom: 0;
    height: 100%;
}

.dashboard-month-chart-note {
    margin: 0;
    font-size: 12px;
    text-align: center;
}

.dashboard-top-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-debt-summary {
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: 24px;
}

.dashboard-widgets {
    display: flex;
    flex-direction: column;
}

.dashboard-widget {
    margin-bottom: 24px;
}

.dashboard-widget-row {
    margin-bottom: 24px;
}

.dashboard-widget-row .dashboard-widget,
.dashboard-top-grid .dashboard-widget {
    margin-bottom: 0;
}

.dashboard-breakdown-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dashboard-mini-stats {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 0;
}

.dashboard-stat-hint {
    margin: 8px 0 0;
    font-size: 12px;
}

.dashboard-net-position-total {
    margin: 16px 0 0;
    font-size: 14px;
}

.dashboard-compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.dashboard-compare-card {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.dashboard-compare-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.dashboard-compare-values {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.dashboard-compare-values strong {
    font-size: 18px;
}

.dashboard-compare-delta {
    font-size: 13px;
    font-weight: 600;
}

.dashboard-compare-delta.is-positive {
    color: var(--income);
}

.dashboard-compare-delta.is-negative {
    color: var(--expense);
}

.dashboard-weekly-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-weekly-row {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 12px;
    align-items: center;
}

.dashboard-weekly-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.dashboard-weekly-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 28px;
}

.dashboard-weekly-bar {
    height: 10px;
    border-radius: 999px;
    min-width: 2px;
}

.dashboard-weekly-bar.income {
    background: var(--income);
}

.dashboard-weekly-bar.expense {
    background: var(--expense);
}

.dashboard-weekly-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    text-align: right;
    min-width: 88px;
}

.line-chart {
    width: 100%;
}

.line-chart-svg {
    width: 100%;
    height: var(--line-chart-height, 200px);
    display: block;
}

.line-chart-grid {
    stroke: var(--border);
    stroke-width: 1;
}

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

.line-chart-dot {
    stroke: var(--surface);
    stroke-width: 1.5;
}

.line-chart-labels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 4px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

.line-chart-legend {
    margin-top: 12px;
    flex-direction: row;
    flex-wrap: wrap;
    max-width: none;
}

.dashboard-layout-intro {
    margin: 0 0 12px;
    font-size: 12px;
}

.dashboard-layout-panel {
    overflow: hidden;
}

.dashboard-layout-details {
    border: none;
}

.dashboard-layout-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid transparent;
}

.dashboard-layout-summary::-webkit-details-marker {
    display: none;
}

.dashboard-layout-details[open] .dashboard-layout-summary {
    border-bottom-color: var(--border);
}

.dashboard-layout-summary-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dashboard-layout-chevron {
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    flex-shrink: 0;
    margin-top: -2px;
}

.dashboard-layout-details[open] .dashboard-layout-chevron {
    transform: rotate(45deg);
    margin-top: 2px;
}

.dashboard-layout-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.dashboard-layout-meta {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.dashboard-layout-summary-hint {
    font-size: 12px;
    flex-shrink: 0;
}

.dashboard-layout-body {
    padding: 14px 18px 18px;
}

.dashboard-widget-picker-scroll {
    max-height: min(42vh, 320px);
    overflow: auto;
    margin: 0 -4px;
    padding: 0 4px 4px;
}

.dashboard-widget-picker {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.dashboard-widget-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.dashboard-widget-picker-item.is-dragging {
    opacity: 0.55;
}

.dashboard-widget-drag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-muted);
    flex-shrink: 0;
    cursor: grab;
}

.dashboard-widget-drag svg {
    width: 12px;
    height: 12px;
}

.dashboard-widget-picker-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.dashboard-widget-picker-label input {
    flex-shrink: 0;
}

.dashboard-widget-picker-text {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-layout-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.dashboard-layout-actions-admin {
    background: color-mix(in srgb, var(--accent) 6%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
    border-radius: var(--radius-sm);
    padding: 12px;
}

.dashboard-layout-admin-note {
    flex: 1 1 100%;
    margin: 0 0 4px;
    font-size: 13px;
    line-height: 1.45;
}

.dashboard-preview-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
}

#dashboard-layout {
    margin-bottom: 0;
}

#dashboard-layout .panel {
    margin-bottom: 16px;
}

@media (min-width: 1100px) {
    .dashboard-widget-picker {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .dashboard-layout-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-layout-summary-hint {
        padding-left: 18px;
    }
}

.chart-donut {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chart-donut-empty {
    background: var(--surface-2);
    border: 2px dashed var(--border);
}

.chart-donut-hole {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px var(--border);
}

.chart-donut-center {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    padding: 0 8px;
}

.chart-legend {
    width: 100%;
    max-width: min(280px, 100%);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.chart-legend-item strong {
    margin-left: auto;
    font-size: 13px;
}

.chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chart-legend-dot.income { background: var(--income); }
.chart-legend-dot.expense { background: var(--expense); }

.chart-comparison {
    width: 100%;
    max-width: min(280px, 100%);
}

.chart-comparison-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
}

.chart-comparison-track {
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.chart-comparison-segment {
    height: 100%;
    transition: width 0.35s ease;
}

.chart-comparison-segment.income { background: var(--income); }
.chart-comparison-segment.expense { background: var(--expense); }

.top-tx-chart-scroll {
    max-height: 248px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-right: 2px;
    margin-right: -2px;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--text-muted) 45%, transparent) transparent;
}

.top-tx-chart-scroll::-webkit-scrollbar {
    width: 6px;
}

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

.top-tx-chart-scroll::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--text-muted) 40%, transparent);
    border-radius: 999px;
}

.top-tx-chart-scroll::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--text-muted) 60%, transparent);
}

.top-tx-chart {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.top-tx-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.top-tx-rank {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.top-tx-body {
    flex: 1;
    min-width: 0;
}

.top-tx-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.top-tx-title {
    font-weight: 600;
    font-size: 14px;
}

.top-tx-amount {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

.top-tx-meta {
    font-size: 12px;
    margin-bottom: 8px;
}

.top-tx-bar-wrap {
    height: 8px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
}

.top-tx-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.35s ease;
}

.top-tx-bar.income { background: linear-gradient(90deg, var(--income), var(--income-light)); }
.top-tx-bar.expense { background: linear-gradient(90deg, var(--expense), var(--expense-light)); }

.text-income { color: var(--income); }
.text-expense { color: var(--expense); }

/* Panels */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

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

.panel-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.panel-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.panel-body {
    padding: 20px;
    min-width: 0;
}

.panel-danger {
    border-color: color-mix(in srgb, var(--expense) 35%, var(--border));
}

.panel-danger .panel-header {
    background: color-mix(in srgb, var(--expense) 8%, var(--surface));
}

.panel-danger-lead {
    color: var(--text-muted);
    margin: 0 0 16px;
}

.panel-body-flush {
    padding: 0;
}

:is(
    .table-scroll,
    .panel-body > .table-scroll,
    .panel-body-flush > .table-scroll,
    .panel-body:has(> .data-table),
    .panel-body-flush:has(> .data-table),
    .panel-body-flush:has(> .support-thread-list),
    .debt-settlement-history
) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--text-muted) 40%, transparent) transparent;
}

:is(
    .table-scroll,
    .panel-body > .table-scroll,
    .panel-body-flush > .table-scroll,
    .panel-body:has(> .data-table),
    .panel-body-flush:has(> .data-table),
    .panel-body-flush:has(> .support-thread-list),
    .debt-settlement-history
)::-webkit-scrollbar {
    height: 6px;
}

:is(
    .table-scroll,
    .panel-body > .table-scroll,
    .panel-body-flush > .table-scroll,
    .panel-body:has(> .data-table),
    .panel-body-flush:has(> .data-table),
    .panel-body-flush:has(> .support-thread-list),
    .debt-settlement-history
)::-webkit-scrollbar-track {
    background: transparent;
}

:is(
    .table-scroll,
    .panel-body > .table-scroll,
    .panel-body-flush > .table-scroll,
    .panel-body:has(> .data-table),
    .panel-body-flush:has(> .data-table),
    .panel-body-flush:has(> .support-thread-list),
    .debt-settlement-history
)::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--text-muted) 40%, transparent);
    border-radius: 999px;
}

:is(
    .table-scroll > .data-table,
    .panel-body > .data-table,
    .panel-body-flush > .data-table,
    .debt-settlement-history > .data-table,
    .panel-body-flush > .support-thread-list
) {
    min-width: 560px;
}

.category-row .table-actions {
    flex-shrink: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
    line-height: 1.2;
}

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

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

.btn-success {
    background: var(--income);
    color: #fff;
    border-color: var(--income);
}

.btn-success:hover {
    background: #047857;
    color: #fff;
}

.btn-danger {
    background: var(--expense);
    color: #fff;
    border-color: var(--expense);
}

.btn-danger:hover {
    background: #b91c1c;
    color: #fff;
}

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

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

.btn-ghost.btn-tone-accent,
.btn-ghost.btn-tone-accent .btn-icon,
.btn-ghost.btn-tone-accent .btn-label {
    color: var(--accent);
}

.btn-ghost.btn-tone-accent:hover {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent);
}

.btn-ghost.btn-tone-income,
.btn-ghost.btn-tone-income .btn-icon,
.btn-ghost.btn-tone-income .btn-label {
    color: var(--income);
}

.btn-ghost.btn-tone-income:hover {
    background: var(--income-bg);
    border-color: color-mix(in srgb, var(--income) 35%, var(--border));
    color: var(--income);
}

.btn-ghost.btn-tone-expense,
.btn-ghost.btn-tone-expense .btn-icon,
.btn-ghost.btn-tone-expense .btn-label {
    color: var(--expense);
}

.btn-ghost.btn-tone-expense:hover {
    background: var(--expense-bg);
    border-color: color-mix(in srgb, var(--expense) 35%, var(--border));
    color: var(--expense);
}

.btn-ghost.btn-tone-warning,
.btn-ghost.btn-tone-warning .btn-icon,
.btn-ghost.btn-tone-warning .btn-label {
    color: #d97706;
}

.btn-ghost.btn-tone-warning:hover {
    background: color-mix(in srgb, #d97706 12%, transparent);
    border-color: color-mix(in srgb, #d97706 35%, var(--border));
    color: #d97706;
}

[data-theme="dark"] .btn-ghost.btn-tone-warning,
[data-theme="dark"] .btn-ghost.btn-tone-warning .btn-icon,
[data-theme="dark"] .btn-ghost.btn-tone-warning .btn-label {
    color: #fbbf24;
}

[data-theme="dark"] .btn-ghost.btn-tone-warning:hover {
    color: #fbbf24;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 13px;
}

.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-with-icon .btn-icon {
    display: inline-flex;
    flex-shrink: 0;
}

.btn-with-icon .btn-icon svg {
    width: 14px;
    height: 14px;
    display: block;
}

.btn-with-icon.is-loading {
    pointer-events: none;
}

.btn-with-icon.is-loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-loading-spin 0.65s linear infinite;
    flex-shrink: 0;
    opacity: 0.95;
}

.btn-with-icon.is-loading .btn-icon {
    display: none;
}

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

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.list-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.list-pagination-meta {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.list-pagination-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.list-pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.list-pagination-page:hover {
    border-color: var(--accent-border);
    color: var(--accent);
}

.list-pagination-page.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

@media (max-width: 768px) {
    .list-pagination {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
    }

    .list-pagination-links {
        justify-content: center;
    }
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.smtp-test-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.smtp-test-row .form-input {
    flex: 1 1 auto;
}

.smtp-test-row .btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

@media (max-width: 520px) {
    .smtp-test-row {
        flex-direction: column;
    }
}

.smtp-test-result {
    margin-top: 12px;
    font-size: 14px;
    font-weight: 500;
}

.notification-template-placeholders {
    display: grid;
    gap: 8px;
}

.notification-template-token {
    display: grid;
    grid-template-columns: minmax(160px, 220px) 1fr;
    gap: 10px;
    align-items: start;
    padding: 8px 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: var(--surface-muted, #f8fafc);
    font-size: 13px;
}

.notification-template-token code {
    font-size: 12px;
    word-break: break-all;
}

@media (max-width: 640px) {
    .notification-template-token {
        grid-template-columns: 1fr;
    }
}

.smtp-test-result[hidden] {
    display: none;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.form-label-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.form-label-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.form-label-icon svg {
    width: 16px;
    height: 16px;
}

.contact-picker {
    position: relative;
}

.contact-picker-control {
    position: relative;
}

.contact-picker-input {
    padding-right: 38px;
}

.contact-picker-clear {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.contact-picker-clear:hover {
    background: color-mix(in srgb, var(--text-muted) 12%, transparent);
    color: var(--text);
}

.contact-picker-dropdown {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.contact-picker-list {
    list-style: none;
    margin: 0;
    padding: 6px;
}

.contact-picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.contact-picker-option:hover,
.contact-picker-option.is-active {
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.contact-picker-option-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    flex-shrink: 0;
}

.contact-picker-option-icon-person {
    background: color-mix(in srgb, #3b82f6 14%, transparent);
    color: #3b82f6;
}

.contact-picker-option-icon-business {
    background: color-mix(in srgb, #8b5cf6 14%, transparent);
    color: #8b5cf6;
}

.contact-picker-option-icon-person::before {
    content: 'K';
    font-size: 11px;
    font-weight: 700;
}

.contact-picker-option-icon-business::before {
    content: 'İ';
    font-size: 11px;
    font-weight: 700;
}

.contact-picker-option-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.contact-picker-option-label {
    font-size: 14px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.contact-picker-option-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.contact-picker-empty {
    padding: 12px 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.contact-picker-empty a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.contact-picker-empty a:hover {
    text-decoration: underline;
}

.contact-picker-hint {
    margin-top: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled,
.form-field.is-disabled .form-input,
.form-field.is-disabled .form-select,
.form-field.is-disabled .form-textarea {
    opacity: 0.65;
    cursor: not-allowed;
    background: var(--surface-2);
    color: var(--text-muted);
    box-shadow: none;
}

.form-field.is-disabled .form-label {
    color: var(--text-muted);
}

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

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 6px 0 0;
}

.form-error {
    background: var(--expense-bg);
    color: var(--expense);
    border: 1px solid var(--expense-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 16px;
}

.form-info {
    background: var(--income-bg);
    color: var(--income);
    border: 1px solid var(--income-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.auth-verify-hint {
    margin: 0 0 20px;
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
}

.auth-verify-steps {
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-verify-steps li {
    position: relative;
    padding-left: 22px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-verify-steps li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--income);
    font-weight: 700;
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

.data-table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
    background: var(--surface-2);
}

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

.table-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.table-actions .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.text-end { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-income { color: var(--income); font-weight: 600; }
.text-expense { color: var(--expense); font-weight: 600; }

/* Badges & tags */
.type-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.type-badge.income {
    background: var(--income-bg);
    color: var(--income);
}

.type-badge.expense {
    background: var(--expense-bg);
    color: var(--expense);
}

.type-badge.investment {
    background: color-mix(in srgb, #6366f1 14%, transparent);
    color: #6366f1;
}

.type-badge.receivable-settlement,
.tx-source-badge.receivable-settlement {
    color: var(--income);
    background: var(--income-bg);
}

.type-badge.payable-settlement,
.tx-source-badge.payable-settlement {
    color: var(--expense);
    background: var(--expense-bg);
}

.type-badge.asset-purchase,
.tx-source-badge.asset-purchase {
    color: var(--expense);
    background: var(--expense-bg);
}

.type-badge.asset-external,
.tx-source-badge.asset-external,
.type-badge.asset-sale,
.tx-source-badge.asset-sale {
    color: var(--income);
    background: var(--income-bg);
}

.type-badge.asset-withdraw,
.tx-source-badge.asset-withdraw,
.type-badge.asset-loss,
.tx-source-badge.asset-loss {
    color: var(--expense);
    background: var(--expense-bg);
}

.type-badge.asset-profit,
.tx-source-badge.asset-profit {
    color: var(--income);
    background: var(--income-bg);
}

.type-badge.retail-sale,
.tx-source-badge.retail-sale {
    color: #7c3aed;
    background: color-mix(in srgb, #8b5cf6 14%, transparent);
}

.type-badge.credit-card,
.tx-source-badge.credit-card {
    color: #2563eb;
    background: color-mix(in srgb, #3b82f6 14%, transparent);
}

.type-badge.loan-given-initial,
.tx-source-badge.loan-given-initial {
    color: var(--expense);
    background: var(--expense-bg);
}

.type-badge.loan-received-initial,
.tx-source-badge.loan-received-initial {
    color: var(--income);
    background: var(--income-bg);
}

.transaction-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.transaction-type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.transaction-type-icon svg {
    display: block;
}

.transaction-type-icon-sm {
    width: 32px;
    height: 32px;
}

.transaction-type-icon-md {
    width: 40px;
    height: 40px;
}

.transaction-type-icon-sm svg {
    width: 16px;
    height: 16px;
}

.transaction-type-icon-md svg {
    width: 20px;
    height: 20px;
}

.transaction-type-icon-income {
    background: var(--income-bg);
    color: var(--income);
}

.transaction-type-icon-expense {
    background: var(--expense-bg);
    color: var(--expense);
}

.transaction-type-icon-credit-card {
    background: color-mix(in srgb, #3b82f6 14%, transparent);
    color: #2563eb;
}

.transaction-type-icon-retail-sale {
    background: color-mix(in srgb, #8b5cf6 14%, transparent);
    color: #7c3aed;
}

.transaction-type-icon-asset-purchase,
.transaction-type-icon-asset-withdraw,
.transaction-type-icon-asset-loss {
    background: var(--expense-bg);
    color: var(--expense);
}

.transaction-type-icon-asset-external,
.transaction-type-icon-asset-sale,
.transaction-type-icon-asset-profit {
    background: var(--income-bg);
    color: var(--income);
}

.transaction-type-icon-investment {
    background: color-mix(in srgb, #6366f1 14%, transparent);
    color: #6366f1;
}

.transaction-type-icon-loan-given-initial {
    background: var(--expense-bg);
    color: var(--expense);
}

.transaction-type-icon-loan-received-initial {
    background: var(--income-bg);
    color: var(--income);
}

.category-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    flex-shrink: 0;
    color: var(--category-icon-color, #64748b);
    background: color-mix(in srgb, var(--category-icon-color, #64748b) 16%, transparent);
}

.category-icon svg {
    width: 16px;
    height: 16px;
}

.category-row-main .category-icon {
    margin-right: 2px;
}

/* Breakdown bars */
.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.breakdown-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    align-items: center;
}

.breakdown-label {
    display: flex;
    align-items: center;
    font-size: 14px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.breakdown-label .category-dot {
    flex-shrink: 0;
}

.breakdown-amount {
    font-weight: 600;
    font-size: 14px;
    text-align: right;
    white-space: nowrap;
}

.breakdown-bar-wrap {
    grid-column: 1 / -1;
    height: 6px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
}

.breakdown-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}

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

.empty-state p {
    margin: 0 0 16px;
}

/* Filters */
.filter-context-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.filter-context-label {
    margin: 0;
    font-size: 14px;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.filter-bar .form-field {
    min-width: 140px;
}

.filter-bar-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 0;
    margin-left: auto;
}

.filter-bar > .filter-bar-form:only-child {
    margin-left: 0;
    width: 100%;
}

.filter-bar-form .form-field {
    min-width: 0;
    flex: 0 1 140px;
}

.filter-bar-form .form-field-contact-filter {
    flex: 1 1 200px;
    min-width: 160px;
    max-width: 280px;
}

.filter-bar-form .form-field-contact-search {
    flex: 0 1 220px;
    min-width: 180px;
    max-width: 280px;
}

.filter-bar-form .contact-picker-hint {
    display: none;
}

.filter-bar-form .form-field-filter-submit {
    flex: 0 0 132px;
    min-width: 132px;
}

.filter-bar-form .filter-submit-btn {
    width: 100%;
    min-height: 0;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.2;
    justify-content: center;
    box-sizing: border-box;
}

.filter-bar-form .form-field.is-disabled .form-select {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (min-width: 768px) {
    .filter-bar > .filter-bar-form:only-child {
        flex-wrap: nowrap;
    }
}

@media (max-width: 767px) {
    .filter-bar > .filter-bar-form:only-child {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
        align-items: end;
    }

    .filter-bar-form .form-field:not(.form-field-contact-search):not(.form-field-contact-filter):not(.form-field-filter-submit) {
        grid-column: 1 / -1;
    }

    .filter-bar-form .form-field-contact-search,
    .filter-bar-form .form-field-contact-filter {
        grid-column: 1;
        min-width: 0;
        max-width: none;
        flex: unset;
    }

    .filter-bar-form .form-field-filter-submit {
        grid-column: 2;
        flex: 0 0 auto;
        min-width: 112px;
        width: auto;
    }
}

.filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface-2);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.filter-tab {
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.filter-tab:hover {
    color: var(--accent);
}

.filter-tab.is-active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

/* Category cards */
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    min-width: 0;
    max-width: 100%;
}

.category-section {
    min-width: 0;
}

.category-section h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.category-section-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 12px;
}

.category-section-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-list-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.category-list-divider::before,
.category-list-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.category-list-system .category-row {
    background: var(--surface);
}

.category-sort-hint,
.category-sort-status {
    font-size: 12px;
}

.category-sort-status {
    color: var(--income);
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
}

.category-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.category-row[draggable="true"] {
    cursor: grab;
}

.category-row.is-dragging {
    opacity: 0.55;
}

.category-row-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.category-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.category-drag-handle svg {
    width: 16px;
    height: 16px;
}

.category-row.is-editing {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    background: color-mix(in srgb, var(--accent) 6%, var(--surface-2));
}

.category-row-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0 6px;
    min-width: 0;
    font-weight: 500;
    font-size: 14px;
}

.category-meta-badge {
    font-size: 12px;
    font-weight: 400;
}

/* Alerts */
.app-alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.app-alert-success {
    background: var(--income-bg);
    color: var(--income);
    border: 1px solid var(--income-border);
}

.app-alert-error {
    background: var(--expense-bg);
    color: var(--expense);
    border: 1px solid var(--expense-border);
}

/* Auth */
.auth-body {
    min-height: 100vh;
    background: var(--bg);
}

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

.auth-panel {
    background: var(--auth-panel-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.auth-panel-inner {
    max-width: 380px;
}

.auth-panel-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.auth-panel-link:hover {
    color: inherit;
}

.auth-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.auth-logo svg {
    width: 26px;
    height: 26px;
    color: #fff;
}

.auth-panel h1 {
    margin: 0 0 12px;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-panel p {
    margin: 0 0 24px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 15px;
    line-height: 1.6;
}

.auth-features {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-features li {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    padding-left: 20px;
    position: relative;
}

.auth-features li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--income-light);
}

.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    background: color-mix(in srgb, var(--accent) 4%, var(--bg));
}

.auth-form-wrap {
    width: 100%;
    max-width: 400px;
}

.auth-form-wrap h2 {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 700;
}

.auth-form-wrap .auth-subtitle {
    margin: 0 0 28px;
    color: var(--text-muted);
    font-size: 14px;
}

.auth-footer-link {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-back-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 20px;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.auth-back-home:hover {
    color: var(--accent);
}

.auth-back-home svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.auth-mobile-brand {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.auth-mobile-brand:hover {
    color: var(--text);
}

.auth-mobile-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-mobile-brand-icon svg {
    width: 20px;
    height: 20px;
}

.two-col-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
}

.two-col-layout > * {
    min-width: 0;
}

.dashboard-overview > *,
.dashboard-top-grid > * {
    min-width: 0;
}

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

    .two-col-layout,
    .category-grid,
    .dashboard-overview,
    .dashboard-top-grid,
    .dashboard-today-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.is-open {
        transform: translateX(0);
    }

    .app-sidebar-backdrop.is-visible {
        display: block;
    }

    .app-main {
        margin-left: 0;
    }

    .app-menu-btn {
        display: inline-flex;
    }

    .app-content {
        padding: 16px;
    }

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

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-panel {
        display: none;
    }

    .auth-mobile-brand {
        display: flex;
    }

    .auth-form-panel {
        padding: 32px 20px;
        align-items: flex-start;
    }

    .auth-form-wrap {
        margin: 0 auto;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }

    .panel-body {
        padding: 16px;
    }

    .panel-header {
        padding: 14px 16px;
    }

    .dashboard-month-filter .form-field {
        min-width: 0;
        flex: 1 1 calc(33.333% - 7px);
    }

    .app-topbar {
        padding: 0 12px;
        gap: 8px;
    }

    .app-topbar-title {
        gap: 6px;
    }

    .app-topbar-title h1 {
        font-size: 16px;
    }

    .active-ledger-badge {
        max-width: 88px;
    }

    .admin-topbar-badge {
        display: none;
    }

    .app-topbar-actions {
        gap: 4px;
    }

    .app-topbar-actions .btn-label,
    .app-topbar-actions .btn-topbar-label {
        display: none;
    }

    .app-topbar-actions .btn-with-icon,
    .app-topbar-actions .btn-sm {
        padding: 6px 8px;
        gap: 0;
    }

    .app-topbar-actions .btn-with-icon .btn-icon svg {
        width: 16px;
        height: 16px;
    }

    .notification-panel .panel-header {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .notification-panel .panel-header .table-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .notification-item {
        padding: 14px 16px;
    }

    .notification-item-head {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .notification-item-head-actions {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
    }

    .notification-item-title {
        font-size: 15px;
    }
}

/* Access & subscription */
.access-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 16px;
    font-size: 14px;
}

.access-banner-compact {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px;
    margin: 0 10px 12px;
    font-size: 12px;
}

.access-banner-compact a {
    color: var(--accent);
    font-weight: 600;
    font-size: 12px;
}

.access-banner-trial {
    background: var(--accent-soft);
    border-color: var(--accent-border);
}

.access-banner-active,
.access-badge-active {
    background: var(--income-bg);
    border-color: var(--income-border);
}

.access-banner-expired,
.access-badge-expired {
    background: var(--expense-bg);
    border-color: var(--expense-border);
}

.app-sidebar-access .access-banner {
    margin-bottom: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.plan-card {
    border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--border));
    border-radius: var(--radius);
    padding: 18px;
    background: color-mix(in srgb, var(--accent) 3%, var(--surface-2));
    box-shadow: var(--shadow);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

.plan-card-head h3 {
    margin: 8px 0 0;
    font-size: 16px;
}

.plan-price {
    font-size: 24px;
    font-weight: 700;
    margin: 12px 0 4px;
}

.plan-price-breakdown {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 8px;
}

.plan-price-line,
.plan-module-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.plan-price-line {
    margin-bottom: 8px;
}

.plan-module-lines {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--border);
}

.plan-module-line {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.plan-module-line:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.plan-module-line strong,
.plan-price-line strong {
    color: var(--text);
    font-size: 13px;
    white-space: nowrap;
}

.plan-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.plan-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 14px;
}

.meta-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.meta-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

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

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

.checkbox-row-reverse {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.checkbox-row-reverse span {
    flex: 1;
}

.email-notification-prefs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.email-notification-pref-row {
    align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.email-notification-pref-row input {
    margin-top: 3px;
}

.radio-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
}

.radio-chip-with-icon {
    gap: 8px;
    min-width: 148px;
    padding: 8px 12px 8px 10px;
}

.radio-chip-with-icon input[type="radio"] {
    margin-left: auto;
    flex-shrink: 0;
}

.color-preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 10px;
}

.color-preset-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    overflow: hidden;
}

.color-preset-preview {
    height: 34px;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
    overflow: hidden;
    position: relative;
}

.color-preset-preview-bar {
    position: absolute;
    inset: 0 auto 0 0;
    width: 38%;
    background: var(--sidebar-gradient, linear-gradient(180deg, #0f172a, #1e293b));
}

.color-preset-preview-content {
    position: absolute;
    inset: 6px 6px 6px 42%;
    border-radius: 4px;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

.color-preset-preview-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 4px 4px 0 0;
}

.color-preset-card:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.color-preset-card.is-selected,
.color-preset-card:has(input:checked) {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.color-preset-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.color-preset-swatches {
    display: flex;
    gap: 4px;
    height: 26px;
}

.color-preset-swatch {
    flex: 1;
    min-width: 0;
    border-radius: 5px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.color-preset-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.color-preset-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.35;
}

[data-theme="dark"] .color-preset-swatch {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

@media (max-width: 900px) {
    .color-preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .color-preset-grid {
        grid-template-columns: 1fr;
    }
}

.admin-inline-form {
    text-align: left;
}

.admin-inline-form summary {
    list-style: none;
    cursor: pointer;
}

.admin-inline-form-body {
    margin-top: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    min-width: 220px;
}

.admin-user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
}

.admin-user-actions > .admin-inline-form {
    display: inline-flex;
    position: relative;
}

.admin-user-actions .admin-inline-form summary {
    display: inline-flex;
}

.admin-user-actions .admin-inline-form summary::-webkit-details-marker {
    display: none;
}

.admin-user-actions .admin-inline-form-body {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 30;
    margin-top: 0;
    box-shadow: var(--shadow);
}

.admin-user-manage-grid {
    align-items: start;
}

.admin-user-manage-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-user-manage-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.admin-meta-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-height: 100%;
}

.admin-meta-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--text-muted) 12%, transparent);
    color: var(--text-muted);
}

.admin-meta-card-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.admin-meta-card-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.admin-meta-card-value {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
    color: var(--text);
}

.admin-user-manage-actions form {
    display: inline-flex;
    margin: 0;
}

@media (max-width: 1024px) {
    .admin-user-manage-grid {
        grid-template-columns: 1fr;
    }
}

.admin-user-actions .btn-label {
    display: inline;
}

@media (max-width: 768px) {
    .admin-user-actions .btn-label {
        display: none;
    }

    .admin-user-actions .admin-inline-form-body {
        position: static;
        margin-top: 8px;
        width: min(280px, 80vw);
    }
}

/* Admin panel */
.admin-body {
    --admin-accent: #d97706;
    --admin-sidebar-bg: #1c1917;
}

.admin-sidebar {
    background: var(--admin-sidebar-bg);
}

.admin-brand-icon {
    background: linear-gradient(135deg, #d97706, #b45309) !important;
}

.admin-sidebar-label {
    padding: 0 18px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.35);
}

.admin-topbar {
    border-bottom-color: rgba(217, 119, 6, 0.15);
}

.admin-topbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-topbar-title h1 {
    margin: 0;
}

.admin-topbar-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(217, 119, 6, 0.12);
    color: #d97706;
    border: 1px solid rgba(217, 119, 6, 0.25);
}

[data-theme="dark"] .admin-topbar-badge {
    color: #fbbf24;
}

.admin-sidebar .app-nav-link.is-active {
    background: rgba(217, 119, 6, 0.15);
    color: #fde68a;
}

.admin-quick-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-quick-link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, background 0.15s;
}

.admin-quick-link:hover {
    border-color: rgba(217, 119, 6, 0.35);
    background: rgba(217, 119, 6, 0.06);
    color: inherit;
}

.admin-quick-link-title {
    font-weight: 600;
    font-size: 14px;
}

.admin-quick-link-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.app-mode-switch {
    margin-bottom: 4px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
}

.app-mode-switch-finance {
    border-color: var(--accent-border-strong);
    color: color-mix(in srgb, var(--accent) 70%, #fff) !important;
}

.app-mode-switch-admin {
    border-color: rgba(217, 119, 6, 0.35);
    color: #fde68a !important;
}

.admin-body .app-mode-switch-finance {
    border-color: var(--accent-focus);
}

body:not(.admin-body) .app-mode-switch-admin {
    border-color: rgba(217, 119, 6, 0.4);
    color: #fcd34d !important;
}

.admin-topbar-switch {
    white-space: nowrap;
}

.notification-bell {
    position: relative;
    text-decoration: none;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
}

.notification-inline-alert {
    margin-bottom: 16px;
    overflow-wrap: anywhere;
}

.notification-list {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}

.notification-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    min-width: 0;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.is-unread {
    background: var(--accent-soft);
}

.notification-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.notification-item-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
    margin-left: auto;
}

.notification-delete-form {
    margin: 0;
}

.notification-item-title {
    margin: 0 0 8px;
    font-size: 16px;
    overflow-wrap: anywhere;
}

.notification-item-body {
    line-height: 1.55;
    color: var(--text);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.notification-item-meta {
    margin-top: 10px;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.page-intro {
    margin: 0 0 20px;
    line-height: 1.55;
}

.ledger-switcher {
    padding: 0 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.ledger-switcher-inner {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 10px;
}

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

.ledger-switcher-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sidebar-text);
}

.ledger-switcher-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.ledger-switcher-form {
    margin: 0;
}

.ledger-switcher-select {
    width: 100%;
    padding: 9px 32px 9px 10px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.3;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(15, 23, 42, 0.45);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    color: #f1f5f9;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ledger-switcher-select:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background-color: rgba(15, 23, 42, 0.6);
}

.ledger-switcher-select:focus {
    outline: none;
    border-color: var(--accent-focus);
    box-shadow: 0 0 0 2px var(--accent-ring);
}

.ledger-switcher-manage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ledger-switcher-manage:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    color: #f8fafc;
    text-decoration: none;
}

.ledger-switcher-manage-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.9;
}

.ledger-switcher-manage-icon svg {
    width: 16px;
    height: 16px;
}

.admin-sidebar .ledger-switcher-inner {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.admin-sidebar .ledger-switcher-manage {
    color: #fde68a;
    border-color: rgba(217, 119, 6, 0.25);
    background: rgba(217, 119, 6, 0.08);
}

.admin-sidebar .ledger-switcher-manage:hover {
    background: rgba(217, 119, 6, 0.14);
    border-color: rgba(217, 119, 6, 0.35);
    color: #fef3c7;
}

.active-ledger-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 0;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.active-ledger-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ledger-color, var(--accent));
}

.app-topbar-title h1 {
    margin-bottom: 0;
}

.ledger-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.ledger-icon-tile {
    --ledger-color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
    color: var(--ledger-color);
    background: color-mix(in srgb, var(--ledger-color) 14%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--ledger-color) 24%, var(--border));
}

.ledger-icon-tile svg {
    width: 22px;
    height: 22px;
}

.ledgers-page {
    max-width: 1280px;
}

.ledgers-hero {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.ledgers-hero-icon {
    width: 52px;
    height: 52px;
}

.ledgers-hero-icon svg {
    width: 26px;
    height: 26px;
}

.ledgers-hero-lead {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 14px;
}

.ledgers-overview {
    margin-bottom: 24px;
}

.ledgers-overview-active {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ledgers-list-section {
    margin-bottom: 8px;
}

.ledger-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 56px 24px;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.ledger-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
}

.ledger-empty-icon svg {
    width: 32px;
    height: 32px;
}

.ledger-empty-state h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.ledger-empty-state p {
    margin: 0;
    max-width: 360px;
    color: var(--text-muted);
    line-height: 1.55;
}

.ledger-form-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ledger-form-title h2 {
    margin: 0;
}

.ledger-form-title-icon {
    width: 40px;
    height: 40px;
}

.ledger-color-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ledger-color-input {
    width: 100%;
    max-width: 160px;
    height: 42px;
    padding: 4px;
    cursor: pointer;
}

.ledger-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ledger-color-swatch {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 999px;
    border: 2px solid transparent;
    background: var(--swatch-color);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ledger-color-swatch:hover {
    transform: scale(1.06);
}

.ledger-color-swatch.is-selected {
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--swatch-color);
}

.ledger-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ledger-card.is-active {
    border-color: color-mix(in srgb, var(--ledger-color, var(--accent)) 45%, var(--border));
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--ledger-color, var(--accent)) 18%, transparent),
        var(--shadow);
}

.ledger-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.ledger-card-icon {
    width: 48px;
    height: 48px;
}

.ledger-card-icon svg {
    width: 24px;
    height: 24px;
}

.ledger-card-heading {
    flex: 1;
    min-width: 0;
}

.ledger-card-heading h3 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.ledger-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ledger-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.ledger-badge-active {
    color: color-mix(in srgb, var(--ledger-color, var(--accent)) 82%, var(--text));
    background: color-mix(in srgb, var(--ledger-color, var(--accent)) 12%, var(--surface));
    border-color: color-mix(in srgb, var(--ledger-color, var(--accent)) 28%, var(--border));
}

.ledger-card-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
}

.ledger-card-balance {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.ledger-card-balance-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ledger-card-balance-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.ledger-card-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.ledger-card-metrics div {
    min-width: 0;
}

.ledger-card-metrics dt {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

.ledger-card-metrics dd {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ledger-card-footer {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 4px;
}

.ledger-card-footer-primary,
.ledger-card-footer-secondary {
    display: contents;
}

.ledger-card-footer form {
    display: inline-flex;
    flex-shrink: 0;
}

@media (min-width: 992px) {
    .ledger-grid {
        grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
    }

    .ledger-card-footer {
        flex-wrap: nowrap;
    }

    .ledger-card-footer .btn {
        flex-shrink: 0;
    }
}

.ledger-card-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.ledger-card-head h3 {
    margin: 0;
    font-size: 16px;
}

.ledger-card-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.ledger-card-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
    font-size: 13px;
}

.ledger-card-stats span {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
}

.ledger-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ledger-tag {
    display: inline-block;
    margin: 2px 4px 2px 0;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    background: color-mix(in srgb, var(--ledger-color, var(--accent)) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--ledger-color, var(--accent)) 35%, transparent);
}

@media (max-width: 768px) {
    .ledgers-hero {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }

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

    .ledger-card-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .ledger-card-metrics dt {
        font-size: 10px;
        letter-spacing: 0.02em;
    }

    .ledger-card-metrics dd {
        font-size: 12px;
        line-height: 1.25;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.contact-icon-wrap {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.contact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.contact-icon svg {
    display: block;
}

.contact-icon-sm {
    width: 32px;
    height: 32px;
}

.contact-icon-md {
    width: 40px;
    height: 40px;
}

.contact-icon-sm svg {
    width: 16px;
    height: 16px;
}

.contact-icon-md svg {
    width: 20px;
    height: 20px;
}

.contact-icon-person {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
}

.contact-icon-business {
    background: color-mix(in srgb, #6366f1 14%, transparent);
    color: #6366f1;
}

.contact-icon-both {
    background: color-mix(in srgb, var(--income) 14%, transparent);
    color: var(--income);
}

.contact-icon-active {
    background: color-mix(in srgb, var(--income) 16%, transparent);
    color: var(--income);
}

.contact-icon-inactive {
    background: color-mix(in srgb, var(--expense) 16%, transparent);
    color: var(--expense);
}

.contact-debt-badge {
    position: absolute;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: #fff;
    border: 2px solid var(--surface);
    box-sizing: content-box;
    pointer-events: none;
}

.contact-debt-badge.receivable {
    top: -5px;
    right: -5px;
    background: var(--income);
}

.contact-debt-badge.payable {
    bottom: -5px;
    right: -5px;
    background: var(--expense);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.debt-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin-bottom: 20px;
}

.debt-type-badge,
.debt-status-badge,
.tx-source-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.debt-type-badge.receivable,
.tx-source-badge.receivable-settlement {
    color: var(--income);
    background: var(--income-bg);
}

.debt-type-badge.payable,
.tx-source-badge.payable-settlement {
    color: var(--expense);
    background: var(--expense-bg);
}

.debt-loan-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--text-muted) 12%, transparent);
}

.debt-loan-mode-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border: 1px solid var(--border);
}

.debt-contact-composite {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.debt-contact-composite-row {
    display: flex;
    align-items: stretch;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: visible;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.debt-contact-composite-row:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.debt-contact-composite-picker {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.debt-contact-composite-picker:focus-within {
    z-index: 2;
}

.debt-contact-composite-picker .contact-picker-dropdown {
    z-index: 40;
}

.debt-contact-composite-picker .contact-picker-hint {
    display: none;
}

.debt-contact-composite-picker .contact-picker-input {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.debt-contact-composite-picker .contact-picker-input:focus {
    border: 0;
    box-shadow: none;
}

.debt-contact-composite-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0 12px;
    border-left: 1px solid var(--border);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--text-muted);
    cursor: pointer;
    flex: 0 0 auto;
    max-width: 44%;
    background: color-mix(in srgb, var(--surface-2) 55%, transparent);
    user-select: none;
}

.debt-contact-composite-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.debt-contact-composite-option:has(input:checked) {
    color: var(--text);
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.debt-contact-composite .form-hint {
    margin: 0;
}

@media (max-width: 640px) {
    .debt-contact-composite-row {
        flex-direction: column;
    }

    .debt-contact-composite-option {
        max-width: none;
        border-left: 0;
        border-top: 1px solid var(--border);
        padding: 10px 12px;
    }
}

.debt-status-badge.open {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.debt-status-badge.settled {
    color: var(--income);
    background: var(--income-bg);
}

.debt-status-badge.cancelled {
    color: var(--text-muted);
    background: var(--surface-2);
}

.tx-source-badge {
    margin-left: 6px;
    vertical-align: middle;
}

.tx-source-badge.asset-purchase {
    color: var(--expense);
    background: var(--expense-bg);
}

.tx-source-badge.asset-external {
    color: var(--income);
    background: var(--income-bg);
}

.tx-source-badge.asset-sale {
    color: var(--income);
    background: var(--income-bg);
}

.tx-source-badge.asset-withdraw {
    color: var(--expense);
    background: var(--expense-bg);
}

.tx-source-badge.asset-profit {
    color: var(--income);
    background: var(--income-bg);
}

.tx-source-badge.asset-loss {
    color: var(--expense);
    background: var(--expense-bg);
}

.tx-source-badge.retail-sale {
    color: #7c3aed;
    background: color-mix(in srgb, #8b5cf6 14%, transparent);
}

.tx-source-badge.credit-card {
    color: #2563eb;
    background: color-mix(in srgb, #3b82f6 14%, transparent);
}

.credit-card-stat-grid {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 0;
}

.credit-card-stat-grid > .stat-card {
    min-width: 0;
}

@media (max-width: 1024px) {
    .credit-card-stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.credit-card-stat-meta {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.credit-card-expense-fields {
    display: contents;
}

.credit-card-expense-fields[hidden] {
    display: none !important;
}

.credit-card-subnav {
    margin-bottom: 20px;
}

.credit-card-payment-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    grid-column: 1 / -1;
    align-items: start;
}

.credit-card-payment-amount-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.credit-card-pay-all-field {
    margin-top: 0;
}

@media (max-width: 720px) {
    .credit-card-payment-row {
        grid-template-columns: 1fr;
    }
}

.app-ajax-toast-stack {
    position: fixed;
    top: max(16px, env(safe-area-inset-top, 0px));
    right: max(20px, env(safe-area-inset-right, 0px));
    z-index: 90;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 10px;
    max-width: min(400px, calc(100vw - 32px));
    pointer-events: none;
}

body.app-body .app-ajax-toast-stack {
    top: calc(var(--topbar-height) + 12px);
}

.app-ajax-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
    border: 1px solid transparent;
    animation: appAjaxToastIn 0.28s ease;
    pointer-events: auto;
}

.app-ajax-toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
}

.app-ajax-toast-icon svg {
    display: block;
    width: 20px;
    height: 20px;
}

.app-ajax-toast-content {
    flex: 1;
    min-width: 0;
}

.app-ajax-toast-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

.app-ajax-toast-message {
    margin-top: 3px;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 400;
}

.app-ajax-toast.is-success .app-ajax-toast-title {
    color: color-mix(in srgb, var(--income) 78%, #000);
}

.app-ajax-toast.is-success .app-ajax-toast-message {
    color: color-mix(in srgb, var(--income) 62%, #000);
}

.app-ajax-toast.is-error .app-ajax-toast-title {
    color: color-mix(in srgb, var(--expense) 78%, #000);
}

.app-ajax-toast.is-error .app-ajax-toast-message {
    color: color-mix(in srgb, var(--expense) 62%, #000);
}

.app-ajax-toast.is-warning .app-ajax-toast-title {
    color: #92400e;
}

.app-ajax-toast.is-warning .app-ajax-toast-message {
    color: #b45309;
}

.app-ajax-toast-countdown {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.app-ajax-toast.is-success .app-ajax-toast-countdown {
    color: color-mix(in srgb, var(--income) 58%, #000);
}

.app-ajax-toast.is-error .app-ajax-toast-countdown {
    color: color-mix(in srgb, var(--expense) 58%, #000);
}

.app-ajax-toast.is-warning .app-ajax-toast-countdown {
    color: #b45309;
}

.app-ajax-toast.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-ajax-toast.is-success {
    background: var(--income-bg);
    color: var(--income);
    border-color: color-mix(in srgb, var(--income) 24%, transparent);
}

.app-ajax-toast.is-warning {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.app-ajax-toast.is-error {
    background: var(--expense-bg);
    color: var(--expense);
    border-color: color-mix(in srgb, var(--expense) 24%, transparent);
}

[data-theme="dark"] .app-ajax-toast {
    box-shadow:
        0 14px 40px rgba(0, 0, 0, 0.48),
        0 0 0 1px rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .app-ajax-toast.is-success {
    background: color-mix(in srgb, var(--income) 22%, var(--surface));
    border-color: color-mix(in srgb, var(--income) 50%, var(--border));
    color: color-mix(in srgb, var(--income) 80%, #fff);
}

[data-theme="dark"] .app-ajax-toast.is-success .app-ajax-toast-title {
    color: color-mix(in srgb, var(--income) 92%, #fff);
}

[data-theme="dark"] .app-ajax-toast.is-success .app-ajax-toast-message {
    color: color-mix(in srgb, var(--income) 78%, #fff);
}

[data-theme="dark"] .app-ajax-toast.is-success .app-ajax-toast-countdown {
    color: color-mix(in srgb, var(--income) 68%, #fff);
}

[data-theme="dark"] .app-ajax-toast.is-error {
    background: color-mix(in srgb, var(--expense) 22%, var(--surface));
    border-color: color-mix(in srgb, var(--expense) 50%, var(--border));
    color: color-mix(in srgb, var(--expense) 80%, #fff);
}

[data-theme="dark"] .app-ajax-toast.is-error .app-ajax-toast-title {
    color: color-mix(in srgb, var(--expense) 92%, #fff);
}

[data-theme="dark"] .app-ajax-toast.is-error .app-ajax-toast-message {
    color: color-mix(in srgb, var(--expense) 78%, #fff);
}

[data-theme="dark"] .app-ajax-toast.is-error .app-ajax-toast-countdown {
    color: color-mix(in srgb, var(--expense) 68%, #fff);
}

[data-theme="dark"] .app-ajax-toast.is-warning {
    background: color-mix(in srgb, #f59e0b 24%, var(--surface));
    border-color: color-mix(in srgb, #fbbf24 48%, var(--border));
    color: #fde68a;
}

[data-theme="dark"] .app-ajax-toast.is-warning .app-ajax-toast-title {
    color: #fef9c3;
}

[data-theme="dark"] .app-ajax-toast.is-warning .app-ajax-toast-message,
[data-theme="dark"] .app-ajax-toast.is-warning .app-ajax-toast-countdown {
    color: #fde68a;
}

form.is-submitting {
    opacity: 0.82;
    pointer-events: none;
}

@keyframes appAjaxToastIn {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .app-ajax-toast-stack {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        align-items: center;
        max-width: min(400px, calc(100vw - 24px));
    }
}

.app-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(20px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(20px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(2px);
    animation: appConfirmOverlayIn 0.2s ease;
}

.app-confirm-overlay.is-hiding {
    animation: appConfirmOverlayOut 0.2s ease forwards;
}

.app-confirm-overlay.is-hiding .app-ajax-confirm {
    opacity: 0;
    transform: scale(0.96);
}

.app-ajax-confirm {
    width: min(400px, 100%);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    pointer-events: auto;
    animation: appConfirmDialogIn 0.24s ease;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-ajax-confirm-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.app-ajax-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid color-mix(in srgb, currentColor 14%, transparent);
}

.app-ajax-confirm-btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.app-ajax-confirm-no {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.app-ajax-confirm-no:hover {
    background: var(--surface-2);
}

.app-ajax-confirm-yes {
    background: var(--expense);
    border-color: var(--expense);
    color: #fff;
}

.app-ajax-confirm-yes:hover {
    background: color-mix(in srgb, var(--expense) 88%, #000);
    border-color: color-mix(in srgb, var(--expense) 88%, #000);
}

[data-theme="dark"] .app-confirm-overlay {
    background: rgba(2, 6, 23, 0.62);
}

[data-theme="dark"] .app-ajax-confirm-no {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

[data-theme="dark"] .app-ajax-confirm-no:hover {
    background: color-mix(in srgb, var(--surface-2) 80%, #fff);
}

@keyframes appConfirmDialogIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes appConfirmOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes appConfirmOverlayOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.assets-summary-grid {
    margin-bottom: 16px;
}

.assets-add-panel {
    margin-bottom: 20px;
}

.assets-sell-panel {
    margin-bottom: 20px;
}

.assets-sell-summary {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    font-size: 14px;
    line-height: 1.5;
}

.assets-sell-summary strong {
    display: block;
    margin-bottom: 4px;
}

.crypto-coin-field[hidden],
.crypto-coin-field:not(.is-visible) {
    display: none !important;
}

.crypto-coin-picker {
    position: relative;
}

.crypto-coin-suggestions {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.crypto-coin-suggestion-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.crypto-coin-suggestion-item:last-child {
    border-bottom: 0;
}

.crypto-coin-suggestion-item:hover,
.crypto-coin-suggestion-item:focus {
    background: var(--surface-2);
}

.crypto-coin-error {
    color: var(--expense);
}

.asset-pricing-row,
.asset-pricing-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.asset-pricing-group {
    display: grid;
    gap: 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.asset-pricing-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.asset-pricing-group.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

@media (max-width: 768px) {
    .asset-pricing-row,
    .asset-pricing-groups {
        grid-template-columns: 1fr;
    }
}

.assets-rate-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.assets-rate-refresh-form {
    margin: 0;
}

.asset-funding-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.asset-funding-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    cursor: pointer;
}

.asset-funding-option input {
    margin: 0;
}

.asset-funding-option-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
}

.asset-funding-option-desc {
    display: block;
    line-height: 1.45;
}

.assets-total-preview {
    margin: 0;
}

.assets-table td,
.assets-table th {
    vertical-align: middle;
}

.assets-table th:first-child,
.assets-table td:first-child {
    white-space: normal;
    min-width: 11rem;
}

.assets-table th:not(:first-child),
.assets-table td:not(:first-child) {
    white-space: nowrap;
}

.assets-table td.text-end:has(> .table-actions) {
    width: 1%;
}

@media (max-width: 768px) {
    .assets-rate-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .assets-rate-refresh-form .btn {
        width: 100%;
        justify-content: center;
    }

    .assets-panel .panel-header h2 {
        font-size: 14px;
    }
}

.module-access-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.module-access-badge-locked {
    color: var(--text-muted);
    background: var(--surface-2);
}

.module-access-badge-active {
    color: var(--income);
    background: var(--income-bg);
}

.module-market-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.module-market-card.is-highlighted {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}

.module-market-card-head {
    align-items: flex-start;
}

.module-market-card-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.module-market-card-title h2 {
    margin: 0 0 6px;
    font-size: 16px;
}

.module-market-icon svg {
    width: 22px;
    height: 22px;
}

.module-market-desc {
    margin: 0 0 16px;
}

.module-plan-heading {
    margin: 0 0 12px;
    font-size: 14px;
}

.module-feature-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    background: var(--surface-2);
}

.module-feature-price {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.module-feature-price strong {
    font-size: 24px;
    line-height: 1.2;
}

.module-feature-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.module-feature-price-free {
    color: var(--income);
}

.price-struck {
    text-decoration: line-through;
    opacity: 0.65;
}

.module-feature-meta {
    margin: 0 0 16px;
    padding-left: 18px;
    color: var(--text-muted);
    font-size: 13px;
}

.module-feature-meta li + li {
    margin-top: 4px;
}

.module-feature-form .form-field {
    margin-bottom: 12px;
}

.module-feature-note {
    margin: 0;
}

.module-admin-grant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.module-admin-grant-card .panel-body {
    padding: 16px;
}

@media (max-width: 768px) {
    .module-market-card-head {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
}

tr.debt-due-soon td {
    background: color-mix(in srgb, #eab308 8%, var(--surface));
}

tr.debt-overdue td {
    background: color-mix(in srgb, var(--expense) 8%, var(--surface));
}

.debt-settle-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.debt-settle-summary div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
}

.debt-settle-summary span {
    color: var(--text-muted);
}

.debt-settlement-history {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.debt-elapsed-label {
    margin-top: 2px;
}

.support-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.support-tab {
    flex: 1 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.support-tab:hover {
    background: var(--surface-2);
    color: var(--text);
}

.support-tab.is-active {
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    color: var(--accent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, var(--border));
}

.support-tab-panels {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.support-tab-panel[hidden] {
    display: none !important;
}

.support-tab-intro {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.5;
}

.support-accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.support-accordion-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
}

.support-accordion-summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    user-select: none;
}

.support-accordion-summary::-webkit-details-marker {
    display: none;
}

.support-accordion-item[open] .support-accordion-summary {
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.support-accordion-chevron {
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-top: -2px;
}

.support-accordion-item[open] .support-accordion-chevron {
    transform: rotate(45deg);
    margin-top: 2px;
}

.support-accordion-title {
    flex: 1;
    min-width: 0;
}

.support-accordion-body {
    padding: 14px 16px 16px;
    font-size: 14px;
    line-height: 1.6;
}

.support-accordion-body p {
    margin: 0 0 10px;
}

.support-accordion-body p:last-child {
    margin-bottom: 0;
}

.support-accordion-body ul,
.support-accordion-body ol {
    margin: 0 0 10px;
    padding-left: 1.25rem;
}

.support-accordion-body li + li {
    margin-top: 4px;
}

.support-accordion-body strong {
    color: var(--text);
    font-weight: 600;
}

@media (max-width: 768px) {
    .support-tab {
        flex: 1 1 calc(50% - 4px);
        font-size: 13px;
        padding: 10px 12px;
    }
}

.support-chat-panel .panel-body.support-chat-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0;
}

.support-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 280px;
    max-height: 420px;
    overflow-y: auto;
    padding: 20px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.support-chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    text-align: center;
}

.support-chat-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 85%;
}

.support-chat-message.is-mine {
    align-self: flex-end;
}

.support-chat-message.is-theirs {
    align-self: flex-start;
}

.support-chat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.support-chat-meta strong {
    color: var(--text);
    font-size: 12px;
}

.support-chat-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.5;
    word-break: break-word;
    background: var(--surface);
    border: 1px solid var(--border);
}

.support-chat-message.is-theirs.from-admin .support-chat-bubble {
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
}

.support-chat-message.is-mine .support-chat-bubble {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.support-chat-composer {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.support-chat-composer-actions {
    display: flex;
    justify-content: flex-end;
}

.support-admin-layout {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.support-thread-list {
    display: flex;
    flex-direction: column;
}

.support-thread-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.support-thread-item:hover {
    background: var(--surface-2);
}

.support-thread-item.is-active {
    background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
    border-left: 3px solid var(--accent);
    padding-left: 13px;
}

.support-thread-item.is-unread {
    background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.support-thread-item-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
}

.support-thread-item-meta {
    grid-column: 1;
    font-size: 12px;
    color: var(--text-muted);
}

.support-thread-item-preview {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.support-thread-item-time {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.support-thread-item-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--expense);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

@media (max-width: 900px) {
    .support-admin-layout {
        grid-template-columns: 1fr;
    }

    .support-thread-list-panel {
        max-height: 240px;
        overflow: hidden;
    }

    .support-thread-list {
        max-height: 200px;
        overflow-y: auto;
    }
}

.support-chat-panel-header {
    flex-wrap: wrap;
    gap: 12px;
}

.support-chat-panel-header > div:first-child {
    min-width: 0;
}

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

.support-thread-action-form {
    margin: 0;
}

.support-chat-header-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.support-thread-status-alert {
    margin: 16px 20px 0;
}

.support-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}

.support-status-open {
    color: var(--income);
    background: var(--income-bg);
}

.support-status-resolved {
    color: var(--accent);
    background: var(--accent-soft);
}

.support-status-closed {
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.support-thread-item.is-inactive {
    opacity: 0.82;
}

.inventory-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.inventory-subnav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.inventory-subnav-icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.inventory-subnav-icon svg {
    width: 16px;
    height: 16px;
}

.inventory-subnav-label {
    line-height: 1.2;
}

.inventory-subnav-link:hover {
    color: var(--text);
    background: var(--surface-2);
}

.inventory-subnav-link.is-active {
    color: var(--accent);
    border-color: var(--accent-border);
    background: var(--accent-soft);
}

.inventory-inline-form {
    display: inline-flex;
    margin: 0;
}

.inventory-stock-code-input {
    text-transform: uppercase;
}

.inventory-stats-overview {
    margin-bottom: 20px;
}

.inventory-stats-overview > .stat-card {
    min-width: 0;
}

.inventory-stats-overview .stat-card-value {
    font-size: clamp(20px, 1.6vw, 28px);
    overflow-wrap: anywhere;
}

.inventory-stats-panels {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.inventory-stats-panels > .panel {
    margin-bottom: 0;
    min-width: 0;
}

.inventory-stats-panels .panel-body-flush:has(> .data-table) {
    overflow-x: visible;
}

.inventory-stats-panels .panel-body-flush > .data-table {
    min-width: 0;
}

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

.inventory-report-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.inventory-category-sort-groups {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.inventory-category-sort-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.inventory-category-sort-toolbar[hidden] {
    display: none !important;
}

.inventory-category-sort-notice {
    font-size: 12px;
}

.inventory-category-row .category-row-main {
    flex-wrap: wrap;
}

.inventory-category-row-meta,
.inventory-category-row-count {
    font-size: 12px;
}

.inventory-category-row-count {
    margin-left: auto;
}

@media (max-width: 640px) {
    .inventory-category-row-count {
        margin-left: 0;
        width: 100%;
    }
}

.inventory-item-image-col {
    width: 56px;
}

.inventory-item-image {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    flex-shrink: 0;
}

.inventory-item-image-sm {
    width: 40px;
    height: 40px;
}

.inventory-item-image-md {
    width: 56px;
    height: 56px;
}

.inventory-item-image-form {
    width: 96px;
    height: 96px;
}

.inventory-item-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.inventory-item-image-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-muted);
}

.inventory-item-image-placeholder svg {
    width: 20px;
    height: 20px;
}

.inventory-item-image-form .inventory-item-image-placeholder svg {
    width: 28px;
    height: 28px;
}

.inventory-image-field {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.inventory-image-field-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.inventory-image-upload {
    position: relative;
    cursor: pointer;
}

.inventory-image-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.inventory-image-remove {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
}

.inventory-item-image-button {
    padding: 0;
    border: 1px solid var(--border);
    background: var(--surface-2);
    cursor: zoom-in;
}

.inventory-item-image-button:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.inventory-image-preview-target.inventory-image-lightbox-trigger {
    cursor: zoom-in;
}

.inventory-image-preview-target.inventory-image-lightbox-trigger:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
    outline-offset: 2px;
}

body.inventory-image-lightbox-open {
    overflow: hidden;
}

.inventory-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.inventory-image-lightbox[hidden] {
    display: none !important;
}

.inventory-image-lightbox-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgb(15 23 42 / 72%);
    cursor: zoom-out;
}

.inventory-image-lightbox-dialog {
    position: relative;
    z-index: 1;
    max-width: min(92vw, 720px);
    max-height: min(92vh, 720px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.inventory-image-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 80px);
    object-fit: contain;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.inventory-image-lightbox-caption {
    margin: 0;
    max-width: 100%;
    text-align: center;
    font-size: 14px;
    color: #fff;
}

.inventory-image-lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.inventory-stats-overview .stat-card-value.text-income,
.inventory-stats-overview .stat-card-value.text-expense {
    font-weight: 600;
}

.inventory-report-list strong.text-income,
.inventory-report-list strong.text-expense,
.inventory-report-list strong .text-income,
.inventory-report-list strong .text-expense {
    font-weight: 600;
}

.inventory-asset-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.inventory-asset-status-active {
    color: var(--income);
    background: var(--income-bg);
}

.inventory-asset-status-passive {
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.inventory-fixed-asset-passive td {
    color: var(--text-muted);
}

.inventory-fixed-asset-kz {
    font-weight: 600;
    white-space: nowrap;
}

.inventory-fixed-asset-location {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.inventory-fixed-asset-location-name {
    font-weight: 500;
}

.inventory-warehouse-passive td {
    color: var(--text-muted);
}

.inventory-warehouse-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.inventory-warehouse-type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    flex-shrink: 0;
}

.inventory-warehouse-type-icon svg {
    width: 14px;
    height: 14px;
}

.inventory-warehouse-type-depo .inventory-warehouse-type-icon {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.inventory-warehouse-type-isyeri .inventory-warehouse-type-icon {
    color: var(--income);
    background: color-mix(in srgb, var(--income) 12%, transparent);
}

.inventory-warehouse-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.inventory-warehouse-status-active {
    color: var(--income);
    background: color-mix(in srgb, var(--income) 12%, transparent);
}

.inventory-warehouse-status-passive {
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.inventory-stock-warehouse-grid .inventory-stock-warehouse-qty {
    max-width: 140px;
    margin-left: auto;
    text-align: right;
}

.inventory-stock-detail-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.inventory-stock-detail-summary > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.inventory-stock-detail-table {
    margin-bottom: 16px;
}

.inventory-stock-detail-actions {
    display: flex;
    gap: 8px;
}

.transaction-detail-meta {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.transaction-detail-meta > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.transaction-detail-panel-header {
    align-items: center;
}

.transaction-detail-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.transaction-detail-id {
    font-size: 13px;
    font-weight: 600;
}

.transaction-detail-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 80%, transparent), var(--surface));
}

.transaction-detail-hero-main {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    min-width: 0;
}

.transaction-detail-hero-copy {
    min-width: 0;
}

.transaction-detail-title {
    margin: 0 0 10px;
    font-size: 24px;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.transaction-detail-hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.transaction-detail-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.transaction-detail-date-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.transaction-detail-date-icon svg {
    width: 14px;
    height: 14px;
    display: block;
}

.transaction-detail-amount {
    flex-shrink: 0;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
    text-align: right;
}

.transaction-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px 24px;
    margin-bottom: 20px;
}

.transaction-detail-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.transaction-detail-field-value {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
}

.transaction-detail-field-value .contact-row a {
    color: inherit;
    text-decoration: none;
}

.transaction-detail-field-value .contact-row a:hover {
    color: var(--accent);
}

.transaction-detail-note-box {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    margin-bottom: 20px;
}

.transaction-detail-note-head {
    margin-bottom: 8px;
}

.transaction-detail-note {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.55;
    color: var(--text);
}

.transaction-detail-related-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.transaction-detail-related-label {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.transaction-detail-related-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
}

.transaction-detail-related {
    margin-top: 4px;
}

@media (max-width: 768px) {
    .transaction-detail-panel .panel-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .transaction-detail-toolbar {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .transaction-detail-panel-header .table-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 8px;
    }

    .transaction-detail-panel-header .table-actions > .btn,
    .transaction-detail-panel-header .table-actions > form {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .transaction-detail-panel-header .table-actions > form {
        display: flex;
    }

    .transaction-detail-panel-header .table-actions > form .btn {
        width: 100%;
        justify-content: center;
    }

    .transaction-detail-hero {
        flex-direction: column;
        gap: 0;
        padding: 16px;
    }

    .transaction-detail-hero-main {
        width: 100%;
        gap: 12px;
    }

    .transaction-detail-title {
        font-size: 20px;
        overflow-wrap: anywhere;
    }

    .transaction-detail-hero-meta {
        gap: 8px;
    }

    .transaction-detail-amount {
        width: 100%;
        margin-top: 14px;
        padding-top: 14px;
        border-top: 1px solid var(--border);
        text-align: left;
        font-size: 28px;
        overflow-wrap: anywhere;
    }

    .transaction-detail-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .transaction-detail-field-value {
        overflow-wrap: anywhere;
    }

    .transaction-detail-field-value .contact-row {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 10px;
    }

    .transaction-detail-note-box {
        padding: 14px 16px;
    }

    .transaction-detail-related-card {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .transaction-detail-related-card .btn {
        width: 100%;
        justify-content: center;
    }
}

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

    .transaction-detail-toolbar .btn,
    .transaction-detail-panel-header .table-actions > .btn,
    .transaction-detail-panel-header .table-actions > form {
        flex: 1 1 100%;
        width: 100%;
    }

    .transaction-detail-hero-main {
        flex-direction: column;
        align-items: flex-start;
    }

    .transaction-detail-title {
        font-size: 18px;
    }

    .transaction-detail-amount {
        font-size: 24px;
    }
}

.sales-pos-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 20px;
}

@media (max-width: 960px) {
    .sales-pos-layout {
        grid-template-columns: 1fr;
    }
}

.sales-cart-panel .panel-body {
    padding: 0;
}

.sales-cart-table td,
.sales-cart-table th {
    vertical-align: middle;
}

.sales-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 18px;
    font-weight: 700;
}

.sales-cart-contact {
    padding: 16px 20px 0;
}

.sales-cart-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 0 20px 20px;
}

.sales-scanner-page .app-main {
    max-width: none;
}

.app-shell-standalone .app-main {
    margin-left: 0;
    width: 100%;
}

.app-body-standalone .app-content {
    padding-top: 20px;
}

.app-shell-standalone .app-topbar-title h1 {
    font-size: 20px;
}

.sales-scanner-intro {
    margin: 0 0 20px;
}

.sales-scanner-shell {
    max-width: 920px;
    margin: 0 auto;
}

.sales-scanner-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.sales-barcode-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.sales-barcode-input {
    font-size: 28px;
    line-height: 1.2;
    padding: 16px 18px;
    letter-spacing: 0.04em;
}

.sales-scan-preview {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--surface-2);
    border: 1px dashed var(--border);
}

.sales-scan-preview.is-found {
    border-style: solid;
    border-color: color-mix(in srgb, var(--income) 35%, var(--border));
    background: color-mix(in srgb, var(--income) 8%, var(--surface-2));
}

.sales-scan-preview-price {
    font-size: 32px;
    font-weight: 700;
    margin-top: 6px;
}

.sales-scanner-cart .sales-cart-total {
    font-size: 22px;
}

.sales-history-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* Sözleşme modalları */
.app-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
    animation: app-modal-in 0.18s ease;
}

.app-modal-overlay.is-hiding {
    animation: app-modal-out 0.2s ease forwards;
}

@keyframes app-modal-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes app-modal-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

.app-modal {
    background: var(--surface, #fff);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
    width: 100%;
    max-width: 640px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.app-modal-title {
    margin: 0;
    font-size: 18px;
}

.app-modal-close {
    border: 0;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
}

.app-modal-body {
    padding: 20px;
    overflow-y: auto;
}

.contract-content {
    white-space: pre-wrap;
    line-height: 1.7;
    font-size: 14px;
}

.app-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border, #e2e8f0);
    text-align: right;
}

.contract-link {
    color: var(--accent, #2563eb);
    text-decoration: underline;
    cursor: pointer;
}

.contract-required-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text, #0f172a);
}

.contract-required-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 8px 0;
}

.contract-required-item {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 12px 14px;
}

.contract-required-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.contract-required-version {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--surface-alt, #f1f5f9);
    padding: 2px 8px;
    border-radius: 999px;
}

.contract-required-head .contract-link {
    margin-left: auto;
}

.contract-required-preview {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.contract-required-desc {
    margin: 8px 0 4px;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 14px;
}

.contract-required-back {
    display: block;
    text-align: center;
    margin-top: 14px;
    color: var(--accent, #2563eb);
    text-decoration: none;
    font-size: 14px;
}

/* Gelir/Gider başlık otomatik tamamlama (transactions.php) */
.title-autocomplete-control {
    position: relative;
}

.title-autocomplete-input {
    padding-right: 38px;
}

.title-autocomplete-clear {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.title-autocomplete-clear:hover {
    background: rgba(100, 116, 139, 0.12);
    color: #0f172a;
}

.title-autocomplete-list {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 6px;
    list-style: none;
    max-height: 280px;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
}

.title-autocomplete-item {
    padding: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.4;
}

.title-autocomplete-item:hover,
.title-autocomplete-item.is-active {
    background: #f1f5f9;
}

[data-theme="dark"] .title-autocomplete-list {
    border-color: #334155;
    background: #1e293b;
    color: #f1f5f9;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .title-autocomplete-clear {
    color: #94a3b8;
}

[data-theme="dark"] .title-autocomplete-clear:hover {
    background: rgba(148, 163, 184, 0.16);
    color: #f1f5f9;
}

[data-theme="dark"] .title-autocomplete-item {
    color: #f1f5f9;
}

[data-theme="dark"] .title-autocomplete-item:hover,
[data-theme="dark"] .title-autocomplete-item.is-active {
    background: #334155;
}

.form-field { position: relative; }


