/* Kamoo design tokens, taken from kamoo-platform-app (src/app/main.css). */
:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --fs-xs: .71875rem; --fs-sm: .8125rem; --fs-base: 1.03125rem; --fs-lg: 1.3125rem; --fs-3xl: 2.6875rem;
  --radius-sm: 9px; --radius-md: 12px; --radius-lg: 15px; --radius-xl: 21px; --radius-pill: 9999px;
  --sidebar-width: 256px;
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
  --page: #f4f1ec; --background: #faf8f5; --card: #fff;
  --foreground: #1f1027; --muted: #f4f1ec; --muted-foreground: #6e6875;
  --border: #e4dfe8; --ring: hsl(279.3 43.9% 30%);
  --primary: #4b255f; --primary-foreground: #fff;
  --secondary: #f1ecf6; --secondary-foreground: hsl(279.3 43.9% 30%);
  --destructive: #e7000b; --success: #009966;
  --sidebar-foreground: #5b5560; --sidebar-accent: #e9e5df;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: hsl(281 20% 8%); --background: hsl(281 22% 6%); --card: hsl(281 18% 10%);
    --foreground: hsl(276 20% 96%); --muted: hsl(281 20% 8%); --muted-foreground: hsl(276 6% 56%);
    --border: hsl(281 14% 20%); --ring: hsl(279 70% 80%);
    --primary: hsl(279 45% 42%); --secondary: hsl(281 22% 13%); --secondary-foreground: hsl(279 70% 80%);
    --destructive: #ff6467;
    --sidebar-foreground: hsl(276 8% 72%); --sidebar-accent: hsl(281 6% 16%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; }
body { margin: 0; font: 400 var(--fs-sm)/1.5 var(--font-sans); background: var(--page); color: var(--foreground); }
a { color: inherit; }
h1, h2, h3 { margin: 0; }
p { margin: 0 0 8px; }
.muted { color: var(--muted-foreground); }
.small { font-size: var(--fs-xs); }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ─── App shell ─────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); flex: none; padding: 8px; display: flex; flex-direction: column; gap: 8px; color: var(--sidebar-foreground); position: sticky; top: 0; height: 100vh; }
.org, .me { display: flex; align-items: center; gap: 8px; height: 48px; padding: 8px; border-radius: var(--radius-md); }
.tile { width: 32px; height: 32px; border-radius: var(--radius-lg); background: var(--sidebar-accent); display: grid; place-items: center; flex: none; }
.tile img { width: 20px; height: 20px; }
.org strong, .me strong { display: block; font-weight: 600; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org span, .me span { display: block; font-size: var(--fs-xs); color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 4px; padding: 8px; }
.nav h4 { margin: 0; padding: 0 8px; font-size: var(--fs-xs); font-weight: 500; opacity: .7; }
.nav a { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: var(--radius-md); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--sidebar-accent); color: var(--foreground); }
.nav a[aria-current="page"] { font-weight: 500; }
.sidebar .spacer { flex: 1; }
.me .avatar { width: 32px; height: 32px; border-radius: var(--radius-lg); background: var(--primary); color: var(--primary-foreground); display: grid; place-items: center; font-weight: 600; flex: none; }
.me form { margin-left: auto; }

.main { flex: 1; min-width: 0; margin: 8px 8px 8px 0; background: var(--background); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); }
.topbar { height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.topbar .divider { width: 1px; height: 16px; background: var(--border); }
.content { max-width: 1280px; padding: 24px 32px; }
.intro { margin-bottom: 24px; color: var(--muted-foreground); max-width: 760px; }
/* Pages rendered by allauth (MFA, password) inside the app shell. */
.content h1 { font-size: var(--fs-lg); font-weight: 600; margin-bottom: 16px; }
.content h2 { font-size: var(--fs-sm); font-weight: 600; margin: 24px 0 4px; }
.content .section > h2 { margin-top: 0; }
.content ul:not(.messages) { list-style: none; padding: 0; display: flex; gap: 8px; }
.content ul:not(.messages) a { display: inline-flex; align-items: center; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--background); text-decoration: none; font-weight: 500; box-shadow: var(--shadow-xs); }

