:root {
  color-scheme: dark;
  --bg: #07101d;
  --panel: rgba(16, 28, 47, 0.88);
  --panel-2: rgba(10, 20, 35, 0.9);
  --line: rgba(148, 163, 184, 0.18);
  --text: #edf4ff;
  --muted: #91a1b8;
  --blue: #5b8cff;
  --cyan: #39d0d8;
  --green: #43cf83;
  --amber: #f0b45d;
  --red: #f26f7c;
  --radius: 20px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(67, 118, 255, .2), transparent 32rem),
    radial-gradient(circle at 100% 15%, rgba(57, 208, 216, .12), transparent 28rem),
    var(--bg);
  color: var(--text);
}
button, input, select { font: inherit; }
a { color: inherit; }

.ec2-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 64px; }
.ec2-topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(91,140,255,.45); border-radius: 14px; background: linear-gradient(145deg, rgba(91,140,255,.28), rgba(57,208,216,.12)); box-shadow: inset 0 1px rgba(255,255,255,.1), 0 12px 32px rgba(0,0,0,.24); font-weight: 900; }
.brand small { display: block; color: var(--muted); margin-top: 3px; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.link-btn, .action-btn { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: rgba(255,255,255,.045); color: var(--text); text-decoration: none; cursor: pointer; transition: .16s ease; }
.link-btn:hover, .action-btn:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(91,140,255,.55); background: rgba(91,140,255,.12); }
.action-btn:disabled { opacity: .42; cursor: not-allowed; }
.action-btn.primary { border-color: rgba(67,207,131,.45); background: rgba(67,207,131,.13); }
.action-btn.danger { border-color: rgba(242,111,124,.42); background: rgba(242,111,124,.12); }
.action-btn.blue { border-color: rgba(91,140,255,.48); background: rgba(91,140,255,.14); }

.hero { display: grid; grid-template-columns: 1.4fr .75fr; gap: 18px; margin-bottom: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, var(--panel), var(--panel-2)); box-shadow: 0 24px 70px rgba(0,0,0,.23), inset 0 1px rgba(255,255,255,.045); }
.hero-main { padding: 28px; }
.eyebrow { margin: 0 0 10px; color: var(--cyan); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(28px, 5vw, 48px); letter-spacing: -.04em; }
.lead { max-width: 720px; margin: 14px 0 0; color: var(--muted); line-height: 1.75; }
.hero-side { padding: 22px; display: grid; align-content: center; gap: 9px; }
.hero-side strong { font-size: 14px; }
.hero-side p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }

