/* Casino SEO Panel — hand-written stylesheet. No build step, no CDN, no JS deps. */

:root {
  color-scheme: light dark;

  --bg:          #f7f8fa;
  --surface:     #ffffff;
  --surface-2:   #f1f3f7;
  --surface-3:   #e7eaf0;
  --border:      #e2e6ed;
  --border-soft: #eef1f5;

  --text:        #14171f;
  --text-2:      #424a58;
  /* Contrast-checked against --surface: secondary text is small, so it needs
     the full 4.5:1 of WCAG AA rather than the 3:1 of large text. */
  --muted:       #5d6574;

  --accent:      #4242b4;
  --accent-soft: #ececfb;
  --accent-text: #ffffff;

  --ok:   #0f6e4f;
  --ok-soft: #e4f5ee;
  --warn: #a16207;
  --warn-soft: #fdf3e0;
  --bad:  #c93c3c;
  --bad-soft: #fdecec;

  --sidebar:  #14161c;
  --sidebar-text:  #a8b0c0;
  --sidebar-active: #ffffff;

  --radius:    10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 20, 32, .05), 0 1px 3px rgba(16, 20, 32, .04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0c0e13;
    --surface:     #14171e;
    --surface-2:   #1a1e27;
    --surface-3:   #232833;
    --border:      #262b36;
    --border-soft: #1e222b;

    --text:        #e8ecf3;
    --text-2:      #b3bccb;
    --muted:       #7d8698;

    /* Light enough that the near-black button label clears 4.5:1 on it. */
    --accent:      #9b9bf7;
    --accent-soft: #1e1f3d;
    --accent-text: #0c0d16;

    --ok:   #3ecf8e;
    --ok-soft: #10281f;
    --warn: #e0a23a;
    --warn-soft: #2a2113;
    --bad:  #f2666b;
    --bad-soft: #2d1618;

    --sidebar:  #0f1116;
    --sidebar-text:  #8b93a5;
    --sidebar-active: #ffffff;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .92em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}

.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------------ Layout */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 218px;
  flex: 0 0 218px;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.2px;
}
.sidebar .logo:hover { text-decoration: none; }
.sidebar .logo .dot {
  width: 26px; height: 26px; flex: none;
  border-radius: 7px;
  background: linear-gradient(135deg, #6d6df0, #a855c8);
  display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 700;
}
.sidebar .logo small {
  display: block; font-size: 11px; font-weight: 400;
  color: var(--sidebar-text); letter-spacing: 0;
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-weight: 500;
  transition: background .12s, color .12s;
}
.sidebar nav a:hover { background: rgba(255,255,255,.055); color: #dfe4ee; text-decoration: none; }
.sidebar nav a.active { background: rgba(255,255,255,.09); color: var(--sidebar-active); }
.sidebar nav a svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.sidebar nav a.active svg { opacity: 1; }

.sidebar .spacer { flex: 1; }

.sidebar .account {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar .account .avatar {
  width: 30px; height: 30px; flex: none;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase;
}
.sidebar .account .who { min-width: 0; flex: 1; }
.sidebar .account .who span {
  display: block;
  font-size: 12px;
  color: var(--sidebar-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar .account form { margin: 0; }
.sidebar .account button {
  background: none; border: none; padding: 5px;
  color: var(--sidebar-text); cursor: pointer; border-radius: 5px;
  display: grid; place-items: center;
}
.sidebar .account button:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .account button svg { width: 16px; height: 16px; }

.content { flex: 1; min-width: 0; }
main { max-width: 1240px; padding: 26px 30px 60px; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; flex: none; height: auto; position: static; }
  .sidebar nav { flex-direction: row; overflow-x: auto; padding: 0 10px 10px; }
  .sidebar nav a span { display: none; }
  .sidebar .spacer { display: none; }
  main { padding: 20px 16px 40px; }
}

/* -------------------------------------------------------------- Typography */

h1 { font-size: 23px; line-height: 1.25; margin: 0 0 5px; letter-spacing: -.4px; }
h2 { font-size: 14px; margin: 0 0 14px; letter-spacing: -.1px; font-weight: 600; }
.subtitle { color: var(--muted); margin: 0; font-size: 13.5px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------- Cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.card > h2 {
  margin: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  color: var(--text);
}
.card > h2 .hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.card .body { padding: 18px; }
.card .body > :first-child { margin-top: 0; }
.card .body > :last-child { margin-bottom: 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 17px;
}
.stat .label {
  color: var(--muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px;
}
.stat .value {
  font-size: 27px; font-weight: 650; letter-spacing: -.9px;
  margin-top: 5px; font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat .value small { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }

/* ------------------------------------------------------------------ Tables */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 18px; text-align: left; vertical-align: middle; }
thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .55px;
  color: var(--text-2);
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
tbody td { border-bottom: 1px solid var(--border-soft); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }

td.num, th.num { font-variant-numeric: tabular-nums; }
td strong { font-weight: 600; }

/* Key-value table inside a card (settings). */
table.kv th {
  background: none; border-bottom: 1px solid var(--border-soft);
  text-transform: none; letter-spacing: 0; font-size: 13px;
  color: var(--text-2); font-weight: 500; width: 42%;
}

/* ------------------------------------------------------------------- Forms */

label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 5px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="file"], select, textarea {
  width: 100%;
  padding: 8px 11px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  transition: border-color .12s, box-shadow .12s;
}
textarea {
  min-height: 96px; resize: vertical;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.6;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row > div { flex: 1; min-width: 160px; }
.form-row > div.narrow { flex: 0 0 140px; min-width: 0; }
.form-row > div.tiny { flex: 0 0 110px; min-width: 0; }
.form-row + .form-row { margin-top: 12px; }

.check {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; color: var(--text); margin-bottom: 0; font-weight: 400;
  cursor: pointer;
}
.check input { width: auto; accent-color: var(--accent); }
.check + .check { margin-top: 11px; }

.hint { font-size: 12.5px; color: var(--muted); }

/* ----------------------------------------------------------------- Buttons */

button, .button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
button:hover, .button:hover {
  background: var(--surface-2); border-color: var(--surface-3); text-decoration: none;
}
button:active, .button:active { transform: translateY(1px); }
button:focus-visible, .button:focus-visible {
  outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

button.primary, .button.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-text);
}
button.primary:hover, .button.primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000);
  border-color: color-mix(in srgb, var(--accent) 88%, #000);
}
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
button.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
button.small, .button.small { padding: 4px 10px; font-size: 12.5px; }

.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.inline-form { display: inline; }

/* ---------------------------------------------------------------- Messages */

.msg {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  font-size: 13.5px;
  display: flex; gap: 9px; align-items: flex-start;
}
.msg svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.msg.error  { border-color: color-mix(in srgb, var(--bad) 40%, transparent);  color: var(--bad);  background: var(--bad-soft); }
.msg.notice { border-color: color-mix(in srgb, var(--ok) 40%, transparent);   color: var(--ok);   background: var(--ok-soft); }
.msg.warn   { border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); background: var(--warn-soft); }
.msg a { color: inherit; text-decoration: underline; }

/* ------------------------------------------------------------------ Badges */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  letter-spacing: .3px;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge.ok   { color: var(--ok);   background: var(--ok-soft);   border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.badge.bad  { color: var(--bad);  background: var(--bad-soft);  border-color: color-mix(in srgb, var(--bad) 28%, transparent); }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.badge.live { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.badge.live::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* Rank pill: colour encodes how good the position is, so a table of numbers
   becomes scannable at a glance. */
.rank {
  display: inline-block;
  min-width: 30px;
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 650;
  font-size: 12.5px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.rank.top3   { color: var(--ok);     background: var(--ok-soft);     border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.rank.top10  { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.rank.top50  { color: var(--warn);   background: var(--warn-soft);   border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.rank.rest   { color: var(--text-2); background: var(--surface-2);   border-color: var(--border); }
.rank.none   { color: var(--muted);  background: none; font-weight: 400; }

.delta { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; }
.delta.up   { color: var(--ok); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); font-weight: 400; }

.host {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.host.retired { color: var(--muted); text-decoration: line-through; }

/* ---------------------------------------------------------------- Progress */

.progress {
  height: 5px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
  min-width: 130px;
}
.progress > span {
  display: block; height: 100%; border-radius: 3px;
  background: var(--accent); transition: width .35s ease;
}
.progress-label { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: block; }

/* ------------------------------------------------------------------ Charts */

.sparkline { vertical-align: middle; }
.sparkline polyline { stroke: var(--muted); fill: none; }
.sparkline circle { fill: var(--muted); }
.sparkline.up   polyline { stroke: var(--ok); }
.sparkline.up   circle   { fill: var(--ok); }
.sparkline.down polyline { stroke: var(--bad); }
.sparkline.down circle   { fill: var(--bad); }

.rank-chart { width: 100%; height: auto; display: block; }
.rank-chart .grid { stroke: var(--border); stroke-width: 1; }
.rank-chart .axis { fill: var(--muted); font-size: 10px; font-family: inherit; }
.rank-chart polyline { fill: none; }
/* One palette drives both the chart lines and the legend swatches, so they
   can never drift apart between light and dark. */
:root {
  --series-0: #4242b4;
  --series-1: #0f6e4f;
  --series-2: #c93c3c;
  --series-3: #a16207;
  --series-4: #9333c4;
  --series-5: #0e7490;
}
@media (prefers-color-scheme: dark) {
  :root {
    --series-0: #8b8bf5;
    --series-1: #3ecf8e;
    --series-2: #f2666b;
    --series-3: #e0a23a;
    --series-4: #c07ae8;
    --series-5: #3fb6cc;
  }
}

.rank-chart .series.s0 { stroke: var(--series-0); fill: var(--series-0); }
.rank-chart .series.s1 { stroke: var(--series-1); fill: var(--series-1); }
.rank-chart .series.s2 { stroke: var(--series-2); fill: var(--series-2); }
.rank-chart .series.s3 { stroke: var(--series-3); fill: var(--series-3); }
.rank-chart .series.s4 { stroke: var(--series-4); fill: var(--series-4); }
.rank-chart .series.s5 { stroke: var(--series-5); fill: var(--series-5); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 12.5px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); }
.legend i { width: 11px; height: 3px; border-radius: 2px; flex: none; }
.legend i.s0 { background: var(--series-0); }
.legend i.s1 { background: var(--series-1); }
.legend i.s2 { background: var(--series-2); }
.legend i.s3 { background: var(--series-3); }
.legend i.s4 { background: var(--series-4); }
.legend i.s5 { background: var(--series-5); }

/* ------------------------------------------------------------------- Login */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 356px; margin: 0; }
.login-card .body { padding: 26px; }
.login-head { text-align: center; margin-bottom: 22px; }
.login-head .dot {
  width: 42px; height: 42px; margin: 0 auto 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6d6df0, #a855c8);
  display: grid; place-items: center;
  color: #fff; font-size: 18px; font-weight: 700;
}
.login-head h1 { font-size: 19px; margin-bottom: 3px; }
.login-card .field { margin-bottom: 14px; }
.login-card button { width: 100%; justify-content: center; margin-top: 6px; }

/* -------------------------------------------------------------- Empty state */

.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.empty svg { width: 32px; height: 32px; opacity: .4; margin-bottom: 10px; }
.empty p { margin: 0 0 6px; }
.empty .button { margin-top: 12px; }
td.empty { border-bottom: none; }
