/* KiteUp portal — UI v2 "Vento" (light) / "Altitude" (dark). CSS puro com tokens (docs/08). Sem Node.
   The dark theme applies on [data-theme="dark"]; App.razor sets that before first paint. Legacy token
   names (--grid, --ring, --radius, --brand-100, --activated) are kept as aliases so existing pages that
   still reference them keep working while the layout is migrated stage by stage. */

/* Base reset + typography: the app is pure CSS (D14) with no framework reset. Without this the browser
   applies its default 8px body margin (a white gutter + a needless scrollbar next to the 100vh sidebar)
   and a serif font, and content-box sizing makes padded elements overflow. border-box matches how the
   design mockups were built (design/*.html: `*{box-sizing:border-box}`). */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { margin: 0; }
button, input, textarea, select { font-family: inherit; }

:root {                                  /* ===== VENTO (light, padrão) ===== */
    color-scheme: light dark;            /* native controls/scrollbars follow the active theme */
    --brand: #2a78d6;
    --brand-strong: #1c5cab;
    --brand-soft: #eaf3fd;
    --aqua: #1baf7a;
    --aqua-soft: #e2f6ee;

    --sidebar-bg: #0f1b2d;
    --sidebar-ink: #aebcd4;
    --sidebar-active: linear-gradient(90deg, rgba(57, 135, 229, .35), rgba(27, 175, 122, .18));

    --page: #f9f9f7;
    --surface: #ffffff;
    --surface-2: #f4f5f2;
    --border: #e9e8e2;
    --border-strong: #d9d8d0;

    --ink: #12161b;
    --ink-2: #5b6068;
    --muted: #8a8f97;

    --success: #0a7a43;
    --success-bg: #e3f4ea;
    --warning: #8a5b00;
    --warning-bg: #fdf0d3;
    --critical: #c03636;
    --critical-bg: #fdecec;

    --grad-brand: linear-gradient(90deg, #2a78d6, #1baf7a);
    --shadow-btn: 0 4px 14px rgba(42, 120, 214, .28);   /* SÓ no botão primário (light) */
    --r-card: 14px;
    --r-ctl: 9px;
    --motion-fast: 160ms cubic-bezier(.3, .7, .4, 1);
    --motion-med: 240ms cubic-bezier(.3, .7, .4, 1);

    /* legacy aliases → new tokens (kept until every page is migrated) */
    --brand-100: var(--brand-soft);
    --grid: var(--border);
    --ring: var(--border);
    --radius: var(--r-card);
    --radius-sm: var(--r-ctl);
    --activated: var(--aqua);
    --success-text: var(--success);
}

[data-theme="dark"] {                    /* ===== ALTITUDE (dark) ===== */
    color-scheme: dark;                  /* native controls go dark when Altitude is active */
    --brand: #3987e5;
    --brand-strong: #5598e7;
    --brand-soft: rgba(57, 135, 229, .14);
    --aqua: #35d08a;
    --aqua-soft: rgba(53, 208, 138, .12);

    --sidebar-bg: #0e1116;
    --sidebar-ink: #8b919b;
    --sidebar-active: rgba(57, 135, 229, .14);

    --page: #0e1116;
    --surface: #141821;
    --surface-2: #1a2029;
    --border: rgba(255, 255, 255, .07);
    --border-strong: rgba(255, 255, 255, .14);

    --ink: #e8eaed;
    --ink-2: #aab0b9;
    --muted: #8b919b;

    --success: #35d08a;
    --success-bg: rgba(53, 208, 138, .14);
    --warning: #f4b74a;
    --warning-bg: rgba(244, 183, 74, .14);
    --critical: #f07d7d;
    --critical-bg: rgba(240, 125, 125, .14);

    --grad-brand: linear-gradient(90deg, #3987e5, #35d08a);
    --shadow-btn: none;                  /* dark: elevação por luminância, não sombra */
}

/* ===== buttons / fields (shared) ===== */
.btn {
    background: var(--brand);
    color: #fff;
    border: 0;
    border-radius: 7px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-block;
    text-decoration: none;
}

.btn:hover { background: var(--brand-strong); }
.btn-block { display: block; width: 100%; text-align: center; margin-top: 14px; }

.field { margin-bottom: 12px; }

.field label {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 4px;
}

.in {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--grid);
    border-radius: 6px;
    padding: 9px 11px;
    font-size: 13px;
    color: var(--ink);
    font-family: inherit;
}

.in:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-100);
}

