/* muellerauth — shared stylesheet. Tokens first, then layout, then components. */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bg: #f4f3ee;
  --bg-2: #ebe9e2;
  --surface: #ffffff;
  --surface-2: #f8f7f3;
  --text: #1b1b1f;
  --muted: #6a6a72;
  --faint: #a2a2aa;
  --border: #e3e1d9;
  --border-2: #cfccc2;
  --accent: #d94f4f;
  --accent-2: #b93c3c;
  --accent-soft: #fbe9e9;
  --ok: #2f9e5a; --ok-soft: #e3f5ea;
  --warn: #b7791f; --warn-soft: #fbf0d6;
  --bad: #c9403e; --bad-soft: #fbe3e2;
  --info-soft: #e6eef9;
  --ring: 0 0 0 3px rgba(217, 79, 79, .25);
  --shadow-1: 0 1px 2px rgba(20, 20, 30, .06), 0 1px 1px rgba(20, 20, 30, .04);
  --shadow-2: 0 8px 24px -8px rgba(20, 20, 30, .18), 0 2px 6px rgba(20, 20, 30, .06);
  --shadow-3: 0 24px 60px -16px rgba(20, 20, 30, .28), 0 4px 12px rgba(20, 20, 30, .08);
  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --glow-a: rgba(217, 79, 79, .22);
  --glow-b: rgba(255, 170, 90, .20);
  --glow-c: rgba(120, 140, 255, .16);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214; --bg-2: #18181b;
    --surface: #1c1c21; --surface-2: #222228;
    --text: #e9e9ec; --muted: #9c9ca5; --faint: #6c6c76;
    --border: #2b2b33; --border-2: #3a3a44;
    --accent: #ef6b6b; --accent-2: #f58585; --accent-soft: #3a2224;
    --ok: #5ccb86; --ok-soft: #1c3326;
    --warn: #e0a84a; --warn-soft: #3a2f16;
    --bad: #f07371; --bad-soft: #3d2222;
    --info-soft: #1f2a3a;
    --ring: 0 0 0 3px rgba(239, 107, 107, .35);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-2: 0 8px 24px -8px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .4);
    --shadow-3: 0 24px 60px -16px rgba(0, 0, 0, .8), 0 4px 12px rgba(0, 0, 0, .4);
    --glow-a: rgba(239, 107, 107, .20);
    --glow-b: rgba(255, 170, 90, .12);
    --glow-c: rgba(120, 140, 255, .14);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; display: flex; flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
p { margin: .5rem 0; }
code, .copy { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: .05em .4em; border-radius: 5px; }
.muted { color: var(--muted); font-size: .92em; }
.faint { color: var(--faint); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
::selection { background: var(--accent-soft); }

/* ---------- auth layout (login / signup / errors) ---------- */
body.layout-auth { align-items: center; justify-content: center; padding: 2rem 1rem; overflow-x: hidden; }
.backdrop {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(60vmax 60vmax at 10% 10%, var(--glow-a), transparent 60%),
    radial-gradient(50vmax 50vmax at 90% 20%, var(--glow-b), transparent 60%),
    radial-gradient(55vmax 55vmax at 50% 100%, var(--glow-c), transparent 60%),
    var(--bg);
}
.backdrop::after {
  content: ""; position: absolute; inset: -50%;
  background: conic-gradient(from 0deg, transparent 0 70%, var(--glow-a) 80%, transparent 90%);
  animation: sweep 28s linear infinite; opacity: .5; filter: blur(60px);
}
@keyframes sweep { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .backdrop::after { animation: none; } }

.auth-card {
  width: 100%; max-width: 420px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 2rem 2rem 1.5rem;
  animation: rise .5s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } }
.auth-card .brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.25rem; color: var(--text); }
.auth-card .brand .mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #f39a5a); color: #fff; box-shadow: var(--shadow-1); }
.auth-card .brand .mark svg { width: 18px; height: 18px; }
.auth-card .brand strong { font-size: 1.05rem; letter-spacing: -.01em; }
.auth-card .brand span { display: block; font-size: .8rem; color: var(--muted); font-weight: 400; }
.auth-card h1 { font-size: 1.35rem; margin-bottom: .25rem; }
.auth-card > p.lead { color: var(--muted); margin: 0 0 1.25rem; }
.auth-card form { margin-top: .5rem; }
.auth-card .foot { margin: 1.25rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border); text-align: center; font-size: .9em; color: var(--muted); }