/* ─── Sections and cards ───────────────────────────────── */
.section { margin-bottom: 32px; }
.section > h2 { font-size: var(--fs-sm); font-weight: 600; }
.section > p { color: var(--muted-foreground); margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-row { display: flex; align-items: center; gap: 12px; padding: 16px; }
.card-row .grow { flex: 1; min-width: 0; }
.card-row strong { font-weight: 500; display: block; }
.logo { width: 36px; height: 36px; flex: none; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); display: grid; place-items: center; }
.logo img, .logo .icon { width: 20px; height: 20px; }
.sub { margin: 0 16px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius-md) var(--radius-md); background: color-mix(in srgb, var(--muted) 30%, var(--background)); }
.sub .card-row { padding: 12px 16px; }
.sub .card-row + .card-row { border-top: 1px solid var(--border); }
.ok { color: var(--success); } .bad { color: var(--destructive); }
.pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 500; background: var(--secondary); color: var(--secondary-foreground); white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { padding: 16px; }
.stat b { display: block; font-size: var(--fs-lg); font-weight: 600; }
.empty { border: 1px dashed var(--border); border-radius: var(--radius-lg); padding: 48px 24px; text-align: center; color: var(--muted-foreground); }
.code { display: flex; align-items: center; gap: 8px; font-family: ui-monospace, SFMono-Regular, monospace; overflow-wrap: anywhere; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--muted-foreground); font-size: var(--fs-xs); }
th, td { padding: 8px 16px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }

/* ─── Controls ─────────────────────────────────────────── */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--radius-pill); background: var(--primary); color: var(--primary-foreground); font: 500 var(--fs-sm) var(--font-sans); text-decoration: none; cursor: pointer; white-space: nowrap; }
button.outline, .button.outline { height: 32px; padding: 0 10px; background: var(--background); color: var(--foreground); border-color: var(--border); box-shadow: var(--shadow-xs); }
button.ghost, .button.ghost { height: 28px; padding: 0 8px; background: transparent; color: var(--muted-foreground); }
button.outline:hover, button.ghost:hover, .button.outline:hover { background: var(--secondary); }
button.danger { background: var(--destructive); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--ring) 50%, transparent); outline-offset: 1px; }
label { display: block; font-weight: 500; margin-bottom: 4px; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: transparent; color: inherit; font: inherit; box-shadow: var(--shadow-xs); }
form p { margin-bottom: 16px; }
.helptext, .errorlist { font-size: var(--fs-xs); color: var(--muted-foreground); }
.errorlist { color: var(--destructive); padding-left: 16px; }
.inline-form { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline-form p { margin: 0; flex: 1; min-width: 180px; }
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 16px; border-radius: var(--radius-md); background: var(--secondary); color: var(--secondary-foreground); margin-bottom: 8px; }
.messages li.error { background: color-mix(in srgb, var(--destructive) 10%, transparent); color: var(--destructive); }

/* ─── Danger zone ──────────────────────────────────────── */
.danger-zone { border-color: color-mix(in srgb, var(--destructive) 35%, var(--border)); }
.danger-zone .card-row + .card-row { border-top: 1px solid var(--border); }

/* ─── Sign-in pages ────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 560px) 1fr; }
.auth-panel { background: var(--card); border-right: 1px solid var(--border); padding: 32px; display: flex; flex-direction: column; }
.auth-panel .brand img { height: 28px; }
.auth-form { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 24px; max-width: 420px; width: 100%; margin: 32px auto; }
.auth-form h1 { font-size: var(--fs-3xl); font-weight: 600; line-height: 1.1; }
.auth-form button[type=submit], .auth-form .primary { width: 100%; height: 40px; }
.auth-aside { display: grid; place-items: center; padding: 48px; color: var(--muted-foreground); font-size: var(--fs-lg); }

@media (prefers-color-scheme: dark) { .tile img { filter: invert(1) hue-rotate(180deg); } }
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; }
  .sidebar .nav { flex-direction: row; flex-wrap: wrap; padding: 0 8px; }
  .sidebar .nav h4, .sidebar .spacer { display: none; }
  .card-row { flex-wrap: wrap; }
  .card-row .grow { flex-basis: calc(100% - 60px); }
  .main { margin: 0 8px 8px; }
  .content { padding: 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-panel { border-right: 0; padding: 16px; }
}

/* QR codes (MFA setup) stay scannable in dark mode. */
.content img[src^="data:"] { background: #fff; padding: 8px; border-radius: var(--radius-md); }
