/* Queye for Partners — built on the Queye design language.

   Layout: a full-width console. A full-bleed identity row (brand, team switcher,
   account), a left section-nav column, then a working area with a one-line page
   bar and a split of primary column plus reference rail. Wide content (tables)
   spans the full width. Below 900px the nav flattens into a horizontal scrolling
   strip — no drawer, no JS. Flat throughout — hairlines and spacing separate; shadows
   are reserved for surfaces that genuinely float. Information Yellow is the one
   accent; Wix Madefor with heavy weights; 140ms touches; pure-black dark mode. */

:root {
    color-scheme: light;

    /* type */
    --heading-font: 'Wix Madefor Display', 'Metropolis', 'Arimo', 'Roboto', system-ui, Arial, sans-serif;
    --body-font: 'Wix Madefor Text', 'Metropolis', 'Arimo', 'Roboto', system-ui, Arial, sans-serif;
    --mono-font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, 'Courier New', monospace;

    /* surfaces */
    --surface: #ffffff;
    --raised: #ffffff;       /* only things that float: menus, dialogs */
    --wash: rgba(32, 33, 36, 0.045);
    --wash-strong: rgba(32, 33, 36, 0.08);
    --fill: #f4f5f6;

    /* ink */
    --ink: #202124;
    --muted: #4d5156;
    --faint: #70757a;
    --link: #1a0dab;

    /* lines */
    --line: #dadce0;
    --line-soft: #e8eaed;
    --input-border: #dfe1e5;
    --input-bg: #ffffff;
    --scrim: rgba(0, 0, 0, 0.45);

    /* the one accent */
    --accent: #ffbd16;
    --accent-hover: #efb200;
    --accent-ink: #111111;

    /* semantic */
    --success: #188038;
    --warning: #a86400;
    --danger: #d93025;

    /* shell */
    --bar-h: 54px;           /* identity row */
    --nav-w: clamp(186px, 15vw, 218px);
    --main-pad: clamp(20px, 2.6vw, 36px);
    --shell-pad: clamp(18px, 3.5vw, 46px);
    --content-max: 1440px;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --surface: #000000;
        --raised: #161616;
        --wash: rgba(255, 255, 255, 0.06);
        --wash-strong: rgba(255, 255, 255, 0.11);
        --fill: #141414;

        --ink: #dddddd;
        --muted: #bbbbbb;
        --faint: #8b8b8b;
        --link: #4e9af1;

        --line: #333333;
        --line-soft: #242424;
        --input-border: #333333;
        --input-bg: #1a1a1a;

        --success: #60d937;
        --warning: #ffbd16;
        --danger: #ff5449;
    }
}

::selection {
    background: rgba(255, 189, 22, 0.6);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: var(--body-font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
}

body.modal-open {
    overflow: hidden;
}

a {
    color: var(--link);
}

img {
    max-width: 100%;
}

.queye-logo {
    filter: none;
}

@media (prefers-color-scheme: dark) {
    .queye-logo {
        filter: invert(1);
    }
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Type ---------- */

h1, h2, h3, h4 {
    font-family: var(--heading-font);
    margin: 0 0 12px;
    letter-spacing: -0.01em;
    line-height: 1.15;
}

h1 {
    font-size: clamp(2.4rem, 4.2vw, 3.6rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.04;
}

h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
h4 { font-size: 15px; font-weight: 700; }

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-family: var(--heading-font);
    font-size: 11px;
    font-weight: 700;
    color: var(--faint);
    margin: 0 0 10px;
}

.intro,
.muted {
    color: var(--muted);
}

.intro {
    font-size: 17px;
    line-height: 1.55;
    max-width: 620px;
}

code {
    font-family: var(--mono-font);
}

/* ---------- Console chrome ---------- */

.chrome {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--surface);
    border-bottom: 1px solid var(--line-soft);
}

/* Row 1 — who you are and which team you're in */

.identity-row {
    height: var(--bar-h);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 var(--shell-pad);
    max-width: var(--content-max);
    margin: 0 auto;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: inherit;
    font-family: var(--heading-font);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
    white-space: nowrap;
    flex: 0 0 auto;
}

.brand img {
    width: 24px;
    height: 24px;
}

.brand-sep {
    color: var(--line);
    font-size: 18px;
    flex: 0 0 auto;
}

.identity-row .spacer {
    flex: 1 1 auto;
}

.topbar-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 650;
    padding: 6px 12px;
    border-radius: 999px;
    white-space: nowrap;
    transition: background 0.14s ease, color 0.14s ease;
}