/* ---------- app layout (home / account / admin) ---------- */
body.layout-app { padding: 0; }
.topbar {
  position: sticky; top: var(--muellerauth-bar-height, 0); z-index: 50;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .inner { max-width: 1120px; margin: 0 auto; padding: .55rem 1.25rem; display: flex; align-items: center; gap: 1rem; }
.topbar .brand { display: flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; letter-spacing: -.01em; }
.topbar .brand .mark { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #f39a5a); color: #fff; }
.topbar .brand .mark svg { width: 14px; height: 14px; }
.topbar nav { display: flex; gap: .15rem; margin-left: .5rem; }
.topbar nav a { color: var(--muted); padding: .35rem .65rem; border-radius: var(--r-sm); font-size: .92em; font-weight: 500; }
.topbar nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.topbar nav a[aria-current] { color: var(--text); background: var(--surface-2); }
.topbar .spacer { flex: 1; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; flex: 1; }
.wrap.narrow { max-width: 720px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { color: var(--muted); margin: .25rem 0 0; }

.with-side { display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; align-items: start; }
.side { position: sticky; top: calc(var(--muellerauth-bar-height, 0px) + 56px); display: flex; flex-direction: column; gap: .15rem; }
.side a { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border-radius: var(--r-sm); color: var(--muted); font-weight: 500; font-size: .95em; }
.side a svg { width: 16px; height: 16px; opacity: .8; }
.side a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.side a[aria-current] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.side a[aria-current] svg { color: var(--accent); opacity: 1; }
@media (max-width: 760px) {
  .with-side { grid-template-columns: 1fr; }
  .side { position: static; flex-direction: row; overflow-x: auto; padding-bottom: .25rem; }
  .side a { white-space: nowrap; }
}

/* ---------- cards & sections ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-1); padding: 1.25rem 1.4rem; }
.card + .card, .card + h2, h2 + .card { margin-top: 1rem; }
.card h2 { display: flex; align-items: center; gap: .5rem; margin-bottom: .9rem; }
.card h2 svg { width: 16px; height: 16px; color: var(--accent); }
.card.danger { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.card.danger h2 svg { color: var(--bad); }
.stack > * + * { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.meta { display: flex; flex-wrap: wrap; gap: .35rem .9rem; color: var(--muted); font-size: .9em; align-items: center; }

/* app launcher tiles */
.apps { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin: .75rem 0 0; }
a.app {
  display: flex; align-items: center; gap: .7rem; padding: .85rem .95rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
a.app:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--border-2); }
a.app .ini { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: .95rem; color: #fff; flex: none;
  background: linear-gradient(135deg, hsl(var(--h, 0) 60% 52%), hsl(calc(var(--h, 0) + 30) 70% 60%)); }
a.app small { display: block; color: var(--muted); font-weight: 400; font-size: .8em; }

/* ---------- forms ---------- */
form { display: grid; gap: .9rem; }
form.inline { display: inline; }
form.row { display: flex; gap: .75rem; align-items: end; flex-wrap: wrap; }
label { display: flex; gap: .45rem; align-items: center; font-weight: 500; font-size: .92em; }
label.stack { display: block; }
label.stack > input, label.stack > select, label.stack > textarea { display: block; width: 100%; margin-top: .35rem; }
label.stack .hint, label .hint { display: block; font-weight: 400; color: var(--muted); font-size: .85em; margin-top: .3rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); padding: .6rem .75rem; transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input:disabled { background: var(--surface-2); color: var(--muted); }
input[type="checkbox"] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); margin: 0; }
input.code { font-family: var(--mono); font-size: 1.15rem; letter-spacing: .12em; text-transform: uppercase; text-align: center; }
fieldset { border: 1px solid var(--border); border-radius: var(--r-sm); padding: .6rem .85rem .75rem; display: flex; gap: .4rem 1rem; flex-wrap: wrap; margin: 0; background: var(--surface-2); }
legend { font-weight: 600; font-size: .85em; color: var(--muted); padding: 0 .35rem; }
fieldset label { font-weight: 450; }

