:root {
  color-scheme: dark;
  --bg: #06111b;
  --surface: rgba(12, 30, 43, 0.86);
  --surface-strong: #102a3c;
  --line: rgba(154, 203, 222, 0.16);
  --text: #f5fbff;
  --muted: #9db4c2;
  --ice: #8ee8ff;
  --blue: #2b9fe8;
  --orange: #ffaf52;
  --danger: #ff6c77;
  --success: #58db9b;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -20%, rgba(43, 159, 232, .28), transparent 42%),
    linear-gradient(160deg, #06111b 0%, #071925 48%, #06111b 100%);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.aurora {
  position: fixed;
  z-index: -1;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  filter: blur(110px);
  opacity: .15;
  pointer-events: none;
}
.aurora-one { top: -12rem; right: -10rem; background: #35d4ff; }
.aurora-two { bottom: -18rem; left: -12rem; background: #1d73da; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(430px, 100%);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(8, 24, 36, .9);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .42);
  backdrop-filter: blur(22px);
}
.crest {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 24px;
  border: 1px solid rgba(142, 232, 255, .45);
  border-radius: 18px;
  color: var(--ice);
  background: linear-gradient(145deg, rgba(142, 232, 255, .17), rgba(43, 159, 232, .06));
  box-shadow: inset 0 0 20px rgba(142, 232, 255, .08);
  font-weight: 800;
  letter-spacing: .08em;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(1.7rem, 4vw, 2.25rem); }
h2 { margin-bottom: 0; font-size: 1.2rem; }
.eyebrow { margin-bottom: 7px; color: var(--ice); font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
.muted { color: var(--muted); line-height: 1.55; }
label { display: grid; gap: 8px; color: #c4d5de; font-size: .86rem; font-weight: 650; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
  color: var(--text);
  background: rgba(3, 14, 23, .62);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--ice); box-shadow: 0 0 0 3px rgba(142, 232, 255, .1); }
.login-card label { margin-top: 26px; }
button {
  border: 0;
  border-radius: 11px;
  padding: 11px 15px;
  color: var(--text);
  font-weight: 750;
}
button:disabled { cursor: wait; opacity: .55; }
.primary { background: linear-gradient(135deg, #168ed8, #38b8ef); box-shadow: 0 8px 24px rgba(20, 143, 216, .22); }
.secondary { color: #06111b; background: var(--ice); }
.ghost { border: 1px solid var(--line); background: rgba(255, 255, 255, .035); }
.danger { color: var(--danger); border: 1px solid rgba(255, 108, 119, .25); background: rgba(255, 108, 119, .08); }
.full { width: 100%; margin-top: 14px; }
.error { min-height: 1.2em; margin: 10px 0 0; color: var(--danger); font-size: .86rem; }
.app-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 26px 0 70px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.topbar h1 { margin: 0; }
.top-actions { display: flex; gap: 10px; }
.dashboard-error {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 108, 119, .35);
  border-radius: 12px;
  background: rgba(255, 108, 119, .1);
  color: var(--danger);
}
.summary-grid { display: grid; grid-template-columns: .7fr 1.35fr 1.35fr; gap: 14px; margin-bottom: 16px; }
.summary-card, .panel {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .18);
  backdrop-filter: blur(18px);
}
.summary-card { min-height: 116px; padding: 22px; border-radius: var(--radius); }
.summary-card span { display: block; margin-bottom: 14px; color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.summary-card strong { font-size: 1.08rem; }
.summary-card:first-child strong { color: var(--ice); font-size: 2rem; }
.panel { margin-top: 16px; padding: 22px; border-radius: var(--radius); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.section-actions { display: flex; gap: 9px; }
.archive-intro, .form-guidance { color: var(--muted); font-size: .86rem; line-height: 1.55; }
.archive-intro { margin: -4px 0 18px; }
.form-guidance { margin: 16px 0 0; padding: 11px 13px; border-radius: 11px; background: rgba(255, 175, 82, .08); }
.event-list { display: grid; gap: 10px; }
.event-card {
  display: grid;
  grid-template-columns: minmax(160px, 1.15fr) minmax(190px, 1.2fr) minmax(180px, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(2, 15, 24, .46);
}
.event-name { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.event-card.archived { background: rgba(2, 15, 24, .3); }
.schedule-badge {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.schedule-badge.recurring { color: var(--ice); background: rgba(142, 232, 255, .1); }
.schedule-badge.one_time { color: var(--orange); background: rgba(255, 175, 82, .1); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 12px rgba(88, 219, 155, .6); }
.status-dot.off { background: #637986; box-shadow: none; }
.event-meta { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.event-time strong { display: block; margin-bottom: 3px; color: var(--ice); }
.event-actions { display: flex; gap: 7px; }
.event-actions button { padding: 8px 10px; font-size: .8rem; }
.empty { padding: 24px 10px; color: var(--muted); text-align: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
td { font-size: .86rem; }
.badge { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.badge.sent { color: var(--success); background: rgba(88, 219, 155, .1); }
.badge.failed { color: var(--danger); background: rgba(255, 108, 119, .1); }
.badge.pending { color: var(--orange); background: rgba(255, 175, 82, .1); }
.badge.skipped { color: var(--muted); background: rgba(157, 180, 194, .1); }
dialog {
  width: min(680px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 0;
  color: var(--text);
  background: #0b202e;
  box-shadow: 0 36px 100px rgba(0, 0, 0, .58);
}
dialog::backdrop { background: rgba(0, 7, 13, .78); backdrop-filter: blur(7px); }
#event-form { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 20px; }
.icon-button { padding: 3px 10px; color: var(--muted); background: transparent; font-size: 1.7rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.wide { grid-column: 1 / -1; }
.reminder-preview { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: rgba(2, 15, 24, .42); }
.reminder-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.reminder-preview-heading .eyebrow { margin: 0 0 3px; }
.reminder-preview h3 { margin: 0; font-size: .96rem; }
.reminder-preview p { margin: 0; white-space: pre-wrap; line-height: 1.55; }
.reminder-preview .preview-placeholder { color: var(--muted); }
.toggle { display: flex; align-items: center; gap: 9px; }
.toggle input { width: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: min(380px, calc(100% - 44px)); padding: 13px 16px; border: 1px solid rgba(142, 232, 255, .24); border-radius: 12px; background: #123044; box-shadow: 0 15px 40px rgba(0, 0, 0, .35); }
@media (max-width: 820px) {
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 95px; }
  .event-card { grid-template-columns: 1fr 1fr; }
  .event-actions { justify-content: flex-end; }
}
@media (max-width: 560px) {
  .app-shell { width: min(100% - 20px, 1180px); padding-top: 18px; }
  .topbar, .section-heading { align-items: stretch; flex-direction: column; }
  .section-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .top-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .event-card, .form-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .event-actions { justify-content: stretch; }
  .event-actions button { flex: 1; }
  .login-card { padding: 28px 22px; }
}
