:root {
  --ink: #17130d;
  --muted: #6d655a;
  --line: #d8d0c4;
  --paper: #f4f1ea;
  --card: rgba(255, 250, 240, 0.78);
  --accent: #b66b2f;
  --accent-soft: #f4e6d7;
  --green: #385c48;
  --red: #a6422f;
  --shadow: 0 24px 70px rgba(80, 61, 38, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(circle at 18% 12%, rgba(182, 107, 47, .16), transparent 28%), radial-gradient(circle at 86% 8%, rgba(56, 92, 72, .12), transparent 30%), var(--paper); color: var(--ink); font: 15px/1.6 "PingFang SC", "Microsoft YaHei", Arial, sans-serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.login-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(460px, 100%); padding: 34px; background: var(--card); border: 1px solid rgba(23, 19, 13, .12); border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.login-card h1 { font-size: clamp(34px, 8vw, 48px); }
.login-field { margin: 24px 0 14px; }
.login-card .button { width: 100%; }
.login-card .back-link { display: block; margin-top: 18px; text-align: center; }
.login-error { min-height: 24px; margin: 12px 0 0; color: var(--red); font-size: 13px; font-weight: 700; text-align: center; }
.shell { width: min(1360px, calc(100% - 36px)); margin: 0 auto; padding: 42px 0 80px; }
.topbar, .section-heading, .panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.eyebrow, .label { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Noto Serif SC", serif; }
h1 { margin-bottom: 12px; font-size: clamp(32px, 5vw, 58px); letter-spacing: -.04em; line-height: 1.05; }
h2 { margin: 4px 0 0; font-size: 22px; letter-spacing: -.02em; }
h3 { margin-bottom: 10px; font-size: 17px; }
.lede { max-width: 680px; color: var(--muted); font-size: 16px; }
.back-link { color: var(--muted); font-weight: 700; text-decoration: none; }
.back-link:hover { color: var(--accent); }
.status-grid, .two-column { display: grid; grid-template-columns: .8fr 1.2fr; gap: 18px; margin-top: 26px; }
.two-column { grid-template-columns: 1fr 1fr; }
.panel { padding: 24px; background: var(--card); border: 1px solid rgba(23, 19, 13, .12); border-radius: 16px; box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.panel-heading { align-items: center; }
.panel-heading p, .panel > p { color: var(--muted); }
.status-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 7px #e7f6ef; }
.status-dot.paused { background: var(--red); box-shadow: 0 0 0 7px #fbeaea; }
.target-note { color: var(--muted); font-size: 12px; }
.schedules-panel { margin-top: 18px; }
.schedule-list { display: grid; gap: 16px; margin-top: 20px; }
.schedule-card { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(255, 252, 246, .96), rgba(244, 241, 234, .88)); }
.schedule-card.disabled { opacity: .7; }
.schedule-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.schedule-card-head .actions, .target-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.field.wide { grid-column: span 2; }
.field.full { grid-column: 1 / -1; }
input, textarea, select { width: 100%; min-height: 42px; padding: 9px 11px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; outline: 0; }
textarea { min-height: 100px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check-field { display: flex; align-items: center; gap: 8px; min-height: 42px; color: var(--ink); }
.check-field input { width: 18px; min-height: 18px; }
.button { min-height: 40px; padding: 8px 14px; border: 1px solid transparent; border-radius: 999px; font-weight: 800; }
.button.primary { color: var(--paper); background: var(--ink); }
.button.primary:hover { background: var(--accent); }
.button.subtle { color: var(--ink); background: #fff; border-color: var(--line); }
.button.danger { color: var(--red); background: #fff; border-color: #efcaca; }
.button:disabled { cursor: not-allowed; opacity: .55; }
.items { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.item-row { display: grid; grid-template-columns: 1.3fr 1fr auto auto; gap: 8px; align-items: center; margin-top: 8px; }
.weekday-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.weekday-field small { color: var(--muted); font-weight: 500; }
.weekday-chip { position: relative; display: inline-flex; align-items: center; }
.weekday-chip input { position: absolute; width: 1px; height: 1px; min-height: 1px; opacity: 0; }
.weekday-chip span { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; min-height: 36px; padding: 6px 12px; color: var(--muted); background: rgba(255,255,255,.58); border: 1px solid var(--line); border-radius: 999px; transition: .18s ease; }
.weekday-chip input:checked + span { color: var(--paper); background: var(--green); border-color: var(--green); }
.weekday-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.preview { margin-top: 16px; padding: 14px; white-space: pre-wrap; color: var(--ink); background: rgba(255, 250, 240, .56); border: 1px dashed #c7aa89; border-radius: 12px; }
.preview strong { display: block; margin-bottom: 5px; color: var(--accent); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.target-list { display: grid; gap: 10px; margin-top: 16px; }
.target-row { display: grid; grid-template-columns: 1.1fr 1.5fr auto; gap: 10px; align-items: end; padding: 12px; background: rgba(255, 250, 240, .56); border: 1px solid rgba(23, 19, 13, .08); border-radius: 12px; }
.target-row small { display: block; color: var(--muted); }
.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 800; white-space: nowrap; }
.muted { color: var(--muted); }
.state { display: inline-flex; padding: 2px 8px; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-weight: 800; }
.state.sent, .state.test_sent { color: var(--green); background: #e7f6ef; }
.state.failed, .state.test_failed { color: var(--red); background: #fbeaea; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: min(420px, calc(100% - 48px)); padding: 12px 16px; color: var(--paper); background: var(--ink); border-radius: 12px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(10px); transition: .2s ease; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--red); }
@media (max-width: 950px) { .status-grid, .two-column { grid-template-columns: 1fr; } .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .login-card { padding: 26px 22px; } .shell { width: min(100% - 24px, 560px); padding-top: 24px; } .topbar, .section-heading { display: grid; } .topbar-actions { justify-content: space-between; } .panel { padding: 18px; border-radius: 16px; } .form-grid { grid-template-columns: 1fr; } .field.wide { grid-column: auto; } .item-row { grid-template-columns: 1fr 1fr auto; } .item-row .item-enabled { grid-column: span 2; } .target-row { grid-template-columns: 1fr; } }
