:root {
  --navy: #16364c;
  --ink: #10263a;
  --muted: #5d7185;
  --line: #d7e2ec;
  --paper: #f4f7fa;
  --soft: #eaf1f8;
  --gold: #9b6f16;
  --green: #177157;
  --red: #a33636;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, .button { min-height: 40px; padding: 9px 13px; border: 1px solid #b8cad8; border-radius: 7px; background: #fff; color: var(--navy); font-weight: 650; cursor: pointer; }
button:hover, .button:hover { background: #edf4fa; }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #c8952f; outline-offset: 2px; }
button.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
button.ghost { background: transparent; }
input, select, textarea { width: 100%; min-height: 40px; border: 1px solid #c9d8e4; border-radius: 7px; padding: 9px 10px; background: #fff; color: var(--ink); }
textarea { min-height: 82px; resize: vertical; }
h2, h3 { margin: 0; line-height: 1.2; letter-spacing: 0; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
p { margin: 0; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 12px; }
.eyebrow { margin: 0 0 5px; font-size: 10px; letter-spacing: .11em; text-transform: uppercase; font-weight: 750; color: #6a654f; }
.allpro-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 24px; align-items: center; padding: 14px max(18px, calc((100vw - 1180px) / 2)); background: #fff; border-bottom: 1px solid var(--line); }
.brand-lockup { display: flex; gap: 18px; align-items: center; min-width: 0; }
.brand-logo { padding-right: 18px; border-right: 1px solid var(--line); }
.brand-logo img { display: block; width: 142px; max-height: 62px; object-fit: contain; }
.allpro-header h1 { margin: 0; font-size: 22px; color: var(--navy); }
.header-account { display: contents; }
.account-summary { grid-column: 2; grid-row: 1; display: flex; align-items: center; justify-content: flex-end; gap: 10px; color: var(--muted); text-align: right; }
.app-menu { grid-column: 1 / -1; grid-row: 2; padding-top: 8px; border-top: 1px solid #e2eaf1; }
.app-menu-items { display: flex; flex-wrap: wrap; gap: 6px; }
.app-menu-item { min-height: 40px; display: flex; align-items: center; gap: 7px; padding: 8px 10px; color: var(--navy); text-decoration: none; border: 1px solid transparent; border-radius: 7px; }
.app-menu-item:hover, .app-menu-item[aria-current="page"] { background: var(--soft); border-color: #bfd0df; }
.menu-icon { width: 23px; height: 23px; display: grid; place-items: center; }
#feedback { max-width: 1180px; margin: 14px auto 0; padding: 11px 14px; border: 1px solid #bcd4c8; background: #eef8f2; border-radius: 8px; color: #174b39; }
#feedback.error { border-color: #e4b9b9; background: #fff2f2; color: var(--red); }
.login-panel { max-width: 560px; margin: 80px auto; padding: 0 18px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 28px; box-shadow: 0 14px 36px #10263a10; }
.login-card h2 { margin-bottom: 8px; }
.field { display: grid; gap: 6px; margin-top: 14px; font-weight: 650; }
.field span { font-weight: 650; }
.field em { color: var(--red); font-size: 12px; font-style: normal; font-weight: 700; }
.field .hint { font-weight: 400; }
.finance-shell { max-width: 1180px; margin: 0 auto; padding: 22px 18px 56px; display: grid; gap: 18px; }
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: end; }
.mode-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.mode-box label { min-width: 160px; font-weight: 650; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.tabs button { min-height: 38px; background: transparent; border-color: transparent; }
.tabs button.active { background: #fff; border-color: #b8cad8; box-shadow: inset 0 -3px var(--gold); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; box-shadow: 0 5px 18px #10263a0a; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fbfdff; min-height: 96px; }
.stat span { display: block; color: var(--muted); font-size: 12px; }
.stat strong { display: block; margin-top: 8px; font-size: 22px; line-height: 1.1; }
.stat.warning { border-color: #e4c383; background: #fff9eb; }
.stat.good { border-color: #add2c1; background: #f0faf5; }
.grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 14px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 10px 11px; border-bottom: 1px solid #e6edf3; text-align: left; vertical-align: top; }
th { font-size: 12px; color: #51687b; background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 8px; border-radius: 999px; background: #edf3f8; color: var(--navy); font-size: 12px; font-weight: 700; }
.badge.good { background: #e4f5ec; color: var(--green); }
.badge.warn { background: #fff1d7; color: #805a00; }
.badge.bad { background: #fdecec; color: var(--red); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wide { grid-column: 1 / -1; }
.project-select { max-width: 460px; }
.notice { border-left: 4px solid var(--gold); background: #fff9eb; padding: 12px 14px; border-radius: 8px; }
.empty { color: var(--muted); padding: 20px; border: 1px dashed #bccbd8; border-radius: 8px; background: #fbfdff; }
.money-positive { color: var(--green); }
.money-negative { color: var(--red); }
.finance-workspace { display: grid; gap: 16px; }
.finance-head, .finance-panel-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.finance-tabs { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.finance-tabs a { min-height: 38px; display: inline-flex; align-items: center; padding: 8px 12px; border: 1px solid transparent; border-radius: 8px; color: var(--navy); font-weight: 700; text-decoration: none; }
.finance-tabs a:hover, .finance-tabs a[aria-current="page"] { background: #fff; border-color: #b8cad8; box-shadow: inset 0 -3px var(--gold); }
.finance-tab-panel { scroll-margin-top: 14px; display: none; gap: 16px; }
#finance-overview, .finance-tab-panel:target { display: grid; }
.finance-workspace:has(.finance-tab-panel:target) #finance-overview:not(:target) { display: none; }
.finance-workspace:has(#finance-overview:target) #finance-overview { display: grid; }
.finance-guide { background: #fbfdff; }
.finance-steps { display: grid; gap: 8px; margin: 0; padding-left: 18px; }
.finance-steps li span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.metric { border: 1px solid var(--line); border-radius: 8px; padding: 13px; background: #fbfdff; }
.metric span, .metric small { display: block; color: var(--muted); }
.metric strong { display: block; margin: 7px 0 5px; font-size: 20px; line-height: 1.15; }
.finance-form { margin-top: 14px; }
.finance-form.compact { padding-top: 8px; border-top: 1px solid #edf2f6; }
.finance-form.compact h4 { margin: 0 0 4px; font-size: 14px; }
.finance-form.compact + .finance-form.compact { margin-top: 18px; }
.field-help { font-size: 12px; color: var(--muted); font-weight: 400; }
.two-col { grid-template-columns: 1fr 1fr; }
.finance-table { min-width: 760px; }
@media (max-width: 840px) {
  .allpro-header { grid-template-columns: 1fr; padding: 13px 14px; }
  .account-summary { grid-column: 1; grid-row: 2; justify-content: space-between; text-align: left; }
  .app-menu { grid-row: 3; }
  .brand-logo img { width: 118px; }
  .toolbar, .grid, .stats, .form-grid, .metrics, .two-col { grid-template-columns: 1fr; }
  .mode-box { justify-content: stretch; }
  .mode-box label { min-width: 0; flex: 1; }
}
