:root {
  color-scheme: light;
  --bg: #f4f3ed;
  --surface: #ffffff;
  --surface-soft: #eeeee7;
  --text: #17211d;
  --muted: #65706b;
  --line: #dfe2dc;
  --green: #126b4f;
  --green-bright: #20c47a;
  --green-soft: #daf4e6;
  --amber: #b26a0b;
  --amber-soft: #fff0d6;
  --blue: #3264bd;
  --blue-soft: #e3ecff;
  --danger: #b73737;
  --danger-soft: #ffebeb;
  --shadow: 0 18px 55px rgba(28, 49, 41, .09);
  --radius-lg: 28px;
  --radius-md: 18px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1411;
  --surface: #14201c;
  --surface-soft: #1b2924;
  --text: #edf6f1;
  --muted: #a0b0a8;
  --line: #2a3a34;
  --green: #36d38c;
  --green-bright: #46e59c;
  --green-soft: #173d2d;
  --amber: #ffc365;
  --amber-soft: #3b2c16;
  --blue: #8db3ff;
  --blue-soft: #1c3154;
  --danger: #ff8888;
  --danger-soft: #432424;
  --shadow: 0 22px 60px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 0; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; transition: background .2s, color .2s; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--green) 55%, transparent); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .45; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 5vw, 72px); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); position: relative; z-index: 3; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-weight: 800; font-size: 1.13rem; text-decoration: none; letter-spacing: -.02em; }
.brand__mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--green); color: var(--bg); font-size: 1.05rem; }
.topbar__actions { display: flex; gap: 9px; }
.icon-button, .text-button { min-height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 13px; cursor: pointer; }
.icon-button { width: 44px; font-size: 1.2rem; }
.text-button { padding: 0 15px; font-weight: 650; }

