/* Original product theme: vibrant, rounded, and intentionally independent of any source brand. */
:root {
    --bg: #E9F8FA;
    --surface: rgba(255, 255, 255, .78);
    --elevated: #E5F9F9;
    --ink: #000000;
    --ink-soft: #102B3B;
    --muted: #7E9498;
    --line: rgba(157, 205, 212, .46);
    --teal: #0A817D;
    --teal-2: #0A4E5D;
    --teal-dark: #0A4E5D;
    --teal-soft: rgba(217, 247, 247, .58);
    --ice: rgba(226, 248, 248, .56);
    --blue-soft: rgba(224, 239, 255, .56);
    --coral: #EE6B61;
    --orange-soft: rgba(255, 238, 225, .68);
    --glass-surface: rgba(255, 255, 255, .58);
    --glass-surface-strong: rgba(255, 255, 255, .74);
    --glass-border: rgba(255, 255, 255, .82);
    --glass-border-soft: rgba(157, 211, 218, .42);
    --accent: #18B8B5;
    --blue: #4A84E8;
    --purple: #7957D5;
    --orange: #EE6B61;
    --red: #C94B55;
    --green: #168253;
    --radius: 24px;
    --radius-card: 24px;
    --radius-button: 50px;
    --radius-chip: 12px;
    --shadow: rgba(43, 121, 134, .08) 0 14px 28px;
    --shadow-medium: rgba(39, 103, 118, .08) 0 10px 28px;
    --shadow-deep: 0 24px 70px rgba(30, 89, 108, .13), inset 0 1px 0 rgba(255, 255, 255, .72);
    --focus-ring: rgba(11, 107, 104, .1) 0 0 0 3px;
    --motion-fast: .18s;
    --motion-base: .32s;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --layout-gutter: 8px;
}

html { background: var(--bg); }

body {
    color: var(--ink);
    font-family: var(--font-ui), Tahoma, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.8;
}

button, input, select, textarea { font-family: inherit; }
a { transition: color var(--motion-fast) ease, opacity var(--motion-fast) ease; }
h2 { font-size: 23px; font-weight: 900; letter-spacing: -.3px; }

.app-body {
    background:
        radial-gradient(circle at 12% 8%, rgba(24, 184, 181, .13), transparent 26rem),
        radial-gradient(circle at 88% 72%, rgba(224, 239, 255, .55), transparent 31rem),
        var(--bg);
}

.app-shell {
    align-items: stretch;
    --sidebar-width: 264px;
    background: linear-gradient(to left, var(--teal-2) 0 var(--sidebar-width), transparent var(--sidebar-width));
}