.field-error { display: block; color: var(--critical); font-size: 11px; margin-top: 3px; }
.muted { color: var(--muted); font-size: 13px; }

/* ===== login (mockup tela 8) ===== */
.login-bg {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--page) 60%, var(--brand-soft));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--ring);
    border-radius: 14px;
    box-shadow: 0 14px 34px rgba(11, 11, 11, .08);
    padding: 30px 32px;
    width: 340px;
    max-width: 100%;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -.02em;
    color: var(--ink);
}

.login-symbol { width: 24px; height: 24px; transform: rotate(12deg); }
.login-tagline { font-size: 12px; color: var(--ink-2); margin: 6px 0 18px; }

.login-error {
    background: var(--critical-bg);
    border: 1px solid var(--border-strong);
    color: var(--critical);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    font-size: 12px;
    margin-bottom: 12px;
}

/* ===== portal shell (E11: responsive — desktop sidebar / tablet rail / mobile header+bottom nav) ===== */
.app-shell { display: flex; min-height: 100vh; }

.side {
    width: 216px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-ink);
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    color: #fff;
    font-size: 15px;
    letter-spacing: -.01em;
    padding: 4px 8px 16px;
}

.logo-symbol { width: 20px; height: 20px; transform: rotate(12deg); flex-shrink: 0; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }

.nav {
    padding: 8px 10px;
    border-radius: 7px;
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--sidebar-ink);
    font-size: 13px;
    text-decoration: none;
    transition: background var(--motion-fast), color var(--motion-fast);
}

.nav:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.nav.active { background: var(--sidebar-active); color: #fff; font-weight: 600; position: relative; }
.nav-ic { flex-shrink: 0; opacity: .75; }
.nav.active .nav-ic { opacity: 1; }

.side-sep { margin: 10px 8px; border-top: 1px solid rgba(255, 255, 255, .09); }
.side-foot { margin-top: auto; padding-top: 10px; }

/* ===== avatar / user menu (E11 PASSO 3) — CSS-only checkbox toggle ===== */
.user-menu { position: relative; }

.user-menu-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 9px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 10px;
    padding: 8px 10px;
    color: var(--sidebar-ink);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background var(--motion-fast), border-color var(--motion-fast);
}
.user-menu-trigger:hover,
.user-menu-cb:checked ~ .user-menu-trigger { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .18); }
.user-menu-cb:checked ~ .user-menu-trigger .user-menu-caret { transform: rotate(180deg); }

.avatar {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--grad-brand);
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-menu-id { flex: 1; min-width: 0; line-height: 1.25; }
.user-menu-id b { display: block; color: #fff; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu-id span { display: block; font-size: 10.5px; color: var(--sidebar-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu-caret { flex-shrink: 0; font-size: 11px; opacity: .7; transition: transform var(--motion-fast); }

/* invisible full-screen catcher: only present (and clickable) while the menu is open */
.user-menu-backdrop { display: none; }
.user-menu-cb:checked ~ .user-menu-backdrop { display: block; position: fixed; inset: 0; z-index: 40; }

.user-menu-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 45;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: 0 8px 28px rgba(11, 11, 11, .18);
    padding: 6px;
    flex-direction: column;
    gap: 2px;
}
.user-menu-cb:checked ~ .user-menu-dropdown { display: flex; }

/* the embedded ThemeToggle should read as a menu item, not the dark-sidebar button */
.user-menu-dropdown .theme-toggle {
    justify-content: flex-start;
    gap: 10px;
    background: transparent;
    border: 0;
    color: var(--ink);
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 13px;
}
.user-menu-dropdown .theme-toggle:hover { background: var(--surface-2); color: var(--ink); border: 0; }

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: 0;
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    text-align: left;
}
.user-menu-item:hover { background: var(--surface-2); }
.user-menu-item.danger { color: var(--critical); }
.user-menu-item .nav-ic { opacity: .7; }
.user-menu-glyph { width: 20px; text-align: center; font-size: 14px; }
.user-menu-logout { margin: 0; }
.user-menu-logout .user-menu-item { width: 100%; }

.tenant {
    background: rgba(255, 255, 255, .06);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 11.5px;
    color: var(--sidebar-ink);
}

