:root {
  color-scheme: light;
  --ink: #202735;
  --subtle: #586474;
  --quiet: #687586;
  --line: #e3e7eb;
  --canvas: #f5f6f8;
  --paper: #fff;
  --nav: #1c2533;
  --teal: #08736b;
  --teal-dark: #075a53;
  --teal-pale: #eaf5f2;
  --red: #a23f3b;
  --red-pale: #fbeeed;
  --amber: #85561d;
  --amber-pale: #fcf1db;
  --blue: #366099;
  --blue-pale: #ecf2fa;
  --radius: 14px;
  font: 14px/1.5 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
button:disabled { opacity: .6; cursor: wait; }
:focus-visible { outline: 2px solid #188d83; outline-offset: 3px; }
h1, h2, h3, p, ul, dl { margin: 0; }
h1 { font-size: clamp(28px, 3vw, 37px); font-weight: 680; letter-spacing: -.045em; line-height: 1.16; overflow-wrap: anywhere; }
h2 { font-size: 19px; font-weight: 660; letter-spacing: -.025em; line-height: 1.3; }
h3 { font-size: 15px; font-weight: 650; line-height: 1.35; }
.muted { color: var(--subtle); }
.meta { font-size: 12px; color: var(--quiet); }
.numeric { font-variant-numeric: tabular-nums; }
.initial-status { margin: 36px; color: var(--subtle); }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 10; transform: translateY(-200%); padding: 10px 14px; background: var(--paper); border-radius: 8px; }
.skip-link:focus { transform: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 18px; height: 18px; display: inline-block; flex: 0 0 auto; vertical-align: middle; }

.shell { min-height: 100dvh; display: grid; grid-template-columns: 222px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; min-height: 540px; padding: 24px 14px 16px; display: flex; flex-direction: column; color: #cad2de; background: var(--nav); }
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; color: white; font-weight: 690; font-size: 21px; letter-spacing: -.045em; }
.sidebar .brand { margin: 1px 0 34px 9px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; color: #f0fffc; background: #167d72; border-radius: 9px; }
.brand-mark .icon { width: 20px; height: 20px; }
.side-nav { display: grid; gap: 4px; }
.nav-label { font-size: 11px; color: #a1afc1; padding: 0 10px 7px; font-weight: 630; }
.nav-link { min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; font-weight: 510; }
.nav-link:hover { background: #263346; color: #fff; }
.nav-link[aria-current] { background: #283a46; border-color: #36505a; color: #f4fffc; font-weight: 620; }
.nav-link[aria-current] .icon { color: #82d6c5; }
.nav-link .icon { color: #a9b7c9; }
.sidebar-bottom { margin-top: auto; padding-top: 25px; }
.side-user { margin-top: 14px; padding: 14px 6px 0 8px; border-top: 1px solid #364351; display: flex; gap: 9px; align-items: center; min-width: 0; }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #e4efef; color: #28665f; font-size: 12px; font-weight: 700; }
.side-user .avatar { background: #374d53; color: #c0efdf; }
.side-user-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: #f0f4fa; }
.side-user .icon-btn { color: #c1cbd7; background: transparent; border-color: transparent; }
.side-user .icon-btn:hover { background: #354459; }
.workspace { min-width: 0; }
.topbar { height: 62px; padding: 0 clamp(18px, 3.4vw, 46px); display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); background: var(--paper); color: var(--subtle); }
.breadcrumbs { display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumbs > span:last-child { color: var(--ink); font-weight: 580; text-overflow: ellipsis; overflow: hidden; }
.breadcrumbs .icon, .top-date .icon { width: 15px; height: 15px; }
.top-date { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--subtle); font-size: 13px; }
.demo-label { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; padding: 4px 8px; margin-left: 6px; background: var(--amber-pale); color: var(--amber); border-radius: 6px; font-size: 11px; }
.demo-label::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #a8732c; }
.main { width: min(100%, 1530px); margin: 0 auto; padding: 32px clamp(18px, 3.4vw, 46px) 52px; }
.header { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 25px; }
.header p { color: var(--subtle); margin-top: 8px; }
.header-actions, .actions, .bar, .row-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.upperline { margin-bottom: 9px; font-size: 13px; color: var(--subtle); font-weight: 550; }

.btn, .icon-btn { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 37px; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 7px 12px; font-weight: 590; white-space: nowrap; line-height: 1.35; }
.btn .icon, .icon-btn .icon { width: 16px; height: 16px; }
.btn:hover, .icon-btn:hover { background: #f2f5f7; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-pale); }
.btn.small { padding: 5px 9px; min-height: 31px; font-size: 12px; }
.icon-btn { padding: 7px; min-width: 34px; min-height: 34px; }
.text-btn { display: inline-flex; gap: 6px; align-items: center; background: none; border: none; padding: 0; color: var(--teal-dark); font-weight: 620; text-align: left; }
.text-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-btn .icon { width: 15px; height: 15px; }
.entry-link { color: var(--ink); }
.entry-link:hover { color: var(--teal-dark); }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin: 0 0 22px; }
.metric { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); min-height: 126px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 17px 19px; }
.metric:hover { border-color: #b2cbc5; }
.metric-label { color: var(--subtle); font-weight: 570; }
.metric-value { font-size: 32px; font-weight: 660; letter-spacing: -.045em; line-height: 1.15; margin-top: 6px; }
.metric-detail { font-size: 12px; color: var(--quiet); margin-top: 4px; }
.glyph { display: inline-grid; width: 34px; height: 34px; border-radius: 9px; place-items: center; flex: 0 0 auto; background: var(--teal-pale); color: var(--teal-dark); }
.glyph.blue { background: var(--blue-pale); color: var(--blue); }
.glyph.amber { background: var(--amber-pale); color: var(--amber); }
.glyph.red { background: var(--red-pale); color: var(--red); }
.glyph.gray { background: #edf0f4; color: #5d6b7d; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(250px, 1fr); align-items: start; gap: 16px; margin-bottom: 20px; }
.stack { display: grid; gap: 17px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 62px; padding: 14px 18px; }
.panel-head h2 { display: flex; gap: 8px; align-items: center; }
.panel-head h2 .icon { color: var(--teal); }
.section-sub { margin-top: 4px; color: var(--subtle); font-size: 12px; }
.panel-body { padding: 17px 18px; }
.rule { border-top: 1px solid var(--line); }
.rows { list-style: none; padding: 0; }
.rows > li + li { border-top: 1px solid #edf0f3; }
.task-row { padding: 13px 18px; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.task-title { font-size: 14px; }
.task-row .row-ctrl { justify-content: flex-end; }
.task-row .meta { display: block; margin-top: 3px; }
.amount-focus { font-weight: 670; font-size: 27px; line-height: 1.2; letter-spacing: -.045em; margin-bottom: 5px; }
.compact-row { display: flex; align-items: start; justify-content: space-between; gap: 10px; padding: 11px 18px; }
.compact-row strong { white-space: nowrap; }
.panel-foot { padding: 13px 18px; border-top: 1px solid var(--line); }
.count { display: inline-block; padding: 1px 6px; border-radius: 5px; background: #edefef; color: #465360; font-size: 11px; font-weight: 650; letter-spacing: 0; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; width: fit-content; padding: 2px 8px; border-radius: 5px; color: #4e5b69; background: #edf0f4; font-size: 11px; font-weight: 650; white-space: nowrap; line-height: 1.65; }
.pill.good { color: #216353; background: #e5f3ec; }
.pill.wait { color: var(--amber); background: var(--amber-pale); }
.pill.bad { color: var(--red); background: var(--red-pale); }
.pill.info { color: var(--blue); background: var(--blue-pale); }
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.empty { padding: 29px 18px; color: var(--subtle); }
.empty strong { color: var(--ink); font-weight: 620; margin-right: 6px; }
.muted-rows { color: var(--subtle); }
.find { position: relative; display: block; min-width: 220px; }
.find .icon { color: var(--quiet); position: absolute; top: 9px; left: 10px; width: 16px; height: 16px; pointer-events: none; }
.find input { padding-left: 34px; }
.bar { padding: 13px 18px; border-bottom: 1px solid var(--line); }
.bar .find { margin-right: auto; flex: 1 1 240px; max-width: 390px; }
.bar select { width: auto; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: 11px 12px; text-align: left; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
th { font-weight: 620; color: #536172; background: #fafbfc; font-size: 11px; white-space: nowrap; }
td { border-top: 1px solid #edf0f3; }
tbody tr:hover { background: #fbfcfd; }
td .meta { display: block; margin-top: 2px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.chevron-col { width: 27px; color: var(--quiet); }
.contract-info { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 22px; padding: 17px 18px; }
.contract-info dt { font-size: 12px; color: var(--subtle); }
.contract-info dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.span-all { grid-column: 1 / -1; }
.tabs { display: flex; gap: 23px; border-bottom: 1px solid var(--line); padding: 0 18px; }
.tab { padding: 13px 1px; background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--subtle); font-weight: 600; }
.tab[aria-current="page"] { border-bottom-color: var(--teal); color: var(--teal-dark); }
.tab:hover { color: var(--teal-dark); }
.file-group { padding: 15px 18px; }
.file-group + .file-group { border-top: 1px solid var(--line); }
.file-group > .meta { margin-top: 5px; }
.file-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding-top: 11px; }
.file-row .meta { display: block; }
.history-label { padding: 14px 18px; border-top: 1px solid var(--line); }

input:not([type="checkbox"]), select, textarea { width: 100%; min-height: 36px; border: 1px solid #d5dce3; border-radius: 7px; background: var(--paper); color: var(--ink); padding: 6px 9px; }
.find input { padding-left: 34px; }
.bar select { width: auto; }
input::placeholder, textarea::placeholder { color: #6a7583; }
input[type="checkbox"] { accent-color: var(--teal); width: 16px; height: 16px; margin: 0; flex: 0 0 auto; }
textarea { resize: vertical; min-height: 76px; }
dialog { max-width: min(690px, calc(100vw - 24px)); width: 100%; max-height: calc(100dvh - 36px); overflow-y: auto; padding: 0; color: var(--ink); background: var(--paper); border: 1px solid #dce3e9; border-radius: 15px; box-shadow: 0 15px 55px #20273533; }
dialog::backdrop { background: #15233372; }
.dialog-head { position: sticky; top: 0; z-index: 2; background: var(--paper); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.dialog-body { padding: 17px 20px; }
.dialog-foot { position: sticky; bottom: 0; background: var(--paper); display: flex; justify-content: end; gap: 8px; flex-wrap: wrap; padding: 13px 20px; border-top: 1px solid var(--line); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field { display: grid; gap: 4px; align-content: start; min-width: 0; }
.field > span:first-child, .fieldset-title { font-size: 12px; font-weight: 620; color: #485668; }
.check { display: flex; gap: 8px; align-items: center; min-height: 33px; cursor: pointer; }
.check-list, .line-items { display: grid; gap: 7px; margin: 0; padding: 11px; border: 1px solid var(--line); border-radius: 8px; }
.check-list legend, .line-items legend { padding: 0 4px; }
.invoice-line { display: grid; grid-template-columns: minmax(80px, 2fr) minmax(42px, .58fr) minmax(42px, .65fr) minmax(65px, .9fr) auto; gap: 7px; align-items: end; }
.line-total { padding-top: 6px; text-align: right; font-size: 15px; font-weight: 650; }
.form-error, .form-note { padding: 9px 11px; border-radius: 7px; overflow-wrap: anywhere; }
.form-error { background: var(--red-pale); color: var(--red); margin-bottom: 10px; }
.form-note { background: var(--amber-pale); color: #774a15; margin-bottom: 9px; }
.form-block { margin-top: 14px; }
.toast { position: fixed; z-index: 5; right: 18px; bottom: 18px; max-width: calc(100% - 36px); background: #253742; color: white; border-radius: 8px; box-shadow: 0 7px 27px #142a4130; padding: 10px 15px; }
.toast.error { background: #8c3836; }
.login-screen { min-height: 100dvh; display: grid; grid-template-columns: minmax(280px, 1fr) minmax(365px, 1.15fr); }
.login-side { padding: clamp(24px, 6vw, 80px); display: grid; align-content: space-between; gap: 55px; background: var(--nav); color: white; }
.login-side .brand .brand-mark { width: 38px; height: 38px; }
.login-side h1 { max-width: 470px; font-size: clamp(29px, 5vw, 58px); font-weight: 640; }
.login-entities { display: flex; flex-wrap: wrap; gap: 12px; color: #c4d4e2; }
.login-entities span + span::before { content: '·'; margin-right: 12px; }
.login-main { padding: 30px; display: grid; place-items: center; }
.login-form { width: min(100%, 375px); display: grid; gap: 17px; }
.login-form h2 { font-size: 29px; }
.login-form .field { gap: 5px; }
.login-form .btn { margin-top: 3px; }
.login-form .form-error { margin: 0; }
pre { overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 7px; border-radius: 6px; background: var(--canvas); font: 12px/1.5 Consolas, monospace; }

@media (max-width: 970px) {
  .shell { grid-template-columns: 180px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; min-height: 0; padding: 12px; }
  .sidebar .brand { margin: 0 0 11px 5px; }
  .side-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-label { display: none; }
  .nav-link { min-height: 34px; font-size: 12px; padding: 6px; gap: 5px; }
  .nav-link .icon { width: 14px; height: 14px; }
  .sidebar-bottom { padding-top: 6px; display: flex; gap: 5px; flex-wrap: wrap; justify-content: space-between; }
  .side-user { padding: 0 3px; margin: 0; border-top: 0; }
  .side-user .avatar { display: none; }
  .topbar { height: 47px; }
  .top-date { display: none; }
  .main { padding-top: 20px; }
  .metrics { gap: 7px; }
  .metric { min-height: 95px; padding: 9px; position: relative; display: block; }
  .metric .glyph { display: none; }
  .metric-label { font-size: 12px; }
  .metric-value { font-size: 24px; }
  .metric-detail { display: none; }
  .contract-info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-screen { display: block; }
  .login-side { gap: 18px; padding: 23px 19px; }
}
@media (max-width: 440px) {
  .task-row { padding-inline: 12px; gap: 7px; }
  .task-row .glyph { display: none; }
  .task-row { grid-template-columns: 1fr auto; }
  .fields { grid-template-columns: minmax(0,1fr); }
  .invoice-line { grid-template-columns: repeat(3, minmax(0,1fr)) auto; }
  .invoice-line > :first-child { grid-column: 1 / -1; }
  .file-row { grid-template-columns: auto 1fr; }
  .file-row .row-ctrl { grid-column: 2; }
}