.topbar-link:hover,
.topbar-link:focus-visible {
    background: var(--wash);
    color: var(--ink);
}

/* ---------- Section nav: the left column ---------- */

.shell {
    display: grid;
    grid-template-columns: var(--nav-w) minmax(0, 1fr);
    align-items: start;
    max-width: var(--content-max);
    margin: 0 auto;
}

.shell.no-nav {
    grid-template-columns: minmax(0, 1fr);
}

.section-nav {
    position: sticky;
    top: var(--bar-h);
    height: calc(100vh - var(--bar-h));
    overflow-y: auto;
    padding: 22px 10px 24px var(--shell-pad);
    border-right: 1px solid var(--line-soft);
    display: grid;
    gap: 24px;
    align-content: start;
}

.nav-group {
    display: grid;
    gap: 1px;
}

.nav-group-label {
    margin: 0 0 5px;
    padding: 0 10px;
    color: var(--faint);
    font-family: var(--heading-font);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    padding: 6px 10px 6px 15px;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
    transition: background 0.14s ease, color 0.14s ease;
}

.nav-link svg {
    flex: 0 0 auto;
    color: var(--faint);
    transition: color 0.14s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
    background: var(--wash);
    color: var(--ink);
}

.nav-link:hover svg {
    color: var(--muted);
}

.nav-link.active {
    background: var(--wash-strong);
    color: var(--ink);
    font-weight: 750;
}

.nav-link.active svg {
    color: var(--ink);
}

/* The accent marks the current section, echoing the brand's one colour. */
.nav-link.active::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
}

.nav-ext {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    opacity: .45;
}

.nav-count {
    margin-left: auto;
    min-width: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 11px;
    font-weight: 800;
    line-height: 17px;
    text-align: center;
}

/* Team switcher */

.team-switcher {
    position: relative;
    flex: 0 1 auto;
    min-width: 0;
}

.team-switcher-trigger {
    max-width: 260px;
    gap: 8px;
    padding: 4px 10px 4px 5px;
    border-radius: 999px;
    border-color: transparent;
    font-size: 14px;
    font-weight: 700;
}

.team-switcher-trigger:hover {
    background: var(--wash);
}

.team-switcher-trigger .team-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-switcher-trigger .chevron {
    color: var(--faint);
    flex: 0 0 auto;
    transition: transform 0.14s ease;
}

.team-switcher-trigger[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

.team-mark,
.team-mark-placeholder {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #ffffff;
    overflow: hidden;
}

.team-mark {
    object-fit: contain;
    padding: 2px;
}

.team-mark-placeholder {
    display: grid;
    place-items: center;
    font-family: var(--heading-font);
    font-weight: 800;
    font-size: 12px;
    color: #202124;
    text-transform: uppercase;
}

/* Account */

.account {
    position: relative;
    flex: 0 0 auto;
}

.account-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    border-color: transparent;
    font-size: 13.5px;
    font-weight: 650;
    max-width: 200px;
}

.account-trigger:hover {
    background: var(--wash);
}

.avatar {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-ink);
    font-family: var(--heading-font);
    font-weight: 800;
    font-size: 12.5px;
    line-height: 1;
    text-transform: uppercase;
}

.account-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Floating surfaces — the one place elevation is allowed */

.account-menu,
.team-menu {
    position: absolute;
    z-index: 40;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--raised);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.account-menu[hidden],
.team-menu[hidden] {
    display: none;
}

.account-menu {
    top: calc(100% + 5px);
    right: 0;
    min-width: 234px;
}