.app-shell { width: min(1380px, calc(100% - 40px)); margin: 0 auto; display: grid; grid-template-columns: minmax(360px, .82fr) minmax(520px, 1.18fr); gap: clamp(36px, 7vw, 108px); padding: clamp(38px, 6vw, 80px) 0 72px; align-items: start; }
.summary-panel { position: sticky; top: 30px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 13px; color: var(--green); text-transform: uppercase; font-size: .75rem; font-weight: 800; letter-spacing: .13em; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-bright); box-shadow: 0 0 0 5px var(--green-soft); }
.hero-card { min-height: 285px; padding: clamp(28px, 4vw, 48px); border-radius: var(--radius-lg); background: linear-gradient(145deg, #116d50, #084a38); color: #fff; display: flex; flex-direction: column; justify-content: center; box-shadow: 0 24px 65px rgba(10, 91, 65, .22); overflow: hidden; position: relative; }
.hero-card::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.07); right: -70px; top: -90px; }
.hero-card--error { background: linear-gradient(145deg, #9b3434, #6f2020); }
.hero-card__label { margin: 0 0 8px; font-weight: 700; opacity: .75; }
.hero-card__time { margin: 0; font-size: clamp(2.5rem, 6vw, 5.5rem); font-weight: 850; line-height: 1; letter-spacing: -.065em; max-width: 100%; }
.hero-card__message { margin: 19px 0 0; max-width: 36ch; color: rgba(255,255,255,.78); line-height: 1.55; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.metric-card { min-width: 0; padding: 17px 14px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-md); display: flex; gap: 11px; align-items: flex-start; }
.metric-card__icon { flex: 0 0 auto; width: 31px; height: 31px; border-radius: 10px; display: grid; place-items: center; font-weight: 850; }
.metric-card__icon--green { color: var(--green); background: var(--green-soft); }
.metric-card__icon--amber { color: var(--amber); background: var(--amber-soft); }
.metric-card__icon--blue { color: var(--blue); background: var(--blue-soft); }
.metric-card__label, .metric-card small { display: block; color: var(--muted); font-size: .72rem; }
.metric-card strong { display: block; margin-top: 3px; font-size: clamp(.86rem, 1.3vw, 1rem); white-space: nowrap; }
.metric-card small { margin-top: 3px; line-height: 1.25; }
.metric-card--warning { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.privacy-note { margin: 19px 4px 0; display: flex; gap: 11px; color: var(--muted); font-size: .83rem; line-height: 1.45; }
.privacy-note p { margin: 0; }

.entry-panel { min-width: 0; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.section-heading .eyebrow { margin-bottom: 7px; }
h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.7rem); line-height: 1.05; letter-spacing: -.055em; max-width: 650px; }
.section-heading time { color: var(--muted); white-space: nowrap; font-weight: 650; }
.target-card { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius-lg); padding: clamp(20px, 3vw, 29px); }
.field-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.field-heading > div > label { font-weight: 800; font-size: 1.1rem; }
.field-heading p, .blocks-heading p { margin: 5px 0 0; color: var(--muted); font-size: .86rem; }
.target-inputs { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.4rem; }
.target-inputs label { position: relative; display: flex; align-items: center; }
.target-inputs input { width: 82px; height: 54px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface-soft); padding: 8px 34px 8px 12px; font-weight: 800; font-size: 1.25rem; }
.target-inputs small { position: absolute; right: 9px; color: var(--muted); font-size: .63rem; font-weight: 700; pointer-events: none; }
.preset-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 21px; }
.preset-list button { flex: 1 1 66px; min-height: 44px; border: 1px solid var(--line); background: var(--surface-soft); border-radius: 12px; cursor: pointer; font-weight: 750; }
.preset-list button.active { background: var(--green); color: #fff; border-color: var(--green); }
.blocks-heading { display: flex; align-items: center; justify-content: space-between; margin: 35px 2px 15px; gap: 18px; }
h2 { margin: 0; font-size: 1.15rem; }
.auto-badge, .running-badge { padding: 6px 10px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.running-badge span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; background: var(--green-bright); }
.blocks-list { display: grid; gap: 12px; }
.work-block { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-md); padding: 18px; }
.work-block--error { border-color: var(--danger); }
.work-block__top { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.block-number { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-soft); color: var(--muted); font-size: .77rem; font-weight: 850; }
.work-block h3 { margin: 0; font-size: .92rem; }
.running-badge { margin-left: auto; }
.remove-button { width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); border-radius: 10px; cursor: pointer; font-size: 1.45rem; }
.remove-button:not(:disabled):hover { background: var(--danger-soft); color: var(--danger); }
.time-fields { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 13px; }
.time-fields > label { min-width: 0; font-size: .75rem; color: var(--muted); font-weight: 700; }
.time-control { display: flex; margin-top: 6px; }
.time-control input { min-width: 0; width: 100%; height: 48px; padding: 0 10px; border: 1px solid var(--line); border-radius: 12px 0 0 12px; background: var(--surface-soft); color: var(--text); font-weight: 750; }
.time-control button { min-height: 48px; padding: 0 11px; border: 1px solid var(--line); border-left: 0; border-radius: 0 12px 12px 0; background: var(--surface); color: var(--green); cursor: pointer; font-size: .72rem; font-weight: 800; }
.time-arrow { padding-bottom: 13px; color: var(--muted); }
.block-error { margin: 12px 0 0; color: var(--danger); font-size: .78rem; font-weight: 650; }
.error-banner { margin-bottom: 12px; padding: 13px 15px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-size: .85rem; }
.add-button { width: 100%; min-height: 52px; margin-top: 12px; border: 1px dashed color-mix(in srgb, var(--green) 50%, var(--line)); border-radius: 15px; background: transparent; color: var(--green); cursor: pointer; font-weight: 800; }
.rule-note { display: flex; gap: 12px; align-items: flex-start; margin-top: 22px; padding: 17px; border-radius: 15px; background: var(--surface-soft); color: var(--muted); font-size: .8rem; line-height: 1.5; }
.rule-note > span { display: grid; place-items: center; width: 23px; height: 23px; flex: 0 0 auto; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 900; }
.rule-note p { margin: 0; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 1fr; width: min(760px, calc(100% - 32px)); gap: 38px; }
  .summary-panel { position: static; }
}
@media (max-width: 620px) {
  .topbar { height: 66px; padding: 0 16px; }
  .text-button { padding: 0 10px; font-size: .8rem; }
  .app-shell { width: min(100% - 24px, 760px); padding-top: 25px; }
  .hero-card { min-height: 235px; }
  .hero-card__time { font-size: clamp(2.4rem, 13vw, 4.2rem); overflow-wrap: anywhere; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { align-items: center; }
  .section-heading { align-items: flex-start; }
  .section-heading time { font-size: .76rem; padding-top: 6px; }
  .field-heading { align-items: flex-start; flex-direction: column; }
  .target-inputs { width: 100%; }
  .target-inputs label { flex: 1; }
  .target-inputs input { width: 100%; }
  .time-fields { grid-template-columns: 1fr; gap: 10px; }
  .time-arrow { display: none; }
  .running-badge { font-size: .62rem; }
}
@media (max-width: 340px) {
  .topbar { padding: 0 10px; }
  .brand > span:last-child { display: none; }
  .app-shell { width: calc(100% - 16px); }
  .section-heading time, .auto-badge { display: none; }
  .hero-card { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
