:root {
  color-scheme: light;
  font-family: var(--brand-font);
  color: var(--brand-ink);
  background: var(--brand-canvas);
  --ink: var(--brand-ink);
  --muted: var(--brand-muted);
  --nav: var(--brand-canvas);
  --accent: var(--brand-purple);
  --accent-dark: var(--brand-purple-dark);
  --tint: var(--brand-tint);
  --line: var(--brand-line);
  --surface: #fff;
  --sidebar: 232px;
  --radius: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
h1,h2,h3,p { margin: 0; }
h1 { font-size: clamp(1.8rem,4vw,2.65rem); line-height: 1.1; letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; line-height: 1.3; letter-spacing: -.015em; }
h3 { font-size: 1rem; }
p { line-height: 1.55; }
a { color: var(--accent-dark); text-underline-offset: .18em; }
button,input,textarea,select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand-focus); outline-offset: 3px; }
.skip { position: fixed; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: white; padding: .7rem; z-index: 5; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.2rem; height: 1.2rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.top { background: var(--nav); color: var(--ink); border-bottom: 1px solid var(--line); padding: 14px clamp(18px,4vw,54px); }
.brand { display: inline-flex; align-items: center; min-width: 0; text-decoration: none; }
.account-name small,.account-name strong { display: block; }
.signed-in .top { box-sizing: border-box; border-right: 1px solid var(--line); position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 22px 14px; display: flex; flex-direction: column; gap: 26px; z-index: 3; overflow: auto; }
.signed-in .brand { margin: 0; }
.top nav { display: grid; gap: 5px; }
.top nav a { display: flex; align-items: center; gap: 11px; padding: .7rem .75rem; border-radius: 9px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .88rem; }
.top nav a:hover,.top nav [aria-current="page"] { color: var(--accent-dark); background: var(--tint); }
.top nav [aria-current="page"] { box-shadow: inset 3px 0 var(--brand-orange); }
.top nav [aria-current="page"] .icon { color: var(--accent); }
.account { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 8px 0; display: grid; gap: 12px; min-width: 0; }
.account-name { overflow-wrap: anywhere; }
.account-name small { color: var(--muted); font-size: .76rem; margin-top: 2px; }
.quiet { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: transparent; padding: .45rem .65rem; font-size: .84rem; }
main.shell { flex: 1; }
.shell.brand-footer { padding: 12px 18px 20px; }
.shell { width: min(1240px,100%); margin: 0 auto; padding: clamp(18px,4vw,44px); }
.signed-in .shell { margin: 0 auto; width: min(calc(100% - var(--sidebar)),1240px); margin-inline-start: max(var(--sidebar),calc((100% + var(--sidebar) - 1240px)/2)); }

.eyebrow { color: var(--accent-dark); text-transform: uppercase; letter-spacing: .115em; font-size: .7rem; font-weight: 800; }
.muted { color: var(--muted); }
.page-heading { margin: 8px 0 20px; }
.page-heading h1,.hero h1 { margin: 5px 0 8px; }
.page-heading .muted { max-width: 65ch; }
.hero { min-height: 178px; padding: clamp(22px,4vw,39px); border-radius: var(--radius); color: white; background: var(--brand-gradient); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero, .login-cover { border-top: 3px solid var(--brand-orange); }
.hero p { color: #dbe2f9; }
.hero .eyebrow { color: #cfc0ff; }
.hero .button { background: #fff; color: var(--accent-dark); }
.hero .button:hover { background: var(--tint); }
.hero .eyebrow span { margin-inline: .35rem; }
.split,.actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.actions { justify-content: flex-start; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 42px; padding: .64rem .9rem; border: 1px solid transparent; border-radius: 9px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 720; font-size: .88rem; }
.button:hover { background: var(--accent-dark); }
.button.secondary { background: var(--tint); color: var(--accent-dark); }
.button.secondary:hover { background: #e9d5fb; }
.back { display: inline-flex; margin-bottom: .65rem; font-weight: 660; font-size: .88rem; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(14px,2.2vw,23px); margin-block: 14px; box-shadow: 0 3px 10px #18264208; }
.panel-heading { margin-bottom: 14px; }
.section-heading { margin-top: 24px; }
.section-heading .eyebrow,.panel-heading .eyebrow { margin-bottom: .3rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(155px,100%),1fr)); gap: 10px; margin-block: 12px 18px; }
.cards .panel { margin: 0; }
.cards span,.proposal-price span { color: var(--muted); font-size: .82rem; }
.cards strong,.proposal-price strong { display: block; margin-top: 5px; font-size: clamp(1.12rem,2vw,1.43rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.metric-grid .panel { border-top: 3px solid var(--brand-purple); }

.input-group { min-width: 0; }
.input-group label,.login label { display: block; font-weight: 690; margin-bottom: .3rem; font-size: .85rem; }
input,select,textarea { width: 100%; min-width: 0; min-height: 42px; border: 1px solid #bec8db; border-radius: 8px; background: white; color: var(--ink); padding: .54rem .64rem; }
textarea { resize: vertical; }
.errorlist { margin: .4rem 0; padding-left: 1.25rem; color: #a01740; font-size: .88rem; }
.period,.search { display: flex; align-items: end; gap: .55rem; flex-wrap: wrap; }
.period { align-items: center; }
.period label,.search a { font-size: .83rem; color: var(--muted); }
.period input { width: auto; min-width: 9.5rem; }
.search { margin-bottom: 16px; }
.search .input-group { flex: 0 1 340px; }
.search a { align-self: center; }
.field-grid,.data-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 18px; }
.field-wide { grid-column: 1 / -1; }
.form-panel { max-width: 800px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; border-top: 1px solid var(--line); margin-top: 20px; padding-top: 14px; }
dt { font-size: .81rem; font-weight: 650; color: var(--muted); }
dd { margin: 4px 0 0; overflow-wrap: anywhere; }
details { border-top: 1px solid var(--line); padding-top: .75rem; }
summary { cursor: pointer; color: var(--accent-dark); font-weight: 680; }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th,td { padding: .7rem .65rem; border-bottom: 1px solid var(--line); font-size: .86rem; }
th { color: #42516d; background: #f2eaf8; font-size: .75rem; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbf6ff; }
.row-primary a,.row-primary strong { font-weight: 720; }
.row-primary small { display: block; color: var(--muted); font-size: .73rem; margin-top: .18rem; overflow-wrap: anywhere; }
.numeric { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; border-radius: 999px; background: #eeebfc; color: #45338e; padding: .24rem .55rem; font-size: .75rem; font-weight: 680; white-space: nowrap; }
.pill[data-status="done"],.pill[data-status="booked"] { background: #dff5e8; color: #18553c; }
.pill[data-status="overdue"],.pill[data-status="cancelled"],.pill[data-status="rejected"] { background: #fae5eb; color: #932948; }
.pill[data-status="pending"],.pill[data-status="negotiation"] { background: #fff0d8; color: #724c14; }
.pill[data-status="draft"] { background: #e9edf4; color: #48536b; }
.pages { margin-top: 14px; }
.empty,.empty-state p { color: var(--muted); }
.empty-state { text-align: center; padding: clamp(18px,4vw,36px); background: #f8f9fd; border: 1px dashed #ccd4e4; border-radius: 12px; }
.empty-state .icon { color: var(--accent); width: 1.8rem; height: 1.8rem; margin-bottom: 4px; }
.empty-state p { margin-top: 5px; }
.empty-state .button { margin-top: 12px; }

.login-layout { width: min(960px,100%); min-height: 480px; margin: 2vh auto 0; display: grid; grid-template-columns: 1fr 1fr; background: white; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: 0 15px 50px #18264215; }
.login-cover { overflow: hidden; padding: clamp(24px,5vw,58px); background: var(--brand-gradient); color: white; }
.login-cover h1 { margin: 12px 0; font-size: clamp(2rem,4.4vw,3rem); }
.login-cover p { color: #dce3ff; max-width: 35ch; }
.login-cover .eyebrow { color: #edc7ff; }
.login-modules { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 24px 0 0; }
.login-modules li { padding: 6px 11px; border: 1px solid #c890f3; border-radius: 999px; color: #fff; font-size: .82rem; font-weight: 650; }
.login { align-self: center; margin: 0; border: 0; box-shadow: none; padding: clamp(24px,5vw,52px); }
.login h2 { font-size: 1.9rem; margin: 5px 0; }
.login form { margin-top: 20px; display: grid; gap: 14px; }
.login button { justify-content: space-between; width: 100%; }
.proposal { max-width: 840px; overflow: hidden; padding: 0; }
.proposal-heading { background: var(--tint); padding: clamp(18px,4vw,32px); }
.proposal-heading h1 { margin: 5px 0; }
.proposal-body { padding: clamp(18px,4vw,32px); }
.proposal-price { border-bottom: 1px solid var(--line); padding-bottom: 15px; }
.proposal-price strong { font-size: 1.8rem; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 840px) {
  .signed-in .top { position: static; width: 100%; overflow: visible; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 9px; padding: 12px 14px; }
  .signed-in .brand { margin-left: 0; }
  .top nav { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; gap: 4px; }
  .top nav a { padding: .55rem .45rem; gap: 5px; font-size: .75rem; }
  .top nav .icon { width: 1rem; height: 1rem; }
  .account { margin: 0; border: 0; padding: 0; }
  .account-name { display: none; }
  .signed-in .shell { width: 100%; margin: 0 auto; }
}
@media (max-width: 680px) {
  .login-layout { min-height: 0; grid-template-columns: 1fr; }
  .login-cover { padding: 23px; }
  .login-cover h1 { font-size: 2rem; }
  .responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .responsive-table,.responsive-table tbody { display: block; }
  .responsive-table tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
  .responsive-table td { border: 0; min-width: 0; padding: 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  .responsive-table td[data-label]::before { display: block; content: attr(data-label); color: var(--muted); font-size: .72rem; font-weight: 670; }
  .responsive-table .row-primary,.responsive-table .row-action { grid-column: 1 / -1; }
}
@media (max-width: 470px) {
  .field-grid,.data-grid { grid-template-columns: 1fr; }
  .search .input-group { flex: 1 1 100%; }
  .hero { min-height: 0; }
  .period label { width: 100%; }
}
@media print {
  body { background: white; }
  .top,.print-help,.skip { display: none !important; }
  .signed-in .shell,.shell { width: 100%; margin: 0; padding: 0; }
  .proposal { border: 0; box-shadow: none; max-width: none; }
}
.section-links { display: flex; flex-wrap: wrap; gap: 8px; }
.section-links a { padding: .42rem .65rem; border-radius: 8px; background: var(--tint); font-size: .85rem; font-weight: 680; text-decoration: none; }

.report-switch { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.report-switch a { padding: .5rem .75rem; border-radius: 8px; text-decoration: none; font-size: .87rem; font-weight: 680; }
.report-switch [aria-current="page"] { background: var(--tint); color: var(--accent-dark); }
.demo-banner { margin: 12px 0; padding: .62rem .8rem; border: 1px solid #efdaa7; border-radius: 9px; background: #fff5df; color: #61490f; font-size: .86rem; }
.report-charts { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); gap: 12px; margin-bottom: 14px; }
.report-charts .panel { margin: 0; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 0; list-style: none; margin: 0 0 14px; font-size: .8rem; color: var(--muted); }
.chart-legend li { display: flex; align-items: center; gap: 6px; }
.chart-legend span { width: 11px; height: 11px; border-radius: 3px; background: var(--brand-purple); }
.chart-legend li:nth-child(2) span { background: #d65c0a; }
.bar-chart { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 6px; margin-bottom: 16px; }
.chart-month { display: grid; gap: 6px; text-align: center; font-size: clamp(.6rem,1.3vw,.76rem); color: var(--muted); }
.chart-bars { display: flex; justify-content: center; align-items: end; gap: 3px; height: 150px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top,#edf0f7 0 1px,transparent 1px 30px); }
.chart-bars div { height: var(--bar); width: min(36%,23px); border-radius: 5px 5px 0 0; background: linear-gradient(#9c46e1,#6617a7); }
.chart-bars div:nth-child(2) { background: linear-gradient(#ffac52,#d65c0a); }
.expense-chart { list-style: none; padding: 0; display: grid; gap: 13px; }
.expense-chart li > div:first-child { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px; font-size: .85rem; }
.expense-track { margin-top: 5px; height: 8px; border-radius: 999px; background: #eeebfa; overflow: hidden; }
.expense-track span { display: block; height: 100%; width: var(--bar); border-radius: inherit; background: var(--brand-spectrum); }
.report-result th,.report-result td { background: #e9e5fa; color: #342674; font-weight: 750; }
@media (max-width: 1060px) { .report-charts { grid-template-columns: 1fr; } }
@media print {
  .hero { color: #172037; background: #fff; min-height: 0; border-bottom: 1px solid #dfe4ee; }
  .hero p,.hero .eyebrow { color: #172037; }
  .panel { box-shadow: none; }
  tr { break-inside: avoid; }
}
.dashboard-scope { margin-top: 14px; }
@media (min-width: 700px) { .finance-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); } }
.pill[data-status="partial"] { background: #fff0d8; color: #724c14; }
.pill[data-status="partial-overdue"] { background: #fae5eb; color: #932948; }

.quote-form { display: grid; gap: 16px; max-width: 850px; }
.quote-form [hidden] { display: none; }
.quote-form .field-grid > p { margin: 0; }
.quote-form details > summary { cursor: pointer; }
.quote-form details > .field-grid, .quote-form details > .input-group { margin-top: 12px; }
.quote-team { min-width: 0; margin: 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.quote-team legend { font-weight: 650; padding: 0 5px; }
.quote-team #id_team { display: flex; gap: 8px 20px; flex-wrap: wrap; }
.quote-team label { display: inline-flex; gap: 6px; align-items: center; }
.quote-team input[type="checkbox"] { width: auto; }
.quote-price { margin: 0; font-weight: 750; font-size: clamp(1.8rem, 4vw, 2.7rem); }

.quote-step-form { display: grid; gap: 8px; min-width: 145px; }
.quote-step-form .button { justify-self: start; }
.quote-step > summary { cursor: pointer; color: var(--accent-dark); font-weight: 650; }
.quote-step[open] > summary { margin-bottom: 8px; }
.quote-step-form input { width: 100%; }
.installment-row { border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; padding: 12px; min-width: 0; }
.installment-row legend { font-weight: 650; padding: 0 5px; }

.selection-row { display: flex; gap: 10px; align-items: center; padding: 7px 0; cursor: pointer; }
.selection-row[hidden] { display: none; }
.selection-row input { width: auto; }

[data-agenda-status="draft"] { --agenda-bg: #e9edf4; --agenda-ink: #46536b; }
[data-agenda-status="sent"] { --agenda-bg: #e0edff; --agenda-ink: #25559a; }
[data-agenda-status="negotiation"] { --agenda-bg: #ffefcc; --agenda-ink: #795213; }
[data-agenda-status="booked"] { --agenda-bg: #d9f4de; --agenda-ink: #22613a; }
[data-agenda-status="contract"] { --agenda-bg: #ece3ff; --agenda-ink: #6539a5; }
[data-agenda-status="deposit_open"] { --agenda-bg: #ffeadc; --agenda-ink: #8a4319; }
[data-agenda-status="confirmed"] { --agenda-bg: #d6f4f0; --agenda-ink: #165c57; }
[data-agenda-status="done"] { --agenda-bg: #e1e8fd; --agenda-ink: #3d4690; }
[data-agenda-status="cancelled"],[data-agenda-status="rejected"] { --agenda-bg: #fbe1e8; --agenda-ink: #9a2b4f; }
[data-agenda-status="busy"] { --agenda-bg: #efe5db; --agenda-ink: #604732; }
.agenda-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.agenda-chip { padding: 3px 7px; border-radius: 6px; background: var(--agenda-bg); color: var(--agenda-ink); font-size: .77rem; font-weight: 650; }
.agenda-month { width: 100%; table-layout: fixed; min-width: 0; border: 1px solid var(--line); }
.agenda-month th { padding: 7px; text-align: center; }
.agenda-month td { padding: 6px; height: 72px; vertical-align: top; border: 1px solid var(--line); }
.agenda-month time { font-size: .82rem; font-weight: 700; }
.agenda-month time[aria-current] { border-radius: 5px; background: var(--tint); color: var(--accent-dark); padding: 2px 5px; }
.agenda-outside { background: #f6f7fb; }
.agenda-day-events { display: grid; gap: 4px; margin-top: 4px; }
.agenda-event { display: block; overflow-wrap: anywhere; text-decoration: none; }
.agenda-operation { display: block; overflow-wrap: anywhere; }
.agenda-event small { display: block; font-weight: 500; }
.agenda-event[href]:hover { text-decoration: underline; }
.agenda-dot, .agenda-mobile-list { display: none; }
.quote-calendar { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.quote-calendar[hidden], .calendar-warning[hidden] { display: none; }
.quote-calendar .actions { justify-content: space-between; margin: 8px 0; }
.quote-calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 4px; }
.quote-calendar-grid > span { text-align: center; font-size: .8rem; }
.quote-calendar-grid button { min-width: 0; min-height: 36px; padding: 4px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--surface); }
.quote-calendar-grid button[aria-pressed="true"] { border: 2px solid var(--accent-dark); font-weight: 800; }
.quote-calendar [data-kind="quote"] { background: #ffefcc; color: #795213; }
.quote-calendar [data-kind="closed"] { background: #d9f4de; color: #22613a; }
.quote-calendar [data-kind="busy"] { background: #efe5db; color: #604732; }
.quote-calendar [data-kind="both"] { background: linear-gradient(135deg,#ffefcc 50%,#d9f4de 50%); color: #38442d; }
.calendar-warning { margin-top: 10px; padding: 10px; border-radius: 8px; background: #ffefcc; color: #795213; }
@media (max-width: 720px) {
  .agenda-month td { height: 44px; padding: 3px; }
  .agenda-event { display: none; }
  .agenda-day-events { display: flex; flex-wrap: wrap; gap: 2px; }
  .agenda-dot { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--agenda-ink); }
  .agenda-mobile-list { display: block; margin-top: 14px; }
  .agenda-mobile-list ul { margin: 4px 0 12px; padding-left: 18px; }
  .agenda-mobile-list li { margin: 4px 0; }
  .quote-calendar .actions { gap: 4px; }
}