.tenant b { color: #fff; display: block; }
.tenant span { display: block; }

.logout-form { margin: 0; }

.logout-btn {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .14);
    color: var(--sidebar-ink);
    border-radius: 7px;
    padding: 7px 10px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.logout-btn:hover { color: #fff; border-color: rgba(255, 255, 255, .3); }

.app-main { flex: 1; min-width: 0; background: var(--page); padding: 22px 26px; }

/* Mobile-only chrome — hidden on desktop, shown by the media queries below. */
.m-header, .m-drawer, .m-bottom-nav { display: none; }

/* ---------- Tablet: sidebar collapses to a 64px icon rail (640–1023) ---------- */
@media (max-width: 1023px) and (min-width: 640px) {
    .side { width: 64px; padding: 14px 8px; align-items: stretch; }
    .logo-word { display: none; }
    .logo { justify-content: center; padding: 4px 0 16px; }
    .nav { justify-content: center; padding: 10px; gap: 0; position: relative; }
    .nav-label { display: none; }

    /* avatar-only trigger; dropdown floats out to the right of the rail */
    .user-menu-trigger { justify-content: center; padding: 6px 0; gap: 0; }
    .user-menu-id, .user-menu-caret { display: none; }
    .user-menu-dropdown { left: 0; right: auto; min-width: 210px; }

    /* label tooltip on hover */
    .nav[data-tip]:hover::after {
        content: attr(data-tip);
        position: absolute;
        left: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        background: var(--sidebar-bg);
        color: #fff;
        border: 1px solid rgba(255, 255, 255, .14);
        padding: 4px 8px;
        border-radius: 6px;
        font-size: 11px;
        white-space: nowrap;
        z-index: 40;
        pointer-events: none;
    }
}

/* ---------- Mobile: no sidebar; top header + bottom nav (<640) ---------- */
@media (max-width: 639px) {
    .side { display: none; }
    .app-shell { display: block; }

    .m-header {
        display: flex;
        align-items: center;
        gap: 10px;
        position: sticky;
        top: 0;
        z-index: 30;
        height: 52px;
        padding: 0 12px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
    }

    .m-title { flex: 1; font-weight: 700; font-size: 15px; color: var(--ink); letter-spacing: -.01em; }
    .m-brand { width: 22px; height: 22px; transform: rotate(12deg); }

    /* expand-to-search: the checkbox reveals a search field that covers the header */
    .hsearch-form { display: none; }
    .hsearch-cb:checked ~ .hsearch-form {
        display: flex; align-items: center; gap: 6px;
        position: absolute; inset: 0; padding: 0 8px;
        background: var(--surface);
    }
    .hsearch-cb:checked ~ .hs-hide { display: none; }
    .hsearch-input {
        flex: 1; min-width: 0; height: 34px;
        border: 1px solid var(--border); border-radius: 8px;
        background: var(--surface-2); color: var(--ink);
        padding: 0 12px; font-size: 16px; font-family: inherit;
    }

    .m-icon-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: transparent;
        border: 0;
        color: var(--ink);
        cursor: pointer;
        border-radius: 8px;
    }
    .m-icon-btn:hover { background: var(--surface-2); }

    .app-main { padding: 16px 14px calc(64px + env(safe-area-inset-bottom, 0px)); }

    /* drawer — toggled by the #m-menu-cb checkbox (no JS) */
    .m-drawer {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 50;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--motion-med);
    }
    .m-drawer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .4); display: block; }
    .m-menu-cb:checked ~ .m-drawer { opacity: 1; pointer-events: auto; }
    .m-drawer-panel {
        position: absolute;
        top: 0; left: 0; bottom: 0;
        width: 82%;
        max-width: 300px;
        background: var(--sidebar-bg);
        color: var(--sidebar-ink);
        padding: 14px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        transform: translateX(-100%);
        transition: transform var(--motion-med);
        overflow-y: auto;
    }
    .m-menu-cb:checked ~ .m-drawer .m-drawer-panel { transform: none; }
    .m-drawer-head { display: flex; align-items: center; justify-content: space-between; color: #fff; font-weight: 800; padding: 4px 4px 10px; }
    .m-drawer-head .m-icon-btn { color: var(--sidebar-ink); }
    .m-drawer-link {
        display: flex; align-items: center; gap: 10px;
        color: var(--sidebar-ink); text-decoration: none;
        padding: 11px 10px; border-radius: 8px; font-size: 14px;
    }
    .m-drawer-link:hover, .m-drawer-link.active { background: rgba(255, 255, 255, .06); color: #fff; }

    /* bottom nav */
    .m-bottom-nav {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 30;
        background: var(--surface);
        border-top: 1px solid var(--border);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .m-bn-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 56px;
        color: var(--muted);
        text-decoration: none;
        font-size: 10px;
        font-weight: 600;
    }
    .m-bn-item .nav-ic { opacity: .8; }
    .m-bn-item.active { color: var(--brand); }
    .m-bn-item.active .nav-ic { opacity: 1; }

    /* mobile inputs ≥16px to stop iOS zoom */
    .in { font-size: 16px; }

    /* touch targets ≥44px (E11 aceite 2) */
    .btn { min-height: 44px; }
    .m-icon-btn { width: 44px; height: 44px; }
    .topline .actions .btn { flex: 1; }        /* full-width primary actions when the inline row is shown */

    /* the inline primary action is hidden on mobile — it becomes the FAB */
    .hide-mobile { display: none !important; }

    /* contextual FAB, above the bottom nav, in the thumb zone */
    .fab {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        position: fixed;
        right: 16px;
        bottom: calc(56px + 16px + env(safe-area-inset-bottom, 0px));
        z-index: 35;
        height: 52px;
        padding: 0 20px;
        background: var(--brand);
        color: #fff;
        border-radius: 999px;
        font-weight: 700;
        font-size: 14px;
        text-decoration: none;
        box-shadow: 0 6px 20px rgba(42, 120, 214, .40);
    }
    .fab-icon { font-size: 20px; line-height: 1; }
}

/* FAB is mobile-only; hidden everywhere else. */
.fab { display: none; }

/* ===== portal content ===== */
.topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.crumb { font-size: 11.5px; color: var(--muted); }
.h { font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--ring);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.card .k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.card .v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; color: var(--ink); }
.card .d { font-size: 10.5px; margin-top: 2px; color: var(--ink-2); }

