:root {
    --primary: #0d6efd;
    --bg: #f7f7f9;
    --fg: #1a1a1a;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--fg);
}

/* Legacy chrome — only applies to the home/marketing header on /, not to
   editorial .topbar elements rendered inside the app shell. Scope explicitly
   so it can't bleed onto the AccountPortal topbar. */
header.site-header {
    background: var(--primary);
    color: #fff;
    padding: 1rem 1.5rem;
}

header.site-header a { color: #fff; text-decoration: none; font-weight: 600; }
header.site-header nav { display: flex; align-items: center; gap: 0.75rem; }
.brand-logo { height: 28px; width: auto; }

main { padding: 2rem 1.5rem; max-width: 960px; margin: 0 auto; }

footer { padding: 1rem 1.5rem; color: #666; }

.muted { color: #666; }
.error { color: #c0392b; font-size: 0.875rem; }

.auth-card {
    max-width: 420px;
    margin: 3rem auto;
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.auth-card h1 { margin-top: 0; font-size: 1.5rem; }

.field { margin: 0.75rem 0; display: flex; flex-direction: column; gap: 0.25rem; }
.field.checkbox { flex-direction: row; align-items: center; gap: 0.5rem; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field input[type=email],
.field input[type=password],
.field input[type=text] {
    padding: 0.5rem 0.75rem;
    border: 1px solid #cfd2d8;
    border-radius: 6px;
    font-size: 1rem;
}

button.primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    margin-top: 0.5rem;
}

.tenant-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.tenant-list .tenant {
    width: 100%;
    text-align: left;
    background: #f7f8fa;
    border: 1px solid #e1e3e8;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.tenant-list .tenant:hover { background: #eef1f6; }
.tenant-list .name { font-weight: 600; }
.tenant-list .slug { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; color: #666; }
.tenant-list .roles { font-size: 0.8rem; color: #444; }

.admin-nav {
    display: flex;
    gap: 1.25rem;
    margin: -1rem 0 1.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e1e3e8;
}
.admin-nav a {
    color: #444;
    text-decoration: none;
    font-weight: 500;
    padding: 0.25rem 0;
}
.admin-nav a:hover { color: var(--primary); }

.flash {
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}
.flash.success { background: #e6f4ea; color: #1e6e3a; border: 1px solid #b6dfbf; }
.flash.error { background: #fdecec; color: #a13b3b; border: 1px solid #f5c2c2; }

.admin-form fieldset {
    border: 1px solid #e1e3e8;
    border-radius: 6px;
    padding: 0.75rem 1rem 1rem;
    margin: 0 0 1rem 0;
}
.admin-form fieldset legend { padding: 0 0.4rem; font-weight: 600; color: #444; }
.admin-form .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.admin-form textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #cfd2d8;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.875rem;
}
.admin-form input[type=color] { width: 4rem; height: 2.4rem; padding: 0; border: 1px solid #cfd2d8; border-radius: 6px; }

.inline-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) auto;
    gap: 0.75rem;
    align-items: end;
    background: #f6f8fb;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}
.inline-form button.primary { width: auto; margin: 0; height: 2.4rem; }

table.data {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.95rem;
}
table.data th, table.data td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #eef0f3;
    text-align: left;
}
table.data th { background: #f7f8fa; font-weight: 600; }
table.data code { font-size: 0.85rem; color: #666; }

button.link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
}
button.link.danger { color: #c0392b; }

.role-form { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.role-checks { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.role-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid #cfd2d8;
    border-radius: 999px;
    font-size: 0.85rem;
    background: #fff;
}
.role-chip input[type=checkbox] { margin: 0; }
.actions form + form { margin-left: 0.4rem; }

button.primary.outline {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
}
button.primary.outline:hover { background: #f0f5ff; }
.auth-divider {
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    margin: 1rem 0;
    position: relative;
}
.auth-divider::before, .auth-divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: calc(50% - 1.5rem);
    height: 1px;
    background: #e1e3e8;
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.stat {
    background: #fff;
    border: 1px solid #e1e3e8;
    border-radius: 8px;
    padding: 1rem 1.25rem;
}
.stat-num { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-lbl { color: #555; margin-top: .25rem; font-size: .9rem; }

section { margin: 1.5rem 0; }
section h2 { margin-bottom: .5rem; font-size: 1.1rem; }

/* === Extracted from view @section Styles === */
.ap-nav { display:flex; gap:4px; padding:4px; background:#fff; border:1px solid var(--yail-stone); border-radius:999px; margin-bottom:24px; flex-wrap:wrap; }
.ap-nav a { padding:7px 14px; font-size:12.5px; color:var(--yail-mocha); border-radius:999px; text-decoration:none; }
.ap-nav a.on { background:var(--yail-coffee); color:var(--yail-cream); }
.ap-nav a:hover { color:var(--yail-coffee); }
.id-key { width: 120px; height: 120px; border-radius: 28px; background: linear-gradient(135deg, #3D2A1A, #6B4423); display: flex; align-items: center; justify-content: center; box-shadow: 0 16px 40px rgba(61,42,26,.22); position: relative; z-index: 2; }
.id-key svg { color: var(--yail-amber-light); }
.id-method { position: absolute; width: 56px; height: 56px; background: #fff; border: 1px solid var(--yail-stone); border-radius: 14px; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-card-soft); color: var(--yail-coffee); }
.id-method .lbl { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--yail-mocha); white-space: nowrap; }
.id-method.email { right: 14%; bottom: 22%; color: var(--yail-amber); }
.id-method.google { right: 14%; top: 22%; color: #5F7A3A; }
.id-method.ms { left: 14%; bottom: 22%; color: #2C5C8F; }
.id-method.passkey { left: 14%; top: 22%; }
.id-orbit { position: absolute; inset: 18%; border-radius: 50%; border: 1px dashed var(--yail-stone); }
.method .ic { width: 36px; height: 36px; border-radius: 8px; background: var(--yail-cream); display: flex; align-items: center; justify-content: center; color: var(--yail-coffee); }
.method .sub { font-size: 12px; color: var(--yail-mocha); margin-top: 2px; }
.method .ttl { font-size: 14px; font-weight: 600; color: var(--yail-ink); }
.switch { width: 36px; height: 20px; background: var(--yail-stone); border-radius: 999px; position: relative; cursor: pointer; transition: background .2s; }
.switch.on { background: var(--yail-coffee); }
.switch.on::after { transform: translateX(16px); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
/* Auth method tile */
  .method { display: grid; grid-template-columns: 36px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; background: #fff; border: 1px solid var(--yail-stone); border-radius: 12px; }
/* Identity hero art — credential constellation */
  .id-art { display: grid; place-items: center; height: 100%; position: relative; }