button, .btn {
  font: inherit; font-weight: 600; font-size: .92em; cursor: pointer; border: 1px solid transparent; border-radius: var(--r-sm);
  padding: .6rem 1rem; background: var(--accent); color: #fff; display: inline-flex; align-items: center; gap: .45rem;
  transition: background .15s, transform .05s, box-shadow .15s; box-shadow: var(--shadow-1); line-height: 1.2;
}
button:hover, .btn:hover { background: var(--accent-2); text-decoration: none; }
button:active { transform: translateY(1px); }
button svg, .btn svg { width: 15px; height: 15px; }
button.secondary, .btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-2); }
button.secondary:hover { background: var(--surface-2); }
button.ghost { background: transparent; color: var(--muted); box-shadow: none; }
button.ghost:hover { background: var(--surface-2); color: var(--text); }
button.danger { background: var(--bad); }
button.small, .btn.small { padding: .35rem .65rem; font-size: .84em; }
button.block { width: 100%; justify-content: center; padding: .7rem; font-size: 1em; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -1.4rem; padding: 0 1.4rem; }
table { border-collapse: collapse; width: 100%; font-size: .93em; }
th, td { padding: .7rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: .78em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tr.hl { background: var(--warn-soft); }
td .sub { color: var(--muted); font-size: .9em; }

/* ---------- pills / avatar ---------- */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .12em .6em; border-radius: 999px; font-size: .78em; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.admin { background: var(--info-soft); color: #4a6fb5; border-color: transparent; }
.pill.plain::before { display: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .95rem; flex: none;
  background: linear-gradient(135deg, hsl(var(--h, 0) 55% 50%), hsl(calc(var(--h, 0) + 40) 65% 58%)); }
.avatar.lg { width: 56px; height: 56px; font-size: 1.4rem; }
.who { display: flex; align-items: center; gap: .9rem; }
.who strong { display: block; font-size: 1.05rem; }

/* ---------- flash toasts ---------- */
.flashes { position: fixed; top: calc(var(--muellerauth-bar-height, 0px) + 12px); right: 12px; z-index: 100; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 24px)); }
.flash {
  display: flex; align-items: flex-start; gap: .6rem; padding: .7rem .85rem; border-radius: var(--r); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-2); font-size: .92em; animation: slide .3s cubic-bezier(.2, .8, .2, 1) both;
  border-left: 4px solid var(--ok);
}
.flash.error { border-left-color: var(--bad); }
.flash.info { border-left-color: var(--accent); }
.flash svg { width: 16px; height: 16px; flex: none; margin-top: .1rem; color: var(--ok); }
.flash.error svg { color: var(--bad); }
.flash .msg { flex: 1; word-break: break-word; }
.flash .x { background: none; border: 0; box-shadow: none; color: var(--faint); padding: 0 .1rem; font-size: 1.1em; line-height: 1; cursor: pointer; }
.flash .x:hover { color: var(--text); background: none; }
.flash.out { animation: fade .3s ease forwards; }
@keyframes slide { from { opacity: 0; transform: translateX(16px); } }
@keyframes fade { to { opacity: 0; transform: translateX(16px); } }
.inline-flash { margin-top: .75rem; padding: .6rem .8rem; border-radius: var(--r-sm); background: var(--ok-soft); color: var(--ok); font-size: .92em; }
.inline-flash.error { background: var(--bad-soft); color: var(--bad); }

/* ---------- misc ---------- */
.qr { width: 84px; height: 84px; border-radius: 6px; background: #fff; padding: 4px; border: 1px solid var(--border); display: block; }
.qr svg { width: 100%; height: 100%; display: block; }
.invite-code { font-family: var(--mono); font-size: 1.05em; font-weight: 600; letter-spacing: .06em; }
.link-row { display: flex; align-items: center; gap: .4rem; margin-top: .3rem; }
.link-row .url { color: var(--muted); font-size: .82em; word-break: break-all; max-width: 26em; }
.empty { color: var(--muted); padding: 1.5rem; text-align: center; }
kbd { font: inherit; font-family: var(--mono); font-size: .85em; background: var(--surface-2); border: 1px solid var(--border-2); border-bottom-width: 2px; padding: .05em .4em; border-radius: 5px; }
footer.site { text-align: center; color: var(--faint); font-size: .8em; padding: 1rem; }
.flash.inline { position: static; margin: .9rem 0 0; box-shadow: none; animation: rise .3s both; }
/* polish after first screenshots */
.pill { white-space: nowrap; }
.flashes { top: calc(var(--muellerauth-bar-height, 0px) + 60px); }
.layout-auth .flashes { top: calc(var(--muellerauth-bar-height, 0px) + 12px); }
a.app > span:last-child, .app > span:last-child { min-width: 0; }
a.app small, .app small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
td .slugs { display: flex; flex-wrap: wrap; gap: .25rem; }
td .slugs code { font-size: .8em; }
.who { min-width: 0; }
.with-side > .main { min-width: 0; }
.wrap { overflow-x: clip; }
td .who { white-space: nowrap; }
td .slugs { min-width: 15em; }
@media (max-width: 640px) {
  .topbar .inner { gap: .5rem; padding: .5rem .75rem; }
  .topbar .brand .txt, .topbar form .txt { display: none; }
  .topbar nav { margin-left: 0; }
  .topbar nav a { padding: .35rem .5rem; }
}
.wrap { max-width: 1200px; }
.topbar .inner { max-width: 1200px; }
