:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #18202f;
  --muted: #667085;
  --line: #e3e8f0;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --success: #16835d;
  --danger: #c03636;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
.container { width: min(1080px, calc(100% - 32px)); margin: 0 auto 64px; }
.home-page { background: #fff; }
.home-page .container { min-height: 100vh; margin-bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.home-page header { padding: 0 0 8px; }
.home-message { font-size: 1.05rem; }
.home-message p { color: var(--muted); margin-bottom: 10px; }
.home-message strong { color: var(--text); }
nav { min-height: 68px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
nav div { display: flex; gap: 20px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.brand { color: var(--text); font-weight: 750; }
header { padding: 38px 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
h1, h2 { margin: 0; letter-spacing: -.025em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h2 { font-size: 1.15rem; margin-bottom: 20px; }
p { margin-top: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: 0 4px 18px rgba(20, 30, 55, .04); margin-bottom: 18px; }
.narrow { max-width: 500px; }
.login-actions { display: block; margin-top: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
label { display: grid; gap: 6px; color: #344054; font-size: .9rem; font-weight: 650; }
label small, .muted, summary small { color: var(--muted); font-weight: 400; }
input, select, button, .button { font: inherit; }
input, select { width: 100%; min-height: 42px; padding: 8px 11px; color: var(--text); background: #fff; border: 1px solid #cbd3df; border-radius: 8px; }
input:focus, select:focus { outline: 3px solid rgba(79, 70, 229, .14); border-color: var(--primary); }
.readonly-field { display: flex; align-items: center; min-height: 42px; padding: 8px 11px; color: var(--muted); background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px; }
.input-with-action { display: flex; align-items: center; gap: 7px; }
.input-with-action input { flex: 1; min-width: 0; }
.checkbox { display: flex; flex-direction: row; align-items: center; gap: 8px; align-self: end; min-height: 42px; }
.checkbox input { width: 18px; min-height: auto; height: 18px; accent-color: var(--primary); }
button, .button { display: inline-flex; justify-content: center; align-items: center; border: 0; border-radius: 8px; padding: 10px 16px; color: #fff; background: var(--primary); font-weight: 700; cursor: pointer; }
button:hover, .button:hover { background: var(--primary-dark); text-decoration: none; }
.tiny-button { flex: none; min-height: 32px; padding: 6px 9px; color: #344054; background: #eef1f6; font-size: .75rem; }
.tiny-button:hover { background: #e2e6ee; }
.button.secondary { color: #344054; background: #eef1f6; }
.button.secondary:hover { background: #e2e6ee; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.notice { border-radius: 9px; padding: 12px 15px; }
.notice.success { color: #086344; background: #e7f8f1; }
.notice.error { color: #932929; background: #ffeded; }
.section-heading { display: flex; align-items: center; gap: 10px; margin: 30px 0 14px; }
.section-heading h2 { margin: 0; }
.badge, .status { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; background: #eef1f6; color: #475467; font-size: .76rem; font-weight: 750; }
.status.on { color: #08704d; background: #e5f7ef; }
.status.off { color: #a33030; background: #feeaea; }
details summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary > span:first-child { display: grid; }
.summary-meta { display: flex; gap: 8px; }
details[open] summary { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th, td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); background: #fafbfc; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
.metric { color: var(--primary); font-size: 1.05rem; font-weight: 800; }
.usage-note { font-size: .82rem; text-align: center; }
.pagination { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; }
.pagination.card { padding: 14px 16px; }
.pagination .button { padding: 7px 10px; font-size: .82rem; }
.pagination-label { font-size: .86rem; }
.pagination-slot { display: flex; gap: 8px; }
.pagination-start { justify-self: start; }
.pagination-end { justify-self: end; }
.pagination-label { text-align: center; }
.pagination-bottom { margin-top: 18px; }
.events-table { min-width: 1250px; }
.events-table td { vertical-align: top; }
.events-table .wrap { min-width: 150px; max-width: 280px; white-space: normal; overflow-wrap: anywhere; }
.code { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }

@media (max-width: 680px) {
  .container { width: min(100% - 20px, 1080px); }
  nav { align-items: flex-start; padding: 16px 0; gap: 12px; }
  nav div { gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
  .card { padding: 18px; border-radius: 11px; }
  .form-grid { grid-template-columns: 1fr; }
  details summary { align-items: flex-start; }
  .summary-meta { flex-direction: column; align-items: flex-end; }
  .pagination { grid-template-columns: 1fr 1fr; }
  .pagination-label { grid-column: 1 / -1; grid-row: 1; }
  .pagination-start { grid-column: 1; grid-row: 2; }
  .pagination-end { grid-column: 2; grid-row: 2; }
}