.team-menu {
    top: calc(100% + 5px);
    left: 0;
    min-width: 240px;
    max-height: 60vh;
    overflow-y: auto;
}

.menu-label {
    padding: 6px 10px 4px;
    margin: 0;
    color: var(--faint);
    font-family: var(--heading-font);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.menu-head {
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 6px;
}

.menu-head strong {
    display: block;
    font-family: var(--heading-font);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.menu-head span {
    display: block;
    color: var(--faint);
    font-size: 12.5px;
    overflow-wrap: anywhere;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
    transition: background 0.14s ease;
}

.menu-item:hover,
.menu-item:focus-visible {
    background: var(--wash);
}

.menu-item[aria-current="true"] {
    background: var(--wash-strong);
}

.menu-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-foot {
    border-top: 1px solid var(--line-soft);
    margin-top: 6px;
    padding-top: 6px;
}

.menu-foot .menu-item {
    color: var(--link);
}

.menu-item.signout {
    color: var(--danger);
}

/* ---------- Working area ---------- */

.app-main {
    min-width: 0;
    padding: 0 var(--shell-pad) 80px var(--main-pad);
}

.no-nav .app-main {
    padding-left: var(--shell-pad);
}

/* One-line page bar: what you're looking at, its state, what you can do */

.page-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 22px 0 18px;
}

.page-title {
    margin: 0;
    font-family: var(--heading-font);
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.page-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.page-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* The split: primary work column + reference rail */

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 288px;
    gap: 0 48px;
    align-items: start;
}

.layout-full {
    display: block;
}

.col-main {
    min-width: 0;
}

.col-rail {
    min-width: 0;
    position: sticky;
    top: calc(var(--bar-h) + 22px);
    display: grid;
    gap: 26px;
    padding-top: 4px;
}

.rail-block {
    display: grid;
    gap: 11px;
}

.rail-title {
    margin: 0;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--line-soft);
    font-family: var(--heading-font);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.rail-block p {
    margin: 0;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.55;
}

.rail-block .kv {
    margin-top: 2px;
}

.rail-links {
    display: grid;
    gap: 2px;
    margin-top: 2px;
}

.rail-links a {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    margin: 0 -8px;
    border-radius: 7px;
    color: var(--link);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 650;
    transition: background 0.14s ease;
}

.rail-links a:hover {
    background: var(--wash);
}

/* ---------- Blocks inside a column ---------- */

.block + .block {
    margin-top: 34px;
    padding-top: 28px;
    border-top: 1px solid var(--line-soft);
}

.block-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.block-head h2 {
    margin: 0;
    font-size: 15.5px;
    font-weight: 700;
}

.block-sub {
    margin: 3px 0 0;
    color: var(--faint);
    font-size: 13px;
    line-height: 1.45;
}

.block-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.block-body {
    display: grid;
    gap: 18px;
}

.block-body > p {
    margin: 0;
    color: var(--muted);
    font-size: 14.5px;
    line-height: 1.55;
}

/* ---------- Stat strip: the horizontal summary ---------- */

.stat-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
}

.stat-strip + .layout,
.stat-strip + .layout-full {
    margin-top: 28px;
}

.stat {
    display: grid;
    align-content: start;
    gap: 3px;
    padding: 14px 18px;
    border-left: 1px solid var(--line-soft);
    color: inherit;
    text-decoration: none;
    transition: background 0.14s ease;
}

.stat:first-child {
    border-left: 0;
    padding-left: 0;
}

a.stat:hover {
    background: var(--wash);
}

