/* WishPanel — dark-first, Ombi-flavoured. No external fonts (self-hosted friendly). */
:root {
  --bg: #0d0f14;
  --bg-2: #141821;
  --surface: #1a1f2b;
  --surface-2: #222838;
  --border: #2a3142;
  --text: #e7e9ee;
  --muted: #8f97a8;
  --accent: #f2b544;
  --accent-ink: #1a1405;
  --accent-soft: rgba(242, 181, 68, 0.14);
  --ok: #4cc38a;
  --bad: #ef6461;
  --warn: #e8a33d;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f6f9;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --border: #dde1ea;
  --text: #171a21;
  --muted: #5d6576;
  --accent: #c98a12;
  --accent-ink: #ffffff;
  --accent-soft: rgba(201, 138, 18, 0.12);
  --shadow: 0 8px 24px rgba(20, 25, 40, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
[x-cloak] { display: none !important; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
.muted { color: var(--muted); }
.sm { font-size: .85rem; }
.mono { font-family: var(--mono); }
.cap { text-transform: capitalize; }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; letter-spacing: .2px; }
.brand-lg { font-size: 1.35rem; margin-bottom: 1rem; }
.logo {
  width: 26px; height: 26px; flex: none; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #e0753a);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1.8l2.9 6.6 7.1.6-5.4 4.7 1.6 7-6.2-3.7-6.2 3.7 1.6-7L2 9l7.1-.6z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1.8l2.9 6.6 7.1.6-5.4 4.7 1.6 7-6.2-3.7-6.2 3.7 1.6-7L2 9l7.1-.6z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ---------- layout ---------- */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow);
}
.card.narrow { width: 100%; max-width: 440px; padding: 1.75rem; }
.card-title { font-size: 1.15rem; }
.row { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- forms ---------- */
.field { display: grid; gap: .3rem; margin: .9rem 0; }
.field > span { font-size: .85rem; color: var(--muted); font-weight: 600; }
input {
  width: 100%; padding: .65rem .8rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text); font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input:disabled { opacity: .55; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.05rem; border-radius: 8px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 650; cursor: pointer;
}
.btn:hover:not(:disabled) { filter: brightness(1.07); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); filter: none; }
.btn.sm { padding: .35rem .7rem; font-size: .85rem; }
.btn.block { width: 100%; margin-top: .4rem; }
.notice { padding: .6rem .8rem; border-radius: 8px; font-size: .9rem; margin-top: .4rem; }
.notice.ok { background: rgba(76, 195, 138, .12); color: var(--ok); }
.notice.bad { background: rgba(239, 100, 97, .12); color: var(--bad); }

.steps { display: flex; gap: .5rem; padding: 0; margin: 1rem 0 0; list-style: none; counter-reset: s; }
.steps li {
  flex: 1; font-size: .8rem; color: var(--muted); padding-top: .5rem;
  border-top: 3px solid var(--border); counter-increment: s;
}
.steps li::before { content: counter(s) ". "; }
.steps li.active { color: var(--text); border-color: var(--accent); }
.steps li.done { border-color: var(--ok); }

.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1.5rem;
  padding: .7rem 1.25rem; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.tabs { display: flex; gap: .25rem; flex: 1; overflow-x: auto; }
.tab { padding: .45rem .85rem; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tab:hover { color: var(--text); background: var(--surface); }
.tab.active { color: var(--accent); background: var(--accent-soft); }
.user { display: flex; align-items: center; gap: .55rem; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); font-weight: 700; font-size: .85rem;
}
.pill {
  display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 650;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.pill.ok { color: var(--ok); border-color: rgba(76, 195, 138, .35); }
.user .pill { color: var(--accent); border-color: rgba(242, 181, 68, .35); }
.content { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 1.5rem 1.25rem 2rem; }
.page-title { font-size: 1.6rem; margin-bottom: 1.25rem; }
.section-title { font-size: 1.1rem; margin: 1.75rem 0 .75rem; }
.footer { text-align: center; padding: 1rem; }

/* ---------- discover ---------- */
.shelf { margin-bottom: 2rem; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.shelf-head h2 { font-size: 1.15rem; }
.shelf-row { display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: .9rem; overflow-x: auto; padding-bottom: .5rem; }
.cover { aspect-ratio: 2 / 3; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.skeleton {
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 300% 100%; animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- search / empty ---------- */
.search { display: grid; gap: .75rem; max-width: 720px; }
.seg { display: flex; gap: .4rem; }
.seg-btn {
  padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font: inherit; font-size: .85rem;
}
.empty {
  margin-top: 1.5rem; padding: 3rem 1rem; text-align: center; color: var(--muted);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty p { margin: .25rem 0; }
.empty-icon { width: 44px; height: 44px; margin: 0 auto .75rem; opacity: .6; }

/* ---------- admin ---------- */
.admin { display: grid; grid-template-columns: 240px 1fr; gap: 1.5rem; align-items: start; }
.admin-nav {
  position: sticky; top: 70px; display: grid; gap: 2px; padding: .5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.admin-link {
  text-align: left; padding: .5rem .7rem; border: 0; border-radius: 7px; background: none;
  color: var(--muted); font: inherit; font-size: .9rem; cursor: pointer;
}
.admin-link:hover { background: var(--surface-2); color: var(--text); }
.admin-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.card h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.card p { margin: .3rem 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: .35rem; }
.dot.ok { background: var(--ok); }
.dot.degraded, .dot.not_configured { background: var(--warn); }
.dot.error { background: var(--bad); }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: .65rem .85rem; border-bottom: 1px solid var(--border); }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--bg-2); }
.table tr:last-child td { border-bottom: 0; }

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; gap: .6rem; padding: .6rem 16px; }
  .tabs { order: 3; flex-basis: 100%; }
  .user { margin-left: auto; }
  .user-name { display: none; }
  .content { padding: 1rem 16px 2rem; }
  .admin { grid-template-columns: 1fr; }
  .admin-nav { position: static; grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .table { display: block; overflow-x: auto; }
}
