:root {
  --ink: #17201c;
  --muted: #66716b;
  --paper: #f6f4ee;
  --panel: #fffefa;
  --line: #dcded7;
  --green: #176b4d;
  --green-dark: #0d5038;
  --mint: #d9eee4;
  --red: #c9453a;
  --amber: #b86b16;
  --shadow: 0 18px 50px rgba(27, 48, 38, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 8%, rgba(214, 235, 224, .8), transparent 24rem),
    var(--paper);
  font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
.shell { width: min(1120px, calc(100% - 36px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid rgba(23, 32, 28, .1); background: rgba(246, 244, 238, .82); backdrop-filter: blur(12px); }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.header-actions form { margin: 0; }
.logout-button { padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: .78rem; }
.logout-button:hover { border-color: var(--green); color: var(--green); }
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); font-weight: 800; text-decoration: none; letter-spacing: -.02em; }
.brand-icon, .primary-button span { color: var(--red); animation: pulse 2s infinite; }
.timezone { color: var(--muted); font-size: .84rem; }
.hero { padding: 76px 0 44px; max-width: 780px; }
.eyebrow, .step { margin: 0 0 8px; color: var(--green); font-size: .75rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(3rem, 8vw, 6.5rem); line-height: .92; letter-spacing: -.07em; }
h1 span { color: var(--green); }
.hero > p:last-child { max-width: 600px; margin-top: 24px; color: var(--muted); font-size: 1.12rem; }
.alert { margin-bottom: 20px; padding: 14px 18px; border: 1px solid #efaaa4; border-radius: 12px; background: #fff0ef; color: #7f221b; }
.panel { padding: clamp(22px, 4vw, 46px); border: 1px solid var(--line); border-radius: 24px; background: rgba(255, 254, 250, .94); box-shadow: var(--shadow); }
.panel-heading, .section-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
h2 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.5rem); letter-spacing: -.045em; }
.limit { padding: 7px 12px; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: .78rem; font-weight: 700; }
fieldset { min-width: 0; margin: 38px 0 0; padding: 0 0 34px; border: 0; border-bottom: 1px solid var(--line); }
legend { margin-bottom: 18px; font-weight: 800; }
.station-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.station-card { position: relative; min-height: 94px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; text-align: center; font-size: .82rem; font-weight: 750; transition: .15s ease; }
.station-card:hover { transform: translateY(-2px); border-color: #9bbbac; }
.station-card:has(input:checked) { border-color: var(--green); background: var(--mint); box-shadow: inset 0 0 0 1px var(--green); }
.station-card input, .mode-switch input { position: absolute; opacity: 0; pointer-events: none; }
.station-mark { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-size: .72rem; font-weight: 900; }
.station-card .station-logo { width: 48px !important; height: 48px !important; min-width: 48px; max-width: 48px; min-height: 48px; max-height: 48px; flex: 0 0 48px; overflow: hidden; border-radius: 10px; background: white; border: 1px solid rgba(23, 32, 28, .08); }
.station-grid .station-logo img { display: block !important; width: 100% !important; height: 100% !important; min-width: 0 !important; min-height: 0 !important; max-width: 48px !important; max-height: 48px !important; margin: 0 !important; padding: 3px !important; position: static !important; object-fit: contain !important; object-position: center !important; }
.saved-station { border-style: dashed; }
.custom-card .station-mark { background: var(--green); font-size: 1.4rem; }
.custom-fields, .time-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; padding: 20px; border-radius: 14px; background: #edf4f0; }
label { display: block; font-size: .88rem; font-weight: 700; }
.hint { color: var(--muted); font-weight: 400; }
input[type="text"], input[type="password"], input[type="url"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], select {
  width: 100%; height: 48px; margin-top: 7px; padding: 0 13px; border: 1px solid #cfd4ce; border-radius: 10px; background: white; color: var(--ink); outline: none;
}
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 77, .13); }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-switch label { position: relative; display: flex; padding: 16px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.mode-switch label:has(input:checked) { border-color: var(--green); background: var(--mint); box-shadow: inset 0 0 0 1px var(--green); }
.mode-switch span { display: flex; flex-direction: column; }
.mode-switch small { margin-top: 2px; color: var(--muted); font-weight: 400; }
[hidden] { display: none !important; }
.primary-button { width: 100%; margin-top: 30px; padding: 16px 24px; border: 0; border-radius: 12px; background: var(--green); color: white; cursor: pointer; font-weight: 800; }
.primary-button:hover { background: var(--green-dark); }
.secondary-button { width: 100%; margin-top: 20px; padding: 13px 20px; border: 1px solid var(--green); border-radius: 11px; background: var(--mint); color: var(--green-dark); cursor: pointer; font-weight: 800; }
.secondary-button:hover { background: var(--green); color: white; }
.management-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 22px; }
.compact-panel { padding: clamp(22px, 3vw, 34px); }
.compact-panel h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.panel-intro { margin: 10px 0 22px; color: var(--muted); font-size: .9rem; }
.stacked-fields { display: grid; gap: 14px; }
.file-input { width: 100%; margin-top: 7px; padding: 9px; border: 1px solid #cfd4ce; border-radius: 10px; background: white; }
.saved-stations-list { display: grid; gap: 8px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.saved-station-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; font-size: .85rem; }
.saved-station-row > img, .saved-station-row > span { width: 34px; height: 34px; display: grid; place-items: center; object-fit: contain; border: 1px solid var(--line); border-radius: 50%; background: white; font-size: .7rem; font-weight: 800; }
.field-label { display: block; margin-bottom: 7px; font-size: .88rem; font-weight: 700; }
.weekday-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.weekday-picker label { position: relative; }
.weekday-picker input { position: absolute; opacity: 0; }
.weekday-picker span { height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: white; font-size: .75rem; }
.weekday-picker input:checked + span { border-color: var(--green); background: var(--mint); color: var(--green-dark); }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-suffix { display: flex; align-items: center; gap: 7px; }
.input-suffix input { flex: 1; }
.input-suffix span { margin-top: 7px; color: var(--muted); font-size: .8rem; }
.series-overview { padding: 64px 0 0; }
.series-list { display: grid; gap: 10px; margin-top: 22px; }
.series-card { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.series-card > div { display: grid; grid-template-columns: 38px 1fr; column-gap: 12px; }
.series-icon { grid-row: 1 / 4; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--green); font-size: 1.35rem; font-weight: 800; }
.series-card h3, .series-card p, .series-card small { grid-column: 2; margin: 0; }
.series-card p, .series-card small { color: var(--muted); }
.series-card p { margin-top: 2px; font-size: .85rem; }
.series-card small { margin-top: 3px; }
.recordings-section { padding: 74px 0; }
.auto-update { color: var(--muted); font-size: .78rem; }
.auto-update i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #34a36f; }
.recording-list { display: grid; gap: 12px; margin-top: 24px; }
.quality-section { display: grid; grid-template-columns: minmax(220px, .7fr) 1.3fr; gap: 14px; margin-top: 18px; align-items: stretch; }
.size-estimate { display: flex; flex-direction: column; justify-content: center; padding: 12px 16px; border-radius: 12px; background: var(--mint); color: var(--green-dark); }
.size-estimate span { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.size-estimate strong { margin: 2px 0; font-size: 1.25rem; }
.size-estimate small { color: var(--muted); }
.recording { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(220px, 360px) auto; align-items: center; gap: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.recording-main { display: flex; align-items: flex-start; gap: 15px; min-width: 0; }
.recording h3 { margin: 0 0 3px; font-size: 1.03rem; }
.recording p { margin: 0; color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; }
.recording .error-text { margin-top: 5px; color: #942d25; }
.recording .partial { color: var(--amber); font-weight: 700; }
.status { flex: 0 0 auto; min-width: 80px; padding: 5px 9px; border-radius: 999px; text-align: center; font-size: .7rem; font-weight: 800; }
.status-running { background: #fee0dd; color: #a22e25; }
.status-running::before { content: "● "; animation: pulse 1.2s infinite; }
.status-completed { background: var(--mint); color: var(--green-dark); }
.status-scheduled, .status-waiting { background: #f4ead5; color: #865214; }
.status-failed, .status-cancelled { background: #ececea; color: #59605c; }
.recording-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex: 0 0 auto; }
.recording-actions form { margin: 0; }
.file-size { color: var(--muted); font-size: .78rem; }
.audio-player { width: 100%; height: 40px; }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); cursor: pointer; text-decoration: none; font-size: .78rem; font-weight: 750; }
.button:hover, .icon-button:hover { border-color: var(--green); }
.button.danger:hover { border-color: var(--red); color: var(--red); }
.icon-button { width: 38px; padding: 0; font-size: 1.3rem; }
.empty-state { margin-top: 24px; padding: 56px 20px; border: 1px dashed #bdc4bd; border-radius: 18px; text-align: center; color: var(--muted); }
.empty-state > span { font-size: 2rem; color: var(--green); }
.empty-state h3 { margin: 10px 0 4px; color: var(--ink); }
.empty-state p { margin: 0; }
footer { padding: 26px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.login-page { min-height: 100vh; display: grid; place-items: center; }
.login-shell { width: min(480px, calc(100% - 28px)); padding: 40px 0; }
.login-card { padding: clamp(26px, 7vw, 48px); border: 1px solid var(--line); border-radius: 24px; background: var(--panel); box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 54px; font-weight: 800; }
.login-card h1 { font-size: clamp(3.2rem, 12vw, 5rem); }
.login-intro { margin: 22px 0 28px; color: var(--muted); }
.login-card label + label { margin-top: 16px; }
@keyframes pulse { 50% { opacity: .35; } }

@media (max-width: 820px) {
  .station-grid { grid-template-columns: repeat(3, 1fr); }
  .management-grid { grid-template-columns: 1fr; }
  .recording { grid-template-columns: 1fr; align-items: flex-start; }
  .recording-actions { width: 100%; }
}
@media (max-width: 560px) {
  .shell { width: min(100% - 24px, 1120px); }
  .hero { padding-top: 52px; }
  .timezone, .auto-update, .limit { display: none; }
  .station-grid { grid-template-columns: repeat(2, 1fr); }
  .custom-fields, .time-fields, .mode-switch, .quality-section { grid-template-columns: 1fr; }
  .two-columns { grid-template-columns: 1fr; }
  .series-card { align-items: flex-start; flex-direction: column; }
  .panel { border-radius: 18px; }
  .recording-main { flex-direction: column; }
  .recording-actions { flex-wrap: wrap; justify-content: flex-start; }
}
