/* Dark theme modelled on whatbox.ca: charcoal page, gold headings,
   teal outline buttons, blue gradient primary buttons, flat shadowed boxes. */
:root {
  --bg: #1a1c1e;
  --text: #ccc;
  --muted: #8f969c;
  --box: rgba(255, 255, 255, 0.06);
  --box-hover: rgba(255, 255, 255, 0.09);
  --rule: rgba(255, 255, 255, 0.2);
  --row-rule: rgba(255, 255, 255, 0.06);
  --input-bg: #141a1a;
  --input-border: #3b3b3b;
  --gold: #e9c267;
  --gold-deep: #e9b335;
  --link: #90cbbd;
  --teal: #75c7c7;
  --blue-top: #80c5e0;
  --blue-bottom: #57a7cc;
  --blue-hover-top: #a9d8ea;
  --blue-hover-bottom: #7fbbd7;
  --red: #ef6651;
  --shadow: 0 0.125rem 0.25rem #000;
  --shadow-inset: inset 0 0.125rem 0.25rem #000;
  --page-width: 66rem;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  background-color: var(--bg);
  /* subtle grain so the page isn't a flat slab */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body {
  margin: 0;
  background: transparent;
  color: var(--text);
  font: 1rem/1.5rem -apple-system, system-ui, "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans",
    "Bitstream Vera Sans", "Liberation Sans", Verdana, sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }
strong { font-weight: 700; }
code {
  background: var(--box);
  outline: 0.1rem dashed var(--input-border);
  box-shadow: var(--shadow);
  padding: 0 0.25rem;
  font-size: 0.9em;
}
h2 { color: var(--gold); font-size: 1.5rem; line-height: 2rem; margin: 0 0 0.75rem; }
h3 { color: var(--gold-deep); font-size: 1rem; font-weight: 400; margin: 1.5rem 0 0.5rem; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: normal; }
.error { color: var(--red); margin: 0.5rem 0 0; }
.error:empty { display: none; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0.5rem 0 0; }
.empty { color: var(--muted); text-align: center; padding: 2rem 0; }
::selection { background: var(--gold); color: var(--bg); }

.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.05rem; color: var(--text); }
.brand img { width: 28px; height: 28px; }

/* header: transparent, thin rule underneath, gold underline on the current tab */
.topbar {
  max-width: calc(var(--page-width) + 2rem);
  margin: 0 auto 1.4rem;
  padding: 0 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.topbar::after {
  content: ""; flex-basis: 100%; height: 0; border-bottom: 0.1rem solid var(--rule); margin-top: -1px;
}
.tabs { display: flex; }
.tabs a {
  display: inline-block; padding: 0.75rem; color: var(--text); text-decoration: none;
}
.tabs a:hover { color: var(--gold); text-decoration: none; }
.tabs a.active { border-bottom: 0.1875rem solid var(--gold); padding-bottom: 0.5625rem; }
.tabs:hover a.active:not(:hover) { border-bottom: 0; padding-bottom: 0.75rem; }
.tabs:hover a:hover { border-bottom: 0.1875rem solid var(--gold); padding-bottom: 0.5625rem; }
.topbar-right {
  margin-left: auto; flex: 1 1 0; min-width: 0;
  display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem;
}
.topbar-right button { flex: none; }

main { max-width: calc(var(--page-width) + 2rem); margin: 0 auto; padding: 0 1rem 4rem; }
.tab { display: none; }
.tab.active { display: block; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 2rem 0 0.75rem; }
.section-head h2 { margin: 0; }
#tab-releases .section-head { margin-top: 0; }

.card {
  background: var(--box); box-shadow: var(--shadow); padding: 1.25rem 1.5rem; margin-bottom: 1.5rem;
}

/* form controls */
input, select, button { font: inherit; color: inherit; }
input:not([type=checkbox]), select {
  width: 100%; padding: 0.6875rem 0.9375rem; line-height: inherit;
  background: var(--input-bg); border: 0.0625rem solid var(--input-border); border-radius: 0;
  box-shadow: var(--shadow-inset); color: var(--text);
}
input::placeholder { color: #6b7276; }
input:focus, select:focus { outline: 1px solid var(--gold); outline-offset: -1px; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); cursor: pointer; }
label.check { flex-direction: row; align-items: center; gap: 0.5rem; color: var(--text); font-size: 1rem; }
label.check input { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--gold); box-shadow: var(--shadow); }