.panel {
    background: var(--surface);
    border: 1px solid var(--ring);
    border-radius: var(--radius);
    padding: 16px 18px;
}

/* ===== public home ===== */
.public-hero {
    max-width: 560px;
    margin: 12vh auto;
    padding: 0 24px;
}

.public-hero h1 { font-size: 30px; letter-spacing: -.02em; }
.public-hero p { color: var(--ink-2); margin-top: 10px; }

/* ===== buttons (variants) ===== */
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--grid); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 11.5px; }
.btn.danger { background: var(--surface); color: var(--critical); border: 1px solid var(--grid); }
.btn.danger:hover { background: var(--critical-bg); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.topline .actions { display: flex; gap: 8px; }

/* ===== tables ===== */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; padding: 7px 8px; border-bottom: 1px solid var(--grid); }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--border); color: var(--ink-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.name { color: var(--ink); font-weight: 600; }
.tbl .row-link { cursor: pointer; }
.tbl .row-link:hover td { background: var(--surface-2); }

/* ===== pills ===== */
/* Pill palette per docs/06: Publicada blue, Ativada green, Rascunho grey, Pausada amber. */
.pill { display: inline-block; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 2px 9px; white-space: nowrap; }
.pill.pub { background: var(--brand-soft); color: var(--brand-strong); }
.pill.ativ { background: var(--aqua-soft); color: var(--success); }
.pill.rasc { background: var(--surface-2); color: var(--ink-2); }
.pill.paus { background: var(--warning-bg); color: var(--warning); }
.pill.arq { background: var(--surface-2); color: var(--muted); }
.pill.gen { background: #ede9fb; color: #4a3aa7; }   /* "gerado": roxo — sem token dedicado, dark via override */

/* ===== panel header ===== */
.panel .ph { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel .ph b { font-size: 13px; }

/* ===== progress ===== */
.prog { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: flex; gap: 2px; min-width: 90px; }
.prog i { display: block; height: 100%; }

/* ===== layout helpers ===== */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--brand-strong); }

/* ===== forms ===== */
.form-card { max-width: 640px; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }
textarea.in { min-height: 76px; resize: vertical; }
.hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ===== fields editor ===== */
.fields-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.fields-row .rm { background: transparent; border: 1px solid var(--grid); color: var(--muted); border-radius: 6px; padding: 7px 10px; cursor: pointer; }
.fields-row .rm:hover { color: var(--critical); border-color: var(--critical); }

/* ===== wizard steps ===== */
.steps { display: flex; gap: 8px; margin-bottom: 18px; font-size: 11px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.steps .st { display: flex; align-items: center; gap: 6px; }
.steps .n { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 10px; color: var(--ink-2); }
.steps .st.done .n { background: var(--activated); color: #fff; }
.steps .st.cur .n { background: var(--brand); color: #fff; }
.steps .st.cur { color: var(--ink); font-weight: 600; }
.steps .ln { width: 24px; border-top: 1px solid var(--grid); }

/* ===== content-type option cards ===== */
.opt-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.opt { border: 1px solid var(--grid); border-radius: 10px; padding: 12px; background: var(--surface); font-size: 11.5px; color: var(--ink-2); cursor: pointer; text-align: left; width: 100%; font-family: inherit; }
.opt b { display: block; color: var(--ink); font-size: 13px; margin-bottom: 3px; }
.opt.sel { border-color: var(--brand); background: var(--brand-100); box-shadow: 0 0 0 1px var(--brand); }

/* smart-tag toggle (E12) */
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); cursor: pointer; }
.check input { width: auto; margin: 0; }
.reco { color: var(--success); font-weight: 600; }
.hint.warn { color: var(--warning); }

/* ===== empty + review + alert ===== */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty p { margin-bottom: 14px; }

/* empty state with the kite (E11 §3) */
.empty-state { text-align: center; padding: 52px 20px; }
.empty-kite { width: 72px; height: 72px; transform: rotate(12deg); opacity: .3; margin-bottom: 18px; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.empty-sub { font-size: 13px; color: var(--ink-2); margin: 6px auto 18px; max-width: 380px; }
.alert-error { background: var(--critical-bg); border: 1px solid var(--border-strong); color: var(--critical); border-radius: var(--radius-sm); padding: 9px 11px; font-size: 12px; margin-bottom: 12px; }

/* theme-aware tinted panels/notes (never hardcode hex inline — it breaks the dark theme) */
.panel.tint-warn { background: var(--warning-bg); }
.panel.tint-ok { background: var(--success-bg); }
.panel.tint-ok b { color: var(--success); }
.note-warn { border: 1px solid var(--warning-bg); background: var(--warning-bg); color: var(--warning); border-radius: 8px; padding: 9px 11px; font-size: 11.5px; margin-bottom: 12px; }
.review dt { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.review dd { font-size: 13px; color: var(--ink); margin: 2px 0 10px; }

/* ===== charts (SVG/CSS, docs/06: single series --brand, thin rounded bars, tabular nums) ===== */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 90px; padding-top: 6px; }
.spark i { flex: 1; background: var(--brand); border-radius: 3px 3px 0 0; min-width: 3px; display: block; }
.axis { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted); margin-top: 4px; }
.hbar { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-2); margin: 6px 0; }
.hbar em { width: 110px; font-style: normal; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .b { height: 12px; border-radius: 0 3px 3px 0; background: var(--brand); min-width: 2px; }
.hbar b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tabnum { font-variant-numeric: tabular-nums; }
.delta-up { color: var(--success-text, #006300); font-weight: 700; }
.delta-down { color: var(--critical); font-weight: 700; }
.card .d { min-height: 14px; }

@media (max-width: 900px) {
    .cards { grid-template-columns: 1fr 1fr; }
    .grid2, .row2, .opt-cards { grid-template-columns: 1fr; }
}

/* Below the mobile breakpoint the 4-up KPI grid drops to two columns (spec §4). */
@media (max-width: 639px) {
    .cards { grid-template-columns: 1fr 1fr; }
    .topline { flex-wrap: wrap; gap: 10px; }
}

/* =========================================================================
   UI v2 — base, code style, theme toggle, and dark-mode fixups for the
   colours that were hardcoded before tokens existed (Stage 1 of E11).
   ========================================================================= */

body {
    background: var(--page);
    color: var(--ink);
}

/* Monospace treatment for tag codes/URLs (the ".code" class the pages already use, r2 review). */
.code {
    font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
    font-size: .92em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1px 6px;
    color: var(--ink);
    letter-spacing: -.01em;
}

/* Theme toggle button (sidebar footer). */
.theme-toggle {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .14);
    color: var(--sidebar-ink);
    border-radius: 7px;
    padding: 7px 10px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.theme-toggle:hover { color: #fff; border-color: rgba(255, 255, 255, .3); }

/* Dark fixups: the base rules now use adaptive tokens (PASSO 2), so the only override still needed is the
   "gerado" pill, whose purple has no dedicated token. */
[data-theme="dark"] .pill.gen { background: rgba(120, 100, 220, .16); color: #b3a5f0; }

/* ---- Blazor framework UI (ported from the removed template app.css, tokenized) ---- */
.validation-message { color: var(--critical); font-size: 11px; }
.invalid { outline: 1px solid var(--critical); }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1rem;
    color: #fff;
}

.blazor-error-boundary::after { content: "Ocorreu um erro."; }

/* ---- Dashboard narrative headline (E11 §3) ---- */
.headline-meta { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.headline-h { font-size: 21px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); margin-top: 3px; line-height: 1.25; }
.headline-sub { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.headline-num {
    background: var(--grad-brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    font-variant-numeric: tabular-nums;
}

/* ---- "Próximo passo" card (E11 §3) ---- */
.next-step {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: linear-gradient(135deg, var(--brand-soft), var(--aqua-soft));
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 14px 16px;
    margin-bottom: 14px;
    text-decoration: none;
    transition: border-color var(--motion-fast), transform var(--motion-fast);
}
.next-step:hover { border-color: var(--brand); transform: translateY(-1px); }
.next-step-kicker { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand-strong); }
.next-step-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-top: 2px; }
.next-step-detail { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.next-step-cta { flex-shrink: 0; font-size: 13px; font-weight: 700; color: var(--brand-strong); white-space: nowrap; }

/* ---- QR thumbnail in tag lists (E11 §3) ---- */
.qr-thumb { width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 6px; background: #fff; flex-shrink: 0; display: block; }
.tag-cell { display: inline-flex; align-items: center; gap: 9px; }

/* ---- filter bar (desktop) ---- */
.filters { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.filters .in { max-width: 200px; }
.filter-search { flex: 1; min-width: 220px; max-width: 340px; }

/* ---- mobile filter: chips + bottom sheet (E11 §4 / aceite 5) ---- */
.filters-m { display: none; }        /* shown only on mobile (media query below) */
.active-chips { display: none; }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 12px; border-radius: 99px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--ink-2); font-size: 12.5px; font-weight: 600;
    font-family: inherit; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
.chip .x { font-size: 15px; line-height: 1; opacity: .7; }
.chip svg { width: 13px; height: 13px; }
.filters-btn { flex: 0 0 auto; background: var(--brand); color: #fff; border-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.sheet-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(4, 8, 14, .5); }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
    background: var(--surface); border-top: 1px solid var(--border-strong);
    border-top-left-radius: 18px; border-top-right-radius: 18px;
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -12px 34px rgba(0, 0, 0, .25);
    max-height: 82vh; overflow-y: auto;
}
.grab { width: 36px; height: 4px; border-radius: 99px; background: var(--border-strong); margin: 0 auto 12px; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet-h b { font-size: 15px; }
.ico-btn { width: 36px; height: 36px; border: 0; background: transparent; color: var(--ink-2); font-size: 22px; line-height: 1; cursor: pointer; border-radius: 8px; }
.ico-btn:hover { background: var(--surface-2); }
.flabel { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 8px; }
.apply-btn {
    width: 100%; min-height: 48px; margin-top: 18px; border: 0; border-radius: 10px;
    background: var(--brand); color: #fff; font-weight: 700; font-size: 14px;
    font-family: inherit; cursor: pointer; box-shadow: var(--shadow-btn);
}
/* the sheet is a mobile pattern; never show it on the desktop layout */
@media (min-width: 640px) { .sheet, .sheet-scrim { display: none; } }

/* ---- responsive lists: table on desktop, stacked cards on mobile (E11 §4) ---- */
@media (max-width: 639px) {
    /* desktop filter bar is hidden (hide-mobile); the chips + sheet take over */
    .filters-m { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; }
    .filters-m .filter-search { flex: 1; min-width: 0; max-width: none; }
    .filters-btn { min-height: 44px; }
    .active-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
    .active-chips .chip, .sheet .chip { min-height: 36px; }

    .tbl.cards-sm thead { display: none; }
    .tbl.cards-sm, .tbl.cards-sm tbody { display: block; }
    .tbl.cards-sm tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: var(--r-card);
        background: var(--surface);
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    .tbl.cards-sm td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 4px 0;
        border: 0;
        text-align: right;
        color: var(--ink);
    }
    .tbl.cards-sm td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 11px;
        font-weight: 600;
        text-align: left;
        flex-shrink: 0;
    }
    /* the code + thumbnail cell becomes the card header */
    .tbl.cards-sm td.name {
        justify-content: flex-start;
        border-bottom: 1px solid var(--border);
        padding-bottom: 9px;
        margin-bottom: 5px;
    }
    .tbl.cards-sm td.name::before { display: none; }
    .tbl.cards-sm td.row-open { display: none; }   /* whole card is tappable */
}