.sidebar {
    width: 264px;
    flex-basis: 264px;
    z-index: 5;
    padding: 24px 16px;
    height: auto;
    min-height: 100vh;
    align-self: stretch;
    background: linear-gradient(165deg, var(--teal-2) 0%, #073945 68%, #062E3A 100%);
    box-shadow: 18px 0 48px rgba(30, 89, 108, .12);
}

.brand-block { gap: 12px; padding: 4px 8px 28px; }
.brand-mark { border-radius: 16px; background: var(--accent); color: var(--ink-soft); box-shadow: 0 10px 22px rgba(24, 184, 181, .24); }
.brand-mark.large { border-radius: 20px; }
.brand-block {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
        "mark copy"
        "fresh fresh";
    align-items: center;
    gap: 10px 12px;
}
.brand-mark { grid-area: mark; }
.brand-block .brand-copy { grid-area: copy; min-width: 0; }
.brand-block > .brand-copy > strong { font-size: 19px; }
.brand-block .brand-freshness {
    grid-area: fresh;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1px 8px;
    border: 1px solid rgba(217, 247, 247, .16);
    border-radius: var(--radius-chip);
    background: rgba(255, 255, 255, .07);
}
.brand-freshness span,
.brand-freshness strong,
.brand-freshness small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-freshness span { grid-column: 1 / -1; color: rgba(217, 247, 247, .7); font-size: 8px; line-height: 1.35; }
.brand-freshness strong { color: #fff; font-size: 10px; line-height: 1.45; }
.brand-freshness small { align-self: center; color: rgba(217, 247, 247, .58); font-size: 8px; line-height: 1.45; }
.nav-label { color: rgba(217, 247, 247, .66); padding-top: 12px; }
.main-nav { gap: 8px; }

.nav-link {
    border-radius: 16px;
    padding: 12px 13px;
    color: rgba(229, 249, 249, .78);
    transition: transform var(--motion-fast) ease, background var(--motion-fast) ease, color var(--motion-fast) ease;
}

.nav-link:hover { transform: translateY(-1px); background: rgba(255, 255, 255, .1); color: #fff; }
.nav-link.active { background: linear-gradient(90deg, rgba(24, 184, 181, .22), rgba(24, 184, 181, .72)); color: #fff; box-shadow: inset -3px 0 var(--accent), 0 8px 22px rgba(4, 63, 74, .22); }

.support-card { border-radius: var(--radius-card); border-color: rgba(217, 247, 247, .18); background: rgba(255, 255, 255, .08); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }
.main-area { background: transparent; }

.topbar {
    z-index: 5;
    height: 76px;
    background: rgba(255, 255, 255, .76);
    border-bottom-color: rgba(157, 205, 212, .48);
    box-shadow: 0 8px 24px rgba(43, 121, 134, .04);
    backdrop-filter: blur(18px);
}

.topbar-title { color: var(--muted); font-size: 13px; }
.live-dot { background: var(--accent); box-shadow: 0 0 0 5px rgba(24, 184, 181, .14); }
.topbar-actions { gap: 10px; }

.top-action, .topbar-icon-action {
    border-radius: var(--radius-button);
    border-color: rgba(24, 184, 181, .32);
    background: rgba(229, 249, 249, .72);
    color: var(--teal-2);
    transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background var(--motion-fast) ease;
}

.top-action:hover, .topbar-icon-action:hover { transform: translateY(-1px); background: #fff; box-shadow: var(--shadow-medium); }
.user-chip .avatar { background: var(--elevated); color: var(--teal); }

.page-content { width: min(100%, 1440px); padding: 32px 32px 52px; }
.page-heading { margin-bottom: 24px; }
.page-heading h1 { margin-bottom: 4px; color: var(--ink); font-size: 28px; letter-spacing: -.5px; }
.page-heading p { color: var(--muted); font-size: 14px; }
.page-heading h1::before { background: var(--accent); border-radius: 99px; }

.panel, .kpi-card, .report-card, .metric-strip, .dashboard-kpi-card, .aging-card, .workspace-widget, .worklist-panel {
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.panel, .metric-strip { padding: 20px; }
.panel-head h2, .workspace-widget-head h2 { color: var(--ink); font-size: 23px; font-weight: 900; letter-spacing: -.3px; }
.panel-head p, .panel-head > a, .page-heading p, .muted-text, .metric-strip span, .kpi-label { color: var(--muted); }
.panel-head > a, .table-link, .sort-link.active, .sort-link.active b { color: var(--teal); }

.btn {
    min-height: 44px;
    padding: 10px 18px;
    border-radius: var(--radius-button);
    font-weight: 400;
    transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background var(--motion-fast) ease;
}

.btn:hover { transform: translateY(-1px); box-shadow: rgba(39, 103, 118, .13) 0 16px 34px; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--user-accent, var(--accent)); color: var(--ink-soft); box-shadow: 0 10px 24px rgba(24, 184, 181, .2); }
.btn.primary:hover { background: #16A9A6; }
.btn.secondary { border: 1px solid rgba(24, 184, 181, .22); background: var(--elevated); color: var(--teal-2); }

.btn:focus-visible, .top-action:focus-visible, .topbar-icon-action:focus-visible, .nav-link:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.flash { border-radius: var(--radius-chip); box-shadow: var(--shadow); }
.kpi-grid, .dashboard-grid, .lower-grid, .profile-grid, .case-grid, .import-layout, .report-grid, .report-notes { gap: 16px; }
.kpi-card, .report-card { transition: transform var(--motion-base) ease, box-shadow var(--motion-base) ease; }
.kpi-card:hover, .report-card:hover, .panel:hover { box-shadow: rgba(39, 103, 118, .13) 0 16px 34px; }
.kpi-card { min-height: 150px; padding: 20px; }
.kpi-icon, .profile-avatar, .excel-mark { border-radius: 16px; background: var(--elevated); color: var(--teal); }
.kpi-card strong, .metric-strip strong, .report-card strong { color: var(--ink); }

.table-wrap th { background: rgba(229, 249, 249, .68); color: var(--teal-2); }
.table-wrap th, .table-wrap td { border-bottom-color: rgba(157, 205, 212, .34); }
.table-wrap tbody tr { transition: background-color var(--motion-fast) ease; }
.table-wrap tbody tr:hover { background: rgba(229, 249, 249, .48); }
.badge, .priority, .source-tag, .age-badge, .scope-chip-list span, .month-filter-chip { border-radius: var(--radius-chip); }
.badge.info, .month-filter-chip { background: rgba(224, 239, 255, .7) !important; color: var(--teal-2) !important; }
.badge.muted, .priority { background: rgba(126, 148, 152, .12); color: var(--muted); }
.source-tag { background: var(--elevated); color: var(--teal); }

.form-grid input, .form-grid select, .form-grid textarea, .stack-form input, .stack-form select, .stack-form textarea, .search-bar input, .inline-form input, .inline-form select, .filter-bar input, .filter-bar select, .worklist-form input, .worklist-date-filters input, .legal-grid input, .legal-grid select, .legal-grid textarea {
    border: 1px solid rgba(157, 205, 212, .54);
    border-radius: var(--radius-chip);
    background: rgba(255, 255, 255, .84);
    color: var(--ink);
    padding: 11px 12px;
    transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background var(--motion-fast) ease;
}

.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .stack-form input:focus, .stack-form select:focus, .stack-form textarea:focus, .search-bar input:focus, .inline-form input:focus, .inline-form select:focus, .filter-bar input:focus, .filter-bar select:focus, .worklist-form input:focus, .worklist-date-filters input:focus, .legal-grid input:focus, .legal-grid select:focus, .legal-grid textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
    background: #fff;
}

.filter-panel, .checkbox-dropdown summary, .filter-panel-toggle, .followup-action-bar .followup-editor > summary, .table-pagination a, .table-pagination i { border-radius: var(--radius-chip); }
.filter-panel, .filter-panel-content, .checkbox-dropdown-menu, .customer-filter-menu, .invoice-mini-list, .followup-editor form { border-color: rgba(157, 205, 212, .42); background: rgba(255, 255, 255, .9); box-shadow: var(--shadow-medium); }
.data-note, .next-action-box, .file-drop, .invoice-mini-list { border-radius: var(--radius-chip); background: rgba(229, 249, 249, .6); }
.table-pagination a:hover, .table-pagination a.active { background: var(--teal); border-color: var(--teal); }

.page-tabs { min-height: 52px; padding-top: 9px; background: rgba(229, 249, 249, .54); border-bottom-color: rgba(157, 205, 212, .38); }
.page-tab { border-color: rgba(157, 205, 212, .42); border-radius: 16px 16px 0 0; background: rgba(224, 239, 255, .56); color: var(--teal-2); }
.page-tab.is-active { color: var(--ink); box-shadow: 0 -2px 0 var(--accent); background: rgba(255, 255, 255, .92); }
.header-popover, .notification-page-list { border-color: rgba(157, 205, 212, .42); border-radius: var(--radius-card); background: rgba(255, 255, 255, .94); box-shadow: var(--shadow-deep); }
.notification-item:hover { background: rgba(229, 249, 249, .75); }

.login-body { background: radial-gradient(circle at 82% 16%, rgba(24, 184, 181, .16), transparent 24rem), var(--bg); }
.login-art { background: linear-gradient(145deg, var(--teal-2), var(--teal)); }
.login-card { border: 1px solid rgba(255, 255, 255, .9); border-radius: var(--radius-card); background: rgba(255, 255, 255, .86); box-shadow: var(--shadow-deep); backdrop-filter: blur(16px); }
.login-card-head h2 { color: var(--ink); font-size: 23px; font-weight: 900; letter-spacing: -.3px; }
.login-hint { border-radius: var(--radius-chip); background: var(--elevated); }

html[data-resolved-theme="dark"] { --bg: #102B3B; --surface: rgba(21, 43, 64, .84); --elevated: rgba(10, 78, 93, .82); --ink: #F4FFFF; --ink-soft: #E5F9F9; --muted: #A5C1C4; --line: rgba(157, 205, 212, .22); }
html[data-resolved-theme="dark"] .app-body { background: radial-gradient(circle at 15% 10%, rgba(24, 184, 181, .12), transparent 25rem), var(--bg); }
html[data-resolved-theme="dark"] .topbar, html[data-resolved-theme="dark"] .page-tab.is-active, html[data-resolved-theme="dark"] .header-popover, html[data-resolved-theme="dark"] .login-card, html[data-resolved-theme="dark"] input, html[data-resolved-theme="dark"] select, html[data-resolved-theme="dark"] textarea { background: rgba(21, 43, 64, .92); color: var(--ink); }

@media (max-width: 1100px) { .page-content { padding-inline: 24px; } }
@media (max-width: 800px) { .sidebar { width: 72px; flex-basis: 72px; padding-inline: 9px; } .topbar { padding-inline: 17px; } }
@media (max-width: 520px) { .page-content { padding: 20px 14px 36px; } .panel { padding: 16px; } }

/* Responsive sizing for data-dense screens: preserve readable text without browser zoom. */
html, body { max-width: 100%; overflow-x: hidden; }
body { font-size: clamp(13px, calc(12px + .22vw), 15px); }
h2, .panel-head h2, .workspace-widget-head h2 { font-size: clamp(18px, calc(15px + .45vw), 21px); }
.page-heading h1 { font-size: clamp(22px, calc(18px + .58vw), 26px); }
.page-content { padding: clamp(18px, 2.2vw, 32px) clamp(14px, 2.2vw, 32px) clamp(32px, 3.6vw, 52px); }
.panel, .metric-strip { padding: clamp(14px, 1.35vw, 20px); }
.btn { min-height: clamp(38px, 3vw, 44px); padding: clamp(8px, .8vw, 10px) clamp(13px, 1.25vw, 18px); }

@media (max-width: 1100px) {
    .app-shell:not(.sidebar-collapsed) { --sidebar-width: 232px; }
    .page-content { padding-inline: 20px; }
    .sidebar { width: 232px; flex-basis: 232px; }
}

@media (max-width: 800px) {
    .app-shell:not(.sidebar-collapsed) { --sidebar-width: 72px; }
    .sidebar { width: 72px; flex-basis: 72px; }
    .page-content { padding: 18px 14px 36px; }
    .page-heading h1 { font-size: 23px; }
    .panel-head h2, h2 { font-size: 19px; }
    .panel, .metric-strip { padding: 15px; }
    .kpi-card, .report-card { padding: 16px; }
    .topbar { height: 64px; }
}

.app-shell.sidebar-collapsed { --sidebar-width: 76px; }

@media (max-width: 680px) {
    .page-heading { gap: 12px; margin-bottom: 16px; }
    .page-heading h1 { font-size: 22px; }
    .filter-bar, .customer-filter { grid-template-columns: 1fr; }
    .filter-bar .btn, .customer-filter .btn { width: 100%; }
    .worklist-actions { flex-direction: column; align-items: stretch; }
    .worklist-actions .btn { width: 100%; }
    .page-tabs { padding-inline: 14px; }
}

@media (max-width: 520px) {
    .page-content { padding: 16px 10px 28px; }
    .panel, .metric-strip { padding: 13px; }
    .page-heading h1 { font-size: 21px; }
    .panel-head h2, h2 { font-size: 18px; }
    .btn { min-height: 38px; }
}