/* outline button (default) */
button {
  padding: 0.6875rem 0.9375rem; border-radius: 0.5rem; border: 1px solid var(--link);
  background: transparent; color: var(--link); cursor: pointer; white-space: nowrap; line-height: 1.5rem;
}
button:hover { background: rgba(144, 203, 189, 0.08); }
button:disabled { opacity: 0.55; cursor: progress; }
button.ghost { background: transparent; }
button.ghost:hover { background: rgba(144, 203, 189, 0.08); }
/* filled blue gradient button */
button.primary {
  border: 0; color: var(--bg); font-weight: 600; text-shadow: 0 1px 0 var(--blue-hover-top);
  background-color: var(--blue-top);
  background-image: linear-gradient(var(--blue-top), var(--blue-bottom));
  box-shadow: var(--shadow); padding: 0.75rem 1rem;
}
button.primary:hover { background-image: linear-gradient(var(--blue-hover-top), var(--blue-hover-bottom)); }
button.primary:active { box-shadow: var(--shadow-inset), 0 0.1rem 0 var(--input-border); }
button.primary:disabled { background-image: linear-gradient(#b7b7b7, #9b9696); text-shadow: 0 1px 0 #d1d1d1; }
button.small { padding: 0.3rem 0.75rem; font-size: 0.875rem; line-height: 1.25rem; }
button.danger { color: var(--red); border-color: var(--red); }
button.danger:hover { background: rgba(239, 102, 81, 0.1); }

.row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.row select { width: auto; flex: 0 0 auto; }
.row input { flex: 1; }
.row-buttons { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 1.25rem; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem 1rem; align-items: end; }
.span2 { grid-column: span 2; }
.settings h2:not(:first-child) { margin-top: 2rem; }

/* IRC status */
.pill {
  display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.875rem; color: var(--muted);
  min-width: 0; white-space: nowrap;
}
.pill span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pill::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--muted); flex: none; }
.pill.ok::before { background: var(--teal); box-shadow: 0 0 6px var(--teal); }
.pill.warn::before { background: var(--gold-deep); }
.pill.bad::before { background: var(--red); }

/* release and repo rows: boxes like the plan cards */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between;
  background: var(--box); box-shadow: var(--shadow); padding: 0.9rem 1.25rem; margin-bottom: 0.75rem;
  border-left: 3px solid transparent;
}
.list li:hover { background: var(--box-hover); }
.list li.paused { opacity: 0.55; }
.list li.fresh { border-left-color: var(--gold); }
.item-main { min-width: 0; flex: 1; }
.item-title { font-weight: 600; overflow-wrap: anywhere; }
.item-title a { color: var(--text); }
.item-title a:hover { color: var(--gold); text-decoration: none; }
.item-sub { color: var(--muted); font-size: 0.875rem; margin-top: 0.15rem; overflow-wrap: anywhere; }
.item-sub .err { color: var(--red); }
.item-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.tag { display: inline-block; color: var(--gold-deep); margin-left: 0.5rem; font-weight: 600; }
.tag.pre { color: var(--teal); }
.badge {
  font-size: 0.75rem; color: var(--muted); border: 1px solid var(--input-border); padding: 0 0.4rem;
  font-weight: 400; vertical-align: 1px;
}

.nudge {
  background: var(--box); box-shadow: var(--shadow); border-left: 3px solid var(--blue-top);
  padding: 0.75rem 1rem; margin: 0 0 1rem; font-size: 0.95rem;
}

.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 1rem; }
.login-card button { align-self: flex-start; }

#toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(1rem);
  background: #24272a; color: var(--text); box-shadow: 0 0.25rem 0.75rem #000; border-left: 3px solid var(--teal);
  padding: 0.7rem 1rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100% - 2rem);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { border-left-color: var(--red); }

@media (max-width: 46em) {
  .topbar { gap: 0.25rem 1rem; }
  .topbar-right { margin-left: 0; flex: 1 1 100%; justify-content: space-between; padding-bottom: 0.5rem; order: 3; }
  .topbar::after { order: 4; }
  .row { flex-wrap: wrap; }
  .row select { flex: 1 1 100%; }
  .grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .list li { flex-direction: column; }
  .item-actions { justify-content: flex-start; }
}
