:root {
    --ink: #142b36;
    --ink-2: #27404a;
    --muted: #6f7f84;
    --line: #dfe7e5;
    --line-soft: #edf2f0;
    --paper: #ffffff;
    --canvas: #f4f7f5;
    --mint: #29d89b;
    --mint-dark: #0d9f70;
    --mint-soft: #e7f9f2;
    --teal: #113b45;
    --navy: #0c252f;
    --danger: #c64a45;
    --danger-soft: #fff0ef;
    --warm: #d49332;
    --warm-soft: #fff7e7;
    --blue: #3b71ca;
    --blue-soft: #edf3ff;
    --shadow: 0 12px 40px rgba(22, 51, 59, .07);
    --radius: 16px;
    --radius-sm: 10px;
    --sidebar: 244px;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3 { margin-top: 0; }
button { color: inherit; }

.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar); padding: 24px 18px 18px;
    display: flex; flex-direction: column; color: #dbe8e7; background: var(--navy);
    border-right: 1px solid rgba(255,255,255,.06);
}
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark {
    width: 39px; height: 39px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px;
    color: var(--navy); background: var(--mint); font-weight: 900; letter-spacing: -.04em;
    box-shadow: 0 6px 18px rgba(41,216,155,.18);
}
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.05; }
.brand strong { color: inherit; font-size: 15px; letter-spacing: -.01em; }
.brand small { margin-top: 4px; color: #85aba9; font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.company-switcher {
    margin: 30px 0 24px; padding: 12px; display: flex; align-items: center; gap: 10px;
    border: 1px solid rgba(255,255,255,.08); border-radius: 13px; background: rgba(255,255,255,.035);
}
.company-switcher > span:nth-child(2), .sidebar-user > span:nth-child(2) { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.company-switcher small, .sidebar-user small { margin-bottom: 3px; color: #759696; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.company-switcher strong, .sidebar-user strong { overflow: hidden; color: #f4fafa; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.company-avatar, .user-avatar {
    display: inline-grid; flex: 0 0 auto; place-items: center; border-radius: 10px; font-weight: 800;
    color: var(--teal); background: var(--mint-soft);
}
.company-avatar { width: 36px; height: 36px; }
.company-avatar.small { width: 34px; height: 34px; border-radius: 9px; font-size: 12px; }
.company-avatar.large { width: 58px; height: 58px; border-radius: 15px; font-size: 21px; }
.user-avatar { width: 34px; height: 34px; color: #d8eee9; background: rgba(41,216,155,.16); font-size: 11px; }
.main-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
    min-height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 12px; border-radius: 10px;
    color: #91aaa9; font-size: 13px; font-weight: 650; transition: .16s ease;
}
.nav-link span { width: 18px; color: #698b8a; font-size: 17px; text-align: center; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-link.active { color: #fff; background: rgba(41,216,155,.13); }
.nav-link.active span { color: var(--mint); }
.sidebar-bottom { margin-top: auto; }
.sidebar-user { margin-top: 14px; padding: 14px 8px 0; display: flex; align-items: center; gap: 9px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user .icon-button { color: #72918f; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; cursor: pointer; }
.icon-button:hover { background: rgba(255,255,255,.08); }
.mobile-topbar { display: none; }
.main-content { min-height: 100vh; margin-left: var(--sidebar); padding: 38px 42px 24px; }
.app-footer { padding: 34px 0 6px; color: #9aa9a6; font-size: 11px; text-align: center; }

.page-header { margin-bottom: 25px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-header h1 { margin-bottom: 6px; font-size: clamp(28px, 3vw, 38px); line-height: 1.08; letter-spacing: -.045em; }
.page-header > div:first-child > p:last-child:not(.eyebrow) { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.eyebrow { margin-bottom: 8px; color: var(--mint-dark); font-size: 10px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.page-actions, .form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.button {
    min-height: 41px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    border: 1px solid transparent; border-radius: 10px; font-size: 12px; font-weight: 800; letter-spacing: .005em; cursor: pointer; transition: .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: #06281e; background: var(--mint); box-shadow: 0 8px 22px rgba(41,216,155,.2); }
.button-primary:hover { background: #35e5a7; }
.button-secondary { color: var(--ink); background: var(--paper); border-color: var(--line); }
.button-secondary:hover { border-color: #bfcfca; }
.button-ghost { min-height: 36px; color: var(--muted); background: transparent; border-color: var(--line); }
.button-danger { color: #fff; background: var(--danger); }
.button-small { min-height: 32px; padding: 0 12px; color: var(--teal); background: var(--mint-soft); }
.button-wide { width: 100%; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.panel-header { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-header h2 { margin-bottom: 0; font-size: 17px; letter-spacing: -.025em; }
.panel-header > a, .panel-header > span { color: var(--mint-dark); font-size: 11px; font-weight: 800; }
.metric-grid { margin-bottom: 18px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.metric-grid.compact { grid-template-columns: repeat(2, minmax(0,320px)); }
.metric-card { min-height: 135px; padding: 20px; display: flex; align-items: flex-start; justify-content: space-between; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); }
.metric-card > div { display: flex; flex-direction: column; }
.metric-card span:first-child { color: var(--muted); font-size: 11px; font-weight: 700; }
.metric-card strong { margin: 14px 0 8px; font-size: clamp(19px, 2vw, 26px); line-height: 1; letter-spacing: -.04em; }
.metric-card small { color: var(--muted); font-size: 10px; }
.metric-card.metric-featured { color: #f5fffb; border-color: var(--teal); background: var(--teal); }
.metric-card.metric-featured span:first-child, .metric-card.metric-featured small { color: #abc6c2; }
.metric-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--teal); background: var(--mint-soft); font-weight: 900; }
.metric-featured .metric-icon { color: var(--mint); background: rgba(41,216,155,.13); }
.metric-icon.danger { color: var(--danger); background: var(--danger-soft); }
.metric-icon.warm { color: var(--warm); background: var(--warm-soft); }
.metric-icon.success { color: var(--mint-dark); background: var(--mint-soft); }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--mint-dark) !important; }
.muted { color: var(--muted); }

.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.dashboard-grid + .dashboard-grid { margin-top: 18px; }
.dashboard-grid .panel { padding: 22px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.aging-chart { height: 225px; padding: 10px 4px 0; display: grid; grid-template-columns: repeat(5,1fr); gap: 14px; }
.aging-column { min-width: 0; display: grid; grid-template-rows: 1fr auto auto; gap: 7px; text-align: center; }
.aging-track { position: relative; width: 34px; height: 100%; margin: 0 auto; overflow: hidden; border-radius: 9px 9px 5px 5px; background: #eef3f1; }
.aging-track span { position: absolute; inset: auto 0 0; height: var(--height); border-radius: 9px 9px 4px 4px; background: var(--mint); }
.aging-column:nth-child(3) .aging-track span { background: #d6c65d; }
.aging-column:nth-child(4) .aging-track span { background: #de914e; }
.aging-column:nth-child(5) .aging-track span { background: #cc5953; }
.aging-column strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
.aging-column small { color: var(--muted); font-size: 9px; }
.forecast-list { display: flex; flex-direction: column; }
.forecast-list > div { padding: 15px 0; display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-soft); }
.forecast-list span { color: var(--muted); font-size: 11px; }
.forecast-list strong { font-size: 13px; }
.panel-note { margin: 17px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.lower-grid .panel { min-height: 330px; }
.client-balance-list { display: flex; flex-direction: column; }
.client-balance-list a { padding: 10px 0; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); }
.client-balance-list a > span:nth-child(2) { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.client-balance-list strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.client-balance-list small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.client-balance-list b { font-size: 11px; }

.list-panel { padding: 0; overflow: hidden; }
.list-panel > .panel-header { margin: 0; padding: 22px 22px 16px; }
.toolbar { min-height: 66px; padding: 13px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-soft); background: #fbfcfb; }
.toolbar-wrap { flex-wrap: wrap; }
.search-box { min-width: min(420px,100%); height: 38px; padding-left: 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.search-box > span { color: #9bacaa; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: none; color: var(--ink); background: transparent; font-size: 12px; }
.search-box button { height: 100%; padding: 0 12px; border: 0; border-left: 1px solid var(--line); color: var(--mint-dark); background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; }
.compact-select { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; font-weight: 750; }
.compact-select select { min-height: 36px; padding: 0 30px 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-size: 11px; }
.table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { padding: 11px 15px; color: #81918f; background: #fbfcfb; font-size: 9px; font-weight: 850; letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 13px 15px; border-top: 1px solid var(--line-soft); color: var(--ink-2); vertical-align: middle; white-space: nowrap; }
tbody tr:hover { background: #fbfdfc; }
td a:hover { color: var(--mint-dark); }
.entity-cell { display: inline-flex; align-items: center; gap: 9px; }
.entity-cell > span:nth-child(2) { display: flex; flex-direction: column; }
.entity-cell strong, td > strong { color: var(--ink); font-size: 11px; }
.entity-cell small, .table-subtitle { margin-top: 3px; display: block; color: #91a09e; font-size: 9px; font-weight: 500; }
.row-action { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--mint-dark); background: var(--mint-soft); font-weight: 900; }
.status { padding: 5px 8px; display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; color: var(--muted); background: #eef2f1; font-size: 9px; font-weight: 800; }
.status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-paid, .status-active, .status-confirmed, .status-matched, .status-sent { color: var(--mint-dark); background: var(--mint-soft); }
.status-overdue, .status-failed, .status-cancelled { color: var(--danger); background: var(--danger-soft); }
.status-pending, .status-scheduled, .status-unmatched { color: var(--warm); background: var(--warm-soft); }
.status-partial, .status-suggested { color: var(--blue); background: var(--blue-soft); }
.empty-state { min-height: 260px; padding: 38px; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; }
.empty-state > span { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; color: var(--mint-dark); background: var(--mint-soft); font-weight: 900; }
.empty-state h3 { margin: 16px 0 6px; font-size: 16px; }
.empty-state p { max-width: 360px; margin-bottom: 16px; color: var(--muted); font-size: 11px; line-height: 1.6; }

.form-layout { max-width: 980px; display: flex; flex-direction: column; gap: 16px; }
.form-layout.narrow { max-width: 730px; }
.form-panel { padding: 25px; }
.section-heading { margin-bottom: 24px; display: flex; align-items: flex-start; gap: 13px; }
.section-heading > span { width: 35px; height: 35px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 10px; color: var(--mint-dark); background: var(--mint-soft); font-size: 10px; font-weight: 900; }
.section-heading h2 { margin: 1px 0 4px; font-size: 16px; letter-spacing: -.02em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.form-grid { display: grid; gap: 18px; }
.form-grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.form-grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.stack-form { display: flex; flex-direction: column; gap: 18px; }
label { display: flex; flex-direction: column; gap: 7px; color: var(--ink-2); font-size: 10px; font-weight: 800; }
label small { color: var(--muted); font-size: 9px; font-weight: 500; line-height: 1.5; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--ink); background: #fff; font-size: 12px; transition: .15s ease; }
input, select { height: 42px; padding: 0 12px; }
textarea { padding: 11px 12px; line-height: 1.5; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--mint-dark); box-shadow: 0 0 0 3px rgba(41,216,155,.12); }
input::placeholder, textarea::placeholder { color: #a7b4b2; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 48px; }
.password-field button { position: absolute; inset: 5px 5px 5px auto; padding: 0 9px; border: 0; border-radius: 7px; color: var(--mint-dark); background: var(--mint-soft); font-size: 9px; font-weight: 800; cursor: pointer; }
.form-actions { margin-top: 2px; }

.detail-grid { margin-bottom: 18px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.detail-grid > .panel { padding: 24px; }
.detail-summary { display: grid; grid-template-columns: 1fr 1.2fr; gap: 25px; }
.entity-hero { display: flex; align-items: center; gap: 14px; }
.entity-hero h2 { margin-bottom: 8px; font-size: 17px; }
dl { margin: 0; }
.detail-summary dl { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
dt { margin-bottom: 4px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
dd { margin: 0; color: var(--ink-2); font-size: 11px; }
.balance-hero { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; background: var(--teal); color: #fff; }
.balance-hero .eyebrow { color: var(--mint); }
.balance-hero > strong { margin: 4px 0 8px; font-size: 34px; letter-spacing: -.05em; }
.balance-hero > p:not(.eyebrow) { color: #a9c4c0; font-size: 10px; }
.portal-link { margin-top: 10px; color: var(--mint); font-size: 10px; font-weight: 800; }
.invoice-hero { margin-bottom: 18px; padding: 25px 28px; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 40px; }
.invoice-hero > div:first-child > strong { display: block; margin: 2px 0 6px; font-size: 34px; letter-spacing: -.05em; }
.invoice-hero > div:first-child > p:last-child { margin: 0; color: var(--muted); font-size: 10px; }
.invoice-progress > div:first-child { margin-bottom: 9px; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.invoice-progress > div:first-child strong { color: var(--ink); }
.progress, .mini-progress { position: relative; height: 8px; margin-bottom: 12px; overflow: hidden; border-radius: 999px; background: #eaf0ee; }
.progress span, .mini-progress span { position: absolute; inset: 0 auto 0 0; width: var(--progress); border-radius: inherit; background: var(--mint); }
.detail-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 10px; }
.timeline { display: flex; flex-direction: column; }
.timeline > div { padding: 11px 0; display: flex; gap: 10px; border-bottom: 1px solid var(--line-soft); }
.timeline-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; color: var(--blue); background: var(--blue-soft); font-size: 10px; font-weight: 900; }
.timeline-icon.success { color: var(--mint-dark); background: var(--mint-soft); }
.timeline p { margin: 0; display: flex; flex-direction: column; }
.timeline strong { font-size: 11px; }
.timeline small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.danger-zone { max-width: 980px; margin-top: 18px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid #efcac8; border-radius: 13px; background: var(--danger-soft); }
.danger-zone h3 { margin-bottom: 4px; color: var(--danger); font-size: 13px; }
.danger-zone p { margin: 0; color: #8d6663; font-size: 10px; }

.import-panel { max-width: 860px; padding: 34px; display: grid; grid-template-columns: 120px 1fr; gap: 32px; }
.upload-illustration { width: 120px; height: 140px; display: grid; place-items: center; border-radius: 13px 13px 13px 3px; color: var(--mint-dark); background: var(--mint-soft); font-size: 24px; font-weight: 900; }
.import-panel h2 { margin-bottom: 7px; font-size: 19px; }
.import-panel p { color: var(--muted); font-size: 11px; line-height: 1.6; }
.upload-form { margin-top: 20px; display: flex; align-items: flex-end; gap: 12px; }
.file-drop { min-height: 88px; padding: 16px; flex: 1; align-items: center; justify-content: center; border: 1px dashed #a8c4bd; border-radius: 11px; color: var(--mint-dark); background: #fbfefd; text-align: center; cursor: pointer; }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-drop span { font-size: 11px; }
.file-drop small { margin-top: 4px; }
.help-panel { max-width: 860px; margin-top: 18px; padding: 22px 25px; }
.help-panel .section-heading { margin: 0; }
.reconcile-layout { margin-bottom: 18px; display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; }
.reconcile-layout > .panel { padding: 24px; }
.compact-upload { margin-top: 0; }
.compact-upload .file-drop { min-height: 70px; }
.reconcile-stats { display: grid; grid-template-columns: 1fr; }
.reconcile-stats > div { padding: 10px 0; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); }
.reconcile-stats span { color: var(--muted); font-size: 10px; }
.reconcile-stats strong { font-size: 16px; }
.channel-cards { margin-bottom: 18px; display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.channel-cards article { padding: 17px 20px; display: flex; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.channel-cards article > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--mint-dark); background: var(--mint-soft); font-weight: 900; }
.channel-cards article > div { display: flex; flex-direction: column; }
.channel-cards strong { font-size: 11px; }
.channel-cards small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.rule-help { margin-bottom: 18px; padding: 14px 16px; border-radius: 10px; color: var(--teal); background: var(--mint-soft); }
.rule-help strong { font-size: 11px; }
.rule-help p { margin: 4px 0 0; font-size: 10px; }
.rule-row { padding: 18px 0; display: grid; grid-template-columns: 35px 80px 120px 1fr; gap: 12px; border-top: 1px solid var(--line-soft); }
.rule-number { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: var(--mint-dark); background: var(--mint-soft); font-size: 10px; font-weight: 900; }
.rule-message { grid-column: 2 / -1; }
.mini-progress { width: 110px; height: 6px; margin: 0; }
.insight-list { display: flex; flex-direction: column; }
.insight-list > div { padding: 14px 0; display: flex; gap: 11px; border-bottom: 1px solid var(--line-soft); }
.insight-list > div > span { width: 28px; height: 28px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 8px; color: var(--mint-dark); background: var(--mint-soft); font-size: 10px; font-weight: 900; }
.insight-list p { margin: 0; display: flex; flex-direction: column; }
.insight-list strong { font-size: 11px; }
.insight-list small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.settings-tabs { margin-bottom: 18px; display: flex; gap: 5px; }
.settings-tabs a { padding: 9px 13px; border-radius: 9px; color: var(--muted); font-size: 10px; font-weight: 800; }
.settings-tabs a.active { color: var(--mint-dark); background: var(--mint-soft); }
#team, #integrations { max-width: 980px; margin-top: 18px; }
#integrations { padding: 24px; }
.integration-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.integration-grid article { padding: 15px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line-soft); border-radius: 11px; }
.integration-grid article > span { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 9px; color: var(--teal); background: var(--mint-soft); font-size: 10px; font-weight: 900; }
.integration-grid article > div { display: flex; flex-direction: column; }
.integration-grid strong { font-size: 11px; }
.integration-grid small { margin-top: 3px; color: var(--muted); font-size: 9px; }

.flash { position: relative; z-index: 60; max-width: 760px; margin: 0 0 14px; padding: 12px 42px 12px 13px; display: flex; align-items: center; gap: 10px; border: 1px solid #c5eadb; border-radius: 10px; color: #1f6d56; background: #ecfbf5; box-shadow: var(--shadow); font-size: 11px; }
.flash > span { width: 24px; height: 24px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 7px; color: #fff; background: var(--mint-dark); font-weight: 900; }
.flash p { margin: 0; }
.flash button { position: absolute; right: 7px; border: 0; color: inherit; background: transparent; cursor: pointer; }
.flash-error { color: #8f3834; border-color: #f0cac7; background: var(--danger-soft); }
.flash-error > span { background: var(--danger); }
.flash-info { color: #315d9b; border-color: #cddcf3; background: var(--blue-soft); }
.public-flash { position: fixed; inset: 18px 18px auto auto; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, .85fr) 1.15fr; background: #fff; }
.login-brand-panel { position: relative; padding: 48px; display: flex; flex-direction: column; overflow: hidden; color: #fff; background: var(--navy); }
.login-brand-panel::before { position: absolute; width: 560px; height: 560px; right: -280px; bottom: -280px; border: 1px solid rgba(41,216,155,.16); border-radius: 50%; content: ""; box-shadow: 0 0 0 70px rgba(41,216,155,.025), 0 0 0 140px rgba(41,216,155,.02); }
.brand-light { color: #fff; }
.login-message { position: relative; z-index: 1; max-width: 480px; margin: auto 0; }
.login-message .eyebrow { color: var(--mint); }
.login-message h1 { margin-bottom: 18px; font-size: clamp(40px,5vw,68px); line-height: .98; letter-spacing: -.06em; }
.login-message > p:last-child { max-width: 420px; color: #a7bfbc; font-size: 15px; line-height: 1.7; }
.login-metric { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.login-metric > span { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; color: var(--navy); background: var(--mint); font-weight: 900; }
.login-metric p { margin: 0; display: flex; flex-direction: column; }
.login-metric strong { font-size: 11px; }
.login-metric small { margin-top: 4px; color: #789896; font-size: 9px; }
.login-form-panel { padding: 50px; display: grid; place-items: center; }
.login-card { width: min(100%,390px); }
.login-card h2 { margin-bottom: 8px; font-size: 29px; letter-spacing: -.04em; }
.login-card > .muted { margin-bottom: 30px; font-size: 11px; }
.login-help { margin-top: 22px; color: var(--muted); font-size: 10px; text-align: center; }
.login-help a { color: var(--mint-dark); font-weight: 800; }

.portal-page { min-height: 100vh; background: var(--canvas); }
.portal-topbar { height: 82px; padding: 0 max(24px,calc((100vw - 1180px)/2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: #fff; }
.portal-topbar .brand small { color: var(--muted); }
.secure-label { color: var(--mint-dark); font-size: 10px; font-weight: 800; }
.portal-hero { padding: 48px max(24px,calc((100vw - 1180px)/2)); display: flex; align-items: center; justify-content: space-between; gap: 30px; color: #fff; background: var(--teal); }
.portal-hero .eyebrow { color: var(--mint); }
.portal-hero h1 { margin-bottom: 8px; font-size: 36px; letter-spacing: -.045em; }
.portal-hero > div:first-child > p:last-child { margin: 0; color: #a9c2bf; font-size: 12px; }
.portal-balance { display: flex; flex-direction: column; align-items: flex-end; }
.portal-balance span, .portal-balance small { color: #a9c2bf; font-size: 10px; }
.portal-balance strong { margin: 7px 0; font-size: 31px; letter-spacing: -.04em; }
.portal-content { max-width: 1180px; margin: 0 auto; padding: 28px 24px; display: grid; grid-template-columns: minmax(0,1fr) 290px; gap: 20px; }
.portal-sidebar { display: flex; flex-direction: column; gap: 16px; }
.portal-sidebar .panel { padding: 21px; }
.payment-instructions h2 { font-size: 17px; }
.payment-instructions label { margin-top: 18px; color: var(--muted); }
.copy-field { height: 40px; margin: 6px 0 17px; padding-left: 10px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; }
.copy-field code { flex: 1; font-size: 11px; }
.copy-field button { height: 100%; border: 0; border-left: 1px solid var(--line); color: var(--mint-dark); background: transparent; font-size: 9px; font-weight: 800; cursor: pointer; }
.payment-instructions > p:last-child, .contact-card p:last-child { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.contact-card h3 { font-size: 14px; }
.portal-footer { padding: 20px 24px 35px; color: var(--muted); font-size: 9px; text-align: center; }

.installer-page { min-height: 100vh; padding: 40px 20px; background: var(--navy); }
.installer-shell { width: min(100%,820px); margin: 0 auto; }
.installer-shell > header { margin-bottom: 26px; display: flex; align-items: center; gap: 11px; color: #fff; }
.installer-shell > header > div { display: flex; flex-direction: column; }
.installer-shell > header small { margin-top: 3px; color: #779a97; font-size: 9px; text-transform: uppercase; }
.installer-intro { margin-bottom: 25px; color: #fff; }
.installer-intro .eyebrow { color: var(--mint); }
.installer-intro h1 { max-width: 700px; margin-bottom: 10px; font-size: clamp(30px,5vw,48px); line-height: 1.05; letter-spacing: -.05em; }
.installer-intro > p:last-child { margin: 0; color: #9bb5b2; font-size: 12px; }
.installer-form, .installer-complete { padding: 30px; border-radius: 18px; background: #fff; box-shadow: 0 22px 70px rgba(0,0,0,.2); }
.installer-form fieldset { margin: 0 0 27px; padding: 0 0 27px; border: 0; border-bottom: 1px solid var(--line-soft); }
.installer-form legend { margin-bottom: 20px; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 850; }
.installer-form legend span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--mint-dark); background: var(--mint-soft); font-size: 9px; }
.installer-privacy { margin: 16px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; text-align: center; }
.installer-complete { min-height: 480px; display: flex; align-items: center; flex-direction: column; justify-content: center; text-align: center; }
.installer-complete > span { width: 60px; height: 60px; margin-bottom: 18px; display: grid; place-items: center; border-radius: 18px; color: var(--navy); background: var(--mint); font-size: 25px; font-weight: 900; }
.installer-complete h1 { margin-bottom: 10px; font-size: 30px; letter-spacing: -.04em; }
.installer-complete > p:not(.eyebrow) { max-width: 480px; color: var(--muted); font-size: 11px; }
.security-note { max-width: 520px; margin-top: 25px; padding: 14px; border-radius: 10px; color: var(--teal); background: var(--mint-soft); text-align: left; }
.security-note strong { font-size: 10px; }
.security-note p { margin: 4px 0 0; font-size: 9px; line-height: 1.5; }
.error-page { min-height: 100vh; padding: 35px; display: flex; flex-direction: column; background: #fff; }
.error-page > section { max-width: 580px; margin: auto; text-align: center; }
.error-code { display: block; color: var(--mint); font-size: 90px; font-weight: 900; line-height: 1; letter-spacing: -.08em; }
.error-page h1 { font-size: 30px; letter-spacing: -.04em; }
.error-page section > p:not(.eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.6; }

@media (max-width: 1180px) {
    .metric-grid { grid-template-columns: repeat(2,1fr); }
    .detail-summary { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar.open { transform: translateX(0); box-shadow: 16px 0 45px rgba(0,0,0,.22); }
    .mobile-topbar { position: sticky; top: 0; z-index: 25; height: 62px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
    .mobile-topbar .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 11px; }
    .mobile-topbar .brand { gap: 7px; }
    .main-content { margin-left: 0; padding: 24px 20px; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .dashboard-grid, .detail-grid, .reconcile-layout { grid-template-columns: 1fr; }
    .dashboard-grid .span-2 { grid-column: auto; }
    .form-grid.three { grid-template-columns: repeat(2,1fr); }
    .span-3 { grid-column: span 2; }
    .login-page { grid-template-columns: 1fr; }
    .login-brand-panel { min-height: 370px; padding: 32px; }
    .login-message h1 { font-size: 48px; }
    .login-metric { margin-top: 30px; }
    .login-form-panel { padding: 48px 24px; }
    .portal-content { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .main-content { padding: 20px 14px; }
    .page-header h1 { font-size: 30px; }
    .page-actions { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
    .page-actions .button { flex: 1; }
    .metric-grid, .metric-grid.compact, .channel-cards { grid-template-columns: 1fr; }
    .metric-card { min-height: 116px; }
    .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
    .span-2, .span-3 { grid-column: auto; }
    .form-panel { padding: 20px 16px; }
    .form-actions { width: 100%; }
    .form-actions .button { flex: 1; }
    .search-box { min-width: 100%; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .detail-grid { gap: 14px; }
    .invoice-hero { grid-template-columns: 1fr; gap: 24px; }
    .detail-list { grid-template-columns: 1fr; }
    .import-panel { padding: 24px 18px; grid-template-columns: 1fr; }
    .upload-illustration { width: 74px; height: 84px; }
    .upload-form { align-items: stretch; flex-direction: column; }
    .upload-form .button { width: 100%; }
    .rule-row { grid-template-columns: 30px 1fr; }
    .rule-message { grid-column: 2; }
    .integration-grid { grid-template-columns: 1fr; }
    .portal-topbar { height: 70px; padding: 0 16px; }
    .secure-label { display: none; }
    .portal-hero { padding: 35px 20px; align-items: flex-start; flex-direction: column; }
    .portal-balance { align-items: flex-start; }
    .portal-content { padding: 18px 12px; }
    .login-brand-panel { min-height: 330px; padding: 25px; }
    .login-message h1 { font-size: 40px; }
    .installer-page { padding: 24px 10px; }
    .installer-form, .installer-complete { padding: 24px 16px; }
    .aging-chart { gap: 5px; }
    .aging-track { width: 25px; }
    .aging-column strong { font-size: 9px; }
    .aging-column small { font-size: 8px; }
}

