:root {
    --ink: #18181b;
    --ink-soft: #3f3f46;
    --muted: #71717a;
    --muted-light: #a1a1aa;
    --brand: #229EFF;
    --brand-dark: #0b86e8;
    --brand-soft: #eaf6ff;
    --provider-openai: #000000;
    --provider-anthropic: #f09978;
    --provider-google: #4796E3;
    --surface: #ffffff;
    --surface-subtle: #f7f7f8;
    --surface-hover: #f1f1f2;
    --border: #e4e4e7;
    --border-strong: #d4d4d8;
    --violet: #229EFF;
    --violet-dark: #0b86e8;
    --violet-soft: #eaf6ff;
    --orange: #f06a24;
    --orange-soft: #fff2e8;
    --pink: #e84d95;
    --green: #24896a;
    --green-soft: #eaf8f2;
    --red: #c83c4a;
    --red-soft: #fff0f1;
    --shadow-sm: 0 1px 2px rgba(18, 18, 23, 0.04);
    --shadow-lg: 0 24px 70px rgba(18, 18, 23, 0.12);
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    color: var(--ink);
    background: var(--surface);
    font-family: "-apple-system-body", "ui-sans-serif", "-apple-system", "system-ui", "Segoe UI", "Helvetica", "Apple Color Emoji", "Arial", "sans-serif", "Segoe UI Emoji", "Segoe UI Symbol";
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

h1,
h2 {
    font-weight: 400;
}

h3 {
    font-weight: 600;
}

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

.lucide {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    stroke-width: 1.8;
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 2000;
    padding: 8px 12px;
    color: #fff;
    background: var(--ink);
    border-radius: 8px;
    transform: translateY(-150%);
    transition: transform 0.2s;
}

.skip-link:focus {
    transform: translateY(0);
}

.min-w-0 {
    min-width: 0;
}

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
    width: var(--sidebar-width);
    padding: 12px 8px 10px;
    flex-direction: column;
    overflow-y: auto;
    background: var(--surface-subtle);
    border-right: 1px solid var(--border);
}

.sidebar-head {
    display: flex;
    min-height: 42px;
    padding: 0 7px;
    align-items: center;
    justify-content: space-between;
}

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

.brand-mark {
    display: inline-grid;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    color: #fff;
    overflow: hidden;
    background: var(--brand);
    border-radius: 9px;
    place-items: center;
    font-size: 15px;
    font-weight: 750;
    letter-spacing: -0.03em;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
}

.brand-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    line-height: 1.25;
}