.stat-label {
    color: var(--faint);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stat-value {
    font-family: var(--heading-font);
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.stat-value.text {
    font-size: 17px;
    line-height: 1.5;
}

.stat-sub {
    color: var(--faint);
    font-size: 12.5px;
}

/* ---------- Key/value ---------- */

.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 20px 28px;
}

.kv {
    min-width: 0;
    display: grid;
    gap: 5px;
    align-content: start;
}

.kv-label {
    margin: 0;
    color: var(--faint);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.kv-value {
    margin: 0;
    font-size: 14.5px;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.kv-value.muted {
    color: var(--muted);
}

.kv-hint {
    margin: 0;
    color: var(--faint);
    font-size: 12px;
    line-height: 1.45;
}

/* ---------- Machine text ---------- */

.code-field {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 2px 2px 10px;
    border-radius: 8px;
    background: var(--fill);
}

.code-field code {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 0;
    font-size: 12.5px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.code-field .copy-button {
    flex: 0 0 auto;
    border-color: transparent;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

.code-field .copy-button:hover {
    background: var(--wash-strong);
    color: var(--ink);
}

.copy-button.copied {
    color: var(--success);
}

.code-block {
    display: block;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--fill);
    font-family: var(--mono-font);
    font-size: 12.5px;
    overflow-wrap: anywhere;
}

.code-list {
    display: grid;
    gap: 5px;
}

/* ---------- Buttons ---------- */

.button,
button,
input,
select,
textarea,
a.button {
    font: inherit;
}

.button,
button {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 16px;
    background: transparent;
    color: var(--ink);
    font-weight: 700;
    font-size: 13.5px;
    line-height: 1.3;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.button svg,
button svg {
    flex: 0 0 auto;
}

.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
    font-weight: 800;
}

.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.ghost:hover {
    background: var(--wash);
}

.button.small,
button.small {
    padding: 5px 12px;
    font-size: 12.5px;
}

.danger-button {
    color: var(--danger);
    border-color: transparent;
}

.danger-button:hover {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    color: var(--danger);
}

.icon-button {
    min-width: 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    border-color: transparent;
    color: var(--muted);
}

.icon-button:hover {
    background: var(--wash);
    color: var(--ink);
}

/* ---------- Flash ---------- */

.flash {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 11px 14px;
    margin: 16px 0 -4px;
    border-left: 3px solid var(--line);
    background: var(--wash);
    font-size: 14px;
    font-weight: 650;
    line-height: 1.45;
    color: var(--ink);
}

.flash-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    margin-top: 2px;
}

.flash p {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.flash-success {
    border-left-color: var(--success);
    background: color-mix(in srgb, var(--success) 8%, transparent);
}

.flash-success .flash-icon {
    background: var(--success);
}

.flash-error {
    border-left-color: var(--danger);
    background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.flash-error .flash-icon {
    background: var(--danger);
}

.flash .icon-button {
    margin: -7px -6px -7px 0;
}

/* ---------- Pills ---------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--fill);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.55;
    white-space: nowrap;
}

.pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

.pill.plain::before {
    display: none;
}

.pill-ok {
    color: var(--success);
    background: color-mix(in srgb, var(--success) 12%, transparent);
}

.pill-warn {
    color: var(--warning);
    background: color-mix(in srgb, var(--warning) 14%, transparent);
}

.pill-accent {
    color: var(--accent-ink);
    background: color-mix(in srgb, var(--accent) 30%, transparent);
}

@media (prefers-color-scheme: dark) {
    .pill-accent {
        color: var(--accent);
    }
}

.meta-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ---------- Lists ---------- */

.row-list {
    display: grid;
    border-top: 1px solid var(--line-soft);
}

.row-list > * {
    border-bottom: 1px solid var(--line-soft);
}

.row {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 11px 10px;
    margin: 0 -10px;
    transition: background 0.14s ease;
}

.row:hover {
    background: var(--wash);
}

.row-main {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    flex: 1 1 240px;
}

.row-copy {
    min-width: 0;
    display: grid;
    gap: 1px;
}

.row-copy strong {
    font-family: var(--heading-font);
    font-size: 14.5px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.row-copy span {
    color: var(--faint);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.row-actions form {
    display: contents;
}

.avatar-lg {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--fill);
    color: var(--muted);
    font-family: var(--heading-font);
    font-weight: 800;
    font-size: 13.5px;
    line-height: 1;
    text-transform: uppercase;
}

/* A record that needs more than a line: an OAuth app, a provider key.
   Facts sit beside the name rather than under it. */

.record {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) auto;
    gap: 6px 28px;
    align-items: start;
    padding: 15px 10px;
    margin: 0 -10px;
    transition: background 0.14s ease;
}

.record:hover {
    background: var(--wash);
}

.record-id {
    grid-column: 1;
    min-width: 0;
}

.record-id h3 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.record-id .sub {
    margin: 2px 0 0;
    color: var(--faint);
    font-size: 12.5px;
}

.record-facts {
    grid-column: 2;
    min-width: 0;
    display: grid;
    gap: 8px;
}

.record-actions {
    grid-column: 3;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-self: end;
}

.record-wide {
    grid-column: 1 / -1;
    min-width: 0;
}

/* ---------- Tables ---------- */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 0 10px 9px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--faint);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.14s ease;
}

.data-table tbody tr:hover {
    background: var(--wash);
}

.data-table .cell-title {
    display: grid;
    gap: 1px;
    min-width: 170px;
}

.data-table .cell-title a {
    font-family: var(--heading-font);
    font-weight: 700;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.data-table .cell-title a:hover {
    text-decoration: underline;
}

.data-table .cell-title span {
    color: var(--faint);
    font-size: 12.5px;
}

.data-table .cell-actions {
    text-align: right;
    white-space: nowrap;
}

.data-table .num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---------- Forms ---------- */

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid.two-col {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.field {
    display: grid;
    gap: 6px;
    min-width: 0;
    align-content: start;
}

label {
    font-weight: 650;
    font-size: 13.5px;
    color: var(--ink);
}

.field-hint {
    margin: 0;
    color: var(--faint);
    font-size: 12px;
    line-height: 1.45;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 9px 13px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--ink);
    font: inherit;
    font-size: 14.5px;
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

select {
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234d5156' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

@media (prefers-color-scheme: dark) {
    select {
        background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23bbbbbb' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    }
}

textarea {
    resize: vertical;
    min-height: 88px;
}

textarea.mono {
    font-family: var(--mono-font);
    font-size: 13px;
    line-height: 1.6;
}

/* No frame — the button is the affordance, the filename is just text. */
input[type="file"] {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 13.5px;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    appearance: none;
    margin-right: 11px;
    padding: 6px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.14s ease;
}

input[type="file"]::file-selector-button:hover {
    background: var(--wash);
}

::placeholder {
    color: #9d9d9d;
}

@media (prefers-color-scheme: dark) {
    ::placeholder {
        color: #777;
    }
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
.button:focus-visible,
a:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 189, 22, 0.35);
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* ---------- One-time secret ---------- */

.secret-reveal {
    margin-bottom: 26px;
    padding: 13px 16px;
    border-left: 3px solid var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    display: grid;
    gap: 9px;
}

.secret-reveal .kv-label {
    color: var(--ink);
}

.secret-reveal .code-field {
    background: var(--surface);
}

.secret-warning {
    margin: 0;
    color: var(--ink);
    font-weight: 700;
    font-size: 13px;
    line-height: 1.5;
}

/* ---------- Empty states: inline, not a full-page void ---------- */

.empty-state {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 0 26px;
    border-top: 1px solid var(--line-soft);
}

.empty-state-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 20%, transparent);
    color: var(--ink);
}

.empty-state-copy {
    flex: 1 1 260px;
    min-width: 0;
}

.empty-state h3 {
    margin: 0;
    font-size: 15px;
}

.empty-state p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.5;
}

.empty-state .button {
    flex: 0 0 auto;
}

/* ---------- Modals ---------- */

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 22px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--scrim);
}

.modal-panel {
    position: relative;
    z-index: 1;
    width: min(100%, 500px);
    max-height: calc(100vh - 44px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--raised);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
    animation: modal-in 0.18s ease;
}

@media (prefers-color-scheme: dark) {
    .modal-panel {
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
    }
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-head {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 0;
}

.modal-head h2 {
    margin: 0;
    font-size: 17px;
}

.modal-body {
    padding: 18px 20px;
    display: grid;
    gap: 16px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding: 0 20px 18px;
}

.modal-panel .code-field {
    background: var(--fill);
}

/* ---------- Signed-out page ---------- */

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line-soft);
}

.topbar-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar .brand {
    font-size: 17px;
}

.topbar .brand img {
    width: 28px;
    height: 28px;
}

.top-links {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    font-size: 14px;
    font-weight: 650;
}

.top-links a {
    color: var(--ink);
    text-decoration: none;
    padding: 9px 14px;
    border-radius: 999px;
    transition: background 0.14s ease;
}

.top-links a:hover,
.top-links a:focus-visible {
    background: var(--wash);
}

.page-shell {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    padding: 40px 0 56px;
}

.hero-public {
    display: grid;
    justify-items: center;
    text-align: center;
    padding: clamp(48px, 10vh, 110px) 0 48px;
}

.hero-public .hero-copy {
    max-width: 640px;
    display: grid;
    justify-items: center;
}

.hero-logo {
    width: 52px;
    height: 52px;
    margin-bottom: 22px;
    border-radius: 26px;
    transition: border-radius 1s ease;
}

.hero-logo:hover {
    border-radius: 5px;
}

.hero-actions {
    margin-top: 28px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Four features: two even rows rather than three-plus-one orphan. */
.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 0 48px;
    max-width: 760px;
    margin: 0 auto;
    border-top: 1px solid var(--line-soft);
}

.feature {
    padding: 18px 0;
    border-bottom: 1px solid var(--line-soft);
}

.feature strong {
    display: block;
    font-family: var(--heading-font);
    font-size: 14.5px;
    font-weight: 700;
    margin-bottom: 3px;
}

.feature span {
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.5;
}

.simple-footer {
    margin-top: 40px;
    border-top: 1px solid var(--line-soft);
    padding-top: 14px;
    font-size: 13px;
    color: var(--muted);
}

.simple-footer a {
    color: var(--link);
    text-decoration: none;
    font-weight: 700;
}

.simple-footer a:hover {
    text-decoration: underline;
}

/* Standalone form page (create team) */

.standalone {
    max-width: 520px;
    margin: 0 auto;
    padding: 52px var(--shell-pad) 80px;
}

.standalone .page-title {
    font-size: 26px;
}

.standalone-lead {
    margin: 10px 0 26px;
    color: var(--muted);
    font-size: 14.5px;
    line-height: 1.55;
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
    .layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .col-rail {
        position: static;
        margin-top: 34px;
        padding-top: 26px;
        border-top: 1px solid var(--line-soft);
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
        gap: 26px 40px;
    }
}

@media (max-width: 900px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .section-nav {
        z-index: 29;
        height: auto;
        display: flex;
        gap: 2px;
        overflow-x: auto;
        scrollbar-width: none;
        padding: 0 var(--shell-pad);
        background: var(--surface);
        border-right: 0;
        border-bottom: 1px solid var(--line-soft);
    }

    .section-nav::-webkit-scrollbar {
        display: none;
    }

    /* Flatten the groups so their links become items of the strip. */
    .nav-group {
        display: contents;
    }

    .nav-group-label {
        display: none;
    }

    .nav-link {
        flex: 0 0 auto;
        white-space: nowrap;
        border-radius: 0;
        padding: 11px 11px;
        border-bottom: 2px solid transparent;
        margin-bottom: -1px;
    }

    .nav-link.active {
        background: transparent;
        border-bottom-color: var(--accent);
    }

    .nav-link.active::before {
        display: none;
    }

    .app-main,
    .no-nav .app-main {
        padding-left: var(--shell-pad);
    }
}

@media (max-width: 720px) {
    .identity-row .brand span,
    .account-name {
        display: none;
    }

    .identity-row {
        gap: 4px;
    }

    .page-bar {
        padding: 18px 0 14px;
    }

    .page-actions {
        margin-left: 0;
        width: 100%;
    }

    .record {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px 14px;
    }

    .record-facts {
        grid-column: 1 / -1;
    }

    .record-actions {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .kv-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stat {
        padding: 12px 14px;
    }

    .empty-state {
        flex-wrap: wrap;
    }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
