:root {
  --ink: #1e2a36;
  --ink-soft: #4a5d6e;
  --muted: #4a5d6e;
  --sun: #f5c518;
  --sky: #3b9ddd;
  --sky-soft: #d7effc;
  --leaf: #3faf6c;
  --navy: #245f8a;
  --navy-deep: #1c4d72;
  --paper: #f7fbff;
  --lemon: #fff8d6;
  --line: rgba(30, 42, 54, 0.14);
  --card: #ffffff;
  --green: var(--navy);
  --font-display: "Fredoka", "Trebuchet MS", sans-serif;
  --font-body: "Nunito Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.45 var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -10%, #ffe56a 0%, transparent 50%),
    radial-gradient(700px 380px at 100% 0%, #9fd6f5 0%, transparent 46%),
    linear-gradient(180deg, var(--lemon) 0%, var(--paper) 40%, var(--sky-soft) 100%);
  min-height: 100vh;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--navy);
  color: #fff;
  flex-wrap: wrap;
  box-shadow: 0 8px 20px rgba(36, 95, 138, 0.22);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.brand img {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 28%;
  object-fit: cover;
  background: #fff;
}

.top-nav { display: flex; gap: 14px; flex: 1; flex-wrap: wrap; }
.top-nav a {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}
.top-nav a:hover { color: #fff; border-bottom: 2px solid var(--sun); }

.logout button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  border-radius: 0.65rem;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
}
.logout button:hover { border-color: var(--sun); }

.block-form { display: grid; gap: 8px; margin: 0; max-width: 280px; }
.actions-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions-inline button {
  background: var(--navy);
  color: #fff;
  border: 0;
  border-radius: 0.65rem;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.actions-inline button.ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line);
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.date-hint { margin: 0 0 14px; }

h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
h2 {
  margin: 28px 0 10px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }

.banner { padding: 10px 12px; border-radius: 0.75rem; margin: 0 0 14px; }
.banner.err { background: #fde2e4; color: #842029; }
.banner.ok { background: #d8f3e4; color: #0f5132; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 16px;
  display: grid;
  gap: 12px;
  max-width: 420px;
  margin: 16px 0;
  box-shadow: 0 8px 18px rgba(36, 95, 138, 0.06);
}

label { display: grid; gap: 6px; font-weight: 700; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }

input[type=text],
input[type=password],
input:not([type]) {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  font: inherit;
  background: #fff;
}

button[type=submit] {
  background: var(--navy);
  color: #fff;
  border: 0;
  border-radius: 0.65rem;
  padding: 10px 14px;
  font-weight: 750;
  cursor: pointer;
  justify-self: start;
  font-family: inherit;
}
button[type=submit]:hover { background: var(--navy-deep); }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(36, 95, 138, 0.05);
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  background: #e8f4fc;
  font-size: 13px;
  font-family: var(--font-display);
  font-weight: 600;
}
th a { color: inherit; text-decoration: none; font-weight: 700; }
th a:hover { text-decoration: underline; color: var(--navy); }
th.is-sorted a { color: var(--navy); }
th .sort-ind { font-size: 10px; opacity: .7; margin-left: 2px; }

.group-filter { margin: 0 0 18px; }
.group-filter .label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.rename-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.rename-row label { flex: 1; min-width: 180px; }
tr.excluded { opacity: .55; }
.path { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }
.toolbar { margin: 0 0 14px; }
.toolbar a { color: var(--navy); font-weight: 700; }

.flow {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 8px 8px 8px 28px;
}
.flow li { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.flow li:last-child { border-bottom: 0; }

a { color: var(--navy); }
code { font-size: 12px; }

.embed { max-width: 720px; }
.embed summary { cursor: pointer; }
.snippet {
  margin: 0;
  padding: 12px;
  background: var(--navy-deep);
  color: #e8f4fc;
  border-radius: 0.75rem;
  overflow: auto;
  font: 13px/1.4 ui-monospace, Consolas, monospace;
}

.clicks { margin: 8px 0 0; padding: 0 0 0 18px; list-style: disc; }
.clicks li { padding: 4px 0; border: 0; font-size: 13px; }

.domains { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.domains a {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--card);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}
.domains a.on {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.timing { margin-top: 6px; display: grid; gap: 2px; font-size: 13px; }
.insights, .devices { margin: 24px 0; }
.insight-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.insight-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 12px 14px;
}
.insight-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
}
.insight-list { margin: 0; padding: 0 0 0 18px; }
.insight-list li { margin: 0 0 6px; font-size: 13px; }
.ua { margin-top: 4px; word-break: break-all; max-width: 42rem; }
.stat { margin: 0; font-size: 1.6rem; font-weight: 700; color: var(--navy); font-family: var(--font-display); }

button.ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.maint-form { max-width: 560px; }
.maint-form textarea,
select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  font: inherit;
  width: 100%;
}
.maint-form input[type=datetime-local] {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  font: inherit;
  width: 100%;
}
.maint-status { margin: 0 0 4px; }
.maint-delete { margin: -8px 0 20px; max-width: 560px; }
.alias-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 0; }
.alias-form input[type=text] {
  flex: 1;
  min-width: 140px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  font: inherit;
}
.alias-form.card { display: grid; gap: 12px; align-items: stretch; }
.alias-form.card input[type=text] { width: 100%; }
