:root {
  --paper: #f5f3ee;
  --paper-deep: #ebe8df;
  --ink: #1f2524;
  --muted: #727b76;
  --line: #d9d8cf;
  --card: #fffefa;
  --green: #2d7962;
  --green-dark: #1d5949;
  --green-soft: #dcefe5;
  --orange: #d97e4f;
  --orange-soft: #f8e5da;
  --yellow: #e2b852;
  --shadow: 0 16px 40px rgba(37, 48, 44, 0.06);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "DM Sans", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 1420px; margin: 0 auto; padding: 0 40px; }
.topbar { height: 78px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 11px; font-family: "Space Grotesk", sans-serif; font-weight: 700; letter-spacing: -0.03em; }
.brand-mark { width: 29px; height: 29px; border-radius: 9px; display: grid; place-items: center; background: var(--green); color: white; font: 600 11px "DM Mono", monospace; letter-spacing: -0.08em; }
.topbar-meta { display: flex; gap: 10px; align-items: center; color: var(--muted); font: 10px "DM Mono", monospace; text-transform: uppercase; letter-spacing: 0.04em; }
.status-dot { height: 7px; width: 7px; border-radius: 50%; background: #5bad81; box-shadow: 0 0 0 4px #dcefe5; }
.status-dot[data-state="connecting"], .status-dot[data-state="saving"] { background: var(--yellow); box-shadow: 0 0 0 4px #f4eed3; }
.status-dot[data-state="device"], .status-dot[data-state="error"] { background: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft); }
.sync-status { transition: color 160ms ease; }
.sync-status[data-state="synced"] { color: var(--green); }
.sync-status[data-state="error"] { color: #ae6947; }
.divider { height: 12px; width: 1px; background: var(--line); margin: 0 3px; }
.intro-grid { min-height: 320px; display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 80px; align-items: center; padding: 57px 0 48px; }
.eyebrow, .section-kicker, .profile-type { color: var(--green); font: 500 10px "DM Mono", monospace; letter-spacing: 0.12em; margin: 0 0 13px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Space Grotesk", sans-serif; letter-spacing: -0.055em; }
h1 { font-size: clamp(46px, 5vw, 72px); line-height: 0.97; max-width: 720px; margin-bottom: 23px; }
h1 em, h2 em { color: var(--green); font-style: normal; }
.intro-text { max-width: 540px; color: #66706b; font-size: 16px; line-height: 1.55; margin-bottom: 24px; }
.logic-pills { display: flex; flex-wrap: wrap; gap: 9px; }
.logic-pills span { background: var(--paper-deep); border-radius: 99px; padding: 8px 12px; color: #69726c; font: 10px "DM Mono", monospace; text-transform: uppercase; letter-spacing: 0.04em; }
.logic-pills b { color: var(--orange); margin-right: 5px; }
.method-card { align-self: center; background: var(--green-dark); color: #f4fbf6; border-radius: 18px; padding: 26px 28px 27px; max-width: 370px; justify-self: end; box-shadow: 0 17px 35px rgba(29, 89, 73, 0.15); }
.method-topline { display: flex; align-items: center; gap: 10px; color: #a9d8c0; font: 500 10px "DM Mono", monospace; letter-spacing: 0.1em; margin-bottom: 22px; }
.mini-icon { background: #346f5d; color: #d8f1e4; border-radius: 8px; width: 26px; height: 26px; display: grid; place-items: center; font-size: 17px; }
.method-card p { color: #d4e9dd; font-size: 14px; line-height: 1.55; margin-bottom: 21px; }
.method-card a { color: #b7e3ca; font: 11px "DM Mono", monospace; text-decoration: none; }
.method-card a span { color: #fff; margin-left: 5px; }
.workspace { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: stretch; }
.panel { background: var(--card); border: 1px solid rgba(217, 216, 207, 0.8); border-radius: var(--radius); box-shadow: var(--shadow); }
.exercise-panel { padding: 25px 18px 18px; }
.panel-heading, .selected-header, .block-heading, .result-card-top, .dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.panel-heading h2, .selected-header h2, .how-heading h2, .dialog-header h2 { font-size: 28px; margin-bottom: 0; }
.icon-button { border: 0; background: var(--green-soft); color: var(--green-dark); width: 32px; height: 32px; border-radius: 10px; font-size: 22px; line-height: 1; }
.icon-button:hover { background: #c8e6d7; }
.search-wrap { margin: 23px 0 14px; height: 39px; display: flex; gap: 9px; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.search-wrap input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.filter-row { display: flex; gap: 5px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.filter-button { background: transparent; border: 1px solid transparent; color: var(--muted); padding: 6px 8px; border-radius: 7px; font: 10px "DM Mono", monospace; }
.filter-button:hover, .filter-button.is-active { color: var(--green-dark); background: var(--green-soft); }
.exercise-list { display: grid; gap: 4px; padding-top: 13px; }
.exercise-item { border: 0; background: transparent; text-align: left; border-radius: 11px; padding: 10px 10px; display: flex; gap: 11px; align-items: center; transition: background 120ms ease, transform 120ms ease; }
.exercise-item:hover { background: #f2f1eb; transform: translateX(2px); }
.exercise-item.is-selected { background: var(--green-dark); color: #fff; }
.exercise-item.is-selected .exercise-meta, .exercise-item.is-selected .exercise-type { color: #afd6bf; }
.exercise-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; color: var(--green-dark); background: var(--green-soft); font-size: 14px; }
.exercise-item.is-selected .exercise-icon { background: #3b816a; color: #e4f6ea; }
.exercise-name { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.exercise-meta { color: var(--muted); font: 9px "DM Mono", monospace; text-transform: uppercase; letter-spacing: 0.03em; }
.exercise-type { margin-left: auto; color: #a0a8a2; font: 9px "DM Mono", monospace; }
.empty-state { color: var(--muted); font-size: 13px; padding: 18px 10px; }
.calculator-panel { padding: 33px 36px 30px; min-width: 0; }
.selected-label { display: flex; align-items: center; gap: 7px; color: var(--green); font: 500 10px "DM Mono", monospace; letter-spacing: 0.08em; margin-bottom: 10px; }
.category-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.selected-header h2 { font-size: 38px; margin-bottom: 7px; }
.selected-header p { color: var(--muted); font-size: 13px; margin: 0; }
.unit-toggle { border-radius: 9px; border: 1px solid var(--line); padding: 3px; display: flex; gap: 2px; }
.unit-button { border: 0; background: transparent; color: var(--muted); border-radius: 6px; padding: 6px 9px; font: 10px "DM Mono", monospace; }
.unit-button.is-active { background: var(--ink); color: #fff; }
.recommendation-strip { margin-top: 30px; border-radius: 13px; background: #f0f6f1; border: 1px solid #d6e9dc; padding: 16px 19px; display: grid; grid-template-columns: auto auto 1fr; align-items: center; column-gap: 17px; }
.strip-label { color: var(--green); font: 10px "DM Mono", monospace; letter-spacing: 0.1em; }
.range-main { display: flex; align-items: baseline; gap: 6px; color: var(--green-dark); }
.range-main strong { font: 600 27px "Space Grotesk", sans-serif; letter-spacing: -0.06em; }
.range-main span, .strip-note { color: var(--muted); font-size: 12px; }
.strip-note { justify-self: end; }
.input-block { margin-top: 30px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.block-heading { align-items: end; margin-bottom: 17px; }
.block-heading h3 { font-size: 21px; margin: 0; }
.soft-label { background: var(--orange-soft); color: #ae6947; border-radius: 99px; padding: 7px 10px; font: 9px "DM Mono", monospace; white-space: nowrap; }
.input-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.field { display: grid; gap: 7px; color: var(--muted); font: 10px "DM Mono", monospace; }
.field small { color: #9ca49e; font-size: 9px; }
.field input, .field select { width: 100%; border: 1px solid var(--line); background: #fbfaf6; color: var(--ink); outline: 0; border-radius: 9px; padding: 12px 11px; font: 500 17px "Space Grotesk", sans-serif; appearance: none; }
.field select { font-size: 12px; padding: 14px 10px; }
.field input:focus, .field select:focus { border-color: var(--green); box-shadow: 0 0 0 3px #dcefe5; }
.increment-row { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; }
.increment-field { display: flex; align-items: center; gap: 8px; color: var(--muted); font: 10px "DM Mono", monospace; }
.increment-field select { border: 0; color: var(--green-dark); background: transparent; font: 500 10px "DM Mono", monospace; outline: 0; }
.text-button { border: 0; background: transparent; color: var(--green); font: 10px "DM Mono", monospace; padding: 5px 0; }
.text-button:hover { color: var(--orange); }
.result-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 12px; margin-top: 24px; }
.result-card { border-radius: 14px; padding: 19px 20px 17px; min-height: 160px; }
.primary-result { background: var(--green-dark); color: white; }
.estimate-result { border: 1px solid var(--line); background: #fbfaf6; }
.result-card .section-kicker { margin: 0; color: #aad6bb; }
.estimate-result .section-kicker { color: var(--green); }
.confidence-chip, .formula-badge { border-radius: 99px; padding: 5px 7px; font: 9px "DM Mono", monospace; }
.confidence-chip { background: rgba(255,255,255,0.12); color: #cae8d6; }
.formula-badge { background: var(--paper-deep); color: var(--muted); }
.big-result, .medium-result { display: flex; align-items: baseline; gap: 6px; font-family: "Space Grotesk", sans-serif; letter-spacing: -0.07em; }
.big-result { margin-top: 13px; font-size: 57px; line-height: 0.95; }
.medium-result { color: var(--ink); margin-top: 13px; font-size: 44px; line-height: 0.95; }
.big-result small, .medium-result small { font: 500 14px "DM Mono", monospace; letter-spacing: 0; }
.result-card p { margin: 9px 0 0; font-size: 11px; color: #a8cdb6; }
.estimate-result p { color: var(--muted); }
.result-footnote { border-top: 1px solid rgba(255,255,255,0.14); margin-top: 16px; padding-top: 11px; display: flex; gap: 8px; align-items: center; color: #c7e3d0; font-size: 10px; }
.accent-check { color: #e5bc56; font-size: 13px; }
.meter { height: 5px; margin-top: 18px; background: #e6e5df; border-radius: 99px; overflow: hidden; }
.meter span { height: 100%; display: block; background: var(--orange); border-radius: inherit; transition: width 220ms ease; }
.meter-labels { display: flex; justify-content: space-between; margin-top: 7px; color: #969e98; font: 9px "DM Mono", monospace; }
.adjustment-message { min-height: 28px; margin: 13px 3px 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.adjustment-message strong { color: var(--green-dark); }
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; margin-top: 20px; }
.profile-card { min-height: 165px; padding: 21px 21px 20px; border-radius: 15px; position: relative; overflow: hidden; display: grid; grid-template-columns: auto 1fr auto; gap: 15px; }
.profile-heavy { background: #f7e9df; }
.profile-accessory { background: #e6f1e7; }
.profile-isolation { background: #f4eed3; }
.profile-number { color: rgba(31,37,36,0.32); font: 11px "DM Mono", monospace; }
.profile-type { margin-bottom: 8px; color: #ae6947; font-size: 9px; }
.profile-accessory .profile-type { color: var(--green); }
.profile-isolation .profile-type { color: #9d7c25; }
.profile-card h3 { font-size: 20px; margin-bottom: 7px; }
.profile-card p:not(.profile-type) { max-width: 260px; color: #69716c; font-size: 11px; line-height: 1.45; margin: 0; }
.profile-range { align-self: start; color: rgba(31,37,36,0.68); font: 600 23px "Space Grotesk", sans-serif; }
.how-section { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 80px; padding: 90px 28px 78px; }
.how-heading h2 { font-size: 38px; line-height: 1; }
.how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding-top: 16px; }
.how-steps article { border-top: 2px solid var(--green); padding-top: 14px; }
.step-index { color: var(--orange); font: 10px "DM Mono", monospace; }
.how-steps h3 { font-size: 21px; margin: 19px 0 9px; }
.how-steps p { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 0; }
.footer { border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; padding: 20px 0 28px; color: #939a95; font: 10px "DM Mono", monospace; }
.add-dialog { border: 0; border-radius: 18px; width: min(420px, calc(100% - 32px)); padding: 26px; background: var(--card); color: var(--ink); box-shadow: 0 24px 80px rgba(25, 35, 30, 0.24); }
.add-dialog::backdrop { background: rgba(28, 36, 32, 0.35); backdrop-filter: blur(3px); }
.dialog-header { align-items: center; margin-bottom: 23px; }
.dialog-header h2 { font-size: 26px; }
.close-button { border: 0; background: var(--paper-deep); color: var(--muted); width: 30px; height: 30px; border-radius: 9px; font-size: 22px; line-height: 1; }
.add-dialog .field { margin-top: 14px; }
.dialog-actions { display: flex; justify-content: end; gap: 9px; margin-top: 25px; }
.primary-button, .secondary-button { border-radius: 9px; padding: 11px 14px; font: 11px "DM Mono", monospace; }
.primary-button { border: 1px solid var(--green-dark); background: var(--green-dark); color: white; }
.secondary-button { border: 1px solid var(--line); background: transparent; color: var(--muted); }

@media (max-width: 1020px) {
  .app-shell { padding: 0 22px; }
  .intro-grid { gap: 35px; }
  .workspace { grid-template-columns: 290px 1fr; }
  .calculator-panel { padding: 27px 25px; }
  .input-grid { grid-template-columns: repeat(2, 1fr); }
  .how-section { gap: 35px; padding-left: 5px; padding-right: 5px; }
}
@media (max-width: 760px) {
  .topbar { height: 66px; }
  .topbar-meta span:not(.status-dot):not(.sync-status) { display: none; }
  .sync-status { max-width: 118px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .intro-grid, .workspace, .profile-grid, .how-section { grid-template-columns: 1fr; }
  .intro-grid { padding: 46px 0 32px; gap: 28px; }
  .method-card { justify-self: stretch; max-width: none; }
  .workspace { gap: 14px; }
  .exercise-panel { padding-bottom: 13px; }
  .exercise-list { max-height: 300px; overflow: auto; }
  .selected-header h2 { font-size: 31px; }
  .recommendation-strip { grid-template-columns: 1fr auto; row-gap: 7px; }
  .strip-note { grid-column: 1 / -1; justify-self: start; }
  .result-grid { grid-template-columns: 1fr; }
  .profile-card { min-height: auto; }
  .how-section { gap: 25px; padding: 60px 4px; }
  .how-steps { grid-template-columns: 1fr; gap: 24px; }
  .footer { flex-direction: column; }
}
@media (max-width: 440px) {
  .app-shell { padding: 0 14px; }
  h1 { font-size: 46px; }
  .calculator-panel { padding: 23px 17px; }
  .input-grid { gap: 8px; }
  .field input { font-size: 15px; }
  .soft-label { white-space: normal; text-align: right; max-width: 115px; }
  .profile-card { grid-template-columns: auto 1fr; }
  .profile-range { grid-column: 2; margin-top: -11px; }
}
