@import url("tokens.css");

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, .panel-scroll:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.workspace {
  max-width: 1036px;
  margin: 0 auto;
  padding: 28px 28px 12px;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 23px;
}

.workspace-title h1 {
  margin: 0 0 5px;
  font-size: clamp(24px, 3.5vw, 40px);
  line-height: 1.12;
  font-weight: 760;
  letter-spacing: -.045em;
}
.workspace-title p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.4; }

.view-picker {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
}
.view-picker button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  padding: 0 13px;
  white-space: nowrap;
  background: none;
  font-size: 13px;
  font-weight: 600;
}
.view-picker button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.view-picker button[aria-pressed="false"]:hover { background: var(--selected); }

.comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 428px)); gap: 28px; justify-content: center; }
.comparison:not([data-layout="compare"]) { grid-template-columns: minmax(0, 428px); }
.variant { min-width: 0; }
.variant-title { margin: 0 0 10px; font-size: 17px; line-height: 1.25; font-weight: 720; letter-spacing: -.025em; }

.surface {
  display: flex;
  flex-direction: column;
  height: clamp(510px, calc(100dvh - 172px), 835px);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--screen);
  box-shadow: 0 5px 20px #1c382607;
}

.app-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px 14px;
  background: var(--header);
}
.app-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--accent-text);
  background: var(--accent);
}
.app-mark svg { width: 25px; height: 25px; }
.app-header strong { display: block; font-size: 20px; font-weight: 780; line-height: 1.15; letter-spacing: -.035em; }
.app-header span:not(.app-mark) { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.25; }

.panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 18px 18px 0 0;
  padding: 16px 15px 18px;
  scrollbar-width: thin;
  scrollbar-color: #aabdb0 transparent;
  scroll-padding: 10px;
}
.panel-scroll:focus-visible { outline-offset: -2px; }

.progress { margin: 1px 2px 16px; }
.progress-bars { margin: 0; padding: 0; display: flex; gap: 7px; list-style: none; }
.progress-bars li { flex: 1; height: 5px; border-radius: 10px; background: var(--border); }
.progress-bars li.is-current, .progress-bars li.is-complete { background: var(--green); }
.progress-caption { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.order-form { display: grid; gap: 9px; }
.form-section { min-width: 0; }
.section-title, .state-title {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 760;
  line-height: 1.17;
  letter-spacing: -.033em;
}
.form-card {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--separator);
  border-radius: var(--card-radius);
  background: var(--paper);
}
.single-app .form-section {
  padding: 7px;
  border: 1px solid var(--separator);
  border-radius: var(--card-radius);
  background: var(--paper);
}
.single-app[data-stage="form"] .panel-scroll { padding-top: 10px; }
.single-app .order-form { gap: 7px; }
.single-app .form-section .choices { gap: 2px; }
.single-app .form-section .choices--bags { gap: 8px; }
.single-app .section-title { margin: 0 0 6px 2px; font-size: 16px; font-weight: 760; letter-spacing: -.02em; }
.single-app .form-section .form-card { padding: 0; border: 0; border-radius: 0; background: none; }

.address-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.field { display: grid; gap: 3px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field > span:first-child, .week-label { font-weight: 580; font-size: 13px; line-height: 1.22; }
.field input, .field select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background-color: var(--paper);
  padding: 7px 9px;
  font-size: 16px;
  line-height: 1.25;
}
.address-fields .field {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  gap: 0;
}
.address-fields .field > span:first-child { position: absolute; top: 5px; left: 9px; color: var(--muted); pointer-events: none; font-size: 11px; }
.address-fields .field input, .address-fields .field select { padding: 18px 9px 3px; border: 0; background: transparent; }
.address-fields .field:focus-within { box-shadow: 0 0 0 2px var(--focus); border-color: transparent; }
.address-fields .field input:focus-visible, .address-fields .field select:focus-visible { outline: none; }
.address-fields .field:has([aria-invalid="true"]), .field [aria-invalid="true"] { border-color: var(--error); }
.field-error, .form-error { margin: 3px 0 0; color: var(--error); font-size: 13px; line-height: 1.35; }
.address-fields .field-error { padding: 0 9px 6px; }
.field-error:empty, .form-error:empty { display: none; }

