:root {
    --ink: #17363a;
    --ink-2: #29484c;
    --muted: #6d7d80;
    --paper: #fff;
    --canvas: #f2f5f3;
    --line: #dce5e2;
    --teal: #137a70;
    --teal-dark: #0d5e58;
    --mint: #dff2ed;
    --coral: #df735f;
    --amber: #c98a27;
    --danger: #b94543;
    --shadow: 0 12px 34px rgba(22, 58, 61, .075);
    --radius: 15px;
    font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 15px; line-height: 1.55; }
a { color: var(--teal-dark); text-decoration: none; }
a:hover { color: var(--teal); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.4rem, 2.5vw, 1.85rem); letter-spacing: -.03em; margin-bottom: 0; }
h2 { font-size: clamp(1.65rem, 3vw, 2.4rem); line-height: 1.15; letter-spacing: -.04em; }
h3 { font-size: 1.08rem; margin-bottom: 0; }
.muted, .page-intro { color: var(--muted); }
.mono { font-family: Consolas, "SFMono-Regular", monospace; }
.number { text-align: right; white-space: nowrap; }
.eyebrow { margin: 0 0 .25rem; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; color: var(--teal); }
.wide { width: 100%; justify-content: center; }
.stack { display: grid; gap: 1rem; }
.grid { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.grid.two { grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.sidebar {
    position: fixed; z-index: 20; inset: 0 auto 0 0; width: 250px;
    display: flex; flex-direction: column; padding: 24px 17px 18px;
    overflow: hidden; color: #dbece8; background: #123c40;
}
.brand { display: flex; flex: 0 0 auto; align-items: center; gap: 12px; padding: 0 8px 26px; color: #fff; }
.brand:hover { color: #fff; }
.brand > span:last-child { display: grid; }
.brand strong { font-size: 1rem; letter-spacing: .01em; }
.brand small { color: #9eb8b5; font-size: .7rem; }
.brand-mark {
    width: 43px; height: 43px; flex: 0 0 43px; display: grid; place-items: center;
    color: white; background: var(--teal); border-radius: 12px; font-weight: 900; letter-spacing: -.09em;
}
.brand-mark span { color: #a9ded4; }
.brand-mark.large { width: 62px; height: 62px; font-size: 1.35rem; border-radius: 17px; }
.sidebar nav { display: grid; flex: 1 1 auto; min-height: 0; gap: 4px; overflow-y: auto; overscroll-behavior: contain; padding-right: 5px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.28) transparent; }
.sidebar nav::-webkit-scrollbar { width: 6px; }
.sidebar nav::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(255,255,255,.24); }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; color: #bcd0cd; border-radius: 9px; font-size: .92rem; }
.sidebar nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar nav a.active { color: #fff; background: var(--teal); box-shadow: inset 3px 0 rgba(255,255,255,.5); }
.nav-icon { width: 20px; text-align: center; font-size: 1.05rem; }
.sidebar-footer { flex: 0 0 auto; margin-top: 10px; display: grid; gap: 10px; padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,.1); color: #9eb8b5; font-size: .72rem; }
.sidebar-footer a { color: #fff; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 4px; background: #69d1ac; border-radius: 50%; }

.app-shell { min-height: 100vh; margin-left: 250px; display: flex; flex-direction: column; }
.topbar { min-height: 91px; padding: 18px clamp(20px, 4vw, 52px); display: flex; align-items: center; gap: 18px; background: rgba(255,255,255,.93); border-bottom: 1px solid var(--line); }
.topbar-user { display: flex; align-items: center; gap: 10px; margin-left: auto; color: var(--muted); font-size: .8rem; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; background: var(--ink); font-weight: 800; font-size: .72rem; }
.menu-toggle { display: none; border: 0; background: none; font-size: 1.4rem; color: var(--ink); }
.content { flex: 1; width: 100%; max-width: 1540px; margin: 0 auto; padding: clamp(22px, 4vw, 46px) clamp(18px, 4vw, 52px); }
.app-footer { padding: 18px 52px 30px; color: var(--muted); font-size: .72rem; text-align: center; }

.hero { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 30px; padding: 28px 31px; color: #fff; background: linear-gradient(120deg,#123f43,#176b65); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; position: relative; }
.hero::after { content:""; position:absolute; width:280px; height:280px; right:-90px; top:-145px; border:1px solid rgba(255,255,255,.18); border-radius:50%; box-shadow:0 0 0 42px rgba(255,255,255,.035),0 0 0 84px rgba(255,255,255,.025); }
.hero > * { position: relative; z-index: 1; }
.hero h2 { margin-bottom: .45rem; }
.hero p:last-child { margin-bottom: 0; color: #c9dcda; }
.hero .eyebrow { color: #8fd4c7; }

.actions, .page-actions, .form-actions { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.page-actions { justify-content: space-between; margin-bottom: 1.25rem; }
.form-actions { justify-content: flex-end; margin-top: 1.25rem; }
.form-actions .muted { margin-right: auto; }
.button {
    min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .65rem 1rem; border: 1px solid transparent; border-radius: 9px; font-weight: 750; font-size: .84rem;
    transition: transform .15s, box-shadow .15s, background .15s;
}
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--teal); box-shadow: 0 7px 17px rgba(19,122,112,.18); }
.button.primary:hover { color: #fff; background: var(--teal-dark); }
.button.secondary { color: var(--ink); background: #fff; border-color: var(--line); }
.button.ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.button.danger { color: #fff; background: var(--danger); }
.button.small { min-height: 33px; padding: .45rem .75rem; }
.icon-button { width: 32px; height: 32px; border: 0; border-radius: 8px; background: #edf2f0; color: var(--muted); font-size: 1.15rem; }
.icon-button.danger:hover { color: var(--danger); background: #fff0ef; }

.panel { padding: clamp(18px, 2.5vw, 27px); background: var(--paper); border: 1px solid rgba(217,228,224,.9); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel.compact { padding: 20px; }
.panel-head { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel .panel-head { padding: 21px 24px 0; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 1.25rem; }
.metric { min-height: 135px; padding: 21px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.metric::before { content:""; position:absolute; inset:0 auto 0 0; width:4px; background:var(--teal); }
.metric.expense::before { background: var(--coral); }
.metric.warning::before { background: var(--amber); }
.metric.neutral::before { background: #819395; }
.metric span, .metric small { display: block; color: var(--muted); font-size: .72rem; }
.metric strong { display: block; margin: 12px 0 7px; font-size: clamp(1.25rem, 2.2vw, 1.75rem); line-height: 1; letter-spacing: -.04em; }

.notice { padding: 13px 16px; margin-bottom: 18px; border-radius: 10px; border: 1px solid; }
.notice.success { color: #135f4e; background: #e5f5ef; border-color: #b9e1d4; }
.notice.error { color: #8f3030; background: #fff0ef; border-color: #efc4c0; }
.notice.info { color: #285b61; background: #edf7f6; border-color: #c7e4df; }
.notice.warning { color: #795116; background: #fff7e6; border-color: #ecd7a9; }
.badge { display: inline-flex; padding: .27rem .55rem; border-radius: 999px; font-size: .68rem; line-height: 1; font-weight: 800; }
.badge.success { color: #17634f; background: #dff3eb; }
.badge.info { color: #245f68; background: #e2f2f3; }
.badge.warning { color: #7a551d; background: #fff1d6; }
.badge.danger { color: #933c39; background: #ffe5e3; }
.badge.neutral { color: #53696c; background: #eaf0ef; }

.responsive-table { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; color: var(--muted); background: #f7f9f8; border-bottom: 1px solid var(--line); text-align: left; font-size: .67rem; text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid #e9efed; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfcfc; }
.table-sub { display: block; margin-top: 3px; color: var(--muted); font-weight: 400; font-size: .73rem; line-height: 1.35; }
.empty { padding: 30px !important; text-align: center; color: var(--muted); }
.document-table tfoot td { padding: 7px 16px; text-align: right; background: #fafcfc; }
.document-table tfoot .grand td { padding-top: 12px; padding-bottom: 12px; color: var(--ink); font-size: 1.08rem; font-weight: 800; border-top: 2px solid var(--ink); }

label { display: grid; gap: 6px; color: var(--ink-2); font-size: .75rem; font-weight: 750; }
label small { color: var(--muted); font-weight: 400; }
input, select, textarea {
    width: 100%; min-height: 42px; padding: .66rem .75rem; color: var(--ink);
    background: #fff; border: 1px solid #cfdad7; border-radius: 8px; outline: none;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(19,122,112,.12); }
input[type=checkbox] { width: 18px; min-height: 18px; }
.form-page { display: grid; gap: 1.2rem; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1/-1; }
.search { display: flex; align-items: stretch; width: min(430px, 100%); }
.search input { border-radius: 8px 0 0 8px; }
.search button { padding: 0 16px; color: #fff; background: var(--ink); border: 0; border-radius: 0 8px 8px 0; }
.filter-bar { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.filter-bar label { min-width: 155px; }
.list-filter-panel { margin-bottom: 1.25rem; padding: 18px 20px; }
.list-filter-bar { width: 100%; }
.list-filter-bar .filter-search { flex: 1 1 280px; }
.list-filter-bar .filter-search input { min-width: 220px; }
.filter-buttons { display: flex; align-items: center; gap: 7px; }

.cms-hero {
    display: flex; align-items: end; justify-content: space-between; gap: 24px;
    margin-bottom: 1.25rem; padding: 26px 29px; color: #fff;
    background: linear-gradient(120deg, #123f43, #176b65); border-radius: 19px; box-shadow: var(--shadow);
}
.cms-hero h2 { margin-bottom: .45rem; font-size: clamp(1.55rem, 3vw, 2.15rem); }
.cms-hero p:last-child { max-width: 720px; margin-bottom: 0; color: #c9dcda; }
.cms-hero .eyebrow { color: #91d6ca; }
.cms-metrics .metric { min-height: 125px; }
.cms-filter-actions { align-items: end; }
.cms-filter-actions .filter-bar { width: 100%; }
.cms-filter-actions .filter-bar label:first-child { flex: 1 1 260px; }
.cms-table td:first-child { min-width: 230px; }
.cms-table td:nth-child(3), .cms-table td:nth-child(4) { min-width: 155px; }
.cms-unmatched { color: var(--amber); font-weight: 700; }
.cms-note { max-width: 250px; }
.checkbox-label { display: flex; align-items: center; align-self: end; min-height: 42px; gap: 9px; padding-bottom: 9px; }
.checkbox-label input { flex: 0 0 auto; }
.cms-dashboard-panel { margin-bottom: 1.25rem; }
.cms-dashboard-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cms-dashboard-summary div { padding: 15px 17px; border: 1px solid var(--line); border-radius: 11px; background: #f8faf9; }
.cms-dashboard-summary strong { display: block; margin-bottom: 3px; font-size: 1.25rem; }
.cms-dashboard-summary span { color: var(--muted); font-size: .72rem; }
.cms-dashboard-summary .is-risk { border-color: #efc4c0; background: #fff0ef; }
.cms-dashboard-summary .is-risk strong { color: var(--danger); }
.cms-dashboard-summary .is-warning { border-color: #ecd7a9; background: #fff7e6; }
.cms-dashboard-summary .is-warning strong { color: #8a5d18; }

.document-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 1.25rem; }
.document-head h2 { margin-bottom: .3rem; }
.document-head p:last-child { color: var(--muted); margin-bottom: 0; }
.positions { overflow: hidden; }
.line-items { display: grid; gap: 12px; }
.line-item { padding: 16px; border: 1px solid var(--line); background: #fafcfc; border-radius: 11px; }
.line-item-top { display: flex; align-items: end; gap: 12px; margin-bottom: 13px; }
.position-number { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 800; font-size: .78rem; }
.product-pick { width: min(440px, 100%); }
.line-item-top .icon-button { margin-left: auto; }
.line-grid { display: grid; grid-template-columns: .7fr 2.2fr .7fr .7fr 1fr .7fr; gap: 11px; align-items: end; }
.title-field { grid-column: span 2; }
.description-field { grid-column: 1 / 6; }
.line-sum { display: grid; align-content: center; min-height: 66px; padding: 10px; text-align: right; border-radius: 8px; background: var(--mint); }
.line-sum span { color: var(--muted); font-size: .66rem; }
.document-totals { display: flex; justify-content: flex-end; gap: 32px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.document-totals span { display: grid; gap: 4px; color: var(--muted); font-size: .72rem; }
.document-totals strong { color: var(--ink); font-size: 1.1rem; }
.document-totals span:last-child strong { color: var(--teal-dark); font-size: 1.35rem; }
.document-detail { grid-template-columns: minmax(0, 1.8fr) minmax(285px, .75fr); align-items: start; }
.detail-address { display: grid; margin-bottom: 30px; }
.detail-address span, .facts small { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.document-copy { margin: 24px 0; white-space: normal; }
.side-actions { display: grid; gap: 15px; }
.side-actions p { margin-bottom: 0; color: var(--muted); }
.danger-zone { border-color: #ecc8c5; }
.facts { display: flex; gap: 15px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.facts span { min-width: 130px; display: grid; }
.details { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0; margin: 0; }
.details div { padding: 13px 0; border-bottom: 1px solid var(--line); }
.details dt { color: var(--muted); font-size: .72rem; }
.details dd { margin: 2px 0 0; font-weight: 700; }
.note { padding: 15px; margin-top: 20px; background: #f5f8f7; border-radius: 9px; }
.note p { margin: 5px 0 0; }

.simple-list { display: grid; }
.simple-list > a, .simple-list > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.simple-list > :last-child { border-bottom: 0; }
.simple-list span { display: grid; }
.simple-list small { color: var(--muted); }
.file-card { display: flex; align-items: center; gap: 11px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); }
.file-card > span:last-child { display: grid; overflow: hidden; }
.file-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card small { color: var(--muted); }
.file-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: var(--teal); font-size: .65rem; font-weight: 900; }

.upload-panel { display: grid; grid-template-columns: minmax(250px,.8fr) minmax(300px,1.2fr); gap: 25px; align-items: center; }
.dropzone { min-height: 140px; display: grid; place-items: center; align-content: center; gap: 3px; border: 2px dashed #a9c7c2; background: #f5faf8; text-align: center; cursor: pointer; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon { font-size: 1.6rem; color: var(--teal); }
.dropzone small { color: var(--muted); }
.ocr-progress { grid-column: 1/-1; }
.ocr-progress span { display: block; width: 100%; height: 6px; background: linear-gradient(90deg,var(--teal) 35%,var(--mint) 35%); border-radius: 999px; animation: scan 1.5s infinite; }
@keyframes scan { 0% { background-position: -300px } 100% { background-position: 500px } }
.ocr-progress p { margin: 6px 0 0; color: var(--muted); }
.ocr-details { margin-top: 20px; }
.ocr-details summary, details summary { cursor: pointer; font-weight: 750; color: var(--teal-dark); }
.ocr-text { max-height: 450px; overflow: auto; padding: 14px; white-space: pre-wrap; background: #f5f8f7; border-radius: 8px; font-size: .76rem; }

.mini-chart { height: 170px; display: flex; align-items: end; gap: 8px; padding-top: 15px; }
.chart-month { height: 100%; flex: 1; min-width: 18px; display: grid; grid-template-rows: 1fr auto; gap: 5px; text-align: center; }
.chart-month .bars { display: flex; align-items: end; justify-content: center; gap: 2px; height: 100%; }
.chart-month i, .chart-month b { width: 7px; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--teal); }
.chart-month b { background: var(--coral); }
.chart-month span { color: var(--muted); font-size: .62rem; }
.legend { display: flex; gap: 16px; margin-top: 12px; color: var(--muted); font-size: .7rem; }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }
.legend .green { background: var(--teal); }.legend .coral { background: var(--coral); }
.ratio { min-height: 190px; display: flex; align-items: center; justify-content: center; gap: 26px; }
.ratio > div:last-child { display: grid; }
.ratio > div:last-child span { color: var(--muted); }
.ratio-ring { --ratio:0; width: 130px; height: 130px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--teal) calc(var(--ratio)*1%), #e5ecea 0); position: relative; }
.ratio-ring::after { content:""; position:absolute; inset:13px; border-radius:50%; background:#fff; }
.ratio-ring strong { z-index:1; font-size:1.5rem; }
.rank-list { display: grid; gap: 8px; }
.rank-list div, .report-summary div { display: flex; justify-content: space-between; gap: 15px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.report-summary { margin: 0; }
.report-summary dt { color: var(--muted); }
.report-summary dd { margin: 0; font-weight: 800; }
.report-summary .total { border-top: 2px solid var(--ink); border-bottom: 0; font-size: 1.05rem; }
.big-number { font-size: 2.4rem; letter-spacing: -.06em; color: var(--teal-dark); }

.year-comparison { margin: 0 0 1.25rem; overflow: hidden; }
.trend-heading { align-items: flex-start; }
.trend-heading h3 { margin-bottom: 5px; }
.trend-legend { display: flex; flex-wrap: wrap; gap: 15px; color: var(--muted); font-size: .72rem; }
.trend-legend span { display: inline-flex; align-items: center; gap: 7px; }
.trend-legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--teal); }
.trend-legend .expense-dot::before { background: var(--coral); }
.trend-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.trend-summary-card { padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(145deg, #fbfdfc, #f2f7f5); }
.trend-summary-card span, .trend-summary-card small { display: block; color: var(--muted); font-size: .7rem; }
.trend-summary-card strong { display: block; margin: 9px 0 6px; color: var(--teal-dark); font-size: clamp(1.15rem, 2vw, 1.55rem); letter-spacing: -.035em; }
.ytd-comparison { margin: 0 -27px 24px; padding: 23px 27px; background: linear-gradient(120deg, #153f45, #1c6868); color: #fff; }
.ytd-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 16px; }
.ytd-heading h4 { color: #fff; font-size: 1.05rem; }
.ytd-heading .eyebrow { color: #9ed1ca; }
.ytd-heading .badge { background: rgba(255,255,255,.12); color: #e7f4f1; }
.ytd-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ytd-grid article { min-width: 0; padding: 15px; border: 1px solid rgba(255,255,255,.16); border-radius: 11px; background: rgba(255,255,255,.08); }
.ytd-grid span, .ytd-grid small { display: block; color: #c8dfdc; font-size: .69rem; }
.ytd-grid strong { display: block; margin: 7px 0; color: #fff; font-size: clamp(1.05rem, 1.8vw, 1.35rem); }
.ytd-grid .trend-positive { color: #9fe5c7; }
.ytd-grid .trend-negative { color: #ffbbb2; }
.year-bars { display: grid; gap: 8px; margin: 0 0 24px; }
.year-bar-row { display: grid; grid-template-columns: 68px minmax(180px, 1fr) 150px; align-items: center; gap: 14px; padding: 8px 10px; border-radius: 9px; }
.year-bar-row.current { background: #f0f7f5; box-shadow: inset 3px 0 0 var(--teal); }
.year-label { display: flex; flex-direction: column; }
.year-label small, .year-values small { color: var(--muted); font-size: .64rem; }
.bar-pair { display: grid; gap: 5px; }
.bar-track { height: 8px; overflow: hidden; border-radius: 999px; background: #edf2f0; }
.bar-track span { display: block; height: 100%; min-width: 0; border-radius: inherit; }
.bar-income { background: linear-gradient(90deg, var(--teal), #55b4a3); }
.bar-expense { background: linear-gradient(90deg, var(--coral), #f0a295); }
.year-values { text-align: right; }
.year-values strong { display: block; }
.year-table { padding-top: 4px; border-top: 1px solid var(--line); }
.year-table small { color: var(--muted); white-space: nowrap; }
.current-year-row td { background: #f3f8f6; }
.trend-positive { color: #16735d; }
.trend-negative { color: #af4942; }

.mapping-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }
.inline-add { display: grid; grid-template-columns: 160px 1fr 200px; gap: 10px; margin-top: 20px; }
.check-list { padding: 0; margin: 20px 0 0; list-style: none; display: grid; gap: 9px; }
.check-list li::before { content:"✓"; margin-right: 8px; color: var(--teal); font-weight: 900; }

.pagination { display: flex; justify-content: center; gap: 4px; list-style: none; padding: 20px 0 0; }
.pagination li a, .pagination li span { display:grid;place-items:center; min-width:35px;height:35px;border:1px solid var(--line);border-radius:7px;background:#fff; }
.pagination .active a { color:#fff;background:var(--teal); }

.login-body { min-height: 100vh; background: #123f43; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; }
.login-intro { display: flex; flex-direction: column; justify-content: center; padding: clamp(35px, 8vw, 120px); color: #fff; background: radial-gradient(circle at 10% 20%,rgba(29,147,133,.32),transparent 36%),#123f43; }
.login-intro .brand-mark { margin-bottom: 45px; }
.login-intro .eyebrow { color: #8bd2c5; }
.login-intro h1 { max-width: 700px; margin-bottom: 25px; font-size: clamp(2.5rem,5vw,5rem); line-height: .98; letter-spacing: -.065em; }
.login-intro > p:last-of-type { max-width: 620px; color: #c3d8d5; font-size: 1.05rem; }
.login-intro ul { margin: 20px 0 0; padding-left: 1.2rem; color: #c3d8d5; }
.login-card { display: flex; flex-direction: column; justify-content: center; gap: 25px; padding: clamp(30px,7vw,95px); background: #f6f8f7; }
.login-card h2 { margin-bottom: 8px; }
.login-note { color: var(--muted); font-size: .72rem; text-align: center; }

.project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 22px; padding: 27px; border-radius: 18px; color: #fff; background: linear-gradient(125deg, #123f43, #1d6968); }
.project-head h2 { margin: 4px 0 9px; color: #fff; }
.project-head p { margin: 0; color: #c8dfdc; }
.project-head .eyebrow { color: #94d5ca; }
.project-head .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.project-head .button.secondary { color: #fff; border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.1); }
.project-summary-grid, .project-dashboard-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 22px; }
.project-summary-grid article, .project-dashboard-metrics div { padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.project-summary-grid span, .project-dashboard-metrics span { display: block; color: var(--muted); font-size: .72rem; }
.project-summary-grid strong, .project-dashboard-metrics strong { display: block; margin-bottom: 5px; color: var(--teal-dark); font-size: 1.45rem; }
.project-dashboard-metrics .is-risk { border-color: #edb7b0; background: #fff5f3; }
.project-dashboard-metrics .is-warning { border-color: #e7cf98; background: #fffaf0; }
.project-complete-hint { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 22px; }
.project-info-grid { align-items: stretch; margin-bottom: 26px; }
.project-info-grid > .panel { margin: 0; }
.project-status-form { display: flex; align-items: end; gap: 9px; margin-top: 20px; }
.project-status-form label { flex: 1; }
.file-list.compact { margin-bottom: 15px; }
.inline-upload { display: flex; align-items: center; gap: 10px; }
.inline-upload input { flex: 1; min-width: 0; }
.project-filters { grid-template-columns: 1.4fr repeat(4,minmax(130px,1fr)) auto auto; align-items: end; }
.progress { width: 130px; height: 7px; overflow: hidden; margin-bottom: 5px; border-radius: 999px; background: #e9efed; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--teal),#55b4a3); }
.text-danger { color: #aa463f !important; }

.kanban-section { margin: 0 -5px; }
.kanban-heading { padding: 0 5px; }
.kanban-board { display: flex; gap: 14px; padding: 5px 5px 19px; overflow-x: auto; scroll-snap-type: x proximity; }
.kanban-column { flex: 0 0 305px; align-self: flex-start; overflow: hidden; border: 1px solid var(--line); border-top: 4px solid #9eb7b3; border-radius: 13px; background: #f3f6f5; scroll-snap-align: start; }
.kanban-column.stage-in_progress { border-top-color: var(--teal); }
.kanban-column.stage-waiting { border-top-color: #dcaa43; }
.kanban-column.stage-done { border-top-color: #3a9a74; }
.kanban-column > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 15px 15px 10px; }
.kanban-column > header h4 { margin: 0 0 3px; }
.kanban-column > header span { color: var(--muted); font-size: .66rem; }
.column-order { display: flex; gap: 3px; }
.column-order form { margin: 0; }
.column-order button { width: 27px; height: 27px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
.column-order button:disabled { opacity: .35; cursor: default; }
.kanban-card-list { min-height: 72px; padding: 5px 10px 10px; border-radius: 8px; transition: background .15s; }
.kanban-card-list.is-drop-target { background: #dfeeea; }
.kanban-card { position: relative; margin-bottom: 9px; padding: 13px; border: 1px solid #dfe6e3; border-left: 4px solid #9eb0ac; border-radius: 10px; box-shadow: 0 2px 8px rgba(24,59,57,.06); background: #fff; cursor: grab; transition: opacity .15s, transform .15s, box-shadow .15s; }
.kanban-card.priority-high { border-left-color: #dd8a48; }
.kanban-card.priority-urgent { border-left-color: #c34f46; }
.kanban-card.is-dragging { opacity: .45; transform: rotate(1deg); }
.kanban-card.is-drop-target { box-shadow: 0 -3px 0 var(--teal), 0 2px 8px rgba(24,59,57,.08); }
.kanban-card-title { display: block; margin: 2px 0 7px; color: var(--ink); font-weight: 800; line-height: 1.3; }
.kanban-card p { margin: 0 0 9px; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.commercial-ref { display: block; padding: 8px; border-radius: 7px; color: #526864; background: #edf4f2; font-size: .64rem; line-height: 1.4; }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.card-labels span { padding: 3px 6px; border-radius: 999px; color: #fff; background: var(--label-color,#668b84); font-size: .58rem; }
.card-meta { display: flex; flex-wrap: wrap; gap: 5px 9px; margin-top: 10px; color: var(--muted); font-size: .62rem; }
.card-meta .overdue { color: #ae443c; font-weight: 800; }
.card-meta .priority { text-transform: uppercase; letter-spacing: .04em; }
.card-move-fallback { display: flex; align-items: end; gap: 4px; margin-top: 11px; }
.card-move-fallback label { flex: 1; color: var(--muted); font-size: .6rem; }
.card-move-fallback select { min-height: 31px; padding: 4px 6px; font-size: .65rem; }
.card-move-fallback button { min-height: 31px; border: 0; border-radius: 6px; color: #fff; background: var(--teal); cursor: pointer; }
.kanban-column > footer { padding: 7px 12px 13px; border-top: 1px solid var(--line); font-size: .7rem; }
.kanban-column > footer > a { display: block; margin-bottom: 9px; }
.kanban-column details { padding-top: 7px; border-top: 1px solid var(--line); }
.kanban-column details summary { cursor: pointer; color: var(--muted); }
.compact-form { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.compact-form input, .compact-form select { min-height: 34px; padding: 6px 8px; }
.add-column { padding: 18px; border-top-color: transparent; background: #fff; }
.project-dashboard-lists { align-items: stretch; }
.project-dashboard-list { height: 100%; padding: 16px; border: 1px solid var(--line); border-radius: 11px; }
.project-dashboard-list h4 { margin-bottom: 10px; }
.project-dashboard-list ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.project-dashboard-list li a { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; padding: 8px; border-radius: 7px; background: #f4f7f6; font-size: .7rem; }
.project-dashboard-list li small { color: var(--muted); }
.project-dashboard-list .empty { padding: 10px 0; color: var(--muted); font-size: .7rem; }

.supplier-hero { background: linear-gradient(125deg,#173f43,#315f62); }
.supplier-hero .button.secondary { color: #fff; border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.1); }
.contract-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.contract-card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #f9fbfa; }
.contract-card-head { display: flex; justify-content: space-between; gap: 18px; }
.contract-card-head h4 { margin: 8px 0 0; }
.contract-amount { display: block; margin: 18px 0 12px; color: var(--teal-dark); font-size: 1.35rem; }
.contract-amount small { color: var(--muted); font-size: .68rem; font-weight: 500; }
.compact-details { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px 15px; margin: 0 0 13px; }
.compact-details div { padding-top: 8px; border-top: 1px solid var(--line); }
.compact-details dt { color: var(--muted); font-size: .62rem; }
.compact-details dd { margin: 3px 0 0; font-size: .74rem; font-weight: 700; }
.file-card.compact { margin-top: 8px; padding: 9px; }
.contract-price-check { display: grid; gap: 3px; margin: 11px 0; padding: 10px; border-radius: 8px; background: #edf4f2; font-size: .68rem; }
.contract-price-check span, .contract-price-check small { color: var(--muted); }
.contract-price-check.is-warning { border: 1px solid #e7cf98; background: #fff8e9; }
.inline-assignment-form { display: flex; align-items: center; gap: 8px; min-width: 430px; }
.inline-assignment-form select { min-width: 260px; }
.contract-dashboard-lists h4 { margin-bottom: 10px; }
.contract-dashboard-lists > section { padding: 16px; border: 1px solid var(--line); border-radius: 11px; }
.forecast-note { margin: 15px 0 0; color: var(--muted); font-size: .68rem; }

.task-hero { background: linear-gradient(125deg,#173f43,#315f62); }
.task-hero .button.secondary { color: #fff; border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.1); }
.task-summary-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 20px; }
.task-summary-grid a { padding: 18px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; }
.task-summary-grid a:hover, .task-summary-grid a.active { border-color: var(--teal); background: #edf6f3; }
.task-summary-grid strong { display: block; color: var(--teal-dark); font-size: 1.55rem; }
.task-summary-grid span { color: var(--muted); font-size: .7rem; }
.task-filter-bar { display: grid; grid-template-columns: 1.6fr repeat(3,minmax(135px,1fr)) auto auto; align-items: end; gap: 12px; }
.task-filter-bar label span, .task-more label span { display: block; margin-bottom: 5px; color: var(--muted); font-size: .65rem; }
.task-list { display: grid; gap: 12px; }
.task-item { display: grid; grid-template-columns: minmax(0,1fr) 220px; gap: 20px; padding: 19px; border: 1px solid var(--line); border-left: 5px solid #a8bab6; border-radius: 12px; background: #fff; }
.task-item.priority-high { border-left-color: #dcaa43; }
.task-item.priority-urgent, .task-item.is-overdue { border-left-color: #c34f46; }
.task-item h3 { margin: 8px 0 5px; font-size: 1rem; }
.task-item p { margin: 0 0 8px; color: var(--muted); font-size: .74rem; }
.task-item-badges, .task-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.task-kind, .task-priority { padding: 4px 8px; border-radius: 999px; font-size: .6rem; font-weight: 800; }
.task-kind { color: var(--teal-dark); background: #e5f0ed; }
.task-priority { color: #526864; background: #edf1f0; }
.task-priority.high { color: #76531c; background: #fff0cc; }
.task-priority.urgent { color: #963d37; background: #fde4e1; }
.task-meta { color: var(--muted); font-size: .65rem; }
.task-meta .overdue { color: #aa463f; font-weight: 800; }
.task-note { display: block; margin-top: 9px; padding: 8px; border-radius: 7px; color: var(--muted); background: #f5f7f6; }
.task-item-actions { display: flex; align-items: stretch; flex-direction: column; gap: 7px; }
.task-item-actions form { margin: 0; }
.task-item-actions .button { width: 100%; text-align: center; }
.success-button { color: #fff; border-color: #3a8e6d; background: #3a8e6d; }
.task-more summary { padding: 7px; color: var(--muted); cursor: pointer; font-size: .68rem; text-align: center; }
.task-more form { display: grid; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.task-more input { min-height: 36px; padding: 7px; }
.dashboard-task-list { display: grid; gap: 7px; }
.dashboard-task-list > a { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 10px; border-radius: 9px; color: var(--ink); background: #f4f7f6; }
.dashboard-task-list small { display: block; margin-top: 3px; color: var(--muted); font-size: .64rem; }
.dashboard-task-list > a > strong { color: var(--teal); font-size: .68rem; }

@media (max-width: 1180px) {
    .metric-grid { grid-template-columns: repeat(3,1fr); }
    .cms-dashboard-summary { grid-template-columns: repeat(2,1fr); }
    .trend-summary-grid, .ytd-grid { grid-template-columns: repeat(2,1fr); }
    .grid.three { grid-template-columns: 1fr; }
    .line-grid { grid-template-columns: repeat(4,1fr); }
    .title-field { grid-column: span 3; }
    .description-field { grid-column: 1/-1; }
    .project-filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .task-filter-bar { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-101%); transition: transform .2s; box-shadow: 15px 0 40px rgba(0,0,0,.2); }
    .sidebar.open { transform: translateX(0); }
    .app-shell { margin-left: 0; }
    .menu-toggle { display: block; }
    .grid.two, .document-detail { grid-template-columns: 1fr; }
    .login-shell { grid-template-columns: 1fr; }
    .login-intro { display: none; }
    .login-card { min-height: 100vh; }
    .project-head { flex-direction: column; }
    .project-head .actions { justify-content: flex-start; }
    .project-summary-grid, .project-dashboard-metrics { grid-template-columns: repeat(2,1fr); }
    .contract-grid { grid-template-columns: 1fr; }
    .task-item { grid-template-columns: 1fr; }
    .task-item-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
    .task-item-actions .task-more { grid-column: 1/-1; }
}
@media (max-width: 680px) {
    .topbar { min-height: 75px; padding: 13px 16px; }
    .topbar-user > span:first-child { display: none; }
    .content { padding: 20px 13px; }
    .metric-grid { grid-template-columns: repeat(2,1fr); }
    .metric { min-height: 110px; padding: 16px; }
    .cms-dashboard-summary { grid-template-columns: 1fr; }
    .metric strong { font-size: 1.2rem; }
    .trend-summary-grid, .ytd-grid { grid-template-columns: 1fr; }
    .trend-heading, .ytd-heading { align-items: flex-start; flex-direction: column; }
    .ytd-comparison { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
    .year-bar-row { grid-template-columns: 52px minmax(120px,1fr); gap: 9px; }
    .year-values { grid-column: 2; display: flex; justify-content: space-between; gap: 8px; }
    .hero { align-items: start; flex-direction: column; padding: 23px; }
    .cms-hero { align-items: start; flex-direction: column; padding: 23px; }
    .cms-hero h2 { font-size: 1.4rem; overflow-wrap: anywhere; }
    .cms-hero .button { width: 100%; }
    .hero .actions { width: 100%; }
    .hero .button { flex: 1; }
    .form-grid, .mapping-grid { grid-template-columns: 1fr; }
    .span-2, .span-3 { grid-column: auto; }
    .line-grid { grid-template-columns: repeat(2,1fr); }
    .line-grid .title-field { grid-column: 1/-1; }
    .description-field { grid-column: 1/-1; }
    .line-sum { grid-column: 1/-1; }
    .document-totals { flex-direction: column; gap: 7px; }
    .document-totals span { display: flex; justify-content: space-between; }
    .document-head { align-items: start; flex-direction: column; }
    .upload-panel { grid-template-columns: 1fr; }
    .inline-add { grid-template-columns: 1fr; }
    .facts { display: grid; grid-template-columns: repeat(2,1fr); }
    .details { grid-template-columns: 1fr; }
    .project-summary-grid, .project-dashboard-metrics, .project-filters { grid-template-columns: 1fr; }
    .project-complete-hint, .project-status-form, .inline-upload { align-items: stretch; flex-direction: column; }
    .kanban-column { flex-basis: min(88vw,305px); }
    .list-filter-bar { align-items: stretch; flex-direction: column; }
    .list-filter-bar label, .list-filter-bar .filter-search { min-width: 0; width: 100%; }
    .list-filter-bar .filter-search input { min-width: 0; }
    .filter-buttons { width: 100%; }
    .filter-buttons .button { flex: 1; }
    .inline-assignment-form { align-items: stretch; flex-direction: column; min-width: 260px; }
    .inline-assignment-form select { min-width: 0; width: 100%; }
    .compact-details { grid-template-columns: 1fr; }
    .task-summary-grid, .task-filter-bar { grid-template-columns: 1fr; }
    .task-item-actions { grid-template-columns: 1fr; }
    .dashboard-task-list > a { grid-template-columns: auto minmax(0,1fr); }
    .dashboard-task-list > a > strong { grid-column: 2; }
}