.brand-copy strong {
    overflow: hidden;
    font-size: 15px;
    font-weight: 680;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-copy small {
    color: var(--muted);
    font-size: 13px;
}

.sidebar-search {
    display: flex;
    width: 100%;
    height: 36px;
    margin-top: 12px;
    padding: 0 10px;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    box-shadow: var(--shadow-sm);
    align-items: center;
    gap: 8px;
    text-align: left;
    font-size: 14px;
}

.sidebar-search:hover {
    color: var(--ink);
    border-color: var(--border-strong);
}

.sidebar-search span {
    flex: 1;
}

kbd {
    padding: 2px 5px;
    color: #8a8a92;
    background: #f1f1f2;
    border: 1px solid #e8e8ea;
    border-radius: 5px;
    box-shadow: none;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0 16px;
}

.nav-section {
    margin-top: 14px;
}

.nav-section-label {
    display: block;
    padding: 0 10px 6px;
    color: var(--muted-light);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.075em;
    text-transform: uppercase;
}

.sidebar .nav-link {
    display: flex;
    min-height: 36px;
    margin: 2px 0;
    padding: 7px 10px;
    color: var(--ink-soft);
    border-radius: 8px;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar .nav-link .lucide {
    width: 17px;
    color: #62626a;
    font-size: 15px;
    text-align: center;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: var(--ink);
    background: #ececee;
}

.sidebar .nav-link.active {
    font-weight: 650;
}

.sidebar .nav-link.active .lucide {
    color: var(--brand-dark);
}

.nav-count {
    min-width: 21px;
    margin-left: auto;
    padding: 1px 6px;
    color: #787880;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(215, 215, 219, 0.8);
    border-radius: 10px;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
}

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

.sidebar-status {
    display: flex;
    padding: 7px 10px 9px;
    color: var(--muted);
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.status-pulse {
    position: relative;
    width: 7px;
    height: 7px;
    background: #34a77d;
    border-radius: 50%;
}

.status-pulse::after {
    position: absolute;
    inset: -3px;
    content: "";
    border: 1px solid rgba(52, 167, 125, 0.4);
    border-radius: 50%;
}

.status-pulse-warning {
    background: var(--orange);
}

.status-pulse-warning::after {
    border-color: rgba(240, 106, 36, 0.4);
}

.user-card {
    display: grid;
    padding: 8px;
    border-radius: 9px;
    align-items: center;
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 9px;
}

.user-card-profile {
    display: grid;
    min-width: 0;
    align-items: center;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 9px;
}

.user-card-profile:hover {
    color: inherit;
}

.user-card form {
    flex: 0 0 auto;
}

.user-card-logout {
    color: var(--muted);
}

.user-card-logout:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.75);
}

.user-card:hover {
    background: #ececee;
}

.avatar {
    display: inline-grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    color: #fff;
    overflow: hidden;
    background: linear-gradient(145deg, #202025, #484852);
    border-radius: 50%;
    place-items: center;
    font-size: 12px;
    font-weight: 750;
}

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

.avatar-sm {
    width: 32px;
    height: 32px;
}

.avatar-xl {
    width: 76px;
    height: 76px;
    font-size: 20px;
}

.user-card-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    line-height: 1.3;
}

.user-card-copy strong {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-card-copy small {
    color: var(--muted);
    font-size: 13px;
}

.user-card > .lucide {
    color: var(--muted);
}

.app-workspace {
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    height: var(--topbar-height);
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    align-items: center;
    justify-content: space-between;
}

.topbar-title {
    max-width: 55vw;
    margin: 0;
    overflow: hidden;
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.015em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-eyebrow {
    color: var(--muted);
    font-size: 12px;
}

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

.btn {
    --bs-btn-font-size: 14px;
    --bs-btn-font-weight: 570;
    --bs-btn-border-radius: 8px;
    --bs-btn-padding-x: 13px;
    --bs-btn-padding-y: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-dark {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: #0877cf;
    --bs-btn-active-border-color: #0877cf;
}

.btn-outline-secondary {
    --bs-btn-color: #3f3f46;
    --bs-btn-border-color: #d9d9dd;
    --bs-btn-hover-color: #18181b;
    --bs-btn-hover-bg: #f5f5f6;
    --bs-btn-hover-border-color: #c9c9ce;
    --bs-btn-active-color: #18181b;
    --bs-btn-active-bg: #efeff1;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    color: #52525b;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
}

.btn-icon:hover {
    color: var(--ink);
    background: var(--surface-hover);
    border-color: var(--border);
}

.btn-subtle {
    gap: 8px;
    color: var(--muted);
    background: var(--surface-subtle);
    border: 1px solid var(--border);
}

.btn-subtle:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.btn-subtle kbd {
    margin-left: 6px;
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 5px;
    width: 6px;
    height: 6px;
    background: var(--violet);
    border: 1.5px solid #fff;
    border-radius: 50%;
}

.notification-menu {
    width: min(390px, calc(100vw - 24px));
    padding: 0;
    overflow: hidden;
    border-color: var(--border);
    box-shadow: var(--shadow-lg);
}

.notification-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--border);
}

.notification-menu-header .btn-link {
    padding: 0;
    color: var(--brand-dark);
    font-size: 12px;
    text-decoration: none;
}

.notification-list {
    max-height: 420px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

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

.notification-item:hover,
.notification-item.unread {
    background: var(--surface-subtle);
}

.notification-item.unread .notification-item-title::after {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    vertical-align: middle;
    content: "";
    background: var(--brand);
    border-radius: 50%;
}

.notification-item-icon {
    display: inline-flex;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.notification-info { color: var(--brand-dark); background: var(--brand-soft); }
.notification-success { color: var(--green); background: var(--green-soft); }
.notification-warning { color: var(--orange); background: var(--orange-soft); }
.notification-danger { color: var(--red); background: var(--red-soft); }

.notification-item-copy,
.command-result-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.notification-item-title {
    color: var(--ink);
    font-size: 13px;
    line-height: 1.25;
}

.notification-item-message {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.notification-item-time {
    margin-top: 5px;
    color: var(--muted-light);
    font-size: 11px;
}

.notification-empty,
.command-empty {
    margin: 0;
    padding: 18px 14px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.command-dynamic a {
    display: flex;
    align-items: center;
    gap: 10px;
}

.command-result-copy small {
    color: var(--muted);
    font-size: 12px;
}

.page-content {
    width: 100%;
    max-width: 1660px;
    min-height: calc(100vh - var(--topbar-height));
    margin: 0 auto;
    padding: 32px 32px 56px;
}

.page-heading {
    display: flex;
    min-height: 72px;
    margin-bottom: 26px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.eyebrow,
.panel-kicker {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.075em;
    text-transform: uppercase;
}

.page-heading h2 {
    margin: 0;
    font-size: clamp(24px, 2.3vw, 34px);
    font-weight: 400;
    letter-spacing: -0.04em;
}

.page-heading p {
    max-width: 640px;
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.55;
}

.page-heading-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.filter-bar {
    display: flex;
    min-height: 52px;
    margin-bottom: 16px;
    padding: 8px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 11px;
    align-items: center;
    gap: 7px;
}

.filter-group {
    position: relative;
}

.filter-select-form {
    align-items: center;
}

.filter-select-control {
    display: inline-flex;
    height: 34px;
    max-width: 235px;
    padding: 0 10px;
    color: var(--ink-soft);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.filter-select-control:focus-within,
.filter-select-control:hover {
    border-color: var(--border-strong);
}

.filter-select-control .lucide {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 15px;
}

.filter-select-control select {
    min-width: 0;
    max-width: 185px;
    padding: 0 17px 0 0;
    color: inherit;
    background: transparent;
    border: 0;
    outline: 0;
    font: inherit;
    text-overflow: ellipsis;
}

.filter-control {
    display: inline-flex;
    height: 34px;
    padding: 0 10px;
    color: var(--ink-soft);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    align-items: center;
    gap: 8px;
    font-size: 14px;
    white-space: nowrap;
}

.filter-control:hover {
    border-color: var(--border-strong);
}

.date-filter {
    display: inline-flex;
    height: 34px;
    margin: 0;
    padding: 0 10px;
    color: var(--ink-soft);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.date-filter:hover,
.date-filter:focus-within {
    border-color: var(--border-strong);
}

.date-filter:focus-within {
    box-shadow: 0 0 0 3px rgba(34, 158, 255, 0.12);
}

.date-filter-input {
    width: 182px;
    min-width: 0;
    padding: 0;
    color: var(--ink-soft);
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 14px;
    cursor: pointer;
}

.date-filter > .lucide:last-child {
    color: var(--muted);
    font-size: 11px;
}

.date-filter-outline {
    height: 36px;
    border-color: #d9d9dd;
    box-shadow: none;
}

.date-filter-outline .date-filter-input {
    width: 184px;
}

.filter-control .lucide-chevron-down {
    margin-left: 3px;
    color: var(--muted);
    font-size: 11px;
}

.filter-spacer {
    flex: 1;
}

.cost-scope-bar {
    display: flex;
    min-height: 96px;
    margin-bottom: 12px;
    padding: 14px 16px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 11px;
    align-items: center;
    gap: 24px;
}

.cost-scope-copy {
    flex: 1 1 280px;
    min-width: 240px;
}

.cost-scope-copy h3 {
    margin: 2px 0 3px;
    color: var(--ink);
    font-size: 17px;
}

.cost-scope-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.cost-scope-options.toggle-list {
    display: grid;
    flex: 1 1 620px;
    max-width: 760px;
    margin: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cost-scope-options.toggle-list label {
    min-height: 64px;
    padding: 10px 14px;
    border-bottom: 0;
}

.cost-scope-options.toggle-list label + label {
    border-left: 1px solid var(--border);
}

.cost-scope-options.toggle-list label > span {
    min-width: 0;
}

.cost-scope-options .form-check-input {
    flex: 0 0 auto;
    margin: 0;
}

.allocation-filter-label {
    margin-left: 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.allocation-filter-bar .period-switcher {
    display: inline-flex;
}

.provider-stack {
    display: inline-flex;
    padding-right: 7px;
}

.provider-stack .provider-dot + .provider-dot {
    margin-left: -7px;
}

.provider-dot {
    display: inline-grid;
    width: 21px;
    height: 21px;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    place-items: center;
    font-size: 10px;
    font-weight: 750;
}

.provider-openai {
    background: var(--provider-openai);
}

.provider-anthropic {
    color: #231916;
    background: var(--provider-anthropic);
}

.provider-google {
    background: var(--provider-google);
}

.period-switcher {
    height: 34px;
    padding: 3px;
    background: #ececef;
    border-radius: 8px;
    align-items: center;
}

.period-switcher button,
.period-switcher a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 9px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.period-switcher button.active,
.period-switcher a.active {
    color: var(--ink);
    background: #fff;
    box-shadow: 0 1px 3px rgba(18, 18, 23, 0.08);
}

.filter-menu {
    min-width: 190px;
    padding: 6px;
    border-color: var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
}

.filter-menu .dropdown-item {
    padding: 7px 9px;
    border-radius: 7px;
    font-size: 14px;
}

.filter-menu .dropdown-item.active {
    color: var(--ink);
    background: var(--surface-hover);
    font-weight: 620;
}

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

.metric-card {
    position: relative;
    min-height: 162px;
    padding: 19px 20px 16px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-right: 0;
}

.metric-card:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
}

.metric-card:last-child {
    border-right: 1px solid var(--border);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.metric-label {
    display: flex;
    color: var(--muted);
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 560;
}

.info-tip {
    display: inline-grid;
    width: 16px;
    height: 16px;
    color: var(--muted-light);
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    place-items: center;
    font-size: 12px;
    cursor: help;
}

.tooltip {
    --bs-tooltip-bg: #242428;
    --bs-tooltip-border-radius: 7px;
    --bs-tooltip-opacity: 1;
    --bs-tooltip-padding-x: 9px;
    --bs-tooltip-padding-y: 6px;
}

.tooltip-inner {
    max-width: 240px;
    font-size: 13px;
    line-height: 1.4;
}

.metric-value {
    margin-top: 8px;
    font-size: clamp(22px, 2vw, 29px);
    font-weight: 690;
    letter-spacing: -0.04em;
}

.metric-meta {
    display: flex;
    margin-top: 5px;
    color: var(--muted);
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.trend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.trend-up {
    color: #9b4c1f;
}

.trend-down,
.trend-good {
    color: var(--green);
}

.sparkline {
    position: absolute;
    right: 5px;
    bottom: 0;
    left: 5px;
    height: 52px;
    opacity: 0.95;
}

.coverage-track {
    position: absolute;
    right: 20px;
    bottom: 21px;
    left: 20px;
    height: 5px;
    overflow: hidden;
    background: #ececef;
    border-radius: 4px;
}

.coverage-track span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--violet-dark), #aa7ff5);
    border-radius: inherit;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.55fr);
    gap: 16px;
}

.panel {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.panel-header {
    display: flex;
    min-height: 74px;
    padding: 18px 20px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.panel-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.panel-kicker {
    margin-bottom: 4px;
    color: var(--muted-light);
    font-size: 12px;
}

.chart-legend {
    display: flex;
    margin: 0;
    padding: 0;
    color: var(--muted);
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    font-size: 13px;
    list-style: none;
}

.chart-legend span,
.chart-legend li,
.provider-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chart-legend i,
.provider-name i {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 2px;
}

.chart-summary {
    display: flex;
    padding: 2px 20px 0;
    align-items: baseline;
    gap: 10px;
}

.chart-summary strong {
    font-size: 20px;
    letter-spacing: -0.025em;
}

.chart-summary span {
    color: var(--muted);
    font-size: 13px;
}

.chart-large {
    height: 310px;
    padding: 0 8px 2px;
}

.apexcharts-tooltip.apexcharts-theme-light,
.apexcharts-tooltip.apexcharts-theme-dark {
    color: var(--ink) !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 24px rgba(18, 18, 23, 0.14) !important;
}

.apexcharts-tooltip-title {
    color: var(--muted) !important;
    background: #f7f7f8 !important;
    border-bottom: 1px solid var(--border) !important;
}

.chart-tooltip {
    display: flex;
    min-width: 154px;
    padding: 10px 12px;
    color: var(--ink);
    background: #fff;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 13px;
}

.chart-tooltip-label {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    font-weight: 560;
}

.chart-tooltip-marker {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
}

.chart-tooltip strong {
    color: var(--ink);
    font-weight: 680;
    white-space: nowrap;
}

/* Date range picker */
.flatpickr-calendar {
    margin-top: 7px;
    padding: 8px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    font-family: inherit;
}

.flatpickr-calendar::before,
.flatpickr-calendar::after {
    display: none;
}

.flatpickr-months {
    margin-bottom: 4px;
}

.flatpickr-months .flatpickr-month,
.flatpickr-current-month,
.flatpickr-current-month .flatpickr-monthDropdown-months {
    color: var(--ink);
    background: transparent;
}

.flatpickr-current-month {
    padding-top: 5px;
    font-size: 15px;
    font-weight: 600;
}

.flatpickr-current-month input.cur-year {
    font-weight: 600;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    top: 8px;
    display: grid;
    width: 32px;
    height: 32px;
    padding: 8px;
    color: var(--muted);
    border-radius: 7px;
    place-items: center;
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    color: var(--ink);
    background: var(--surface-hover);
}

.flatpickr-weekdays {
    height: 34px;
}

span.flatpickr-weekday {
    color: var(--muted);
    background: transparent;
    font-size: 12px;
    font-weight: 600;
}

.flatpickr-day {
    height: 38px;
    max-width: 38px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 38px;
}

.flatpickr-day:hover,
.flatpickr-day:focus {
    background: var(--surface-hover);
    border-color: var(--surface-hover);
}

.flatpickr-day.today {
    border-color: var(--brand);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
}

.flatpickr-day.inRange,
.flatpickr-day.prevMonthDay.inRange,
.flatpickr-day.nextMonthDay.inRange {
    background: var(--brand-soft);
    border-color: var(--brand-soft);
    box-shadow: -5px 0 0 var(--brand-soft), 5px 0 0 var(--brand-soft);
}

.budget-panel {
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
}

.budget-panel-content {
    display: flex;
    min-height: 0;
    padding: 12px 20px 0;
    flex: 1;
    flex-direction: column;
}

.budget-panel-content > :last-child {
    margin-bottom: 0;
}

.sync-run-details {
    max-width: 280px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
}

.sync-run-details summary {
    cursor: pointer;
    color: var(--ink);
    font-weight: 600;
}

.sync-run-details p {
    margin: 5px 0 0;
    overflow-wrap: anywhere;
}

.budget-number {
    padding: 1px 20px 0;
    font-size: 16px;
    font-weight: 670;
}

.budget-number span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.budget-status-row {
    display: flex;
    padding: 0 20px;
    color: var(--muted);
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
}

.budget-track {
    height: 7px;
    margin: 12px 20px 8px;
    overflow: hidden;
    background: #ececef;
    border-radius: 8px;
}

.budget-track span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #df5613, var(--orange));
    border-radius: inherit;
}

.budget-track-fill-ok {
    background: linear-gradient(90deg, #168b63, #35b986) !important;
}

.budget-track-fill-warning {
    background: linear-gradient(90deg, #d99a18, #efbd4b) !important;
}

.budget-track-fill-exceeded {
    background: linear-gradient(90deg, #c53d36, #e26b61) !important;
}

.budget-caption {
    display: flex;
    padding: 0 20px;
    color: var(--muted);
    justify-content: space-between;
    font-size: 12px;
}

.projection-card {
    display: flex;
    margin: 0;
    padding: 12px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 9px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.budget-panel-content .notice-card {
    margin: 12px 0 0;
}

.budget-panel-content .budget-conversion-note {
    margin-top: auto;
    margin-bottom: 0;
    padding: 10px 0 0;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 0;
    align-items: flex-start;
    gap: 10px;
}

.budget-conversion-note > .lucide {
    width: 17px;
    height: 17px;
    color: var(--muted);
    flex: 0 0 auto;
}

.budget-conversion-note strong {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.budget-conversion-note p {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.projection-card > div {
    display: flex;
    flex-direction: column;
}

.projection-card > div span {
    color: var(--muted);
    font-size: 12px;
}

.projection-card > div strong {
    margin-top: 1px;
    font-size: 15px;
}

.status-badge {
    display: inline-flex;
    min-height: 23px;
    padding: 3px 8px;
    color: #5f5f68;
    background: #f4f4f5;
    border: 1px solid #e6e6e8;
    border-radius: 20px;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 630;
    white-space: nowrap;
}

.status-badge i:not([class]) {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
}

.status-success {
    color: #27725a;
    background: var(--green-soft);
    border-color: #ccebdd;
}

.status-warning {
    color: #a04b1b;
    background: var(--orange-soft);
    border-color: #f6d8c1;
}

.status-danger {
    color: #a32929;
    background: #fde8e7;
    border-color: #f3c7c5;
}

.budget-divider {
    height: 1px;
    margin: 18px 20px 6px;
    background: var(--border);
}

.compact-stat {
    display: flex;
    margin: 12px 20px 0;
    align-items: center;
    gap: 10px;
}

.compact-stat-icon {
    display: inline-grid;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    place-items: center;
}

.compact-stat-icon.violet {
    color: var(--violet-dark);
    background: var(--violet-soft);
}

.compact-stat-icon.orange {
    color: var(--orange);
    background: var(--orange-soft);
}

.compact-stat > div {
    display: flex;
    flex-direction: column;
}

.compact-stat span:not(.compact-stat-icon) {
    color: var(--muted);
    font-size: 12px;
}

.compact-stat strong {
    font-size: 14px;
}

.provider-chart-layout {
    display: grid;
    min-height: 240px;
    padding: 0 16px 12px;
    grid-template-columns: minmax(180px, 0.85fr) minmax(190px, 1fr);
    align-items: center;
}

.chart-donut {
    min-height: 210px;
}

.provider-breakdown {
    display: flex;
    flex-direction: column;
}

.provider-breakdown > div {
    display: grid;
    padding: 12px 3px;
    border-bottom: 1px solid var(--border);
    grid-template-columns: 1fr auto;
    align-items: center;
}

.provider-breakdown > div:last-child {
    border-bottom: 0;
}

.provider-breakdown strong {
    font-size: 14px;
}

.provider-breakdown small {
    grid-column: 2;
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}

.btn-link-inline {
    display: inline-flex;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 0;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}

.btn-link-inline:hover {
    color: var(--ink);
}

.panel-clients {
    overflow: hidden;
}

.panel-clients .token-cell {
    white-space: nowrap;
}

.client-usage-list {
    display: grid;
    margin: 0 20px;
    gap: 0;
}

.client-usage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.client-usage-row:last-child {
    border-bottom: 0;
}

.client-usage-row strong {
    color: var(--ink);
    font-size: 14px;
}

.client-usage-row small,
.panel-footnote {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.panel-clients .panel-footnote {
    margin-right: 20px;
    margin-left: 20px;
}

.data-table {
    --bs-table-color: var(--ink-soft);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border);
    font-size: 14px;
}

.data-table > :not(caption) > * > * {
    padding: 11px 16px;
    vertical-align: middle;
}

.data-table thead th {
    color: var(--muted);
    background: #fbfbfc;
    border-top: 1px solid var(--border);
    border-bottom-width: 1px;
    font-size: 12px;
    font-weight: 630;
    white-space: nowrap;
}

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

.data-table tbody tr:hover td {
    background: #fcfcfd;
}

.client-cell,
.entity-cell {
    display: inline-flex;
    min-width: 160px;
    align-items: center;
    gap: 9px;
}

.client-mark,
.provider-logo,
.key-icon,
.agent-icon {
    display: inline-grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 8px;
    place-items: center;
    font-size: 12px;
    font-weight: 750;
}

.client-mark {
    position: relative;
    color: #565b66;
    overflow: hidden;
    background: #edf0f4;
}

.client-mark img {
    display: block;
    width: 19px;
    height: 19px;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.client-mark .client-initial {
    display: none;
    color: #565b66;
}

.client-mark.fallback img {
    display: none;
}

.client-mark.fallback .client-initial {
    display: inline;
}

.agent-icon.violet {
    color: #6541cb;
    background: #eee8ff;
}

.agent-icon.pink {
    color: #b83572;
    background: #fdebf4;
}

.agent-icon.orange {
    color: #b84c18;
    background: #fff0e6;
}

.agent-icon.green {
    color: #20745a;
    background: #e6f6f0;
}

.client-cell > span:last-child,
.entity-cell > span:last-child {
    display: flex;
    flex-direction: column;
}

.client-cell strong,
.entity-cell strong {
    color: var(--ink);
    font-size: 14px;
    font-weight: 640;
}

.client-cell small,
.entity-cell small {
    margin-top: 1px;
    color: var(--muted);
    font-size: 12px;
}

.coverage-cell {
    display: inline-flex;
    min-width: 100px;
    align-items: center;
    gap: 8px;
}

.coverage-cell > span {
    width: 66px;
    height: 4px;
    overflow: hidden;
    background: #ededf0;
    border-radius: 4px;
}

.coverage-cell i {
    display: block;
    height: 100%;
    background: var(--violet);
    border-radius: inherit;
}

.coverage-cell small {
    color: var(--muted);
    font-size: 12px;
}

.mini-metrics {
    display: grid;
    margin-bottom: 16px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    grid-template-columns: repeat(3, 1fr);
}

.mini-metrics > div {
    display: flex;
    min-height: 103px;
    padding: 17px 20px;
    border-right: 1px solid var(--border);
    flex-direction: column;
    justify-content: center;
}

.mini-metrics > div:last-child {
    border-right: 0;
}

.mini-metrics span {
    color: var(--muted);
    font-size: 13px;
}

.mini-metrics strong {
    margin: 5px 0 1px;
    font-size: 20px;
    letter-spacing: -0.025em;
}

.mini-metrics small {
    color: var(--muted);
    font-size: 12px;
}

.list-panel {
    overflow: hidden;
}

.list-toolbar {
    display: flex;
    min-height: 66px;
    padding: 13px 16px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.list-toolbar h3 {
    font-size: 16px;
    font-weight: 600;
}

.list-toolbar-meta {
    color: var(--muted);
    font-size: 13px;
}

.allocation-footnote {
    margin: 0 16px 16px;
}

.table-search {
    position: relative;
    width: min(380px, 55%);
}

.table-search > .lucide {
    position: absolute;
    top: 50%;
    left: 11px;
    z-index: 1;
    color: var(--muted);
    transform: translateY(-50%);
}

.table-search .form-control {
    height: 36px;
    padding-left: 34px;
    background: var(--surface-subtle);
}

.form-control,
.form-select,
.input-group-text {
    min-height: 40px;
    color: var(--ink);
    background-color: var(--surface);
    border-color: var(--border-strong);
    border-radius: 8px;
    font-size: 15px;
}

.form-control:focus,
.form-select:focus {
    border-color: #9999a2;
    box-shadow: 0 0 0 3px rgba(80, 80, 90, 0.08);
}

.form-control-lg {
    min-height: 47px;
    padding: 10px 12px;
    font-size: 16px;
}

.form-label {
    margin-bottom: 6px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 620;
}

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

.input-group > .form-control,
.input-group > .form-select {
    border-radius: 0 8px 8px 0;
}

.input-group-text {
    min-width: 40px;
    padding: 8px 11px;
    color: var(--muted);
    background: var(--surface-subtle);
    justify-content: center;
}

.list-toolbar-actions {
    display: flex;
    gap: 7px;
}

.list-table > :not(caption) > * > * {
    padding: 14px 16px;
}

.list-table thead th {
    background: var(--surface-subtle);
}

.api-key-table {
    width: 100%;
    table-layout: fixed;
}

.api-key-col-alias {
    width: 18%;
}

.api-key-col-provider {
    width: 11%;
}

.api-key-col-fingerprint {
    width: 16%;
}

.api-key-col-project {
    width: 14%;
}

.api-key-col-client {
    width: 17%;
}

.api-key-col-cost {
    width: 9%;
}

.api-key-col-last-seen {
    width: 9%;
}

.api-key-col-status {
    width: 6%;
}

.api-key-table > :not(caption) > * > * {
    min-width: 0;
    overflow: hidden;
}

.api-key-table .entity-cell,
.api-key-table .provider-pill {
    display: flex;
    min-width: 0;
    max-width: 100%;
}

.api-key-table .entity-cell > span:last-child {
    min-width: 0;
}

.api-key-table .entity-cell > span:last-child,
.api-key-table .provider-pill {
    overflow: hidden;
    text-overflow: ellipsis;
}

.api-key-table .entity-cell strong,
.api-key-table .entity-cell small,
.api-key-table .provider-pill {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.api-key-fingerprint {
    display: inline-block;
    width: 24ch;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.api-key-project {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.api-key-client-mapping {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.api-key-client-mapping .form-select {
    min-width: 0;
    min-height: 32px;
    width: auto;
    padding-top: 4px;
    padding-bottom: 4px;
    flex: 1 1 auto;
    font-size: 12px;
}

.api-key-client-mapping .btn {
    display: inline-grid;
    width: 32px;
    height: 32px;
    padding: 0;
    flex: 0 0 auto;
    place-items: center;
}

.api-key-client-mapping .lucide {
    width: 14px;
    height: 14px;
}

.client-google-mapping {
    display: flex;
    min-width: 250px;
    align-items: center;
    gap: 7px;
    flex-wrap: nowrap;
}

.client-google-mapping .form-select {
    min-width: 0;
    min-height: 36px;
    width: auto;
    padding-top: 6px;
    padding-bottom: 6px;
    flex: 1 1 auto;
    font-size: 13px;
}

.client-google-mapping .btn {
    display: inline-grid;
    width: 36px;
    height: 36px;
    padding: 0;
    flex: 0 0 auto;
    place-items: center;
}

.client-google-mapping .lucide {
    width: 15px;
    height: 15px;
}

.table-subtext {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.capability-list {
    display: flex;
    max-width: 250px;
    flex-wrap: wrap;
    gap: 4px;
}

.capability-list span {
    padding: 3px 6px;
    color: var(--muted);
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
}

.provider-logo {
    color: #fff;
    border-radius: 9px;
}

.logo-openai {
    background: var(--provider-openai);
}

.logo-anthropic {
    color: #fff;
    background: var(--provider-anthropic);
}

.logo-google {
    background: var(--provider-google);
}

.logo-openclaw {
    color: #fff;
    background: #3c6e9f;
}

.provider-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.provider-pill .provider-logo {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    font-size: 10px;
}

.key-icon {
    color: var(--muted);
    background: var(--surface-subtle);
    border: 1px solid var(--border);
}

code {
    padding: 3px 6px;
    color: #4a4a51;
    background: #f5f5f6;
    border: 1px solid #ebebed;
    border-radius: 5px;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 13px;
    white-space: nowrap;
}

.list-footer {
    display: flex;
    min-height: 54px;
    padding: 10px 16px;
    color: var(--muted);
    background: #fbfbfc;
    border-top: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.list-footer nav {
    display: flex;
    gap: 3px;
}

.list-footer-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.list-footer nav a,
.list-footer nav button {
    display: inline-grid;
    width: 28px;
    height: 28px;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    place-items: center;
    font-size: 12px;
    text-decoration: none;
}

.list-footer nav a.active,
.list-footer nav button.active {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
}

.table-sort {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.table-sort:hover,
.table-sort:focus-visible {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.notice-card {
  display: flex;
  margin-bottom: 16px;
    padding: 15px 17px;
    color: #164d75;
    background: var(--brand-soft);
    border: 1px solid #c9e8ff;
    border-radius: var(--radius);
    align-items: center;
    gap: 12px;
}

.collector-notice {
  margin: 20px 20px 24px;
}

.notice-card > .lucide {
    font-size: 20px;
}

.notice-card > div {
    display: flex;
    flex-direction: column;
}

.notice-card strong {
    font-size: 14px;
}

.notice-card p {
    margin: 2px 0 0;
    color: #736d83;
    font-size: 13px;
}

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

.entity-card {
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.entity-card > header,
.entity-card > footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.agent-icon {
    width: 38px;
    height: 38px;
    font-size: 15px;
}

.agent-icon.agent-avatar {
    overflow: hidden;
    background: #edf0f4;
}

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

.entity-card h3 {
    margin: 17px 0 3px;
    font-size: 17px;
    font-weight: 600;
}

.entity-card > p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.entity-card > p.agent-description {
    display: -webkit-box;
    min-height: 2.9em;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.entity-card-meta,
.entity-card-usage {
    display: grid;
    margin-top: 18px;
    grid-template-columns: repeat(2, 1fr);
}

.entity-card-meta > span,
.entity-card-usage > span {
    display: flex;
    padding: 0 14px;
    border-left: 1px solid var(--border);
    flex-direction: column;
}

.entity-card-meta > span:first-child,
.entity-card-usage > span:first-child {
    padding-left: 0;
    border-left: 0;
}

.entity-card-meta small,
.entity-card-usage small {
    color: var(--muted);
    font-size: 12px;
}

.entity-card-meta strong {
    margin-top: 2px;
    font-size: 13px;
}

.entity-card-usage {
    margin-top: 15px;
    padding: 14px;
    background: var(--surface-subtle);
    border-radius: 9px;
}

.entity-card-usage > span {
    padding-left: 16px;
}

.entity-card-usage strong {
    font-size: 15px;
}

.entity-card > footer {
    margin-top: 12px;
    color: var(--muted);
    font-size: 12px;
}

.reconciliation-hero {
    display: grid;
    margin-bottom: 16px;
    padding: 20px;
    background: #1c1c20;
    border-radius: var(--radius);
    box-shadow: 0 16px 45px rgba(24, 24, 27, 0.13);
    grid-template-columns: 1fr auto 1fr auto 1fr;
    align-items: center;
}

.reconciliation-stat {
    display: flex;
    padding: 0 12px;
    color: #fff;
    flex-direction: column;
}

.reconciliation-stat span {
    color: #a7a7af;
    font-size: 13px;
}

.reconciliation-stat strong {
    margin: 3px 0;
    font-size: 23px;
    letter-spacing: -0.03em;
}

.reconciliation-stat small {
    color: #898992;
    font-size: 12px;
}

.reconciliation-stat.warning strong {
    color: #fff;
}

.reconciliation-arrow {
    color: #65656e;
}

.allocation-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.75fr);
    gap: 16px;
}

.chart-medium {
    height: 280px;
    padding: 0 8px;
}

.method-panel {
    padding-bottom: 16px;
}

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

.method-steps li {
    display: flex;
    align-items: center;
    gap: 10px;
}

.method-steps li > span {
    display: inline-grid;
    width: 27px;
    height: 27px;
    flex: 0 0 auto;
    color: var(--violet-dark);
    background: var(--violet-soft);
    border-radius: 8px;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
}

.method-steps li > div {
    display: flex;
    flex-direction: column;
}

.method-steps strong {
    font-size: 13px;
}

.method-steps small {
    color: var(--muted);
    font-size: 12px;
}

.method-note {
    display: flex;
    margin: 18px 20px 0;
    padding: 11px;
    color: #686571;
    background: var(--surface-subtle);
    border-radius: 8px;
    align-items: flex-start;
    gap: 9px;
    font-size: 12px;
    line-height: 1.5;
}

.sync-overview {
    display: grid;
    margin-bottom: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    grid-template-columns: 1.7fr repeat(3, 0.65fr);
}

.sync-health {
    display: flex;
    min-height: 112px;
    padding: 20px;
    border-right: 1px solid var(--border);
    align-items: center;
    gap: 15px;
}

.health-orbit {
    display: inline-grid;
    width: 50px;
    height: 50px;
    color: #fff;
    background: var(--green);
    border: 7px solid var(--green-soft);
    border-radius: 50%;
    place-items: center;
    font-size: 18px;
}

.sync-health > div,
.sync-overview-stat {
    display: flex;
    flex-direction: column;
}

.sync-health span:not(.health-orbit),
.sync-overview-stat span {
    color: var(--muted);
    font-size: 12px;
}

.sync-health strong {
    margin: 2px 0;
    font-size: 15px;
}

.sync-health small {
    color: var(--muted);
    font-size: 12px;
}

.sync-overview-stat {
    min-width: 0;
    padding: 20px 14px;
    border-right: 1px solid var(--border);
    justify-content: center;
}

.sync-overview-stat:last-child {
    border-right: 0;
}

.quality-panel {
    margin-bottom: 16px;
}

.quality-panel > .panel-header {
    align-items: flex-start;
}

.quality-panel > .panel-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.quality-metrics {
    display: grid;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quality-metrics > div {
    display: flex;
    min-height: 92px;
    padding: 16px 20px;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid var(--border);
}

.quality-metrics > div:last-child {
    border-right: 0;
}

.quality-metrics span,
.quality-metrics small {
    color: var(--muted);
    font-size: 12px;
}

.quality-metrics strong {
    margin: 3px 0;
    color: var(--ink);
    font-size: 20px;
}

.quality-table-wrap {
    padding: 0 8px 8px;
}

.quality-table-wrap .table {
    margin-bottom: 0;
}

.sync-overview-stat strong {
    margin-top: 4px;
    font-size: 18px;
}

.settings-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 760px);
    gap: 28px;
    align-items: start;
}

.settings-nav {
    position: sticky;
    top: calc(var(--topbar-height) + 24px);
    display: flex;
    padding: 6px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    flex-direction: column;
    gap: 2px;
}

.settings-nav a,
.settings-nav > span {
    display: flex;
    min-height: 38px;
    padding: 7px 9px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 7px;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    text-align: left;
}

.settings-nav a:hover,
.settings-nav a.active {
    color: var(--ink);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.settings-nav a.active {
    font-weight: 630;
}

.settings-nav-disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.settings-nav-disabled small {
    margin-left: auto;
    font-size: 10px;
    text-transform: uppercase;
}

.settings-layout-wide {
    grid-template-columns: 210px minmax(0, 1000px);
}

.settings-layout > *,
.settings-main,
.form-grid > * {
    min-width: 0;
}

.settings-alert {
    display: flex;
    max-width: 1238px;
    align-items: center;
    gap: 9px;
}

.settings-alert .lucide {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.settings-status-grid {
    display: grid;
    padding: 16px 20px;
    background: #fbfbfc;
    border-bottom: 1px solid var(--border);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.settings-status-grid > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.settings-status-grid span,
.settings-status-grid small {
    color: var(--muted);
    font-size: 12px;
}

.settings-status-grid strong {
    font-size: 14px;
}

.settings-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-page-heading,
.profile-page {
    width: 100%;
    max-width: 900px;
    margin-right: auto;
    margin-left: auto;
}

.profile-page > .alert {
    display: flex;
    align-items: center;
    gap: 9px;
}

.profile-page > .alert .lucide {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-panel {
    padding-bottom: 0;
    overflow: hidden;
}

.form-panel .panel-header {
    border-bottom: 1px solid var(--border);
}

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

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

.form-footer {
    display: flex;
    min-height: 62px;
    padding: 12px 20px;
    color: var(--muted);
    background: #fbfbfc;
    border-top: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.form-footer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-avatar-row {
    display: flex;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    gap: 15px;
}

.profile-avatar-row > div {
    display: flex;
    flex-direction: column;
}

.profile-avatar-copy {
    min-width: 0;
}

.profile-avatar-actions {
    display: flex;
    margin-top: 10px;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.profile-avatar-selection {
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-form-footer > span {
    max-width: 620px;
    line-height: 1.45;
}

.profile-avatar-row strong {
    font-size: 14px;
}

.profile-avatar-row small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.toggle-list {
    margin: 0 20px 20px;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.toggle-list label {
    display: flex;
    min-height: 64px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.toggle-list label:last-child {
    border-bottom: 0;
}

.toggle-list label > span {
    display: flex;
    flex-direction: column;
}

.toggle-list strong {
    font-size: 14px;
}

.toggle-list small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.form-check-input:checked {
    background-color: var(--ink);
    border-color: var(--ink);
}

.member-row {
    display: flex;
    padding: 16px 20px;
    align-items: center;
    gap: 10px;
}

.member-row > span:nth-child(2) {
    display: flex;
    flex-direction: column;
}

.member-row strong {
    font-size: 14px;
}

.member-row small {
    color: var(--muted);
    font-size: 12px;
}

.settings-editor {
    overflow: hidden;
}

.settings-editor-summary,
.member-editor-summary,
.role-editor-summary {
    display: flex;
    min-height: 76px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    align-items: center;
    gap: 12px;
}

.settings-editor-summary::-webkit-details-marker,
.member-editor-summary::-webkit-details-marker,
.role-editor-summary::-webkit-details-marker {
    display: none;
}

.settings-editor-summary > span:first-child,
.role-editor-summary > span:first-child {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

.settings-editor-summary strong,
.role-editor-summary strong {
    font-size: 15px;
}

.settings-editor-summary small,
.role-editor-summary small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.settings-editor-summary > .lucide,
.member-editor-summary > .lucide,
.role-editor-summary > .lucide {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: var(--muted);
    transition: transform 0.18s ease;
}

details[open] > .settings-editor-summary > .lucide,
details[open] > .member-editor-summary > .lucide,
details[open] > .role-editor-summary > .lucide {
    transform: rotate(180deg);
}

.settings-editor-form,
.role-readonly {
    border-top: 1px solid var(--border);
}

.permission-fieldset {
    min-width: 0;
    padding: 0;
    border: 0;
}

.permission-fieldset legend {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

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

.permission-grid > label {
    display: flex;
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    align-items: flex-start;
    gap: 9px;
}

.permission-grid > label:has(input:checked) {
    background: #f3f8ff;
    border-color: rgba(34, 158, 255, 0.45);
}

.permission-grid label > span {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.permission-grid strong {
    font-size: 13px;
}

.permission-grid small {
    color: var(--muted);
    font-size: 11px;
}

.settings-editor-list > details {
    border-bottom: 1px solid var(--border);
}

.settings-editor-list > details:last-child {
    border-bottom: 0;
}

.member-editor-summary {
    display: grid;
    grid-template-columns: 34px minmax(180px, 1fr) minmax(120px, auto) auto 18px;
}

.member-editor-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.member-editor-copy strong,
.member-editor-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-editor-copy strong {
    font-size: 14px;
}

.member-editor-copy small {
    color: var(--muted);
    font-size: 12px;
}

.member-role-list {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 4px;
}

.member-secondary-action {
    display: flex;
    min-height: 46px;
    padding: 8px 20px;
    background: #fbfbfc;
    border-top: 1px solid var(--border);
    align-items: center;
    justify-content: flex-end;
}

.role-editor-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto 18px;
}

.role-readonly {
    padding: 16px 20px;
}

.permission-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.permission-chip-list > span {
    padding: 5px 8px;
    color: var(--muted);
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
}

.audit-list > div {
    display: flex;
    min-height: 56px;
    padding: 10px 20px;
    border-top: 1px solid var(--border);
    align-items: flex-start;
    gap: 10px;
}

.audit-list > div > .lucide {
    width: 17px;
    height: 17px;
    margin-top: 2px;
    color: var(--muted);
}

.audit-list > div > span {
    display: flex;
    flex-direction: column;
    font-size: 13px;
}

.audit-list small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.empty-state {
    margin: 0;
    padding: 24px 20px;
    color: var(--muted);
}

.budget-row-selected > * {
    background: #f3f8ff;
}

.command-dialog {
    max-width: 560px;
}

.command-dialog .modal-content {
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
}

.command-search {
    display: flex;
    min-height: 58px;
    padding: 8px 13px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    gap: 10px;
}

.command-search > .lucide {
    color: var(--muted);
}

.command-search .form-control {
    flex: 1;
    min-height: 40px;
    padding: 0;
    border: 0;
    box-shadow: none;
}

.command-results {
    padding: 8px;
}

.command-label {
    padding: 6px 8px;
    color: var(--muted-light);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.command-results a {
    display: flex;
    min-height: 40px;
    padding: 8px 9px;
    border-radius: 7px;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.command-results a:hover {
    background: var(--surface-hover);
}

.command-results a > .lucide:first-child {
    width: 17px;
    color: var(--muted);
}

.toast {
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--border) !important;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    font-size: 13px;
}

.mobile-navigation {
    width: min(88vw, 320px) !important;
    background: var(--surface-subtle);
}

.mobile-navigation .sidebar-head {
    min-height: 58px;
    padding: 10px 14px 4px;
}

.mobile-navigation .sidebar-search {
    width: auto;
    height: 40px;
    margin: 10px 14px 0;
}

.mobile-navigation .sidebar-nav {
    min-height: 0;
    padding: 8px 14px 20px;
    overflow-y: auto;
}

.mobile-navigation .nav-section {
    margin-top: 18px;
}

.mobile-navigation .nav-section:first-child {
    margin-top: 10px;
}

.mobile-navigation .nav-section-label {
    padding: 0 8px 7px;
}

.mobile-navigation .sidebar-nav .nav-link {
    min-height: 42px;
    margin: 1px 0;
    padding: 9px 8px;
    gap: 11px;
    line-height: 1.25;
}

.mobile-navigation .sidebar-nav .nav-link .lucide {
    width: 18px;
    height: 18px;
}

.mobile-navigation .sidebar-footer {
    flex: 0 0 auto;
    padding: 10px 14px;
}

.empty-state-page {
    display: grid;
    min-height: calc(100vh - 170px);
    place-items: center;
    align-content: center;
    text-align: center;
}

.empty-code {
    color: var(--violet);
    font-size: 60px;
    font-weight: 750;
    letter-spacing: -0.07em;
}

.empty-state-page h2 {
    margin: 8px 0;
}

.empty-state-page p {
    margin: 0 0 20px;
    color: var(--muted);
}

/* Login */
.login-page {
    min-height: 100vh;
    background: #fff;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(390px, 0.9fr) minmax(520px, 1.1fr);
}

.login-brand-panel {
    position: relative;
    display: flex;
    min-height: 100vh;
    padding: 34px clamp(32px, 5vw, 72px);
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 20% 72%, rgba(34, 158, 255, 0.34), transparent 34%),
        radial-gradient(circle at 88% 18%, rgba(71, 150, 227, 0.22), transparent 30%),
        #18181b;
    flex-direction: column;
    justify-content: space-between;
}

.login-brand-panel::before {
    position: absolute;
    inset: 0;
    content: "";
    opacity: 0.15;
    background-image:
        linear-gradient(rgba(255,255,255,.14) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.14) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black, transparent 88%);
}

.login-brand-panel > * {
    position: relative;
    z-index: 1;
}

.brand-on-dark .brand-copy small {
    color: #9e9ea7;
}

.login-brand-content {
    max-width: 560px;
}

.login-brand-content .eyebrow {
    color: #9e9ea7;
}

.login-brand-content h1 {
    max-width: 540px;
    margin: 12px 0 18px;
    font-size: clamp(34px, 4.4vw, 64px);
    font-weight: 400;
    letter-spacing: -0.055em;
    line-height: 0.99;
}

.login-brand-content p {
    max-width: 500px;
    margin: 0;
    color: #aaaab2;
    font-size: 16px;
    line-height: 1.6;
}

.login-mini-chart {
    display: flex;
    height: 120px;
    margin-top: 40px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    align-items: flex-end;
    gap: 9px;
}

.login-mini-chart span {
    width: 8%;
    background: linear-gradient(to top, var(--brand-dark), #65bdff);
    border-radius: 4px 4px 1px 1px;
    opacity: 0.92;
}

.login-brand-bottom {
    color: #777781;
    font-size: 13px;
}

.login-form-panel {
    display: grid;
    padding: 36px;
    background: #fff;
    place-items: center;
}

.login-card {
    width: min(100%, 410px);
}

.login-card h2 {
    margin: 8px 0 4px;
    font-size: 30px;
    font-weight: 400;
    letter-spacing: -0.035em;
}

.login-card > p {
    font-size: 15px;
}

.small-link {
    color: var(--muted);
    font-size: 13px;
    font-weight: 580;
}

.small-link:hover {
    color: var(--ink);
}

.password-field {
    position: relative;
}

.password-field .form-control {
    padding-right: 45px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
}

.login-security {
    display: flex;
    margin-top: 28px;
    padding-top: 20px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    align-items: flex-start;
    gap: 9px;
    font-size: 13px;
    line-height: 1.5;
}

.login-security .lucide {
    color: var(--green);
    font-size: 14px;
}

.login-mobile-brand {
    display: flex;
    margin-bottom: 46px;
    align-items: center;
    gap: 10px;
}

.auth-back-link {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
}

.auth-back-link a {
    display: inline-flex;
    color: var(--muted);
    align-items: center;
    gap: 6px;
}

.auth-back-link a:hover {
    color: var(--ink);
}

.auth-back-link .lucide {
    width: 15px;
    height: 15px;
}

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

    .metric-card:nth-child(2) {
        border-right: 1px solid var(--border);
        border-radius: 0 var(--radius) 0 0;
    }

    .metric-card:nth-child(3) {
        border-top: 0;
        border-radius: 0 0 0 var(--radius);
    }

    .metric-card:nth-child(4) {
        border-top: 0;
        border-radius: 0 0 var(--radius) 0;
    }

    .dashboard-grid {
        grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.65fr);
    }

    .panel-clients {
        grid-column: 1 / -1;
    }

    .sync-overview {
        grid-template-columns: 1.4fr repeat(3, 0.6fr);
    }
}

@media (max-width: 991.98px) {
    .app-workspace {
        width: 100%;
        margin-left: 0;
    }

    .page-content {
        padding: 26px 22px 48px;
    }

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

    .budget-panel {
        grid-row: auto;
    }

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

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

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

    .login-brand-panel {
        display: none;
    }

    .login-form-panel {
        min-height: 100vh;
    }
}

@media (max-width: 767.98px) {
    :root {
        --topbar-height: 58px;
    }

    .topbar {
        padding: 0 14px;
    }

    .topbar-title {
        font-size: 15px;
    }

    .page-content {
        padding: 22px 14px 40px;
    }

    .page-heading {
        margin-bottom: 20px;
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }

    .page-heading h2 {
        font-size: 27px;
    }

    .page-heading-actions {
        width: 100%;
    }

    .page-heading-actions .btn {
        flex: 1;
    }

    .cost-scope-bar {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .cost-scope-copy {
        min-width: 0;
    }

    .cost-scope-options.toggle-list {
        width: 100%;
        max-width: none;
        grid-template-columns: 1fr;
    }

    .cost-scope-options.toggle-list label + label {
        border-top: 1px solid var(--border);
        border-left: 0;
    }

    .filter-bar {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .filter-spacer {
        display: none;
    }

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

    .metric-card {
        min-height: 158px;
        border-right: 1px solid var(--border);
        border-bottom: 0;
        border-radius: 0 !important;
    }

    .metric-card:first-child {
        border-radius: var(--radius) var(--radius) 0 0 !important;
    }

    .metric-card:last-child {
        border-bottom: 1px solid var(--border);
        border-radius: 0 0 var(--radius) var(--radius) !important;
    }

    .chart-legend {
        justify-content: flex-start;
    }

    .panel-header {
        min-height: 68px;
        flex-wrap: wrap;
    }

    .chart-large {
        height: 280px;
    }

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

    .provider-breakdown {
        padding: 0 8px;
    }

    .mini-metrics,
    .sync-overview,
    .quality-metrics {
        grid-template-columns: 1fr;
    }

    .mini-metrics > div,
    .sync-health,
    .sync-overview-stat {
        min-height: 84px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .mini-metrics > div:last-child,
    .sync-overview-stat:last-child,
    .quality-metrics > div:last-child {
        border-bottom: 0;
    }

    .quality-metrics > div {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

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

    .reconciliation-hero {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .reconciliation-stat {
        padding: 9px;
    }

    .reconciliation-arrow {
        display: none;
    }

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

    .settings-nav {
        position: static;
        display: grid;
        overflow-x: auto;
        grid-auto-columns: minmax(120px, 1fr);
        grid-auto-flow: column;
    }

    .settings-nav a,
    .settings-nav > span {
        white-space: nowrap;
    }

    .member-editor-summary {
        grid-template-columns: 34px minmax(0, 1fr) auto 18px;
    }

    .member-role-list {
        display: none;
    }

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

    .form-grid-full {
        grid-column: auto;
    }

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

    .table-search {
        width: 100%;
    }

    .list-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .list-toolbar-actions {
        justify-content: flex-end;
    }

    .notice-card {
        align-items: flex-start;
    }

    .settings-status-grid {
        grid-template-columns: 1fr;
    }

    .login-form-panel {
        padding: 28px 20px;
    }
}

@media (max-width: 479.98px) {
    .page-heading-actions {
        flex-direction: column-reverse;
    }

    .metric-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .provider-chart-layout {
        padding: 0 8px 12px;
    }

    .form-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .form-footer-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .form-footer-actions .btn {
        width: 100%;
    }

    .profile-avatar-row {
        align-items: flex-start;
    }

    .profile-avatar-preview {
        width: 64px;
        height: 64px;
    }

    .member-editor-summary,
    .role-editor-summary {
        padding: 13px 14px;
    }

    .member-editor-summary {
        grid-template-columns: 34px minmax(0, 1fr) 18px;
    }

    .member-editor-summary > .status-badge {
        display: none;
    }

    .role-editor-summary {
        grid-template-columns: minmax(0, 1fr) auto 18px;
    }

    .role-editor-summary > .status-badge:first-of-type {
        display: none;
    }
}

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