:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172823;
  background: #f4f6f3;
  font-synthesis: none;
  --ink: #172823;
  --muted: #66756f;
  --line: #e2e8e1;
  --green: #23664c;
  --green-dark: #164733;
  --green-soft: #e9f2eb;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 14px; line-height: 1.55; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { touch-action: manipulation; }
button:disabled { cursor: wait; opacity: .55; }
fieldset:disabled button, fieldset:disabled input { cursor: not-allowed; }
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.035em; }
h1 { font-size: clamp(22px, 2.3vw, 30px); font-weight: 650; }
h2 { font-size: 23px; font-weight: 650; }
h3 { font-size: 17px; }
button, input, select, a, [tabindex] { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #8bba66; outline-offset: 4px; }

.page-shell { width: min(1280px, calc(100% - 80px)); margin: 0 auto; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 36px 0 20px; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand-mark { display: grid; place-items: center; flex: 0 0 48px; height: 48px; border-radius: 14px; color: #e0efbc; background: var(--ink); font-size: 27px; font-weight: 700; font-style: italic; }
.eyebrow { margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .16em; }
.brand .eyebrow { margin-bottom: 3px; }
.status-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid #cfdecf; border-radius: 999px; background: #edf3e9; color: #3b593a; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-badge > span { width: 6px; height: 6px; border-radius: 50%; background: #699451; }
.safety-note { padding-bottom: 24px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.message { margin-top: 22px; padding: 14px 17px; border: 1px solid #c4dace; border-radius: 10px; background: #eaf5ee; color: #215539; overflow-wrap: anywhere; }
.message:empty { display: none; }
.message.error, .message[data-type="error"], .message.is-error { border-color: #edc7be; background: #fff0ec; color: #903c2d; }
.message.success, .message[data-type="success"] { border-color: #c4dace; background: #eaf5ee; color: #215539; }
.message.info, .message[data-type="info"] { border-color: #d0dfe5; background: #edf4f7; color: #365965; }

.login-layout { display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: clamp(40px, 8vw, 110px); min-height: 590px; padding: 64px 42px 78px; }
.section-index { display: block; margin-bottom: 26px; color: var(--green); font-size: 11px; font-weight: 750; letter-spacing: .15em; }
.login-intro h2 { margin-bottom: 22px; font-size: clamp(30px, 3.4vw, 44px); line-height: 1.16; letter-spacing: -.045em; }
.login-intro > p { max-width: 390px; color: var(--muted); font-size: 15px; line-height: 1.75; }
.intro-detail { display: flex; align-items: flex-start; gap: 13px; max-width: 390px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.detail-marker { display: grid; place-items: center; flex: 0 0 29px; height: 29px; background: #e3eadc; border-radius: 50%; font-size: 17px; }
.intro-detail p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 3px 10px #17282303; overflow: hidden; }
.login-card { padding: 34px; box-shadow: 0 18px 46px #273b2607; }
.card-heading { padding: 26px 28px 23px; }
.card-heading > p:not(.eyebrow), .card-heading > div > p:not(.eyebrow) { margin-top: 11px; color: var(--muted); font-size: 13px; }
.login-card .card-heading { padding: 0 0 28px; }
.field { min-width: 0; margin-bottom: 23px; }
label, .group-label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 600; }
input, select { width: 100%; min-height: 45px; border: 1px solid #cfd9d1; border-radius: 8px; color: var(--ink); background: #fff; transition: border-color .15s, box-shadow .15s; }
input { padding: 10px 13px; }
input:hover, select:hover { border-color: #92ae9c; }
input:focus, select:focus { border-color: var(--green); }
input:disabled { background: #f5f7f4; color: var(--muted); }
input::placeholder { color: #8a9690; }
.field-help { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 13px; min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; font-weight: 650; line-height: 1.4; transition: background-color .15s, border-color .15s; }
.button-primary { color: #fff; background: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { color: var(--ink); background: #fff; border-color: #d6e0d7; }
.button-secondary:hover { border-color: #96ac9b; background: #f4f7f3; }
.button-quiet { color: var(--muted); background: transparent; }
.button-quiet:hover { color: var(--ink); background: #eaf0e8; }
.button-wide { width: 100%; justify-content: space-between; padding-right: 18px; padding-left: 18px; }

.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 30px 0 24px; }
.header-actions, .form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 24px; }
.summary-card { min-width: 0; padding: 22px 26px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.summary-card > p { color: var(--muted); font-size: 12px; font-weight: 550; }
.summary-card > strong { display: block; margin: 12px 0 6px; font-size: 36px; font-weight: 600; letter-spacing: -.05em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.summary-card > span { color: var(--muted); font-size: 11px; }
.summary-featured { border-color: #d8e6ca; background: #eaf0e1; }
.summary-featured > strong { color: #2f5038; }
.main-grid { display: grid; grid-template-columns: minmax(300px, .82fr) minmax(0, 1.3fr); align-items: start; gap: 24px; }
.settings-card form { padding: 0 28px 25px; }
.range-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.range-grid .field { margin: 0; }
.range-grid label { margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 400; }
.field-group { margin-bottom: 20px; }
.estimate-row { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 13px 14px; border-radius: 8px; background: #f1f5ef; font-size: 12px; }
.estimate-row strong { white-space: nowrap; color: var(--green); font-variant-numeric: tabular-nums; }
.counting-note { margin: 12px 0 24px; }
.settings-meta { display: grid; gap: 10px; margin: 0; padding: 20px 28px; border-top: 1px solid var(--line); background: #fcfdfb; font-size: 11px; }
.settings-meta > div { display: flex; justify-content: space-between; gap: 15px; }
.settings-meta dt { color: var(--muted); }
.settings-meta dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.select-field { flex: 0 0 110px; }
.select-field label { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
select { min-height: 37px; padding: 6px 10px; font-size: 12px; }
.preview-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 28px; padding: 18px 20px; border: 1px solid #e3eade; border-radius: 10px; background: #f7f9f3; }
.preview-summary > div { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 10px; row-gap: 3px; }
.preview-summary strong { font-size: 29px; font-weight: 600; line-height: 1.2; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.preview-summary span { color: var(--muted); font-size: 11px; }
.preview-summary .small-badge { padding: 4px 9px; border-radius: 5px; color: var(--green); background: #e4ecdf; font-size: 10px; font-weight: 650; }
.preview-caption { margin: 14px 28px 23px; color: var(--muted); font-size: 11px; }
.table-scroll { width: 100%; overflow: auto; overscroll-behavior: contain; }
.preview-scroll { max-height: 454px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: #f8faf7; font-size: 10px; font-weight: 650; }
th, td { padding: 14px 18px; border-bottom: 1px solid #edf0eb; }
th:first-child, td:first-child { padding-left: 28px; }
th:last-child, td:last-child { padding-right: 28px; }
th.numeric, td.numeric { text-align: right; }
tbody tr:hover { background: #fbfcf8; }
tbody tr:last-child td { border-bottom: 0; }
td.empty-state { padding: 42px 24px; text-align: center; color: #87948c; white-space: normal; }
.table-note { padding: 17px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.7; }
.history-card { margin-top: 24px; }
.history-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.history-heading > p { font-size: 11px !important; }
.conflict-panel { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 24px; padding: 22px 24px; border: 1px solid #e6d5a3; border-radius: 12px; background: #fff8e7; color: #745c20; }
.conflict-panel p { max-width: 740px; margin-top: 7px; font-size: 12px; }
.conflict-panel button { flex-shrink: 0; }
.page-footer { display: flex; justify-content: space-between; gap: 20px; padding: 27px 0 32px; margin-top: 36px; border-top: 1px solid var(--line); color: #859187; font-size: 10px; }
.page-footer > span { font-weight: 750; letter-spacing: .14em; }
.skip-link { position: fixed; left: 16px; top: -70px; z-index: 10; padding: 12px 16px; border-radius: 6px; color: #fff; background: var(--green-dark); }
.skip-link:focus { top: 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (min-width: 1500px) {
  .page-shell { width: min(1320px, calc(100% - 120px)); }
  .login-layout { min-height: 650px; }
}

@media (max-width: 1050px) {
  .page-shell { width: calc(100% - 48px); }
  .login-layout { gap: 40px; padding: 52px 8px 64px; }
  .login-card { padding: 26px; }
  .main-grid { grid-template-columns: minmax(280px, .85fr) minmax(0, 1fr); gap: 18px; }
  .card-heading { padding: 23px 22px 20px; }
  .settings-card form { padding: 0 22px 22px; }
  .settings-meta { padding: 19px 22px; }
  .preview-heading { align-items: flex-start; }
  .preview-heading h2 { font-size: 20px; }
  .preview-summary { margin: 0 22px; padding: 15px; }
  .preview-caption { margin-right: 22px; margin-left: 22px; }
  .preview-summary > div { display: block; }
  .preview-summary > div > span { display: block; margin-top: 5px; }
  .summary-card { padding: 20px; }
  .form-actions { align-items: stretch; }
  .form-actions .button { flex-grow: 1; }
}

@media (max-width: 760px) {
  .page-shell { width: calc(100% - 36px); }
  .page-header { padding-top: 24px; align-items: flex-start; flex-wrap: wrap; gap: 16px; }
  .brand-mark { flex-basis: 42px; height: 42px; border-radius: 12px; }
  .status-badge { padding: 6px 10px; font-size: 10px; }
  .safety-note { font-size: 12px; padding-bottom: 20px; }
  .login-layout { grid-template-columns: 1fr; gap: 32px; min-height: auto; padding: 38px 0 20px; }
  .section-index { margin-bottom: 18px; }
  .login-intro h2 { font-size: 34px; }
  .login-intro > p { max-width: 480px; font-size: 14px; }
  .intro-detail { display: none; }
  .login-card { width: 100%; max-width: 500px; }
  .workspace-heading { align-items: flex-start; flex-wrap: wrap; gap: 16px; }
  .workspace-heading h2 { font-size: 22px; }
  .header-actions { gap: 3px; }
  .summary-grid { gap: 10px; margin-bottom: 18px; }
  .summary-card { padding: 15px 12px; border-radius: 10px; }
  .summary-card > p { min-height: 35px; font-size: 10px; line-height: 1.5; }
  .summary-card > strong { margin: 9px 0; font-size: 27px; }
  .summary-card > span { display: block; font-size: 9px; line-height: 1.5; }
  .main-grid { grid-template-columns: 1fr; gap: 18px; }
  .settings-card form, .card-heading { padding-left: 22px; padding-right: 22px; }
  .preview-heading h2 { font-size: 22px; }
  .preview-summary > div { display: flex; }
  .preview-summary > div > span { margin-top: 0; }
  .preview-scroll { max-height: 405px; }
  .history-card { margin-top: 18px; }
  .history-heading { align-items: flex-start; flex-direction: column; gap: 0; }
  .conflict-panel { flex-direction: column; align-items: flex-start; gap: 15px; padding: 20px; }
  .conflict-panel button { max-width: 100%; }
  .page-footer { margin-top: 26px; padding: 23px 0; font-size: 9px; }
}

@media (max-width: 390px) {
  .page-shell { width: calc(100% - 28px); }
  .brand { gap: 11px; }
  h1 { font-size: 22px; }
  .login-intro h2 { font-size: 30px; }
  .login-card { padding: 23px; }
  .summary-card { padding: 14px 9px; }
  .summary-card > strong { font-size: 24px; }
  .preview-heading { flex-direction: column; }
  .select-field { flex: auto; width: 100%; }
  .preview-summary > div { display: block; }
  .settings-meta > div { flex-wrap: wrap; gap: 3px 10px; }
  .settings-meta dd { margin-left: auto; }
  .page-footer { flex-direction: column; gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
