:root {
  color-scheme: light;
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #242033;
  background: #f7f6fb;
  --ink: #242033;
  --muted: #625e73;
  --purple: #6740d0;
  --border: #e8e4f0;
  --white: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, canvas:focus-visible { outline: 3px solid #a68afb; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px, 3.2vw, 40px); line-height: 1.1; letter-spacing: -.05em; overflow-wrap: anywhere; }
h2 { font-size: 19px; letter-spacing: -.025em; }
h3 { font-size: 16px; }
small { font-size: 12px; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar { background: #211a34; color: #f7f3ff; padding: 29px 17px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 7px; margin-bottom: 32px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #926bff; color: #211a34; font-size: 26px; font-weight: 850; }
.brand strong { display: block; font-size: 19px; line-height: 1.15; }
.brand small { color: #c9c0da; }
.compare-nav, .scenario { width: 100%; color: #ece5f8; background: transparent; border: 1px solid transparent; border-radius: 9px; text-align: left; }
.compare-nav { display: flex; align-items: center; gap: 10px; padding: 11px; border-color: #4a3b62; }
.sidebar button:hover { background: #352749; }
.sidebar button[aria-current="page"] { border-color: #7054a0; background: #382853; color: #fff; }
.sidebar-heading { display: flex; margin: 28px 3px 9px 9px; align-items: center; justify-content: space-between; }
.sidebar-heading h2 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #c9c0da; }
.icon { border: 1px solid currentColor; border-radius: 8px; color: inherit; background: transparent; width: 30px; height: 30px; line-height: 1; font-size: 20px; }
.sidebar-heading .icon { color: #d7cbec; border-color: #544569; }
.scenario { display: grid; grid-template-columns: 9px minmax(0, 1fr); gap: 0 9px; align-items: baseline; padding: 10px 11px; overflow-wrap: anywhere; margin-bottom: 4px; }
.scenario small { grid-column: 2; color: #c9c0da; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #a68afb; }
main { min-width: 0; max-width: 1760px; width: 100%; padding: 0 clamp(16px, 4vw, 55px) 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 64px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 13px; }
#status { text-align: right; }
.heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin: 29px 0 23px; }
.heading p { margin-top: 8px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.actions, .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions { flex-shrink: 0; }
.button, .filters select { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-weight: 650; color: var(--ink); background: white; }
.button:hover { border-color: var(--purple); }
.button.primary { color: white; background: var(--purple); border-color: var(--purple); }
.button.primary:hover { background: #5630bc; }
.button.danger, .text-button.remove-role { color: #a32d4d; }
.text-button { border: 0; background: transparent; color: #5731bb; font-weight: 650; padding: 4px 0; text-align: left; }
.text-button:hover { text-decoration: underline; }
.panel { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 16px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 13px; }
.panel p, .muted { color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { min-width: 0; border: 1px solid var(--border); border-radius: 12px; padding: 15px 16px; background: white; }
.metric:first-child { background: #efe9ff; border-color: #e9dfff; }
.metric small { color: var(--muted); display: block; }
.metric strong { font-size: clamp(17px, 2.2vw, 28px); letter-spacing: -.05em; line-height: 1.1; display: block; margin: 6px 0; overflow-wrap: anywhere; }
.loss { color: #ac3052; }
.gain { color: #13745c; }
.summary { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 12px 0 16px; }
.summary span { display: block; color: var(--muted); font-size: 12px; }
.note { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.notice { padding: 10px 13px; border-radius: 8px; background: #fff0e5; color: #82421c; margin-bottom: 12px; }
.chart canvas { width: 100%; height: 270px; display: block; }
.chart-controls { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid var(--border); background: white; border-radius: 7px; padding: 5px 9px; color: var(--muted); }
.chip[aria-pressed="true"] { border-color: #e3d7ff; background: #f1ebff; color: #542cab; font-weight: 650; }
.legend { display: flex; flex-wrap: wrap; gap: 5px 16px; margin-top: 5px; font-size: 13px; }
.chart-detail { font-size: 13px; color: var(--muted); min-height: 20px; margin-top: 6px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; white-space: nowrap; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: right; }
th:first-child, td:first-child { text-align: left; }
thead { background: #f7f5fc; color: var(--muted); font-size: 12px; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr.selected { background: #f4efff; }
tbody tr:hover { background: #f7f5fc; }
.choices { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.choices label { display: inline-flex; gap: 6px; align-items: center; }
input[type=checkbox] { accent-color: var(--purple); }
dialog { width: min(750px, calc(100vw - 24px)); max-height: 92dvh; border: 1px solid var(--border); padding: 0; border-radius: 15px; color: var(--ink); }
dialog::backdrop { background: #211a3477; }
#form { display: flex; flex-direction: column; max-height: 91dvh; }
.dialog-header, .dialog-footer { display: flex; align-items: center; gap: 10px; padding: 15px 20px; }
.dialog-header { justify-content: space-between; border-bottom: 1px solid var(--border); }
.dialog-footer { justify-content: flex-end; border-top: 1px solid var(--border); }
.dialog-body { padding: 17px 20px; overflow-y: auto; }
.dialog-body h3 { margin: 16px 0 8px; }
#form-error { color: #a32d4d; margin-right: auto; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid label, .dialog-body > label { display: grid; align-content: end; gap: 4px; color: var(--muted); font-size: 13px; }
.dialog-body > label + label { margin-top: 11px; }
.grid input, .grid select, .dialog-body > label input, textarea { min-width: 0; width: 100%; padding: 7px 8px; border: 1px solid #cdc5dc; background: white; color: var(--ink); border-radius: 7px; }
textarea { min-height: 75px; resize: vertical; }
.role { border: 1px solid var(--border); min-width: 0; border-radius: 8px; margin: 0 0 10px; padding: 9px 12px; }
[hidden] { display: none !important; }
@media (max-width: 1120px) { .heading { flex-wrap: wrap; } }
@media (max-width: 800px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding: 12px 16px; }
  .brand { margin: 0 0 10px; }
  .sidebar-heading { margin-top: 10px; }
  #scenario-list { display: flex; gap: 5px; overflow-x: auto; }
  .scenario { width: auto; min-width: 145px; }
  .topbar { min-height: 46px; }
  .heading { margin-top: 18px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 14px; }
}
@media (max-width: 470px) {
  .dialog-footer { flex-wrap: wrap; }
  #form-error:not(:empty) { flex-basis: 100%; }
}

.scenario-tabs { display: flex; flex-wrap: wrap; column-gap: 20px; margin: -4px 0 18px; border-bottom: 1px solid var(--border); }
.section-tab { padding: 8px 4px 10px; background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 650; }
.section-tab[aria-current="page"] { color: var(--purple); border-bottom-color: var(--purple); }
.section-tab:hover { color: var(--purple); }
.staff-table .staff-name { text-align: left; min-width: 130px; white-space: normal; overflow-wrap: anywhere; }
.staff-name small { display: block; color: var(--muted); }
.staff-table tbody > tr:last-child > * { border-bottom: 1px solid var(--border); }
.staff-table tbody > tr > :is(th, .volume-actions) { border-bottom: 1px solid var(--border); vertical-align: top; }
.staff-table tbody:nth-of-type(even) { background: #faf8fe; }
.staff-table .button { padding: 5px 8px; font-size: 13px; }
.staff-table .button + .button { margin-left: 4px; }
.tax-settings .grid { max-width: 560px; }
.tax-basis { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; }
.price-table input, .price-table select { padding: 6px 7px; border: 1px solid #cdc5dc; border-radius: 7px; background: white; color: var(--ink); }
.price-table input { width: 7ch; }
.price-table input[data-price] { width: 15ch; }
.price-table small { display: block; color: var(--muted); }
.price-table small[data-price-note] { color: #a32d4d; }
.price-actions { margin-top: 14px; }
.info-button { display: inline-grid; place-items: center; vertical-align: middle; width: 21px; height: 21px; padding: 0; border-radius: 50%; border: 1px solid #d5c9f3; background: #f5f0ff; color: #5731bb; font-weight: 750; line-height: 1; font-size: 12px; }
.info-button:hover { background: #e9dfff; }
#info-dialog { max-width: 450px; }

.employee-settings { margin-top: 12px; }

.topbar form { margin-left: 6px; }
.topbar #status { margin-left: auto; }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-panel { width: min(100%, 410px); margin: 0; padding: clamp(20px, 5vw, 36px); }
.login-panel .brand { margin: 0 0 22px; padding: 0; }
.login-panel h1 { font-size: 30px; }
.login-panel form { display: grid; gap: 10px; margin-top: 20px; }
.login-panel input { width: 100%; padding: 9px 10px; border: 1px solid #cdc5dc; border-radius: 7px; color: var(--ink); }
