:root {
  color-scheme: light;
  font-family: system-ui, 'Segoe UI', sans-serif;
  color: #172740;
  background: #f3f6fa;
  --navy: #10233e;
  --blue: #1752b0;
  --blue-dark: #12428e;
  --blue-soft: #eaf2ff;
  --muted: #53657d;
  --line: #d9e2ee;
  --surface: #fff;
  --red: #962b2e;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .62; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #337ce4;
  outline-offset: 3px;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 3vw, 2.6rem); letter-spacing: -.045em; line-height: 1.12; }
h2 { font-size: 1.17rem; letter-spacing: -.02em; }
h3 { font-size: 1rem; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link { position: absolute; z-index: 5; left: 1rem; top: 1rem; padding: .7rem 1rem; background: white; transform: translateY(-180%); }
.skip-link:focus { transform: none; }
.sidebar { position: sticky; align-self: start; top: 0; min-height: 100vh; display: flex; flex-direction: column; gap: 32px; padding: 26px 16px 18px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 3px; color: inherit; text-decoration: none; }
.brand-mark { flex: 0 0 43px; height: 43px; display: grid; place-items: center; border-radius: 10px; background: #dfeeff; color: #163d72; font-weight: 850; font-size: .82rem; letter-spacing: -.04em; }
.brand strong, .brand div span { display: block; }
.brand strong { font-size: .92rem; white-space: nowrap; }
.brand div span { color: #b9cae2; margin-top: 2px; font-size: .77rem; }
.navigation { display: grid; gap: 4px; }
.navigation button { text-align: left; display: flex; gap: 11px; align-items: center; padding: 11px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #d9e5f7; font-weight: 600; }
.navigation button:hover { background: #1a3557; }
.navigation button[aria-current] { background: #264974; border-color: #3c5f8b; color: #fff; }
.nav-icon { width: 20px; text-align: center; color: #c1d7f7; font-size: 1.13rem; line-height: 1; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #304661; padding: 16px 4px 0; color: #bdcbe0; font-size: .76rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; min-height: 65px; padding: 12px clamp(18px, 4vw, 48px); border-bottom: 1px solid var(--line); background: #fff; font-size: .9rem; font-weight: 650; }
.demo-status { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #d8e7fa; border-radius: 999px; padding: 5px 10px; color: #284d7e; background: #f0f6ff; font-size: .77rem; white-space: nowrap; }
.demo-status span { width: 7px; height: 7px; border-radius: 100%; background: #3979cb; }
main { max-width: 1550px; margin-inline: auto; padding: 32px clamp(18px, 4vw, 48px) 48px; outline: none; }
.page-heading, .section-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; }
.page-heading { margin-bottom: 24px; }
.page-heading p { margin-top: 7px; color: var(--muted); }
.section-heading { padding: 16px 19px; }
.section-heading p { margin-top: 4px; color: var(--muted); font-size: .85rem; }
.panel, .metric, .notice, .board-column { border: 1px solid var(--line); border-radius: var(--radius); }
.panel { background: var(--surface); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 38px; padding: 8px 13px; border: 1px solid #c6d3e4; border-radius: 8px; background: #fff; color: #1a3c67; font-weight: 650; font-size: .88rem; text-align: center; }
.button:not(:disabled):hover { background: #eff5ff; border-color: #9db9dc; }
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.primary:not(:disabled):hover { background: var(--blue-dark); }
.button.danger { color: var(--red); }
.button.danger:not(:disabled):hover { background: #fff0f0; border-color: #ecbfc0; }
.text-button { padding: 0; border: 0; background: transparent; color: #174d9c; font-weight: 700; text-align: left; overflow-wrap: anywhere; }
.text-button:hover { text-decoration: underline; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; color: var(--muted); font-size: .88rem; font-weight: 650; }
.filter select { max-width: 100%; width: auto; min-width: 180px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { text-align: left; display: grid; gap: 6px; padding: 16px 18px; background: #fff; color: #243a56; font-weight: 700; }
.metric strong { display: block; width: fit-content; font-size: 2.15rem; color: #173f78; line-height: 1.05; font-variant-numeric: tabular-nums; }
.metric[data-category="blocked"] strong { color: #99441b; }
.metric[data-category="overdue"] strong { color: var(--red); }
.metric:hover { border-color: #7da8e2; }
.metric[aria-pressed="true"] { border-color: #4580cf; box-shadow: inset 0 0 0 1px #4580cf; background: #f0f6ff; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
th, td { padding: 12px 15px; vertical-align: top; border-top: 1px solid #e5ebf3; }
th:first-child, td:first-child { padding-left: 19px; }
th:last-child, td:last-child { padding-right: 19px; }
th { background: #f6f8fb; color: #4a5d77; font-size: .78rem; font-weight: 750; white-space: nowrap; }
.row-detail { margin-top: 4px; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.money { white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 3px 7px; border-radius: 5px; background: #e9eef6; color: #2e4562; white-space: nowrap; font-size: .76rem; font-weight: 700; }
.badge.in_progress, .badge.draft { background: #e6efff; color: #204e8d; }
.badge.review { background: #efebff; color: #543a8b; }
.badge.done, .badge.approved { background: #e2f4eb; color: #206248; }
.badge.blocked, .badge.pending { background: #fff0df; color: #823e16; }
.badge.overdue, .badge.rejected { background: #ffe9e9; color: #922b31; }
.empty { padding: 18px 19px; color: var(--muted); font-size: .9rem; }
.panel > .empty { border-top: 1px solid #e5ebf3; }
.notice, .feedback { padding: 14px 16px; background: #fff; color: var(--muted); }
.notice .button { margin-top: 10px; }
.feedback { margin-bottom: 18px; border: 1px solid #c9dfd3; border-radius: 8px; color: #245941; background: #f2fbf6; }
.is-error { color: var(--red); }
.feedback.is-error, .notice.is-error { background: #fff3f3; border-color: #eac3c3; }

.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.board-column { min-width: 0; min-height: 230px; padding: 12px; background: #eaf0f7; border-top: 3px solid #8c9cb1; }
.board-column.in_progress { border-top-color: #5388d3; }
.board-column.review { border-top-color: #8669c4; }
.board-column.done { border-top-color: #51947b; }
.column-heading { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin: 1px 1px 11px; }
.column-heading span { border-radius: 999px; padding: 2px 7px; background: #dce6f2; font-size: .75rem; font-weight: 750; }
.board-column .empty { padding: 6px 0; }
.task-card { display: grid; gap: 10px; margin-top: 9px; padding: 11px; border: 1px solid #d3dfed; border-radius: 9px; background: #fff; }
.task-card dl { display: grid; gap: 4px; margin: 0; font-size: .81rem; }
.task-card dl div { display: flex; flex-wrap: wrap; gap: 5px; }
.task-card dt { color: var(--muted); }
.task-card dd { margin: 0; overflow-wrap: anywhere; }
.task-card .button { justify-self: start; min-height: 34px; font-size: .79rem; }
.subnav { display: flex; gap: 6px; margin-bottom: 16px; }
.subnav button[aria-pressed="true"] { background: var(--blue-soft); border-color: #86aad9; color: var(--blue-dark); }

dialog { width: min(570px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0; border: 1px solid var(--line); border-radius: 14px; color: inherit; box-shadow: 0 16px 55px #10233e46; }
dialog.wide { width: min(920px, calc(100vw - 28px)); }
dialog::backdrop { background: #10233e88; }
.dialog-content { padding: clamp(15px, 3vw, 24px); }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 17px; }
.dialog-header h2 { font-size: 1.38rem; }
.dialog-header p { margin-top: 5px; color: var(--muted); font-size: .87rem; }
.close-button { display: inline-grid; place-items: center; flex: 0 0 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #29405b; font-size: 1.25rem; }
.close-button:hover { background: #eaf2ff; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-stack { display: grid; gap: 12px; }
.full { grid-column: 1 / -1; }
.field { display: grid; align-content: start; gap: 4px; min-width: 0; color: #263e5b; font-size: .85rem; font-weight: 650; }
.optional { color: var(--muted); font-size: .78rem; font-weight: 450; }
input:not([type="checkbox"]), select, textarea { width: 100%; min-width: 0; min-height: 39px; padding: 7px 9px; border: 1px solid #b9cadd; border-radius: 7px; background: #fff; color: #162743; }
textarea { min-height: 70px; resize: vertical; }
input[type="checkbox"] { margin: 0; width: 16px; height: 16px; accent-color: var(--blue); }
.check-label { display: flex; align-items: center; gap: 8px; width: fit-content; font-size: .9rem; font-weight: 650; }
[aria-invalid="true"] { border-color: #bb4a4c !important; }
.field-error { color: var(--red); font-size: .77rem; font-weight: 550; }
.field-error:empty { display: none; }
.form-error { margin-bottom: 13px; padding: 10px 12px; border: 1px solid #eac3c3; border-radius: 8px; background: #fff3f3; color: var(--red); font-size: .86rem; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.form-note { color: var(--muted); font-size: .83rem; }
.quote-item { min-width: 0; margin: 0 0 9px; padding: 9px 12px 12px; border: 1px solid var(--line); border-radius: 9px; }
.quote-item legend { padding: 0 4px; color: var(--muted); font-size: .8rem; font-weight: 650; }
.item-fields { display: grid; grid-template-columns: minmax(100px, 2fr) minmax(90px, .8fr) minmax(90px, .8fr) minmax(113px, 1fr) auto; gap: 8px; align-items: start; }
.item-end { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.quote-totals { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.quote-totals output { color: #17447b; font-weight: 800; font-size: 1.16rem; }

@media (max-width: 1120px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  body { display: block; }
  .sidebar { position: static; min-height: auto; padding: 14px 16px; gap: 12px; }
  .navigation { display: flex; flex-wrap: wrap; gap: 5px; }
  .navigation button { padding: 7px 9px; font-size: .86rem; }
  .sidebar-footer { display: none; }
  main { padding-top: 23px; }
}
@media (max-width: 570px) {
  .metric { padding: 11px 8px; font-size: .79rem; }
  .metric strong { font-size: 1.7rem; }
  .metrics { gap: 6px; }
  .board, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .board-column { min-height: 0; }
  .item-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-fields > :first-child { grid-column: 1 / -1; }
}