.note { display: flex; align-items: flex-start; gap: 8px; margin: 11px 1px 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.note svg { flex: 0 0 auto; width: 17px; height: 17px; }
.single-app .address-note { margin: 7px 1px 0; font-size: 11px; }
.single-app .address-note svg { width: 14px; height: 14px; }

.choices { display: grid; gap: 4px; min-width: 0; }
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  padding: 5px 8px;
  cursor: pointer;
}
.choice input, .day input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice:has(input:focus-visible), .day:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.choice:has(input:checked) { border-color: var(--green); background: var(--selected); }
.radio-dot {
  display: block;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 1px solid #61756a;
  border-radius: 50%;
  background: var(--paper);
}
.choice:has(input:checked) .radio-dot { border: 1px solid var(--green); box-shadow: inset 0 0 0 3px var(--paper); background: var(--green); }
.choice-text { min-width: 0; font-size: 14px; line-height: 1.2; }
.choice-text small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.2; }
.choices--bags { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bag-choice { min-height: 61px; border-color: var(--border); gap: 8px; }
.bag-choice:has(input:checked) { border-color: var(--green); }
.bag-choice svg { flex: 0 0 auto; width: 21px; height: 21px; color: var(--green); }
.bag-choice strong { display: block; margin-top: 3px; color: var(--green); font-size: 16px; font-weight: 760; }

.dependent { margin-top: 9px; border-top: 1px solid var(--separator); padding-top: 9px; }
.time-fields { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 8px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 6px 0 8px; }
.day {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 3px 1px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
.day:has(input:checked) { border-color: var(--green); background: var(--selected); font-weight: 730; }
.balance-info { margin: 8px 0 0; padding: 8px 9px; border-radius: 8px; font-size: 13px; line-height: 1.32; }
.balance-info.is-error { color: var(--error); background: var(--error-bg); }
.balance-info:not(.is-error) { color: var(--muted); background: var(--selected); }

.app-footer {
  flex: 0 0 auto;
  padding: 11px 14px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  border-radius: 17px 17px 0 0;
  background: var(--paper);
  box-shadow: 0 -3px 12px #1e382805;
}
.cost-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 1px 8px; font-size: 14px; line-height: 1.2; }
.cost-line strong { flex: 0 0 auto; font-size: 22px; font-weight: 780; letter-spacing: -.04em; }
.form-error { margin: 0 1px 8px; }
.footer-actions { display: flex; gap: 8px; }
.primary, .back {
  min-height: 47px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 8px 12px;
  text-wrap: balance;
  font-size: 14px;
  font-weight: 720;
  line-height: 1.2;
}
.primary { flex: 1 1 auto; background: var(--green); color: var(--button-text); }
.primary:hover { background: var(--green-hover); }
.back { color: var(--green); background: var(--screen); border-color: var(--border); }
.back:hover { background: var(--selected); }

.state-title:focus, .section-title:focus { outline: none; }
.state-title { margin: 3px 0 15px; }
.summary-card { margin: 0; padding: 0 10px; }
.summary-row {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px 0;
}
.summary-row:not(:last-child) { border-bottom: 1px solid var(--separator); }
.summary-row > svg { width: 21px; height: 21px; color: var(--green); }
.summary-row dt { margin-bottom: 3px; color: var(--muted); font-size: 12px; line-height: 1.25; }
.summary-row dd { margin: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 690; line-height: 1.31; }
.summary-row dd small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 500; }
.summary-row button { min-height: 44px; border: 0; border-radius: 7px; background: none; padding: 2px 5px; color: var(--green); font-size: 12px; font-weight: 670; }
.summary-row button:hover { background: var(--selected); }
.summary-total { display: flex; justify-content: space-between; gap: 8px; margin: 10px 0 0; padding: 11px 12px; font-size: 16px; font-weight: 730; }
.summary-total strong { flex: 0 0 auto; font-size: 20px; letter-spacing: -.03em; }
.result-mark { display: grid; place-items: center; width: 48px; height: 48px; margin: 3px 0 12px; border: 1px solid var(--border); border-radius: 13px; color: var(--success); background: var(--success-bg); }
.result-mark svg { width: 25px; height: 25px; }
.result-intro { margin: -7px 0 13px; font-size: 14px; color: var(--muted); }
.result-restart { margin-top: 12px; }

.workspace-footer { display: flex; justify-content: center; padding-top: 3px; }
.reset { min-height: 44px; padding: 4px 10px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 13px; text-underline-offset: 3px; text-decoration: underline; }
.reset:hover { color: var(--green); }
.workspace-footer a.reset { display: inline-grid; align-items: center; }

@media (max-width: 820px) {
  .workspace { max-width: 510px; padding: 15px 16px 5px; }
  .workspace-header { display: block; margin-bottom: 10px; }
  .workspace-title p { margin-bottom: 10px; font-size: 13px; }
  .view-picker { display: flex; width: 100%; }
  .view-picker button { flex: 1; min-height: 40px; }
  .view-picker button[data-view="compare"] { display: none; }
  .comparison { grid-template-columns: minmax(0, 428px); gap: 0; }
  .variant-title { margin-bottom: 6px; font-size: 14px; }
  .surface { height: clamp(492px, calc(100dvh - 176px), 806px); border-radius: 17px; }
  .app-header { padding: 9px 12px 10px; }
  .app-mark { width: 37px; height: 37px; }
  .app-mark svg { width: 22px; height: 22px; }
  .app-header strong { font-size: 18px; }
  .panel-scroll { padding: 13px 11px 15px; }
  .section-title, .state-title { font-size: 22px; }
  .app-footer { padding-inline: 11px; }
}

@media (max-width: 360px) {
  .workspace { padding-inline: 10px; }
  .choice { gap: 6px; padding-inline: 6px; }
  .bag-choice svg { width: 17px; height: 17px; }
  .choice-text { font-size: 13px; }
  .summary-row { grid-template-columns: 20px minmax(0, 1fr) auto; gap: 6px; }
}
