:root {
  --bg: #0a141c;
  --panel: #10242f;
  --panel-2: #16323f;
  --ink: #e8f1f5;
  --muted: #90a9b7;
  --line: #214a5b;
  --ok: #2fb36b;
  --soon: #e0a323;
  --critical: #e8663f;
  --expired: #d9534f;
  --available: #9b7ce0;
  --error: #b0716f;
  --accent: #35b2d4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 0 3rem;
  background: radial-gradient(1200px 600px at 15% -10%, #14333f 0%, var(--bg) 58%);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 20, 27, 0.78);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { margin: 0; font-size: 1.3rem; letter-spacing: 0.02em; }
.topbar .sub { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.82rem; }
.topbar-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.clock { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.82rem; }

button {
  background: var(--accent);
  color: #06212c;
  border: 0;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
}
button:disabled { opacity: 0.55; cursor: progress; }
button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
button.danger { background: transparent; color: #ff9a97; border: 1px solid var(--expired); }
button.tiny { padding: 0.25rem 0.55rem; font-size: 0.76rem; }

main { max-width: 1180px; margin: 0 auto; padding: 1.25rem; }
.loading { color: var(--muted); padding: 2rem 0; text-align: center; }

/* summary ------------------------------------------------------------- */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.7rem;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
}
.stat .value { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .name { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; }
.stat.ok { border-left-color: var(--ok); }
.stat.soon { border-left-color: var(--soon); }
.stat.critical { border-left-color: var(--critical); }
.stat.expired { border-left-color: var(--expired); }
.stat.available { border-left-color: var(--available); }
.stat.error { border-left-color: var(--error); }

/* controls ------------------------------------------------------------ */
.controls { margin: 1.1rem 0 0.5rem; display: grid; gap: 0.7rem; }
.add-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.add-form input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}
.add-form input::placeholder { color: var(--muted); }
.filters { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; }
.filters input[type="search"] {
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  min-width: 200px;
}
.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip-btn {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.chip-btn.active { background: var(--panel-2); color: var(--ink); border-color: var(--accent); }

.banner {
  margin-top: 0.9rem;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 0.88rem;
}
.banner.error { border-color: var(--expired); color: #ffb3b1; background: rgba(217,83,79,0.12); }
.banner.ok { border-color: var(--ok); color: #9fe7bd; background: rgba(47,179,107,0.1); }

/* table --------------------------------------------------------------- */
.domains { margin-top: 1rem; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 0.55rem 0.6rem; text-align: left; border-bottom: 1px solid var(--line); font-size: 0.87rem; vertical-align: middle; }
thead th { color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
tbody tr:hover { background: rgba(53,178,212,0.06); }
td.actions { text-align: right; white-space: nowrap; }
td.actions button { margin-left: 0.3rem; }
.name-cell { display: flex; flex-direction: column; gap: 0.15rem; }
.name-cell .domain { font-weight: 650; }
.name-cell .notes { color: var(--muted); font-size: 0.78rem; }
.row-disabled { opacity: 0.55; }

/* badges -------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge.ok { background: rgba(47,179,107,0.18); color: #7ce3ab; }
.badge.soon { background: rgba(224,163,35,0.2); color: #ffd98a; }
.badge.critical { background: rgba(232,102,63,0.22); color: #ffb392; }
.badge.expired { background: rgba(217,83,79,0.22); color: #ff9a97; }
.badge.available { background: rgba(155,124,224,0.22); color: #cdb8ff; }
.badge.error { background: rgba(176,113,111,0.25); color: #e0b0ae; }
.badge.pending { background: rgba(144,169,183,0.18); color: var(--muted); }

/* events / runs ------------------------------------------------------- */
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.1rem; margin-top: 1.4rem; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }
.section-title { margin: 0 0 0.5rem; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.event {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.event:last-child { border-bottom: 0; }
.event .when { color: var(--muted); font-size: 0.75rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.event .what { flex: 1; }
.event.critical .what { color: #ffb392; }
.event.warning .what { color: #ffd98a; }
.event .tag { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.run-row { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.32rem 0; border-bottom: 1px solid var(--line); font-size: 0.82rem; }
.run-row:last-child { border-bottom: 0; }
.run-row .status-ok { color: #7ce3ab; }
.run-row .status-error { color: #ff9a97; }
.run-row .status-running { color: #ffd98a; }

/* modal --------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 10, 14, 0.72);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem 1rem;
  z-index: 40;
  overflow-y: auto;
}
.modal-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.4rem 1.5rem 1.5rem;
  width: min(760px, 100%);
}
.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.1rem 0.4rem;
}
.modal h2 { margin: 0 0 0.2rem; font-size: 1.25rem; }
.modal .sub { color: var(--muted); font-size: 0.84rem; margin-bottom: 0.9rem; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.15rem 1.4rem; }
@media (max-width: 620px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.28rem 0; border-bottom: 1px solid var(--line); font-size: 0.86rem; }
.detail-row .k { color: var(--muted); }
.detail-row .v { text-align: right; word-break: break-word; }
.detail-section { margin-top: 1rem; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.pill { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.6rem; font-size: 0.76rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; }

footer {
  max-width: 1180px;
  margin: 2rem auto 0;
  padding: 1rem 1.25rem 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}