.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.status-card { padding: 20px; min-height: 145px; }
.status-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status-label { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.status-value { margin-top: 18px; font-size: 24px; font-weight: 850; letter-spacing: -.025em; }
.status-sub { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #64748b; box-shadow: 0 0 0 5px rgba(100,116,139,.12); }
.dot.ok { background: var(--green); box-shadow: 0 0 0 5px rgba(67,207,131,.12), 0 0 18px rgba(67,207,131,.35); }
.dot.wait { background: var(--amber); box-shadow: 0 0 0 5px rgba(240,180,93,.12); }
.dot.off { background: #64748b; }

.finance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.finance-card { padding: 20px; min-height: 166px; }
.finance-card .status-value { font-variant-numeric: tabular-nums; }
.micro-copy { margin-top: 12px; color: #71839d; font-size: 11px; line-height: 1.55; }
.mini-btn { border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; background: rgba(255,255,255,.045); color: var(--text); font-size: 11px; font-weight: 800; cursor: pointer; }
.mini-btn:hover:not(:disabled) { border-color: rgba(91,140,255,.55); background: rgba(91,140,255,.12); }
.mini-btn:disabled { opacity: .42; cursor: not-allowed; }
.mini-btn.danger { border-color: rgba(242,111,124,.35); color: #ffd0d5; background: rgba(242,111,124,.08); }

.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.control-card { padding: 22px; }
.control-card h2 { margin: 0; font-size: 19px; }
.control-card > p { color: var(--muted); font-size: 13px; line-height: 1.65; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.action-btn { min-height: 48px; font-weight: 800; }

.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 16px; }
.inline-form input { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,.2); color: var(--text); padding: 12px 14px; outline: none; }
.inline-form input:focus { border-color: rgba(91,140,255,.72); box-shadow: 0 0 0 3px rgba(91,140,255,.12); }
.meta-list { display: grid; gap: 9px; margin-top: 16px; }
.meta-row { display: flex; justify-content: space-between; gap: 18px; padding: 11px 0; border-bottom: 1px solid rgba(148,163,184,.1); font-size: 13px; }
.meta-row span:first-child { color: var(--muted); }
.meta-row span:last-child { text-align: right; font-weight: 750; }

.notice { min-height: 48px; margin: 18px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.035); color: var(--muted); line-height: 1.5; }
.notice.success { border-color: rgba(67,207,131,.34); color: #bff5d7; background: rgba(67,207,131,.08); }
.notice.error { border-color: rgba(242,111,124,.38); color: #ffd0d5; background: rgba(242,111,124,.08); }

.scheduler-panel { margin-top: 18px; padding: 24px; }
.scheduler-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.scheduler-head h2 { margin: 0; font-size: 22px; }
.scheduler-head p:not(.eyebrow) { max-width: 760px; margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.timezone-badge { flex: 0 0 auto; border: 1px solid rgba(57,208,216,.3); border-radius: 999px; padding: 7px 10px; color: #9aebef; background: rgba(57,208,216,.08); font-size: 11px; font-weight: 800; }
.scheduler-form { display: grid; grid-template-columns: 1fr 1fr 1.25fr auto; gap: 12px; align-items: end; margin-top: 22px; }
.scheduler-form label { display: grid; gap: 7px; min-width: 0; }
.scheduler-form label > span { color: var(--muted); font-size: 11px; font-weight: 800; }
.scheduler-form input, .scheduler-form select { width: 100%; min-width: 0; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,.2); color: var(--text); padding: 11px 13px; outline: none; }
.scheduler-form input:focus, .scheduler-form select:focus { border-color: rgba(91,140,255,.72); box-shadow: 0 0 0 3px rgba(91,140,255,.12); }
.scheduler-form [hidden] { display: none !important; }
.scheduler-submit { min-width: 132px; }
.scheduler-state { margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(148,163,184,.1); color: var(--muted); font-size: 12px; }
.scheduler-state.error { color: #ffd0d5; }
.schedule-list { display: grid; gap: 9px; margin-top: 12px; }
.schedule-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 14px; padding: 13px 14px; border: 1px solid rgba(148,163,184,.12); border-radius: 13px; background: rgba(0,0,0,.14); }
.schedule-main { display: grid; gap: 5px; min-width: 0; }
.schedule-main strong { font-size: 13px; }
.schedule-main span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.schedule-badge { border-radius: 999px; padding: 5px 8px; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.schedule-badge.start { color: #bff5d7; background: rgba(67,207,131,.12); }
.schedule-badge.stop { color: #ffd0d5; background: rgba(242,111,124,.12); }
.schedule-empty { padding: 18px; border: 1px dashed rgba(148,163,184,.18); border-radius: 13px; color: var(--muted); font-size: 12px; text-align: center; }

.detail-link { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 18px; padding: 18px 20px; text-decoration: none; }
.detail-link strong { display: block; margin-bottom: 6px; }
.detail-link span { color: var(--muted); font-size: 13px; }
.detail-link b { font-size: 24px; }

.auth-guard { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: #07101d; }
.auth-guard[hidden] { display: none; }
.auth-card { width: min(420px, calc(100% - 32px)); padding: 28px; text-align: center; }
.auth-card p { color: var(--muted); line-height: 1.7; }
.spinner { width: 28px; height: 28px; margin: 0 auto 16px; border: 3px solid rgba(255,255,255,.16); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  .hero, .control-grid, .finance-grid { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: 1fr; }
  .scheduler-form { grid-template-columns: 1fr 1fr; }
  .scheduler-submit { min-width: 0; }
  .ec2-topbar { align-items: flex-start; }
}
@media (max-width: 560px) {
  .ec2-shell { width: min(100% - 20px, 1180px); padding-top: 16px; }
  .ec2-topbar { display: grid; }
  .top-actions { width: 100%; }
  .top-actions > * { flex: 1; text-align: center; }
  .hero-main, .control-card, .scheduler-panel { padding: 20px; }
  .button-row, .inline-form, .scheduler-form { grid-template-columns: 1fr; }
  .scheduler-head { display: grid; gap: 12px; }
  .timezone-badge { justify-self: start; }
  .schedule-row { grid-template-columns: 1fr auto; }
  .schedule-main { grid-column: 1 / -1; }
}
