:root {
    --ink: #202a25;
    --ink-2: #435049;
    --muted: #637068;
    --paper: #f5f6f3;
    --surface: #ffffff;
    --surface-2: #eef1ed;
    --line: #e1e5e0;
    --brand: #d96c4f;
    --brand-dark: #b7553d;
    --brand-soft: #f8ece7;
    --lime: #dce8e0;
    --navy: #244b3e;
    --green: #16865f;
    --green-soft: #e7f6ef;
    --red: #d94b56;
    --red-soft: #fcebed;
    --amber: #b87516;
    --amber-soft: #fff5de;
    --radius-sm: 12px;
    --radius: 18px;
    --radius-lg: 26px;
    --shadow-sm: 0 1px 2px rgba(32, 42, 37, .03), 0 8px 24px rgba(32, 42, 37, .035);
    --shadow: 0 18px 48px rgba(32, 42, 37, .075);
    --sidebar: 256px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: "DM Sans", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
svg { width: 19px; height: 19px; stroke-width: 1.8; }

.app-shell { min-height: 100vh; display: flex; }
.app-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 1040;
    width: var(--sidebar); padding: 22px 16px;
    background: #fff; border-right: 1px solid var(--line);
    display: flex; flex-direction: column;
}
.app-main { min-width: 0; width: calc(100% - var(--sidebar)); margin-left: var(--sidebar); }
.page-wrap { width: 100%; max-width: 1580px; margin: 0 auto; padding: 36px 40px 64px; }
.sidebar-scrim { display: none; }
.sidebar-head { min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 7px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark { position: relative; width: 34px; height: 34px; display: inline-flex; gap: 3px; padding: 7px; border-radius: 11px; background: var(--ink); transform: rotate(-3deg); box-shadow: 0 7px 16px rgba(23,35,31,.18); }
.brand-mark span { display: block; width: 8px; border-radius: 3px; background: #a9c4b4; }
.brand-mark span:last-child { background: var(--brand); transform: translateY(5px); }
.brand-name { font: 700 19px/1 "DM Sans", sans-serif; letter-spacing: -.5px; }
.brand-name span { color: var(--brand); }
.icon-button { border: 0; width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; background: transparent; color: var(--ink-2); transition: .2s ease; }
.icon-button:hover { background: var(--surface-2); color: var(--ink); }
.sidebar-close, .menu-trigger { display: none; }
.workspace-pill { margin-top: 25px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; display: flex; align-items: center; gap: 10px; background: linear-gradient(135deg, #fafbf8, #f0f3ed); }
.workspace-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--navy); color: #fff; font-weight: 800; }
.workspace-pill > span:nth-child(2) { flex: 1; min-width: 0; }
.workspace-pill small, .workspace-pill strong { display: block; }
.workspace-pill small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.workspace-pill strong { font-size: 13px; margin-top: 2px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #31b87c; box-shadow: 0 0 0 4px rgba(49,184,124,.12); }
.side-nav { margin-top: 26px; display: flex; flex-direction: column; gap: 5px; }
.nav-label { padding: 0 12px 7px; color: #9aa49f; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-label-spaced { margin-top: 17px; }
.side-nav a { position: relative; min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: 13px; color: #647169; text-decoration: none; font-size: 14px; font-weight: 600; transition: transform .18s ease, color .18s ease, background .18s ease; }
.side-nav a:hover { color: var(--ink); background: #f4f6f1; transform: translateX(2px); }
.side-nav a.active { color: var(--ink); background: var(--brand-soft); }
.side-nav a.active::before { content: ""; position: absolute; left: 0; width: 4px; height: 20px; border-radius: 0 4px 4px 0; background: var(--brand); }
.side-nav a.active svg { color: var(--brand); }
.nav-new { margin-left: auto; padding: 3px 7px; border-radius: 20px; background: var(--surface-2); color: var(--navy); font-size: 9px; font-weight: 700; }
.sidebar-tip { margin-top: auto; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #f1f4f0; color: var(--ink); display: flex; gap: 11px; }
.tip-icon { flex: 0 0 32px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: var(--navy); background: var(--lime); }
.sidebar-tip strong { font-size: 12px; }
.sidebar-tip p { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }

.app-topbar { position: sticky; top: 0; z-index: 1020; height: 72px; padding: 0 40px; display: flex; align-items: center; justify-content: space-between; background: rgba(246,247,242,.86); border-bottom: 1px solid rgba(224,229,222,.8); backdrop-filter: blur(18px); }
.topbar-left, .topbar-actions, .profile-trigger, .quick-add { display: flex; align-items: center; }
.breadcrumb-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.breadcrumb-line svg { width: 14px; }
.breadcrumb-line strong { color: var(--ink); }
.topbar-actions { gap: 12px; }
.quick-add { gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 13px; background: var(--navy); color: white; text-decoration: none; font-weight: 700; font-size: 13px; box-shadow: 0 8px 20px rgba(36,75,62,.12); transition: .2s ease; }
.quick-add:hover { background: var(--brand); transform: translateY(-1px); color: white; }
.quick-add svg { width: 17px; }
.profile-trigger { gap: 10px; border: 0; padding: 4px 5px 4px 8px; border-radius: 14px; background: transparent; transition: .2s ease; }
.profile-trigger:hover, .profile-trigger[aria-expanded="true"] { background: var(--surface-2); }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--brand-soft); color: var(--brand-dark); overflow: hidden; font-size: 0; font-weight: 800; }
.avatar::first-letter { font-size: 14px; }
.profile-copy { max-width: 165px; text-align: left; }
.profile-copy strong, .profile-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy strong { font-size: 12px; }
.profile-copy small { color: var(--muted); font-size: 10px; }
.profile-trigger > svg { width: 14px; color: var(--muted); }
.profile-menu { min-width: 245px; margin-top: 10px !important; padding: 8px; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.profile-menu-head { padding: 8px 10px; }
.profile-menu-head small, .profile-menu-head strong { display: block; }
.profile-menu-head small { color: var(--muted); font-size: 11px; }
.profile-menu-head strong { margin-top: 2px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.profile-menu .dropdown-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; font-weight: 600; font-size: 13px; }
.danger-item { color: var(--red); }

.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 18px; height: 2px; border-radius: 3px; background: #9aaba2; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-actions { display: flex; align-items: center; gap: 9px; }
.page-title { margin: 0; font: 700 clamp(28px, 2.6vw, 38px)/1.15 "DM Sans", sans-serif; letter-spacing: -1.15px; }
.page-subtitle { max-width: 680px; margin: 10px 0 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.accent-word { position: relative; color: inherit; }
.accent-word::after { display: none; }
.btn { --bs-btn-font-weight: 700; --bs-btn-border-radius: 12px; min-height: 44px; padding-inline: 17px; }
.btn-primary { --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); }
.btn-dark { --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); }
.btn-soft { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn-soft:hover { background: #e4e9e1; }
.btn-icon-text { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-icon-text svg { width: 17px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-head { min-height: 74px; padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-head h2, .panel-head h3 { margin: 0; font: 700 17px/1.2 "DM Sans", sans-serif; }
.panel-label { margin: 0 0 4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.text-link { display: inline-flex; align-items: center; gap: 6px; color: var(--brand-dark); font-size: 13px; font-weight: 700; text-decoration: none; }
.text-link:hover { color: var(--ink); }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card { min-height: 158px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); position: relative; overflow: hidden; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.metric-card:hover { transform: translateY(-2px); border-color: #cfd6d0; box-shadow: var(--shadow); }
.metric-card.dark, .metric-card.coral, .metric-card.lime { color: var(--ink); background: var(--surface); }
.metric-card::after { display: none; }
.metric-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.metric-top span:last-child { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--green-soft); color: var(--green); }
.metric-card.coral .metric-top span:last-child { background: var(--red-soft); color: var(--red); }
.metric-card.lime .metric-top span:last-child { background: var(--surface-2); color: var(--navy); }
.metric-value { margin-top: 23px; font: 700 clamp(25px, 2.3vw, 32px)/1 "DM Sans", sans-serif; letter-spacing: -.9px; }
.metric-note { margin-top: 10px; color: var(--muted); font-size: 12px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr); align-items: start; gap: 20px; }
.activity-row { display: flex; align-items: center; gap: 14px; padding: 17px 22px; border-bottom: 1px solid var(--line); transition: background .18s ease; }
.activity-row:last-child { border-bottom: 0; }
.activity-row:hover { background: #fafbf8; }
.category-icon { flex: 0 0 44px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; color: var(--brand-dark); background: var(--brand-soft); }
.activity-main { min-width: 0; flex: 1; }
.activity-main strong, .activity-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-main strong { font-size: 14px; }
.activity-main span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.expense-activity-end { display: flex; align-items: center; gap: 10px; }
.row-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .18s ease; }
.activity-row:hover .row-actions, .row-actions:focus-within { opacity: 1; }
.row-actions .icon-button { width: 34px; height: 34px; border-radius: 10px; }
.row-actions svg { width: 15px; }
.status-inline { margin-left: 5px; padding: 3px 6px; border-radius: 999px; color: var(--red); background: var(--red-soft); font-size: 9px; font-style: normal; font-weight: 700; }
.activity-row.is-cancelled { opacity: .62; }
.activity-row.is-cancelled .amount { text-decoration: line-through; }
.amount { white-space: nowrap; font: 700 15px/1 "DM Sans", sans-serif; }
.amount.positive { color: var(--green); }
.empty-state { padding: 52px 24px; text-align: center; }
.empty-icon { width: 64px; height: 64px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 20px; background: var(--surface-2); color: var(--muted); transform: rotate(-3deg); }
.empty-icon svg { width: 28px; height: 28px; }
.empty-state h3 { margin: 0; font: 700 16px "DM Sans", sans-serif; }
.empty-state p { max-width: 380px; margin: 7px auto 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.focus-card { padding: 22px; border-radius: var(--radius); color: white; background: var(--navy); overflow: hidden; position: relative; box-shadow: var(--shadow-sm); }
.focus-card::after { display: none; }
.focus-card > * { position: relative; z-index: 1; }
.focus-card .focus-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: white; background: rgba(255,255,255,.12); }
.focus-card h3 { margin: 22px 0 7px; font: 700 19px "DM Sans", sans-serif; }
.focus-card p { margin: 0; color: #d6e0da; font-size: 13px; line-height: 1.55; }
.focus-card a { display: inline-flex; align-items: center; gap: 7px; margin-top: 20px; color: white; font-size: 12px; font-weight: 700; text-decoration: none; }
.category-stats { padding: 18px 20px 21px; display: grid; gap: 16px; }
.category-stat > div:first-child { margin-bottom: 7px; display: flex; justify-content: space-between; gap: 10px; font-size: 11px; }
.category-stat strong { font-weight: 700; }
.category-stat span { color: var(--muted); }
.stat-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-2); }
.stat-track span { display: block; height: 100%; min-width: 5px; border-radius: inherit; background: var(--navy); }
.compact-empty { padding: 28px 20px; }
.compact-empty .empty-icon { width: 50px; height: 50px; margin-bottom: 12px; border-radius: 16px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.toolbar-summary, .panel-head-actions { display: flex; align-items: center; gap: 10px; }
.compact-pagination { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.compact-pagination a { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); background: white; transition: border-color .18s, color .18s, transform .18s; }
.compact-pagination a:hover { color: var(--brand); border-color: #c6d0c9; transform: translateY(-1px); }
.compact-pagination a.disabled { opacity: .35; pointer-events: none; }
.compact-pagination svg { width: 14px; }
.search-box { width: min(430px, 100%); height: 46px; padding: 0 14px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px; background: white; transition: border .2s, box-shadow .2s; }
.search-box:focus-within { border-color: #a9b7af; box-shadow: 0 0 0 4px rgba(23,35,31,.05); }
.search-box svg { color: var(--muted); width: 17px; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.count-pill { padding: 8px 12px; border-radius: 999px; background: white; border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.group-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.group-card { min-height: 235px; padding: 22px; display: flex; flex-direction: column; color: inherit; text-decoration: none; position: relative; overflow: hidden; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.group-card:hover { color: inherit; border-color: #cbd2cb; box-shadow: var(--shadow); transform: translateY(-4px); }
.group-card-top { display: flex; justify-content: space-between; align-items: center; }
.group-symbol { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); color: var(--ink); font: 700 18px "DM Sans", sans-serif; }
.status-chip { padding: 6px 9px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.group-card h3 { margin: 23px 0 7px; font: 700 18px "DM Sans", sans-serif; }
.group-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.group-meta { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 700; }
.group-meta span { display: flex; align-items: center; gap: 6px; }
.group-meta svg { width: 14px; }

.list-panel { overflow: hidden; }
.expense-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) minmax(130px, auto) 22px; align-items: center; gap: 15px; min-height: 86px; padding: 14px 20px; border-bottom: 1px solid var(--line); transition: background .18s ease; }
.expense-row:has(.expense-list-actions) { grid-template-columns: 48px minmax(0, 1fr) minmax(130px, auto) auto; }
.expense-row.is-cancelled { opacity: .58; }
.expense-row.is-cancelled .expense-meta strong, .expense-row.is-cancelled .expense-total strong { text-decoration: line-through; }
.expense-list-actions { display: flex; align-items: center; gap: 6px; }
.expense-row:last-child { border-bottom: 0; }
.expense-row:hover { background: #fafbf8; }
.expense-meta strong, .expense-meta span { display: block; }
.expense-meta strong { font-size: 14px; }
.expense-meta span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.expense-total { text-align: right; }
.expense-total strong { display: block; font: 700 15px "DM Sans", sans-serif; }
.expense-total small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.row-chevron { color: #aab3ae; }

.group-hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; margin-bottom: 26px; padding: 28px; color: white; border-radius: var(--radius-lg); background: var(--ink); position: relative; overflow: hidden; }
.group-hero::after { content: ""; position: absolute; width: 220px; height: 220px; right: 12%; top: -160px; border: 45px solid var(--brand); border-radius: 50%; opacity: .9; }
.group-hero > * { position: relative; z-index: 1; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: #c5cfca; text-decoration: none; font-size: 12px; }
.back-link:hover { color: white; }
.group-hero h1 { margin: 19px 0 7px; font: 700 clamp(27px, 3vw, 38px) "DM Sans", sans-serif; }
.group-hero p { margin: 0; color: #b8c4be; font-size: 13px; }
.hero-actions { display: flex; gap: 10px; }
.group-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(290px, .8fr); gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.member-list { padding: 7px 20px 15px; }
.member-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; }
.member-avatar { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; font-size: 12px; }
.member-copy { min-width: 0; flex: 1; }
.member-copy strong, .member-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-copy strong { font-size: 13px; }
.member-copy small { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .05em; }
.member-balance { font-size: 11px; font-weight: 700; white-space: nowrap; }
.member-balance.positive { color: var(--green); }
.member-balance.negative { color: var(--red); }
.member-admin-menu .icon-button { width: 30px; height: 30px; }
.member-admin-menu .dropdown-menu { min-width: 210px; padding: 7px; border-color: var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.member-admin-menu .dropdown-item { padding: 9px 10px; border: 0; border-radius: 8px; display: flex; align-items: center; gap: 8px; background: transparent; color: var(--ink-2); font-size: 11px; font-weight: 700; }
.member-admin-menu .dropdown-item:hover { background: var(--surface-2); color: var(--ink); }
.member-admin-menu .dropdown-item svg { width: 15px; }
.role-chip { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.settlement-row { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.settlement-row:last-child { border: 0; }
.settlement-flow { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.settlement-filter { padding: 12px 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.settlement-filter label { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.settlement-filter .form-select { width: min(220px, 100%); min-height: 38px; font-size: 11px; }
.settlement-flow svg { width: 15px; color: var(--brand); }
.settlement-bottom { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settlement-status { padding: 5px 8px; border-radius: 99px; background: var(--amber-soft); color: var(--amber); font-size: 9px; font-weight: 800; }
.provider-reference { margin-top: 5px; display: block; color: var(--muted); font: 700 9px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; }
.gateway-strip { margin-bottom: 18px; padding: 16px 18px; border: 1px solid #c9ded3; border-radius: var(--radius); display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 14px; color: white; background: linear-gradient(135deg,#18352c,#285848); box-shadow: var(--shadow-sm); }
.gateway-mark { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: #18352c; background: var(--lime); }
.gateway-mark svg { width: 21px; }
.gateway-strip h2 { margin: 2px 0; font-size: 16px; }
.gateway-strip small { color: #cfe0d7; font-size: 10px; }
.gateway-strip .panel-label { color: #a9c9ba; }
.gateway-badges, .settlement-page-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.gateway-badges span { padding: 6px 8px; border: 1px solid rgba(255,255,255,.16); border-radius: 99px; color: #dce9e2; font-size: 9px; font-weight: 800; }
.gateway-badges span:first-child { color: #142e26; background: var(--lime); border-color: var(--lime); }
.gateway-badges svg, .settlement-page-actions svg { width: 12px; }
.settlement-page-actions .btn { display: inline-flex; align-items: center; gap: 5px; }
.payment-actions { display: flex; align-items: center; gap: 8px; }
.payment-actions .btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.payment-actions svg { width: 13px; }
.attempt-history { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.attempt-history summary { padding: 9px 12px; display: flex; align-items: center; gap: 7px; color: var(--ink-2); cursor: pointer; font-size: 10px; font-weight: 750; list-style: none; }
.attempt-history summary::-webkit-details-marker { display: none; }
.attempt-history summary svg { width: 14px; }
.attempt-history .attempt-chevron { margin-left: auto; transition: transform .2s ease; }
.attempt-history[open] .attempt-chevron { transform: rotate(180deg); }
.attempt-list { border-top: 1px solid var(--line); }
.attempt-item { min-height: 38px; padding: 7px 12px; display: grid; grid-template-columns: 25px 78px 90px minmax(80px, 1fr); align-items: center; gap: 8px; border-bottom: 1px solid var(--line); font-size: 9px; }
.attempt-item:last-child { border-bottom: 0; }
.attempt-number { color: var(--muted); font-weight: 800; }
.attempt-status { width: fit-content; padding: 3px 6px; border-radius: 99px; color: var(--muted); background: #e7ebe8; font-weight: 800; }
.attempt-status.is-succeeded { color: #157752; background: #dff3e9; }
.attempt-status.is-failed { color: #b63f4a; background: #fae4e7; }
.attempt-item time { color: var(--muted); }
.attempt-item code { color: var(--ink-2); font-size: 9px; overflow-wrap: anywhere; }
.attempt-item small { grid-column: 4; color: #a23c46; line-height: 1.35; }
.settlement-insight { margin: 18px; padding: 20px; border: 1px solid #cadecf; border-radius: 17px; color: white; background: linear-gradient(135deg, #1d3c32, #285848); box-shadow: 0 14px 32px rgba(36,75,62,.13); }
.settlement-insight.is-balanced { background: linear-gradient(135deg, #244b3e, #34715d); }
.insight-story { display: flex; align-items: flex-start; gap: 14px; }
.insight-icon { flex: 0 0 42px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: #d8eee2; background: rgba(255,255,255,.11); }
.insight-icon svg { width: 21px; }
.insight-badge { color: #bcd5c8; font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.insight-story h3 { margin: 5px 0 4px; font-size: 18px; font-weight: 700; }
.insight-story p { margin: 0; color: #d3e1d9; font-size: 11px; line-height: 1.55; }
.insight-story p strong { color: white; }
.insight-metrics { margin-top: 17px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,.13); display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.insight-metrics span, .insight-metrics strong { display: block; }
.insight-metrics span { color: #bcd0c5; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.insight-metrics strong { margin-top: 4px; color: white; font-size: 14px; }
.insight-metrics strong span { display: inline; color: inherit; font: inherit; text-transform: none; letter-spacing: 0; }
.insight-pending { margin: 14px 0 0; padding: 9px 11px; border-radius: 10px; display: flex; align-items: center; gap: 7px; color: #f5ddae; background: rgba(255,198,88,.1); font-size: 10px; font-weight: 600; }
.insight-pending svg { width: 14px; }
.member-search { position: relative; margin: 14px 20px 5px; }
.member-search > svg { position: absolute; left: 11px; top: 50%; width: 15px; color: var(--muted); transform: translateY(-50%); }
.member-search input { width: 100%; min-height: 40px; padding: 0 42px 0 34px; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: #fafbf9; color: var(--ink); font-size: 11px; }
.member-search input:focus { border-color: #9fada6; background: white; box-shadow: 0 0 0 4px rgba(23,35,31,.05); }
.member-search .icon-button { position: absolute; right: 2px; top: 2px; width: 36px; height: 36px; }
.member-empty { padding: 24px 0; color: var(--muted); text-align: center; font-size: 11px; }
.member-pagination { padding: 11px 20px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: center; gap: 13px; color: var(--muted); font-size: 10px; }
.member-pagination a { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 9px; display: grid; place-items: center; color: var(--ink-2); background: white; }
.member-pagination a:hover { color: var(--brand); border-color: #cbd4cd; }
.member-pagination a.disabled { opacity: .35; pointer-events: none; }
.member-pagination svg { width: 14px; }

.form-shell { max-width: 980px; margin: 0 auto; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .75fr); gap: 20px; align-items: start; }
.form-card { padding: 26px; }
.section-title { margin: 0 0 4px; font: 700 18px "DM Sans", sans-serif; }
.section-help { margin: 0 0 23px; color: var(--muted); font-size: 13px; }
.form-label { margin-bottom: 7px; color: var(--ink-2); font-size: 12px; font-weight: 700; }
.form-control, .form-select { min-height: 48px; border: 1px solid var(--line); border-radius: 13px; background-color: #fbfcfa; color: var(--ink); font-size: 14px; box-shadow: none !important; }
textarea.form-control { min-height: 100px; padding-top: 12px; }
.form-control:focus, .form-select:focus { border-color: #9fada6; background: white; box-shadow: 0 0 0 4px rgba(23,35,31,.05) !important; }
.invite-code-input { text-transform: uppercase; letter-spacing: .14em; font-weight: 700; }
.input-money { position: relative; }
.input-money input { padding-right: 56px; font: 700 20px "DM Sans", sans-serif; }
.input-money span { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; font-weight: 800; }
.split-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 5px; border-radius: 14px; background: var(--surface-2); }
.split-tab { min-height: 40px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; transition: .18s ease; }
.split-tab.active { color: var(--ink); background: white; box-shadow: 0 3px 10px rgba(23,35,31,.08); }
.participant-list { margin-top: 17px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.participant-row { min-height: 58px; padding: 9px 12px; display: grid; grid-template-columns: auto minmax(0,1fr) 120px; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.participant-row:last-child { border: 0; }
.participant-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); }
.participant-row label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.share-input { min-height: 36px; text-align: right; }
.form-aside { position: sticky; top: 96px; }
.summary-card { padding: 22px; background: var(--ink); color: white; }
.summary-card h3 { font: 700 16px "DM Sans", sans-serif; }
.summary-card p { color: #b8c3bd; font-size: 12px; line-height: 1.55; }
.summary-line { padding: 12px 0; border-top: 1px solid rgba(255,255,255,.12); display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.summary-line span:first-child { color: #aebbb4; }
.submit-wide { width: 100%; margin-top: 16px; }

.drop-zone { min-height: 330px; padding: 45px 24px; border: 2px dashed #cbd4cd; border-radius: var(--radius); display: grid; place-items: center; text-align: center; background: linear-gradient(135deg, #fff, #f7f9f5); transition: .2s ease; cursor: pointer; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--brand); background: var(--brand-soft); transform: translateY(-2px); }
.drop-zone .upload-icon { width: 74px; height: 74px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 23px; color: white; background: var(--ink); box-shadow: var(--shadow); }
.drop-zone .upload-icon svg { width: 30px; height: 30px; }
.drop-zone h2 { margin: 0; font: 700 21px "DM Sans", sans-serif; }
.drop-zone p { max-width: 420px; margin: 9px auto 20px; color: var(--muted); font-size: 13px; }
.drop-zone.compact { min-height: 235px; padding: 28px 20px; }
.drop-zone.compact .upload-icon { width: 58px; height: 58px; margin-bottom: 14px; border-radius: 18px; }
.drop-zone.compact .upload-icon svg { width: 25px; height: 25px; }
.drop-zone.compact h2 { max-width: 430px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.ai-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .75fr); gap: 20px; align-items: start; }
.ai-method-head { display: flex; align-items: center; gap: 13px; }
.ai-draft { padding: 22px; border-color: #c9d8cf; }
.ai-draft-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ai-draft-head h2 { margin: 0; font-size: 19px; font-weight: 700; }
.confidence { min-height: 32px; padding: 0 10px; display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 11px; font-weight: 700; }
.confidence svg { width: 14px; }
.draft-source { margin: 20px 0 12px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.draft-source svg { width: 16px; color: var(--navy); }
.draft-fields { margin: 0 0 20px; }
.draft-fields > div { padding: 14px 0; display: grid; grid-template-columns: 88px minmax(0,1fr); gap: 12px; border-top: 1px solid var(--line); }
.draft-fields dt { color: var(--muted); font-size: 11px; font-weight: 600; }
.draft-fields dd { margin: 0; text-align: right; font-size: 13px; font-weight: 700; word-break: break-word; }
.draft-disclaimer { margin: 14px 0 0; display: flex; gap: 7px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.draft-disclaimer svg { flex: 0 0 14px; width: 14px; }
.ai-guide { padding: 24px; color: white; background: var(--navy); }
.ai-guide .focus-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: rgba(255,255,255,.12); }
.ai-guide h3 { margin: 20px 0 15px; font-size: 18px; font-weight: 700; }
.ai-guide ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.ai-guide li { display: flex; align-items: center; gap: 10px; color: #d6e0da; font-size: 12px; }
.ai-guide li span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.1); color: white; font-weight: 700; }
.app-alert { padding: 14px; display: flex; gap: 11px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.app-alert > svg { flex: 0 0 20px; width: 20px; }
.app-alert strong { display: block; font-size: 13px; }
.app-alert p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.app-alert.danger { border-color: #f0d4d7; color: var(--red); background: #fffafa; }
.dark-link { color: var(--ink-2); }
.dark-link:hover { color: var(--brand-dark); }
.import-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 20px; align-items: stretch; }
.import-summary { padding: 24px; color: white; background: var(--navy); }
.import-summary .focus-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: rgba(255,255,255,.12); }
.import-summary h3 { margin: 22px 0 8px; font-size: 18px; font-weight: 700; }
.import-summary p { margin: 0; color: #d6e0da; font-size: 12px; line-height: 1.6; }
.import-drop { min-height: 145px; padding: 24px; border: 1.5px dashed #bcc8c0; border-radius: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; text-align: center; cursor: pointer; background: #fafbf9; transition: .18s ease; }
.import-drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.import-drop > svg { width: 27px; height: 27px; color: var(--navy); }
.import-drop strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.import-drop span { color: var(--muted); font-size: 11px; }
.format-example { margin-top: 22px; padding: 14px; border-radius: 13px; display: grid; grid-template-columns: 56px minmax(0,1fr); gap: 10px; background: var(--surface-2); }
.format-example span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.format-example code { color: var(--ink-2); font-size: 11px; line-height: 1.65; }
.import-divider { margin: 22px 0; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.import-divider::before, .import-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.names-paste { min-height: 145px !important; line-height: 1.65; }
.import-preview { overflow: hidden; }
.import-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.import-table th { padding: 11px 20px; color: var(--muted); background: #fafbf9; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.import-table td { padding: 14px 20px; border-top: 1px solid var(--line); color: var(--ink-2); }
.import-table td:first-child { color: var(--ink); font-weight: 600; }
.import-status { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.import-status.valid { color: var(--green); background: var(--green-soft); }
.import-status.invalid { color: var(--red); background: var(--red-soft); }
.import-confirm { padding: 16px 20px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 18px; background: #fafbf9; }
.import-confirm strong { font-size: 13px; }
.import-confirm p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }

.analytics-live { min-height: 38px; padding: 0 12px; border: 1px solid #cfe2d7; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.analytics-live svg { width: 15px; }
.analytics-metrics { margin-bottom: 20px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.analytics-metrics article { min-height: 130px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.analytics-metrics span, .analytics-metrics strong, .analytics-metrics small { display: block; }
.analytics-metrics span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.analytics-metrics strong { margin-top: 13px; font: 700 25px "DM Sans", sans-serif; }
.analytics-metrics small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.analytics-metrics .trend-up, .signal-change.is-up { color: var(--red); }
.analytics-metrics .trend-down, .signal-change.is-down { color: var(--green); }
.analytics-layout { margin-bottom: 20px; display: grid; grid-template-columns: minmax(0,1.3fr) minmax(320px,.7fr); gap: 20px; }
.query-chip { padding: 5px 8px; border-radius: 999px; color: var(--navy); background: var(--green-soft); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.trend-chart { height: 310px; padding: 30px 24px 22px; display: flex; align-items: stretch; gap: 12px; }
.trend-column { min-width: 0; flex: 1; display: grid; grid-template-rows: 20px minmax(130px,1fr) 18px 15px; gap: 5px; text-align: center; }
.trend-value { overflow: hidden; color: var(--muted); font-size: 9px; font-weight: 700; text-overflow: ellipsis; }
.trend-track { position: relative; overflow: hidden; border-radius: 10px; background: var(--surface-2); }
.trend-track span { position: absolute; inset: auto 0 0; min-height: 4%; border-radius: 10px 10px 0 0; background: linear-gradient(180deg, var(--brand), #bd5940); transition: height .5s cubic-bezier(.2,.7,.2,1); }
.trend-column strong { font-size: 10px; }
.trend-column small { color: var(--muted); font-size: 9px; }
.payer-ranking { padding: 8px 20px 16px; }
.payer-row { min-height: 66px; display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.payer-row:last-child { border: 0; }
.payer-rank { width: 25px; height: 25px; border-radius: 8px; display: grid; place-items: center; color: var(--brand-dark); background: var(--brand-soft); font-size: 10px; font-weight: 800; }
.payer-row > div { min-width: 0; }
.payer-row > div strong, .payer-row > div small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payer-row > div strong { font-size: 11px; }
.payer-row > div small { color: var(--muted); font-size: 9px; }
.payer-row > strong { font-size: 10px; white-space: nowrap; }
.payer-bar { height: 3px; margin-top: 5px; display: block; overflow: hidden; border-radius: 9px; background: var(--surface-2); }
.payer-bar i { height: 100%; display: block; border-radius: inherit; background: var(--navy); }
.signal-grid { padding: 17px 20px 20px; display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; }
.signal-grid article { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; display: grid; grid-template-columns: 32px minmax(0,1fr); gap: 9px; background: #fafbf9; }
.signal-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--navy); background: var(--lime); }
.signal-icon svg { width: 15px; }
.signal-grid small, .signal-grid strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signal-grid small { color: var(--muted); font-size: 9px; }
.signal-grid strong { margin-top: 2px; font-size: 11px; }
.signal-change { grid-column: 1 / -1; width: fit-content; padding: 4px 7px; border-radius: 8px; color: var(--muted); background: var(--surface-2); font-size: 9px; font-weight: 800; }
.compact-empty { min-height: 230px; }

@media (min-width: 992px) {
    .dashboard-page, .group-detail-page, .analytics-page, .invoice-page { height: calc(100vh - 172px); height: calc(100dvh - 172px); display: grid; gap: 12px; }
    .dashboard-page { grid-template-rows: auto auto minmax(0, 1fr); }
    .dashboard-page .page-heading { margin-bottom: 0; }
    .dashboard-page .page-title { font-size: 34px; }
    .dashboard-page .page-subtitle { margin-top: 6px; font-size: 13px; line-height: 1.45; }
    .dashboard-page .eyebrow { margin-bottom: 7px; }
    .dashboard-page .metric-grid { margin-bottom: 0; gap: 12px; }
    .dashboard-page .metric-card { min-height: 112px; padding: 16px 20px; }
    .dashboard-page .metric-value { margin-top: 13px; font-size: 27px; }
    .dashboard-page .metric-note { margin-top: 7px; }
    .dashboard-page .content-grid { min-height: 0; align-items: stretch; gap: 12px; }
    .dashboard-page .content-grid > .panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c9d0ca transparent; }
    .dashboard-page .content-grid > .stack { min-height: 0; gap: 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c9d0ca transparent; }
    .dashboard-page .panel-head { min-height: 58px; padding: 12px 20px; }
    .dashboard-page .activity-row { min-height: 0; padding: 11px 20px; }
    .dashboard-page .category-icon { flex-basis: 38px; width: 38px; height: 38px; border-radius: 11px; }
    .dashboard-page .focus-card { padding: 16px 20px; }
    .dashboard-page .focus-card .focus-icon { width: 36px; height: 36px; }
    .dashboard-page .focus-card h3 { margin: 12px 0 5px; font-size: 17px; }
    .dashboard-page .focus-card p { font-size: 11px; line-height: 1.4; }
    .dashboard-page .focus-card a { margin-top: 10px; }
    .dashboard-page .category-stats { padding: 12px 20px 14px; gap: 10px; }
    .dashboard-page .category-stat > div:first-child { margin-bottom: 4px; }
    .dashboard-page .stat-track { height: 5px; }
    .group-detail-page { grid-template-rows: auto minmax(0, 1fr); }
    .group-detail-page .group-hero { min-height: 118px; margin-bottom: 0; padding: 18px 26px; align-items: center; }
    .group-detail-page .group-hero h1 { margin: 9px 0 4px; font-size: 30px; }
    .group-detail-page .group-hero::after { width: 180px; height: 180px; top: -138px; border-width: 36px; }
    .group-detail-page .group-layout { min-height: 0; gap: 12px; }
    .group-detail-page .group-layout > .stack { min-height: 0; gap: 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c9d0ca transparent; }
    .group-detail-page .panel-head { min-height: 58px; padding: 12px 20px; }
    .group-detail-page .activity-row { padding: 10px 20px; }
    .group-detail-page .category-icon { flex-basis: 38px; width: 38px; height: 38px; border-radius: 11px; }
    .group-detail-page .member-search { margin: 10px 16px 3px; }
    .group-detail-page .member-search input { min-height: 36px; }
    .group-detail-page .member-list { padding: 3px 16px 7px; }
    .group-detail-page .member-row { padding: 7px 0; }
    .group-detail-page .member-avatar { flex-basis: 32px; width: 32px; height: 32px; }
    .group-detail-page .member-pagination { padding: 8px 16px; }
    .group-detail-page aside .focus-card { padding: 15px 18px; }
    .group-detail-page aside .focus-card .focus-icon { width: 34px; height: 34px; }
    .group-detail-page aside .focus-card h3 { margin: 11px 0 4px; font-size: 16px; }
    .group-detail-page aside .focus-card p { font-size: 11px; line-height: 1.4; }
    .group-detail-page aside .focus-card a { margin-top: 9px; }
    .analytics-page, .invoice-page { height: calc(100vh - 180px); height: calc(100dvh - 180px); min-height: 650px; }
    .analytics-page { grid-template-rows: auto auto minmax(285px, 1fr) auto; }
    .analytics-page .page-heading, .invoice-page .page-heading { margin-bottom: 0; }
    .analytics-page .page-title, .invoice-page .page-title { font-size: 36px; }
    .analytics-page .analytics-metrics { margin-bottom: 0; gap: 12px; }
    .analytics-page .analytics-metrics article { min-height: 88px; padding: 13px 18px; }
    .analytics-page .analytics-metrics strong { margin-top: 6px; font-size: 22px; }
    .analytics-page .analytics-metrics small { margin-top: 2px; }
    .analytics-page .analytics-layout { min-height: 0; margin-bottom: 0; gap: 12px; }
    .analytics-page .analytics-layout > .panel { min-height: 0; overflow: hidden; }
    .analytics-page .panel-head { padding: 13px 20px; }
    .analytics-page .trend-chart { height: calc(100% - 61px); min-height: 205px; padding: 16px 20px 12px; }
    .analytics-page .trend-column { grid-template-rows: 16px minmax(100px,1fr) 15px 13px; }
    .analytics-page .payer-ranking { height: calc(100% - 61px); padding: 2px 20px 8px; display: grid; grid-template-rows: repeat(5,minmax(0,1fr)); }
    .analytics-page .payer-row { min-height: 0; }
    .analytics-page .signal-grid { padding: 10px 16px 12px; }
    .analytics-page .signal-grid article { padding: 9px 11px; grid-template-columns: 28px minmax(0,1fr); gap: 7px; }
    .analytics-page .signal-icon { width: 28px; height: 28px; }
    .analytics-page .signal-change { padding-block: 2px; }
    .invoice-page { grid-template-rows: auto minmax(0,1fr); }
    .invoice-page .ai-layout { min-height: 0; }
    .invoice-page .ai-layout > .stack:first-child { min-height: 0; display: grid; grid-template-rows: repeat(2,minmax(0,1fr)); }
    .invoice-page .form-card { min-height: 0; padding: 17px 20px; }
    .invoice-page .form-card .mt-4 { margin-top: 12px !important; }
    .invoice-page textarea.form-control { min-height: 72px; }
    .invoice-page .drop-zone.compact { min-height: 150px; }
}

.auth-body { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .9fr) minmax(500px, 1.25fr); background: var(--paper); }
.auth-form-side { display: flex; flex-direction: column; padding: 34px clamp(28px, 6vw, 88px); background: white; }
.auth-form-wrap { width: 100%; max-width: 430px; margin: auto; }
.auth-form-wrap h1 { margin: 0; font: 700 clamp(31px, 4vw, 42px)/1.14 "DM Sans", sans-serif; letter-spacing: -1.2px; }
.auth-form-wrap > p { margin: 11px 0 30px; color: var(--muted); line-height: 1.55; }
.auth-label-row { display: flex; align-items: center; justify-content: space-between; }
.auth-label-row a { margin-bottom: 8px; color: var(--brand-dark); font-size: 11px; font-weight: 700; }
.demo-mailbox { margin-top: 16px; padding: 13px; border: 1px solid #cce1d5; border-radius: 14px; display: flex; gap: 11px; background: var(--green-soft); }
.demo-mailbox > span { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--green); background: white; }
.demo-mailbox svg { width: 17px; }
.demo-mailbox strong { font-size: 11px; }
.demo-mailbox p { margin: 2px 0 5px; color: var(--muted); font-size: 10px; }
.demo-mailbox a { color: var(--green); font-size: 10px; font-weight: 800; }
.auth-art { position: relative; padding: clamp(42px, 6vw, 92px); overflow: hidden; display: grid; place-items: center; color: white; background: #1d2b25; }
.auth-art::before { content: ""; position: absolute; inset: 0; opacity: .22; background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px); background-size: 52px 52px; mask-image: linear-gradient(to bottom right, black, transparent 78%); }
.auth-art::after { content: ""; position: absolute; width: 380px; height: 380px; right: -180px; top: -180px; border: 70px solid rgba(217,108,79,.7); border-radius: 50%; }
.auth-showcase { position: relative; z-index: 1; width: min(600px, 100%); }
.auth-badge { width: fit-content; min-height: 34px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: #dce9e1; background: rgba(255,255,255,.07); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.auth-badge svg { width: 15px; color: #e59a84; }
.auth-showcase h2 { margin: 28px 0 16px; font: 700 clamp(38px, 4.7vw, 64px)/1.06 "DM Sans", sans-serif; letter-spacing: -2px; }
.auth-showcase h2 span { color: #e18a70; }
.auth-lead { max-width: 540px; margin: 0; color: #d4ded8; font-size: 16px; line-height: 1.7; }
.auth-proof-list { margin-top: 38px; display: grid; gap: 10px; }
.auth-proof { min-height: 78px; padding: 14px 16px; display: grid; grid-template-columns: 30px minmax(0,1fr) 34px; align-items: center; gap: 13px; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: rgba(255,255,255,.055); backdrop-filter: blur(8px); }
.auth-proof > span { color: #e18a70; font-size: 11px; font-weight: 700; }
.auth-proof strong { display: block; font-size: 14px; }
.auth-proof p { margin: 3px 0 0; color: #c4d0c9; font-size: 12px; }
.auth-proof > svg { width: 19px; color: #afc8ba; }
.auth-footnote { margin-top: 25px; display: flex; align-items: center; gap: 9px; color: #b9c8bf; font-size: 11px; }
.auth-footnote svg { width: 17px; color: #7fc2a2; }
.auth-alert { padding: 12px 14px; margin-bottom: 18px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.auth-alert.danger { color: var(--red); background: var(--red-soft); }
.auth-alert.success { color: var(--green); background: var(--green-soft); }
.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 47px; }
.password-toggle { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); }
.auth-switch { margin-top: 22px; text-align: center; color: var(--muted); font-size: 13px; }
.auth-switch a { color: var(--brand-dark); font-weight: 800; text-decoration: none; }

.modal-content { border: 0; border-radius: 22px; box-shadow: 0 28px 90px rgba(23,35,31,.2); }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-title { font: 700 19px "DM Sans", sans-serif; }
.modal.fade .modal-dialog { transform: translateY(18px) scale(.98); transition: transform .22s ease; }
.modal.show .modal-dialog { transform: none; }
.toast-stack { position: fixed; z-index: 1090; right: 20px; top: 86px; width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.app-toast { padding: 14px; display: grid; grid-template-columns: 38px minmax(0,1fr) 30px; gap: 11px; align-items: start; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: var(--shadow); opacity: 0; transform: translateX(24px) scale(.98); transition: .22s ease; pointer-events: auto; }
.app-toast.show { opacity: 1; transform: none; }
.toast-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; }
.is-success .toast-icon { color: var(--green); background: var(--green-soft); }
.is-danger .toast-icon { color: var(--red); background: var(--red-soft); }
.app-toast strong { font-size: 13px; }
.app-toast p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.app-toast button { width: 30px; height: 30px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); }
.app-toast button:hover { background: var(--surface-2); }
.app-toast button svg { width: 15px; }

@media (max-width: 1180px) {
    .group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-grid, .group-layout { grid-template-columns: minmax(0, 1.35fr) minmax(280px, .8fr); }
    .profile-copy { display: none; }
}

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-105%); box-shadow: 30px 0 70px rgba(23,35,31,.18); transition: transform .26s cubic-bezier(.2,.7,.2,1); }
    .app-sidebar.is-open { transform: translateX(0); }
    .sidebar-close, .menu-trigger { display: inline-grid; }
    .sidebar-scrim { position: fixed; inset: 0; z-index: 1035; border: 0; background: rgba(12,23,19,.42); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: .22s ease; }
    .sidebar-open .sidebar-scrim { display: block; opacity: 1; visibility: visible; }
    .sidebar-open { overflow: hidden; }
    .app-main { width: 100%; margin-left: 0; }
    .page-wrap { padding: 28px 24px 54px; }
    .app-topbar { padding: 0 24px; }
    .topbar-left { gap: 5px; }
    .content-grid, .group-layout, .form-grid, .ai-layout, .import-layout, .analytics-layout { grid-template-columns: 1fr; }
    .signal-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .form-aside { position: static; }
}

@media (max-width: 767.98px) {
    .settlement-filter { align-items: stretch; flex-direction: column; }
    .settlement-filter .form-select { width: 100%; }
    .gateway-strip { grid-template-columns: 40px minmax(0,1fr); }
    .gateway-badges { grid-column: 1 / -1; justify-content: flex-start; }
    .settlement-page-actions { width: 100%; justify-content: flex-start; }
    .app-topbar { height: 64px; padding: 0 14px; }
    .page-wrap { padding: 22px 16px 46px; }
    .breadcrumb-line span, .breadcrumb-line svg, .quick-add span { display: none; }
    .quick-add { width: 42px; padding: 0; justify-content: center; }
    .page-heading { align-items: stretch; flex-direction: column; margin-bottom: 22px; }
    .page-heading .btn { width: 100%; }
    .page-actions { flex-direction: column-reverse; align-items: stretch; }
    .page-title { font-size: 31px; letter-spacing: -1.2px; }
    .page-subtitle { font-size: 14px; }
    .metric-grid { grid-template-columns: 1fr; gap: 12px; }
    .metric-card { min-height: 145px; }
    .metric-value { margin-top: 20px; }
    .group-grid { grid-template-columns: 1fr; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .toolbar-summary { width: 100%; justify-content: space-between; }
    .panel-head-actions { flex-wrap: wrap; justify-content: flex-end; }
    .search-box { width: 100%; }
    .count-pill { align-self: flex-start; }
    .expense-row { grid-template-columns: 42px minmax(0,1fr) auto; min-height: 78px; padding: 12px 14px; gap: 10px; }
    .expense-row:has(.expense-list-actions) { grid-template-columns: 42px minmax(0,1fr) auto; }
    .expense-list-actions { grid-column: 2 / -1; justify-content: flex-end; }
    .expense-row .category-icon { width: 42px; height: 42px; }
    .row-chevron { display: none; }
    .expense-meta span { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .expense-total strong { font-size: 13px; }
    .group-hero { grid-template-columns: 1fr; padding: 22px; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { width: 100%; }
    .panel-head { padding: 17px 16px; }
    .activity-row { padding: 14px 16px; }
    .activity-main span { max-width: 45vw; }
    .expense-activity { align-items: flex-start; }
    .expense-activity-end { align-items: flex-end; flex-direction: column; }
    .row-actions { opacity: 1; }
    .form-card { padding: 20px 16px; }
    .split-tabs { grid-template-columns: 1fr; }
    .participant-row { grid-template-columns: auto minmax(0,1fr); }
    .participant-row .share-input { grid-column: 1 / -1; width: 100%; }
    .settlement-bottom { align-items: flex-start; flex-direction: column; }
    .settlement-bottom form, .settlement-bottom .btn { width: 100%; }
    .payment-actions { width: 100%; flex-direction: column-reverse; }
    .attempt-item { grid-template-columns: 24px 74px 1fr; }
    .attempt-item code, .attempt-item small { grid-column: 1 / -1; }
    .settlement-insight { margin: 12px; padding: 16px; }
    .insight-metrics { grid-template-columns: 1fr; gap: 10px; }
    .auth-body { grid-template-columns: 1fr; }
    .auth-form-side { min-height: 100vh; padding: 24px 20px; }
    .auth-art { display: none; }
    .toast-stack { top: 76px; right: 16px; }
    .modal-dialog { margin: 12px; }
    .import-confirm { align-items: stretch; flex-direction: column; }
    .import-confirm .btn { width: 100%; }
    .analytics-live { align-self: flex-start; }
    .analytics-metrics { grid-template-columns: 1fr; }
    .trend-chart { height: 270px; padding-inline: 14px; gap: 7px; }
    .trend-value { display: none; }
    .signal-grid { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
    .page-wrap { padding-inline: 12px; }
    .app-topbar { padding-inline: 10px; }
    .metric-card { padding: 19px; }
    .amount { font-size: 13px; }
    .activity-row { gap: 10px; }
    .category-icon { flex-basis: 40px; width: 40px; height: 40px; }
}

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