:root {
    --ink: #17202a;
    --muted: #667085;
    --line: #d9e1e8;
    --bg: #f6f8fb;
    --panel: #ffffff;
    --blue: #2563eb;
    --green: #0f9f6e;
    --red: #d92d20;
    --amber: #b7791f;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
}
a { color: inherit; text-decoration: none; }
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: #111827; color: white; padding: 24px 18px; }
.brand { font-size: 24px; font-weight: 800; letter-spacing: .08em; margin-bottom: 4px; }
.tenant { color: #b8c2d6; font-size: 13px; margin-bottom: 28px; }
.nav a { display: flex; padding: 11px 12px; border-radius: 8px; color: #d7deea; margin-bottom: 6px; }
.nav a:hover, .nav a.active { background: #243044; color: white; }
.main { padding: 28px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
h1 { font-size: 28px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 14px; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel, .card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.metric .label { color: var(--muted); font-size: 13px; }
.metric .value { font-size: 24px; font-weight: 750; margin-top: 6px; }
.metric .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.btn { border: 0; border-radius: 8px; padding: 10px 14px; background: var(--blue); color: white; font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn.secondary { background: #e8eef7; color: #1f2a37; }
.btn.danger { background: var(--red); }
.btn.small { padding: 7px 10px; font-size: 13px; }
.table-wrap { overflow-x: auto; background: white; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: #fbfcfe; }
tr:last-child td { border-bottom: 0; }
.form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label { display: grid; gap: 6px; font-weight: 650; font-size: 13px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; font: inherit; background: white; }
textarea { min-height: 96px; resize: vertical; }
.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: #ecfdf5; border-color: #abefc6; }
.flash.error { background: #fef3f2; border-color: #fecdca; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #f6f8fb 0%, #edf4ff 100%); }
.login-card { width: min(420px, 100%); background: white; border: 1px solid var(--line); border-radius: 8px; padding: 28px; }
.progress { height: 10px; border-radius: 99px; background: #e6ebf2; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--green); }
.status { display: inline-flex; padding: 4px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; background: #eef4ff; color: #1849a9; }
.status.warn { background: #fff7ed; color: #9a3412; }
.status.ok { background: #ecfdf5; color: #067647; }
.status.danger { background: #fef3f2; color: #b42318; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 11px; border-radius: 8px; background: #e8eef7; color: #1f2a37; font-weight: 650; }
.dashboard-band { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 16px; margin-top: 16px; }
.chart-title { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-bottom: 16px; }
.chart-title p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.bar-list { display: grid; gap: 13px; }
.bar-row { display: grid; grid-template-columns: minmax(150px, 220px) 1fr auto; gap: 12px; align-items: center; }
.bar-label strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-label span { color: var(--muted); font-size: 12px; }
.bar-track { position: relative; height: 12px; border-radius: 99px; background: #e8eef7; overflow: hidden; }
.bar-track span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--blue); }
.bar-track .actual { background: var(--green); }
.bar-value { font-weight: 750; font-size: 13px; min-width: 88px; text-align: right; }
.split-bars { display: grid; gap: 7px; }
.donut-wrap { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; }
.donut {
    width: 150px;
    aspect-ratio: 1;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--green) calc(var(--value) * 1%), #e8eef7 0);
}
.donut::after {
    content: attr(data-label);
    width: 102px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: white;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 22px;
}
.legend { display: grid; gap: 10px; }
.legend-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.legend-item span:first-child { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); display: inline-block; }
.swatch.green { background: var(--green); }
.swatch.amber { background: var(--amber); }
.swatch.red { background: var(--red); }
.insight-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.insight { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fbfcfe; }
.insight strong { display: block; font-size: 14px; margin-bottom: 5px; }
.insight span { color: var(--muted); font-size: 13px; }
.workstream { display: grid; gap: 12px; }
.work-item { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.work-icon { width: 42px; height: 42px; border-radius: 8px; display: grid; place-items: center; background: #e8eef7; font-weight: 800; color: #1d4ed8; }
.work-item strong { display: block; font-size: 14px; }
.work-item span { color: var(--muted); font-size: 13px; }
.health-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.health { border-left: 4px solid var(--green); background: white; border-radius: 8px; padding: 12px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.health.warn { border-left-color: var(--amber); }
.health.danger { border-left-color: var(--red); }
.health strong { display: block; font-size: 13px; margin-bottom: 4px; }
.health span { color: var(--muted); font-size: 12px; }
.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.quick-tile { border: 1px solid var(--line); background: white; border-radius: 8px; padding: 14px; cursor: pointer; display: grid; gap: 8px; min-height: 108px; }
.quick-tile:hover, .quick-tile.active { border-color: var(--blue); box-shadow: 0 8px 22px rgba(37, 99, 235, .10); }
.quick-tile .icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: #eef4ff; color: #1849a9; font-weight: 800; }
.quick-tile strong { font-size: 14px; }
.quick-tile span { color: var(--muted); font-size: 12px; }
.category-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.category-picker-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.category-card { border: 1px solid var(--line); border-radius: 8px; background: white; padding: 14px; cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 76px; }
.category-card:hover, .category-card.active { border-color: var(--blue); box-shadow: 0 8px 22px rgba(16, 24, 40, .08); }
.category-card h3 { margin: 0; font-size: 14px; line-height: 1.25; }
.category-card .meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.category-card .money-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.picker-card { border: 1px solid var(--line); background: white; border-radius: 8px; padding: 14px; cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 72px; text-align: left; }
.picker-card:hover, .picker-card.active { border-color: var(--blue); background: #f8fbff; box-shadow: 0 8px 22px rgba(37, 99, 235, .10); }
.picker-icon { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 8px; background: #eef4ff; color: #1849a9; display: grid; place-items: center; font-weight: 800; }
.picker-card strong { font-size: 13px; line-height: 1.25; }
.quick-expense-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(360px, .55fr); gap: 16px; align-items: start; }
.sticky-panel { position: sticky; top: 18px; }
@media (max-width: 960px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .grid-4, .grid-3, .form-grid, .dashboard-band, .insight-grid, .health-strip, .quick-actions, .category-grid, .category-picker-grid, .quick-expense-layout { grid-template-columns: 1fr; }
    .donut-wrap { grid-template-columns: 1fr; }
    .bar-row { grid-template-columns: 1fr; }
    .bar-value { text-align: left; }
    .main { padding: 18px; }
}

/* CONSTROL product layer: clear hierarchy for daily construction work. */
:root {
    --ink: #172b3a;
    --muted: #72808d;
    --line: #dbe4ea;
    --bg: #f3f6f8;
    --panel: #ffffff;
    --blue: #1769aa;
    --blue-dark: #0e3857;
    --green: #16866a;
    --red: #c43f35;
    --amber: #c27a22;
    --shadow: 0 10px 30px rgba(14, 56, 87, .06);
}

html, body { overflow-x: hidden; }
body { background: var(--bg); color: var(--ink); }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
.app { grid-template-columns: 258px minmax(0, 1fr); }
.sidebar { background: var(--blue-dark); padding: 25px 16px 18px; display: flex; flex-direction: column; min-height: 100vh; }
.brand-row { display: flex; gap: 11px; align-items: center; padding: 0 8px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #8ed1b3; color: var(--blue-dark); font-size: 19px; font-weight: 850; }
.brand { font-size: 20px; letter-spacing: .11em; line-height: 1; }
.brand-caption { color: #a5c1d1; font-size: 11px; margin-top: 4px; }
.tenant { display: flex; align-items: center; gap: 8px; margin: 31px 8px 13px; padding: 10px 11px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; color: #c3d4df; font-size: 12px; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #68c79c; box-shadow: 0 0 0 3px rgba(104,199,156,.14); flex: 0 0 auto; }
.nav { display: grid; gap: 4px; }
.nav a { min-height: 45px; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c5d5df; margin: 0; font-size: 13px; font-weight: 650; transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(2px); }
.nav a.active { background: #ffffff; color: var(--blue-dark); box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.nav-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,.10); color: #a9d9c1; font-size: 16px; font-weight: 800; }
.nav a.active .nav-icon { background: #d9f1e4; color: var(--green); }
.nav a em { margin-left: auto; padding: 3px 6px; border-radius: 5px; background: #d9f1e4; color: var(--green); font-size: 10px; font-style: normal; font-weight: 800; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.12); display: flex; gap: 10px; align-items: center; color: #e6eef2; font-size: 12px; }
.sidebar-foot small { display: block; margin-top: 3px; color: #9fb7c5; }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #f0bd6d; color: #57380e; font-size: 11px; font-weight: 850; }
.main { padding: 30px clamp(18px, 4vw, 52px); max-width: 1540px; width: 100%; margin: 0 auto; }
.topbar { min-height: 72px; margin-bottom: 24px; align-items: flex-end; }
.eyebrow, .section-kicker { text-transform: uppercase; letter-spacing: .08em; font-size: 10px; font-weight: 800; color: var(--green); }
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dot-separator { color: #adbac2; padding: 0 2px; }
h1 { font-size: clamp(24px, 3vw, 33px); letter-spacing: -.02em; line-height: 1.1; }
.top-context { font-size: 12px; margin-top: 7px; }
.topbar-actions { display: flex; align-items: flex-end; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.project-switcher, .role-switcher { display: grid; gap: 4px; font-size: 10px; font-weight: 800; color: var(--muted); }
.project-switcher select { min-width: 210px; }
.role-switcher select { min-width: 135px; }
.project-switcher select, .role-switcher select { height: 39px; padding: 8px 30px 8px 11px; border-radius: 9px; background: var(--panel); border-color: var(--line); color: var(--ink); font-size: 12px; font-weight: 700; }
.client-lock { padding: 11px 12px; border: 1px solid #bfe4d1; background: #effaf4; color: #176b50; border-radius: 9px; font-size: 11px; font-weight: 800; }
.card, .panel { border-color: var(--line); box-shadow: var(--shadow); }
.card { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.card:hover { box-shadow: 0 14px 34px rgba(14, 56, 87, .10); }
.metric { position: relative; padding: 17px 18px 16px; min-height: 112px; }
.metric-top { display: block; }
.metric .value { font-size: clamp(17px, 1.9vw, 24px); color: var(--blue-dark); letter-spacing: -.04em; white-space: nowrap; }
.metric-spark { position: absolute; top: 15px; right: 16px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: #e9f5ef; color: var(--green); font-size: 14px; font-weight: 800; }
.metric .hint { line-height: 1.35; }
.btn { min-height: 42px; padding: 10px 15px; border-radius: 9px; background: var(--blue); box-shadow: 0 6px 14px rgba(23, 105, 170, .16); transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 9px 18px rgba(23, 105, 170, .22); background: #125989; }
.btn.secondary { background: #e9f0f4; color: var(--blue-dark); box-shadow: none; }
.btn.secondary:hover { background: #dce8ef; }
.btn-block { width: 100%; justify-content: center; }
.status { border-radius: 6px; padding: 5px 8px; }
.status.ok { background: #e8f7ef; color: #146b4f; }
.status.warn { background: #fff4e3; color: #94540d; }
.welcome-line, .view-intro { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-left: 3px solid var(--green); background: #eaf5f0; border-radius: 9px; margin-bottom: 15px; }
.welcome-line strong, .view-intro strong { display: block; font-size: 14px; }
.welcome-line span:not(.date-chip), .view-intro span:not(.date-chip) { display: block; color: #567265; font-size: 12px; margin-top: 3px; }
.date-chip, .count-pill, .project-code { display: inline-flex; align-items: center; white-space: nowrap; border-radius: 6px; padding: 6px 8px; background: #fff; color: var(--muted); border: 1px solid #d3e2d9; font-size: 10px; font-weight: 800; }
.quick-actions { gap: 11px; margin: 0 0 18px; }
.quick-tile { position: relative; display: flex; align-items: center; gap: 11px; min-height: 68px; padding: 11px 13px; border-radius: 10px; text-align: left; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.quick-tile:hover { transform: translateY(-2px); }
.quick-tile.primary { border-color: #a9d9c1; background: #f0fbf5; }
.quick-tile .icon { width: 35px; height: 35px; flex: 0 0 35px; border-radius: 9px; background: #e4f3eb; color: var(--green); font-size: 22px; line-height: 1; }
.quick-tile:not(.primary) .icon { background: #eaf2f7; color: var(--blue); }
.quick-copy { min-width: 0; display: grid; gap: 3px; }
.quick-tile strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.quick-copy small { display: block; color: var(--muted); font-size: 10px; line-height: 1.2; }
.tile-arrow { margin-left: auto; color: #93a5b0; font-size: 17px; }
.health-strip { gap: 11px; }
.health { padding: 13px 14px; border-radius: 9px; box-shadow: 0 5px 18px rgba(14, 56, 87, .04); }
.health span { line-height: 1.35; }
.dashboard-band { gap: 18px; }
.panel { padding: 20px; }
.chart-title { margin-bottom: 19px; }
.chart-title h2 { margin-top: 4px; margin-bottom: 0; }
.bar-list { gap: 15px; }
.bar-row { grid-template-columns: minmax(145px, 205px) 1fr auto; gap: 13px; }
.bar-track { height: 10px; background: #e7eef1; }
.bar-track .actual { background: var(--green); }
.donut { background: conic-gradient(var(--green) calc(var(--value) * 1%), #e5edf0 0); }
.donut::after { background: var(--panel); }
.chart-legend { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.budget-panel { margin-top: 17px; }
.budget-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.budget-header h2 { margin: 4px 0 0; }
.budget-header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.budget-controls { display: flex; align-items: center; gap: 8px; padding: 10px; margin-bottom: 3px; border: 1px solid #edf1f3; border-radius: 8px; background: #f8fafb; }
.budget-controls .search-field { flex: 1; min-width: 190px; }
.budget-controls select { min-width: 170px; height: 39px; }
.result-count { color: var(--muted); font-size: 10px; font-weight: 750; white-space: nowrap; }
.text-button { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; margin-top: 11px; padding: 11px; border: 0; border-top: 1px solid #edf1f3; background: transparent; color: var(--blue); cursor: pointer; font: inherit; font-size: 12px; font-weight: 800; }
.text-button:hover { color: var(--blue-dark); background: #f7fafb; }
.budget-empty { min-height: 120px; }
.budget-list { display: grid; gap: 0; }
.budget-row { display: grid; grid-template-columns: minmax(175px, 1.25fr) minmax(140px, 2fr) minmax(112px, auto) 66px minmax(125px, auto); align-items: center; gap: 13px; padding: 11px 0; border-top: 1px solid #edf1f3; }
.budget-row:first-child { border-top: 0; }
.budget-row-name { min-width: 0; display: flex; align-items: center; gap: 8px; }
.budget-row-name > span:last-child { min-width: 0; }
.budget-row-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.budget-row-name small, .budget-row-amount small { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; white-space: nowrap; }
.budget-track { height: 9px; border-radius: 99px; overflow: hidden; background: #e7eef2; }
.budget-fill { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: var(--blue); transition: width .4s ease; }
.budget-fill.over { background: var(--red); }
.budget-row-amount { text-align: right; }
.budget-row-amount strong { display: block; font-size: 12px; white-space: nowrap; }
.budget-status { justify-self: start; padding: 4px 7px; border-radius: 5px; font-size: 10px; font-weight: 850; }
.budget-status.ok { background: #e8f7ef; color: #146b4f; }
.budget-status.warn { background: #fff4e3; color: #94540d; }
.budget-status.danger { background: #fce9e7; color: #a8342c; }
.budget-balance { color: var(--muted); font-size: 11px; text-align: right; white-space: nowrap; }
.over-budget .budget-balance { color: var(--red); font-weight: 750; }
.alert-line { display: flex; align-items: center; gap: 8px; padding: 9px 11px; margin: -3px 0 8px; border-radius: 7px; background: #fff4e3; color: #94540d; font-size: 11px; }
.alert-line > span:first-child { width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%; background: #f6c979; color: #744208; font-weight: 900; }
.alert-line > span:last-child { margin-left: auto; opacity: .75; }
.alert-line.ok-line { background: #eaf6ef; color: #176b50; }
.alert-line.ok-line > span:first-child { background: #bce5ce; color: #176b50; }
.category-grid { gap: 10px; }
.category-card { min-height: 74px; padding: 12px; border-radius: 10px; box-shadow: none; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.category-card:hover { transform: translateY(-2px); }
.category-card h3 { font-size: 13px; }
.picker-icon { border-radius: 9px; background: #eaf2f7; color: var(--blue); }
.category-card:nth-child(3n) .picker-icon { background: #fff2dc; color: #a76212; }
.category-card:nth-child(4n) .picker-icon { background: #e7f6ed; color: var(--green); }
.category-picker-grid { gap: 9px; }
.picker-card { position: relative; min-height: 67px; padding: 11px; border-radius: 10px; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.picker-card:hover { transform: translateY(-2px); }
.picker-card.active { border-color: #56b58c; background: #effaf4; box-shadow: 0 7px 16px rgba(22, 134, 106, .10); }
.picker-card.active .picker-icon { background: #d6f0e2; color: var(--green); }
.picker-check { margin-left: auto; color: var(--green); font-weight: 900; }
.picker-icon.mini { width: 28px; height: 28px; flex-basis: 28px; border-radius: 7px; font-size: 10px; }
.selected-category { display: flex; align-items: center; gap: 8px; color: var(--blue-dark); font-size: 13px; font-weight: 750; }
.sticky-panel { top: 22px; }
.form { gap: 15px; }
label { color: var(--blue-dark); }
input, select, textarea { min-height: 42px; border-color: #d4e0e6; border-radius: 9px; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(23, 105, 170, .12); border-color: var(--blue); }
.table-panel { padding-bottom: 12px; }
.table-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.table-toolbar h2 { margin: 4px 0 0; }
.filter-row { display: flex; align-items: center; gap: 8px; }
.filter-row select { min-width: 150px; }
.search-field { position: relative; display: block; min-width: 250px; }
.search-field span { position: absolute; left: 11px; top: 10px; z-index: 1; color: var(--muted); font-size: 17px; }
.search-field input { padding-left: 32px; }
.table-wrap { border: 0; border-radius: 9px; }
th { background: #f6f9fa; color: #7b8a94; }
th, td { padding: 13px 14px; }
td small { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; margin-top: 4px; }
.table-category { display: inline-flex; align-items: center; gap: 9px; }
.empty-state { height: 150px; text-align: center; vertical-align: middle; color: var(--muted); }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { color: var(--blue-dark); margin-bottom: 5px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; transform: translateY(20px); opacity: 0; pointer-events: none; padding: 13px 16px; border-radius: 9px; background: var(--blue-dark); color: #fff; font-size: 13px; font-weight: 700; box-shadow: 0 14px 30px rgba(14, 56, 87, .24); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-left: 4px solid #75d2a8; }
.project-card { cursor: pointer; padding: 19px; }
.project-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.project-card-title { display: flex; align-items: flex-start; gap: 11px; margin: 19px 0 14px; }
.project-card-title h2 { margin: 0 0 5px; font-size: 17px; line-height: 1.2; }
.project-card-title p { margin: 0; font-size: 12px; }
.project-symbol { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 36px; border-radius: 10px; background: #eaf2f7; color: var(--blue); font-size: 19px; }
.project-location { margin-bottom: 16px; color: var(--muted); font-size: 12px; }
.project-card .legend { margin-top: 14px !important; }

@media (max-width: 960px) {
    .app { display: block; }
    .sidebar { min-height: auto; position: sticky; top: 0; z-index: 20; padding: 14px 16px 10px; flex-direction: row; align-items: center; gap: 18px; }
    .brand-row { padding: 0; flex: 0 0 auto; }
    .tenant { margin: 0; padding: 8px 9px; white-space: nowrap; }
    .nav { display: flex; gap: 5px; overflow-x: auto; flex: 1; padding-bottom: 2px; }
    .nav a { flex: 0 0 auto; min-height: 40px; padding: 8px 10px; }
    .sidebar-foot { display: none; }
    .main { max-width: none; }
    .topbar { align-items: flex-start; }
    .topbar-actions { align-items: stretch; }
    .dashboard-band, .quick-expense-layout { grid-template-columns: 1fr; }
    .sticky-panel { position: static; }
}
@media (max-width: 680px) {
    .app { padding-bottom: 70px; }
    .sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; min-height: 64px; padding: 7px 9px; display: block; border-top: 1px solid rgba(255,255,255,.12); box-shadow: 0 -8px 25px rgba(14, 56, 87, .15); }
    .brand-row, .tenant { display: none; }
    .nav { width: 100%; gap: 2px; overflow-x: auto; padding: 0; }
    .nav a { min-width: 72px; flex: 1 0 72px; min-height: 56px; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 5px 4px; border-radius: 8px; font-size: 10px; text-align: center; }
    .nav-icon { width: 24px; height: 22px; background: transparent; }
    .nav a.active { box-shadow: none; background: #e6f5ed; }
    .nav a em { display: none; }
    .main { padding: 19px 14px 12px; }
    .topbar { display: block; margin-bottom: 18px; }
    .topbar-actions { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; }
    .topbar-actions > .btn, .topbar-actions > .client-lock { grid-column: 1 / -1; justify-content: center; }
    .project-switcher, .role-switcher { min-width: 0; }
    .project-switcher select, .role-switcher select { min-width: 0; width: 100%; }
    .welcome-line, .view-intro, .table-toolbar { align-items: flex-start; flex-direction: column; }
    .date-chip { align-self: flex-start; }
    .grid-4, .grid-3, .health-strip, .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .metric { padding: 13px; min-height: 105px; }
    .metric .value { font-size: 16px; letter-spacing: -.03em; }
    .metric .hint { font-size: 10px; }
    .quick-tile { min-height: 91px; padding: 11px; align-items: flex-start; }
    .quick-copy span { line-height: 1.3; }
    .tile-arrow { display: none; }
    .panel { padding: 15px; }
    .budget-header { display: block; }
    .budget-header .chart-legend { margin-top: 10px; }
    .budget-controls { display: grid; grid-template-columns: 1fr; padding: 8px; }
    .budget-controls .search-field { min-width: 0; }
    .budget-controls select { width: 100%; }
    .result-count { padding: 2px 3px; }
    .category-grid, .category-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .category-card { min-height: 68px; padding: 9px; }
    .category-card .meta { display: none; }
    .picker-card { min-height: 64px; padding: 9px; gap: 7px; }
    .picker-card strong { font-size: 11px; }
    .picker-check { font-size: 12px; }
    .form-grid { grid-template-columns: 1fr; }
    .filter-row { width: 100%; display: grid; grid-template-columns: 1fr; }
    .search-field, .filter-row select { min-width: 0; width: 100%; }
    .chart-legend { font-size: 10px; gap: 7px; }
    .budget-row { grid-template-columns: 1fr auto; gap: 8px; padding: 11px 0; }
    .budget-row-name { grid-column: 1; }
    .budget-row-amount { grid-column: 2; grid-row: 1; }
    .budget-track { grid-column: 1 / -1; }
    .budget-status { grid-column: 1; }
    .budget-balance { grid-column: 2; grid-row: 3; }
    .table-wrap { margin: 0 -2px; }
    th, td { padding: 11px 10px; }
    .toast { left: 14px; right: 14px; bottom: 78px; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
