/* ==========================================================================
   STEAM SHELF — SteamDevHQ design system
   A dark, dense SteamOS-derived operations console.
   Tokens derive from the Steam client's own dark palette: deep #171a21 ground,
   navy panels, low-saturation text, and a high-lumen accent blue reserved for
   the active path.
   ========================================================================== */

:root {
    /* Deixa os widgets nativos (popup de <select>, scrollbar, date picker) no tema escuro */
    color-scheme: dark;

    /* ==== Color tokens: ground + panels ==== */
    --bg: #0b0d10;
    --bg-panel: #14181c;
    --bg-raised: #1b2027;
    --bg-hover: #222933;
    --bg-inset: #0e1115;
    --bg-accent-soft: #1f3340;

    /* ==== Chrome: borders + shadows ==== */
    --border: #232a34;
    --border-strong: #32404f;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
    --shadow-md: 0 6px 20px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.4);

    /* ==== Text: steam low-lumen ==== */
    --text: #c7d5e0;
    --text-dim: #8ea2b8;
    --text-faint: #5f748a;
    --text-invert: #0b0d10;

    /* ==== Brand accent (Steam high-lumen blue) ==== */
    --accent: #5ba9cf;
    --accent-bright: #7bc3eb;
    --accent-ink: #06121a;

    /* ==== Platform accents — one per storefront integration ==== */
    --platform-apple: #0071e3;
    --platform-steam: #10b981;
    --platform-switch: #e60012;

    /* ==== Signal colors — each tracks one of the four signals ==== */
    --signal-review: #7fc76b;   /* positive sentiment green  */
    --signal-review-alt: #d3ff8f;
    --signal-forum: #5eb9e0;    /* community blue            */
    --signal-wishlist: #e8c255;   /* wishlist amber (alias)      */
    --signal-sales: #4fd1c5;    /* revenue teal               */

    /* ==== Semantic state ==== */
    --good: #6fdc74;
    --warn: #f0b232;
    --bad: #f26d6d;
    --info: #5eb9e0;

    /* ==== Type ==== */
    --font-ui: "Inter", "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-display: var(--font-ui);
    --font-mono: "JetBrains Mono", "Cascadia Mono", "SFMono-Regular", Consolas, "Roboto Mono", monospace;
    --font-data: var(--font-mono);

    /* ==== Radius & rhythm ==== */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;

    /* Layout metrics */
    --sidebar-w: 248px;
    --sidebar-w-collapsed: 64px;
    --topbar-h: 60px;

    /* ==== Icones (regime de opacidade unificado) ==== */
    --ico-op: .92;
}

/* ==========================================================================
   Reset / base
   ========================================================================== */
* { box-sizing: border-box; }

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

body {
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(94,182,207,.06), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent-bright); text-decoration: none; }
a:hover { color: #a5d8f2; text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 650;
    letter-spacing: -0.015em;
    color: #eef3f7;
    margin: 0 0 var(--sp-3);
    line-height: 1.2;
}
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); font-weight: 600; }
h5 { font-size: 14px; }

code {
    font-family: var(--font-data);
    font-size: .86em;
    background: var(--bg-inset);
    color: var(--accent-bright);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: var(--sp-4) 0;
}

.text-center { text-align: center; }
.text-end { text-align: right; }
.text-muted { color: var(--text-dim) !important; }
.text-success { color: var(--good) !important; }
.text-danger { color: var(--bad) !important; }
.text-warning { color: var(--warn) !important; }
.text-primary, .text-info { color: var(--accent-bright) !important; }
.small { font-size: .83em; }
.fw-bold, .fw-semibold { font-weight: 650; }

/* ==========================================================================
   Shell — sidebar + topbar + content
   ========================================================================== */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-areas: "sidebar topbar" "sidebar content";
    height: 100vh;
    overflow: hidden;
}

.app-sidebar {
    grid-area: sidebar;
    background: linear-gradient(180deg, #12161c 0%, #0f1318 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 var(--sp-4);
    height: var(--topbar-h);
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}

.brand-mark {
    width: 30px; height: 30px;
    border-radius: 8px;
    display: grid; place-items: center;
    background: radial-gradient(circle at 35% 30%, #2c4a5a, #16232e 70%);
    border: 1px solid var(--border-strong);
    box-shadow: inset 0 0 8px rgba(94,182,207,.25);
    font-size: 15px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.brand-word {
    font-weight: 700;
    letter-spacing: .01em;
    color: #e8f1f7;
    font-size: 15px;
    line-height: 1.1;
}
.brand-sub {
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: .14em;
    text-transform: uppercase;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: var(--sp-3) var(--sp-2);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-label {
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 600;
    padding: var(--sp-3) var(--sp-2) var(--sp-1);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    color: var(--text);
    font-weight: 500;
    font-size: 13.5px;
    transition: background .12s ease, color .12s ease;
    position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: #fff; text-decoration: none; }
.nav-item.active {
    background: var(--bg-accent-soft);
    color: var(--accent-bright);
}
.nav-item.active::before {
    content: "";
    position: absolute; left: calc(-1 * var(--sp-2)); top: 8px; bottom: 8px;
    width: 3px; border-radius: 2px;
    background: var(--accent-bright);
    box-shadow: 0 0 8px rgba(123,195,235,.6);
}
.nav-item .nav-ico {
    width: 18px; height: 18px;
    flex: 0 0 18px;
    opacity: var(--ico-op, .92);
}
.nav-count {
    margin-left: auto;
    font-size: 11px;
    font-family: var(--font-data);
    color: var(--text-dim);
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 7px;
}

.sidebar-footer {
    flex: 0 0 auto;
    border-top: 1px solid var(--border);
    padding: var(--sp-3) var(--sp-4);
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 10px;
}
.footer-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    color: var(--accent-bright);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
}
.footer-id {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}
.footer-user {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.footer-sub {
    font-size: 11px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.footer-signout {
    width: 32px; height: 32px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text-dim);
    cursor: pointer;
    transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.footer-signout:hover {
    color: var(--bad);
    border-color: rgba(242,109,109,.6);
    background: rgba(242,109,109,.08);
}

/* Rail colapsavel no desktop (alternancia via .app-shell.sidebar-collapsed) */
.app-shell.sidebar-collapsed {
    grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}
.app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-section-label,
.app-shell.sidebar-collapsed .footer-id { display: none; }
.app-shell.sidebar-collapsed .sidebar-nav { padding: var(--sp-3) var(--sp-1); align-items: center; }
.app-shell.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; font-size: 0; }
.app-shell.sidebar-collapsed .nav-item.active::before { display: none; }
.app-shell.sidebar-collapsed .nav-item.active {
    background: var(--bg-accent-soft);
    box-shadow: inset 0 0 0 1px rgba(94,182,207,.35);
}
.app-shell.sidebar-collapsed .sidebar-footer { grid-template-columns: 1fr; justify-items: center; padding: var(--sp-3) var(--sp-1); }
.app-shell.sidebar-collapsed .footer-avatar { display: none; }

.app-topbar {
    grid-area: topbar;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: 0 var(--sp-5);
    position: relative;
    z-index: 5;
}
.topbar-toggle {
    flex: 0 0 auto;
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: transparent;
}
.topbar-toggle:hover { color: var(--accent-bright); background: var(--bg-raised); border-color: var(--border-strong); }
.topbar-title { font-size: 15px; font-weight: 650; color: var(--text); }
.topbar-breadcrumb { font-size: 12.5px; color: var(--text-faint); }
.topbar-spacer { flex: 1 1 auto; }

.app-content {
    grid-area: content;
    overflow-y: auto;
    padding: var(--sp-5) var(--sp-6) var(--sp-6);
}

/* Bare surface (Login / Home) — no sidebar chrome */
.app-bare {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--sp-5);
}

/* ==========================================================================
   Studio sub-navigation (persistent across all studio pages)
   ========================================================================== */
.studio-nav {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-6);
    margin: calc(-1 * var(--sp-5)) calc(-1 * var(--sp-6)) var(--sp-5);
    background: var(--bg-panel);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.02), 0 4px 12px rgba(0,0,0,.18);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: calc(-1 * var(--sp-5));
    z-index: 15;
}
.studio-nav-top {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}
.studio-nav-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .03em;
    color: var(--text-dim);
    padding: 5px 10px 5px 6px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
}
.studio-nav-back:hover { color: var(--accent-bright); background: var(--bg-raised); text-decoration: none; border-color: var(--border); }
.studio-nav-id {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex: 1 1 auto;
    min-width: 0;
}
.studio-id {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.studio-nav-name {
    font-size: 14px;
    font-weight: 650;
    color: var(--text);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.studio-nav-slug {
    font-size: 11.5px;
    color: var(--text-faint);
    font-weight: 500;
    letter-spacing: .02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.studio-nav-meta {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-left: auto;
    min-width: 0;
}
.studio-signals {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: var(--sp-1);
}
.signal-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    box-shadow: inset 0 0 2px rgba(0,0,0,.45);
}
.signal-review { background: var(--signal-review); }
.signal-forum { background: var(--signal-forum); }
.signal-wishlist { background: var(--signal-wishlist); }
.signal-sales { background: var(--signal-sales); }
.signal-sales.signal-off { background: var(--bg-inset); box-shadow: inset 0 0 0 1px var(--border-strong); }
.tenant-switch-wrap { display: inline-flex; flex: 0 0 auto; }
.tenant-switch {
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-dim);
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    padding: 5px 8px;
    max-width: 180px;
    cursor: pointer;
}
.tenant-switch:hover { color: var(--text); border-color: #3d4d5f; }
.tenant-switch option { color: var(--text); background: var(--bg-raised); }

.topbar-lang-wrap { display: inline-flex; flex: 0 0 auto; }
.topbar-lang {
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-dim);
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    padding: 5px 8px;
    cursor: pointer;
}
.topbar-lang:hover { color: var(--text); border-color: #3d4d5f; }
.topbar-lang option { color: var(--text); background: var(--bg-raised); }
.studio-nav-id .badge-sync {
    align-self: center;
    flex: 0 0 auto;
    min-width: 0;
}
.studio-nav-groups {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2) var(--sp-5);
}
.studio-group {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}
.studio-group + .studio-group {
    padding-left: var(--sp-5);
    border-left: 1px solid var(--border);
}
.studio-group-label {
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-dim);
    white-space: nowrap;
}
.studio-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
}
.studio-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: var(--r-sm);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-dim);
    white-space: nowrap;
}
.studio-tab svg { opacity: var(--ico-op, .92); }
.studio-tab:hover { color: var(--text); background: var(--bg-raised); text-decoration: none; }
.studio-tab.active {
    color: var(--accent-bright);
    background: var(--bg-accent-soft);
    box-shadow: inset 0 0 0 1px rgba(94,182,207,.35);
}
.studio-body { min-width: 0; }

/* Sub-navegacao segmentada (ex.: views Financeiras/Mensal/Promocoes) */
.subnav {
    display: flex;
    gap: 2px;
    padding: 3px;
    margin-bottom: var(--sp-4);
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
}
.subnav-link {
    padding: 6px 14px;
    border-radius: calc(var(--r-md) - 2px);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-dim);
    white-space: nowrap;
}
.subnav-link:hover { color: var(--text); background: var(--bg-raised); text-decoration: none; }
.subnav-link.active { color: var(--accent-bright); background: var(--bg-raised); box-shadow: inset 0 0 0 1px rgba(94,182,207,.4); }

@media (max-width: 900px) {
    .studio-nav { padding: var(--sp-3) var(--sp-4); margin: calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)) var(--sp-4); top: calc(-1 * var(--sp-4)); }
    .studio-nav-top { flex-wrap: wrap; row-gap: var(--sp-2); }
    .studio-nav-meta { margin-left: 0; width: 100%; justify-content: space-between; }
    .studio-nav-groups { gap: var(--sp-2) var(--sp-3); }
    .studio-group { flex: 1 1 auto; flex-wrap: wrap; }
    .studio-group + .studio-group { padding-left: var(--sp-2); border-left: 0; }
    .studio-group:not(:first-child)::before { content: ""; width: 1px; align-self: stretch; background: var(--border); margin-right: var(--sp-2); }
    .studio-tab { padding: 6px 9px; }
}

/* ==========================================================================
   Page header with actions
   ========================================================================== */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
    flex-wrap: wrap;
}
.page-head h1 { margin-bottom: 4px; }
.page-head .page-sub { color: var(--text-dim); font-size: 13.5px; margin: 0; }
.page-head-actions { display: flex; gap: var(--sp-2); flex: 0 0 auto; flex-wrap: wrap; align-items: center; }
.updated-badge { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: var(--font-ui);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    padding: 9px 15px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-raised);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s ease, border-color .12s ease, color .12s ease, transform .05s ease;
    user-select: none;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(180deg, #6fb9dd, #3e8ab3);
    border-color: #4d9cc4;
    color: var(--accent-ink);
    text-shadow: 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:hover { background: linear-gradient(180deg, #84c3e2, #4b9cc6); color: var(--accent-ink); }

.btn-success {
    background: linear-gradient(180deg, #4f9e57, #2e7d3a);
    border-color: #3c8a47;
    color: #eaffef;
}
.btn-success:hover { background: linear-gradient(180deg, #5cb264, #3a9450); color: #fff; }

.btn-danger {
    background: linear-gradient(180deg, #b84b4b, #933434);
    border-color: #b04d4d;
    color: #ffecec;
}
.btn-danger:hover { background: linear-gradient(180deg, #cf5a5a, #a83a3a); color: #fff; }

.btn-outline { background: transparent; border-color: var(--border-strong); color: var(--text-dim); }
.btn-outline:hover { background: var(--bg-raised); color: #fff; }

.btn-secondary { background: var(--bg-raised); border-color: var(--border-strong); color: #fff; }
.btn-secondary:hover { background: var(--bg-hover); }

.btn-sm { font-size: 12px; padding: 6px 10px; border-radius: 5px; }
.btn-xs { font-size: 12px; padding: 3px 7px; border-radius: 4px; line-height: 1; }
.btn-lg { font-size: 15px; padding: 12px 20px; }

.icon-btn {
    width: 32px; height: 32px; padding: 0;
    display: inline-grid; place-items: center;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card + .card, .row > .card { }

.card-header {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}
.card-header h5 { margin: 0; font-size: 13.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.card-body { padding: var(--sp-4); }
.card-footer { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }

.row { display: flex; flex-wrap: wrap; margin: 0 calc(var(--sp-3) * -1); }
.row > .col, .row > [class*="col-"] { padding: 0 var(--sp-3); margin-bottom: var(--sp-4); flex: 1 1 auto; width: 100%; }
.row.g-0 > .col, .row.g-0 > [class*="col-"] { padding: 0; margin-bottom: 0; }

.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }

@media (min-width: 576px) {
    .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
    .col-sm-6  { flex: 0 0 50%; max-width: 50%; }
    .col-sm-4  { flex: 0 0 33.3333%; max-width: 33.3333%; }
    .col-sm-3  { flex: 0 0 25%; max-width: 25%; }
}

@media (min-width: 768px) {
    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
    .col-md-11 { flex: 0 0 91.6666%; max-width: 91.6666%; }
    .col-md-10 { flex: 0 0 83.3333%; max-width: 83.3333%; }
    .col-md-9  { flex: 0 0 75%; max-width: 75%; }
    .col-md-8  { flex: 0 0 66.6666%; max-width: 66.6666%; }
    .col-md-7  { flex: 0 0 58.3333%; max-width: 58.3333%; }
    .col-md-6  { flex: 0 0 50%; max-width: 50%; }
    .col-md-5  { flex: 0 0 41.6666%; max-width: 41.6666%; }
    .col-md-4  { flex: 0 0 33.3333%; max-width: 33.3333%; }
    .col-md-3  { flex: 0 0 25%; max-width: 25%; }
    .col-md-2  { flex: 0 0 16.6666%; max-width: 16.6666%; }
}

@media (min-width: 992px) {
    .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
    .col-lg-6  { flex: 0 0 50%; max-width: 50%; }
    .col-lg-4  { flex: 0 0 33.3333%; max-width: 33.3333%; }
    .col-lg-3  { flex: 0 0 25%; max-width: 25%; }
}

.row.g-0 { margin: 0; }
.row.g-0 > .col, .row.g-0 > [class*="col-"] { padding: 0; margin-bottom: 0; }

.row.g-1 { margin: 0 calc(var(--sp-1) * -0.5); }
.row.g-1 > .col, .row.g-1 > [class*="col-"] { padding: 0 calc(var(--sp-1) * 0.5); margin-bottom: var(--sp-1); }

.row.g-2 { margin: 0 calc(var(--sp-2) * -0.5); }
.row.g-2 > .col, .row.g-2 > [class*="col-"] { padding: 0 calc(var(--sp-2) * 0.5); margin-bottom: var(--sp-2); }

.row.g-3 { margin: 0 calc(var(--sp-3) * -0.5); }
.row.g-3 > .col, .row.g-3 > [class*="col-"] { padding: 0 calc(var(--sp-3) * 0.5); margin-bottom: var(--sp-3); }

.row.g-4 { margin: 0 calc(var(--sp-4) * -0.5); }
.row.g-4 > .col, .row.g-4 > [class*="col-"] { padding: 0 calc(var(--sp-4) * 0.5); margin-bottom: var(--sp-4); }

.row.g-5 { margin: 0 calc(var(--sp-5) * -0.5); }
.row.g-5 > .col, .row.g-5 > [class*="col-"] { padding: 0 calc(var(--sp-5) * 0.5); margin-bottom: var(--sp-5); }

.form-control, input, select, textarea {
    background: var(--bg-base);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--r-sm);
    padding: 8px 11px;
    transition: border-color .12s ease, box-shadow .12s ease;
    outline: none;
    font-family: inherit;
    font-size: 13.5px;
}
.form-control:focus, input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(94,182,207,.18);
}
.form-control::placeholder, input::placeholder { color: var(--text-faint); }
.form-control:disabled { opacity: .55; cursor: not-allowed; }

/* Popup dos <select> no tema escuro: color-scheme so resolve no Chromium com pages
   "dark-aware"; pintar option/optgroup explicitamente garante o popup escuro em
   todos os browsers (senao o dropdown abre com fundo branco e letra clara). */
select, select:hover, select:focus {
    background-color: var(--bg-panel);
    color: var(--text);
}
select option, select optgroup {
    background-color: var(--bg-panel);
    color: var(--text);
}
select option:checked, select option:hover {
    background-color: var(--bg-hover);
    color: var(--text);
}

.form-switch { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.form-switch input[type=checkbox] {
    appearance: none;
    width: 36px; height: 20px;
    border-radius: 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border-strong);
    position: relative;
    cursor: pointer;
    transition: background .15s ease;
    margin: 0; flex: 0 0 auto;
}
.form-switch input[type=checkbox]::after {
    content: "";
    position: absolute; top: 2px; left: 2px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--text-dim);
    transition: transform .15s ease, background .15s ease;
}
.form-switch input[type=checkbox]:checked { background: var(--accent); }
.form-switch input[type=checkbox]:checked::after { transform: translateX(16px); background: #fff; }
.form-switch input[type=checkbox]:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.form-check-label { font-size: 13.5px; color: var(--text); }

.form-text { font-size: 12px; color: var(--text-faint); margin-top: 5px; }
.form-group { margin-bottom: var(--sp-4); }

.input-group { display: flex; align-items: stretch; }
.input-group .form-control { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.input-group-text {
    display: flex; align-items: center;
    padding: 0 11px;
    font-size: 13.5px;
    background: var(--bg-hover);
    border: 1px solid var(--border-strong);
    border-right: 0;
    border-radius: var(--r-sm) 0 0 var(--r-sm);
    white-space: nowrap;
}

.validation-message { color: var(--bad); font-size: 12px; margin-top: 4px; display: block; }
.input-validation-error, .invalid { border-color: var(--bad) !important; }
.valid.modified { border-color: var(--good) !important; }

.form-floating { position: relative; }
.form-floating > .form-control { }

/* ==========================================================================
   Alerts / callouts
   ========================================================================== */
.alert {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    font-size: 13.5px;
    margin-bottom: var(--sp-4);
    display: flex;
    align-items: flex-start;
    gap: var(--sp-2);
}
.alert-success { background: rgba(111,220,116,.08); border-color: rgba(111,220,116,.35); color: var(--good); }
.alert-danger  { background: rgba(242,109,109,.08); border-color: rgba(242,109,109,.35); color: var(--bad); }
.alert-warning { background: rgba(210,178,50,.08);  border-color: rgba(210,178,50,.35);  color: var(--warn); }
.alert-info    { background: rgba(94,185,224,.08);  border-color: rgba(94,185,224,.35);  color: var(--info); }
.alert-dismissible { position: relative; padding-right: 44px; }
.btn-close, .alert .dismiss {
    position: absolute; right: 10px; top: 10px;
    width: 22px; height: 22px;
    border: 0; background: transparent;
    color: inherit; opacity: .6;
    font-size: 16px; cursor: pointer; line-height: 1;
}
.btn-close:hover { opacity: 1; }

/* ==========================================================================
   Tables
   ========================================================================== */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left;
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-faint);
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
}
/* .table th's "text-align: left" (class+element, specificity 0-1-1) beats a lone
   ".text-end" (specificity 0-1-0) on <th class="text-end">, so right-aligned header
   labels rendered left-aligned while their <td> data below correctly right-aligned -
   the header/data misalignment seen across every table with numeric columns. */
.table th.text-end { text-align: right; }
.table th.text-center { text-align: center; }
.table td {
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--bg-hover); }
.table-sm th, .table-sm td { padding: 5px 8px; font-size: 12.5px; }

.inbox-row-attention td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.table-striped tbody tr:nth-child(odd) td { background: rgba(255,255,255,.015); }
.table-hover tbody tr:hover td { background: var(--bg-hover); }
.table-dark { background: var(--bg-raised); }

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

.inbox-filters {
    display: flex; gap: var(--sp-3); flex-wrap: wrap;
    align-items: flex-start; justify-content: space-between; margin-bottom: var(--sp-4);
}
.inbox-filter-groups { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.inbox-filters-list { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.inbox-game-filter select { min-width: 160px; max-width: 240px; }

.inbox-ellipsis {
    max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.inbox-status-actions { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.inbox-more-toggle { border-style: dashed; }

/* Instant, always-consistent tooltip for icon-only controls — native `title` has an
   inconsistent OS delay/style, which is exactly why these icons read as unlabeled. */
.inbox-hint { position: relative; }
.inbox-hint::after {
    content: attr(data-inbox-hint);
    position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    background: var(--bg-inset, #10151b); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 5px;
    padding: 3px 7px; font-size: 11px; font-weight: 500; white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,.35);
    opacity: 0; pointer-events: none; visibility: hidden;
    transition: opacity .1s ease;
    z-index: 30;
}
.inbox-hint.inbox-hint-left::after { left: auto; right: 0; transform: none; }
.inbox-hint:hover::after, .inbox-hint:focus-visible::after {
    opacity: 1; visibility: visible;
    transition-delay: .15s;
}

.inbox-save-error { margin-top: 4px; font-size: 11px; color: var(--danger, #d66); }

.inbox-pagination {
    display: flex; align-items: center; gap: var(--sp-2);
    justify-content: center; padding: var(--sp-3) 0;
}

.inbox-undo-toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
    display: flex; align-items: center; gap: var(--sp-3);
    background: var(--bg-raised); border: 1px solid var(--border-strong);
    border-radius: 8px; padding: 10px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
    z-index: 1000; font-size: 13px;
}
.table > :not(caption) > * > * { }
.table-responsive { overflow-x: auto; }
.table-responsive.table-scroll-y { max-height: 420px; overflow-y: auto; }
.table-responsive.table-scroll-y thead th { position: sticky; top: 0; background: var(--bg-panel); z-index: 1; }

/* ==========================================================================
   Badges / pills / dots
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .02em;
    padding: 3px 8px;
    border-radius: 20px;
    line-height: 1.4;
    border: 1px solid transparent;
    white-space: nowrap;
    font-family: var(--font-ui);
}
.badge-success { background: rgba(111,220,116,.12); color: var(--good); border-color: rgba(111,220,116,.35); }
.badge-danger  { background: rgba(242,109,109,.12); color: var(--bad); border-color: rgba(242,109,109,.35); }
.badge-warning { background: rgba(210,178,50,.12);  color: var(--warn); border-color: rgba(210,178,50,.3); }
.badge-info, .badge-primary { background: rgba(94,185,224,.12); color: var(--info); border-color: rgba(94,185,224,.35); }
.badge-secondary { background: var(--bg-raised); color: var(--text-dim); border-color: var(--border); }

/* badge de sync em andamento (topbar) */
.badge-sync {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(94,185,224,.12);
    color: var(--info);
    border-color: rgba(94,185,224,.35);
    max-width: 340px;
}
.badge-sync .spinner-border { width: 13px; height: 13px; border-width: 2px; flex: 0 0 auto; }
.badge-sync .sync-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.badge-sync .sync-count {
    color: var(--text-dim);
    font-size: 11px;
}

/* signal pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.pill-review  .dot { background: var(--signal-review); box-shadow: 0 0 6px rgba(127,199,107,.7); }
.pill-forum   .dot { background: var(--signal-forum); box-shadow: 0 0 6px rgba(97,185,232,.7); }
.pill-wish    .dot { background: var(--signal-wishlist); box-shadow: 0 0 6px rgba(232,194,85,.7); }
.pill-sales   .dot { background: var(--signal-sales); box-shadow: 0 0 6px rgba(79,209,197,.7); }
.pill-off     .dot { background: var(--text-faint); box-shadow: none; }
.pill-bad     .dot { background: var(--bad); box-shadow: 0 0 6px rgba(242,109,109,.6); }

/* fixed-window tag on KPI cards whose value ignores the page period selector */
.stat-label .stat-fixed-window {
    margin-left: auto;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .04em;
    color: var(--text-faint);
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1px 6px;
    text-transform: none;
}

/* ==========================================================================
   Breadcrumb + tabs
   ========================================================================== */
.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; margin: 0 0 var(--sp-3); color: var(--text-faint); list-style: none; }
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--accent-bright); }
.breadcrumb .active { color: var(--text); font-weight: 600; }
.breadcrumb-item + .breadcrumb-item::before { content: "/"; color: var(--text-faint); margin-right: 7px; }

.nav-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: var(--sp-5); list-style: none; padding: 0; overflow-x: auto; }
.nav-tabs .nav-link {
    padding: 10px 15px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.nav-tabs .nav-link:hover { color: var(--text); text-decoration: none; }
.nav-tabs .nav-link.active { color: var(--accent-bright); border-bottom-color: var(--accent); }

/* ==========================================================================
   Spinners / loading
   ========================================================================== */
.spinner-border { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dim);
    font-size: 13.5px;
    padding: var(--sp-4) var(--sp-2);
}
.loading::before {
    content: "";
    width: 15px; height: 15px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

/* empty state */
.empty {
    text-align: center;
    padding: var(--sp-6) var(--sp-4);
    color: var(--text-faint);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    font-size: 13.5px;
}
.empty .empty-title { color: var(--text-dim); font-weight: 600; margin-bottom: 4px; font-size: 14px; }
.empty.empty-sm { padding: var(--sp-4) var(--sp-3); }

/* ==========================================================================
   Sign-in (Login)
   ========================================================================== */
.signin { width: 100%; max-width: 400px; margin: 0 auto; }
.signin-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    padding: var(--sp-6);
    text-align: center;
}
.signin-mark { margin: 0 auto var(--sp-4); }
.signin-panel h3 { margin-bottom: 2px; }
.signin-sub { color: var(--text-faint); font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 var(--sp-5); }
.signin-form { text-align: left; }
.signin-foot {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin: var(--sp-5) 0 0;
    color: var(--text-faint); font-size: 12px;
}

/* ==========================================================================
   Landing (Home)
   ========================================================================== */
.landing {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
}
.landing-grid {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: var(--sp-6);
    align-items: center;
}
.landing-mark { margin-bottom: var(--sp-4); }
.landing-h { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: var(--sp-3); }
.landing-sub { font-size: 16.5px; color: var(--text-dim); max-width: 46ch; margin: 0 0 var(--sp-5); line-height: 1.55; }
.landing-note { margin-top: var(--sp-3); color: var(--text-faint); font-size: 12.5px; }

.status-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.section-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(94,182,207,.8); display: inline-block; }
.dirty-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 6px rgba(240,178,50,.7); display: inline-block; }
.status-rows { padding: var(--sp-2) var(--sp-4); }
.status-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--sp-4);
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}
.status-row:last-child { border-bottom: 0; }
.status-row > span:first-child { color: var(--text-faint); }
.status-row .mono { font-size: 12.5px; }

/* ==========================================================================
   Automation console (platform tab strip + detail panel)
   ========================================================================== */
.automation-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}
.automation-tab {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-top: 3px solid transparent;
    border-radius: var(--r-md);
    text-align: left;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.automation-tab:hover { background: var(--bg-hover); }
.automation-tab:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.automation-tab.active {
    background: var(--bg-raised);
    border-top-color: var(--tab-accent, var(--accent));
    box-shadow: var(--shadow-sm);
}
.automation-tab-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.automation-tab-name { font-size: 13.5px; font-weight: 700; letter-spacing: .01em; color: var(--text); }
.automation-tab-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: 11.5px; color: var(--text-faint); }
.automation-tab-meta .mono { font-family: var(--font-data); color: var(--text-dim); }

.automation-panel { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.automation-panel-head {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2);
}
.automation-panel-desc { padding: var(--sp-4) var(--sp-4) 0; }
.automation-panel-body {
    padding: var(--sp-4);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-3);
    align-items: start;
}
@media (max-width: 1180px) {
    .automation-panel-body { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .automation-panel-body { grid-template-columns: 1fr; }
}
.automation-panel-footer {
    padding: var(--sp-3) var(--sp-4);
    border-top: 1px solid var(--border);
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3);
}

.setting-block { background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; }
.setting-block .status-row {
    font-size: 11.5px;
    color: var(--text-faint);
    border-bottom: 0;
    border-top: 1px dashed var(--border);
    padding: var(--sp-2) 0 0;
}
.setting-block .status-row .mono { color: var(--text-dim); }

/* Native hour picker: the operator edits their own local time, never UTC math.
   The small UTC readout underneath is the only place UTC still appears. */
.hour-field-input {
    font-family: var(--font-data);
    font-size: 14px;
    max-width: 140px;
}
.hour-field-input::-webkit-calendar-picker-indicator { filter: invert(.8); cursor: pointer; }
.hour-field .form-text { font-family: var(--font-data); }

.automation-savebar {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 8px 8px 8px 18px;
    box-shadow: 0 8px 24px rgba(0,0,0,.45);
    z-index: 1000;
    font-size: 13.5px;
    animation: automation-savebar-in .18s ease-out;
}
@keyframes automation-savebar-in {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}
@media (max-width: 640px) {
    .automation-tabs { grid-template-columns: 1fr; }
    .automation-savebar {
        left: var(--sp-4); right: var(--sp-4); transform: none;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        border-radius: 12px; flex-wrap: wrap;
    }
    @keyframes automation-savebar-in {
        from { opacity: 0; transform: translateY(8px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

@media (max-width: 820px) {
    .landing-grid { grid-template-columns: 1fr; gap: var(--sp-5); }
    .landing-h { font-size: 30px; }
}

/* ==========================================================================
   Studio grid (Tenants Index)
   ========================================================================== */
.studio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: var(--sp-4);
}
.studio-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
    display: flex;
    flex-direction: column;
}
.studio-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.studio-eyebrow {
    padding: 10px var(--sp-4);
    display: flex; align-items: center; gap: var(--sp-2);
    border-bottom: 1px solid var(--border);
    background: var(--bg-raised);
    flex-wrap: wrap;
}
.studio-body { padding: var(--sp-4); flex: 1 1 auto; }
.studio-name-link { display: block; color: inherit; }
.studio-name-link:hover { text-decoration: none; }
.studio-name-link:hover .studio-name { color: var(--accent-bright); }
.studio-name { font-size: 16px; font-weight: 700; color: #f1f5f8; margin: 0 0 2px; transition: color .12s ease; }
.studio-slug { font-size: 12px; color: var(--accent-bright); font-family: var(--font-data); }
/* Card-local signal grid — deliberately distinct from .studio-signals (nav-bar dots in StudioLayout) */
.studio-card-signals { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); margin-top: var(--sp-3); }
.studio-card-signal { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim); }
.studio-card-signal strong { color: var(--text); font-family: var(--font-data); font-weight: 600; }
.studio-attention-note {
    display: flex; align-items: center; gap: 6px;
    margin-top: var(--sp-3);
    padding: 6px 9px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
}
.studio-attention-note.warn { color: var(--warn); background: rgba(210,178,50,.08); border-color: rgba(210,178,50,.3); }
.studio-attention-note.bad { color: var(--bad); background: rgba(242,109,109,.08); border-color: rgba(242,109,109,.35); }
.studio-foot { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: 0 var(--sp-4) var(--sp-4); }
.studio-foot-primary { flex: 1 1 100%; }
.studio-foot-secondary { display: flex; flex-wrap: wrap; gap: var(--sp-2); flex: 1 1 100%; }

/* ==========================================================================
   Game shelf (Games page)
   ========================================================================== */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: var(--sp-4); }
.game-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color .15s ease;
}
.game-card:hover { border-color: var(--border-strong); }
.game-cover {
    position: relative;
    aspect-ratio: 460 / 215;
    background: var(--bg-inset);
    overflow: hidden;
}
.game-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.game-cover .status-ribbon {
    position: absolute; top: 8px; left: 8px;
    font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    padding: 3px 8px; border-radius: 4px; backdrop-filter: blur(3px);
}
.game-cover .status-ribbon.on { background: rgba(13,28,18,.82); color: var(--good); border: 1px solid rgba(111,220,116,.4); }
.game-cover .status-ribbon.off { background: rgba(20,22,26,.82); color: var(--text-faint); border: 1px solid var(--border-strong); }
.game-info { padding: var(--sp-3); display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }
.game-info .g-name { font-weight: 650; font-size: 13.5px; line-height: 1.25; color: #f0f4f7; }
.game-info .g-meta { font-size: 11.5px; color: var(--text-faint); font-family: var(--font-data); }
.game-signals { display: flex; gap: 8px; flex-wrap: wrap; }
.game-actions { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; }

/* sync mini-state */
.sync-state { font-size: 11.5px; color: var(--text-faint); display: flex; align-items: center; gap: 6px; }
.sync-state b { color: var(--text-dim); font-weight: 600; }
.sync-state .ago { color: var(--good); }

/* ==========================================================================
   Stat / KPI blocks
   ========================================================================== */
.stat { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-4); min-width: 0; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.stat .stat-label { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); display: flex; align-items: center; gap: 6px; margin-bottom: 6px; min-width: 0; flex-wrap: wrap; }
.stat .stat-label > * { min-width: 0; }
.stat .stat-value { font-family: var(--font-data); font-size: 26px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; line-height: 1.1; overflow-wrap: anywhere; }
.stat .stat-value.tone-review { color: var(--signal-review); }
.stat .stat-value.tone-forum { color: var(--signal-forum); }
.stat .stat-value.tone-wish { color: var(--signal-wishlist); }
.stat .stat-value.tone-sales { color: var(--signal-sales); }
.stat .stat-foot { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; display: flex; gap: 5px; align-items: center; flex-wrap: wrap; min-width: 0; }
.stat .stat-foot .delta { font-family: var(--font-data); font-weight: 600; }
.stat .stat-foot .delta.up { color: var(--good); }
.stat .stat-foot .delta.down { color: var(--bad); }
.stat .stat-value.stat-value-sm { font-size: 20px; }

.stat-value .trend-arrow { font-size: .7em; margin-right: 3px; }

/* ==========================================================================
   Sections / subsections
   ========================================================================== */
.section { margin-bottom: var(--sp-5); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.section-head h3 { margin: 0; }
.section-head .sub { font-size: 12px; color: var(--text-faint); }

/* small utility */
.divider { height: 1px; background: var(--border); margin: var(--sp-4) 0; border: 0; }
.muted { color: var(--text-faint); }
.mono { font-family: var(--font-data); }
.nowrap { white-space: nowrap; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-middle{ }

/* ==========================================================================
   Expandable text (reviews / forum previews com link original)
   ========================================================================== */
.expandable-text {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    max-width: 100%;
}
.expandable-text-trunc,
.expandable-text-full {
    display: inline;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-dim);
}
.expandable-text-link {
    flex: none;
    width: 26px; height: 26px;
}
.expandable-text-toggle {
    flex: none;
    padding: 0;
    font-size: 12px;
    color: var(--accent);
    white-space: nowrap;
}
.expandable-text-toggle:hover { color: var(--accent-bright); }

/* ==========================================================================
   Emails hub (recipients / preview / send log)
   ========================================================================== */
.hub-tabs {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
    margin-bottom: var(--sp-4);
}
.email-preview-frame {
    width: 100%;
    height: 520px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: #fff;
}

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a4a58; }

/* ==========================================================================
   Modal overlay (blazor inline, sem JS)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    background: rgba(8, 11, 15, .62);
    backdrop-filter: blur(2px);
}
.modal-panel {
    width: min(440px, calc(100vw - 32px));
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    padding: var(--sp-4);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
}
.modal-panel-lg {
    width: min(940px, calc(100vw - 32px));
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
}
.modal-panel h4 { margin: 0 0 var(--sp-1); }

/* Flexbox and layout utilities */
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-none { display: none !important; }
.d-block { display: block !important; }
.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.flex-1 { flex: 1 1 0% !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; }
.gap-1 { gap: var(--sp-1) !important; }
.gap-2 { gap: var(--sp-2) !important; }
.gap-3 { gap: var(--sp-3) !important; }
.gap-4 { gap: var(--sp-4) !important; }
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }
.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 var(--sp-2);
}
.modal-body {
    font-size: 13.5px;
    color: var(--text-dim);
    margin: 0 0 var(--sp-4);
    line-height: 1.5;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-2);
}

/* Elemento visivel apenas para leitores de tela */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Tabelas com linha de total no rodape
   ========================================================================== */
.table-total td {
    border-top: 2px solid var(--border-strong);
    border-bottom: 0;
    background: rgba(255, 255, 255, .02);
}
.table-total td:first-child { color: var(--text-dim); }

/* Daily series agrupada por mes */
.daily-series-table .month-row {
    cursor: pointer;
    background: rgba(255, 255, 255, .03);
}
.daily-series-table .month-row:hover { background: rgba(94, 185, 224, .08); }
.daily-series-table .month-row.expanded { background: rgba(94, 185, 224, .05); }
.daily-series-table .month-row td {
    border-top: 1px solid var(--border-strong);
    border-bottom: 1px solid var(--border);
}
.daily-series-table .month-caret {
    display: inline-block;
    width: 14px;
    color: var(--text-dim);
    font-size: 11px;
}
.daily-series-table .day-row td {
    background: var(--bg);
}
.daily-series-table .day-cell {
    padding-left: calc(var(--sp-3) + 18px);
    color: var(--text-dim);
}

/* Painel de progresso ao vivo da tela Sync */
.sync-live {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}
.sync-live-line {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}
.sync-live-sub {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

/* ==========================================================================
   Dashboard melhorado (Marco 8): deltas, sentimento, health, backlog, charts
   ========================================================================== */

/* Delta badge (▲/▼) - usado no KPI rail, cards de studio e dashboard por tenant */
.delta-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: var(--font-data);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    line-height: 1.3;
    white-space: nowrap;
}
.delta-badge.delta-up { color: var(--good); background: rgba(111,220,116,.1); border: 1px solid rgba(111,220,116,.3); }
.delta-badge.delta-down { color: var(--bad); background: rgba(242,109,109,.1); border: 1px solid rgba(242,109,109,.35); }
.delta-badge.delta-flat { color: var(--text-dim); background: var(--bg-raised); border: 1px solid var(--border-strong); }
.delta-badge.delta-na { color: var(--text-faint); background: var(--bg-raised); border: 1px solid var(--border); }
.delta-badge .db-arrow { font-size: .72em; }
.delta-badge .db-sign { font-size: .9em; }
.delta-badge .db-flat { color: var(--text-dim); }

/* Sync health strip (Index) */
.sync-health-strip {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 10px var(--sp-4);
    margin-bottom: var(--sp-5);
    font-size: 13px;
}
.health-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); }
.health-chip strong { color: var(--text); font-family: var(--font-data); font-weight: 600; }
.health-chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.health-good .dot { background: var(--good); }
.health-warn .dot { background: var(--warn); }
.health-bad .dot { background: var(--bad); }

/* Deltas dentro do card de studio (Index) */
.studio-card-deltas {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    margin-top: var(--sp-3);
    padding-top: var(--sp-2);
    border-top: 1px dashed var(--border);
}
.studio-card-delta { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-faint); }
.studio-card-delta .delta-badge { font-size: 11px; }

/* Sentimento: barra pos/neg + bloco do dashboard */
.sentiment-bar {
    display: flex;
    height: 7px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--bg-inset);
    width: 100%;
    max-width: 220px;
}
.sentiment-bar .sb-pos { background: var(--good); }
.sentiment-bar .sb-neg { background: var(--bad); }
.sentiment-block { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 520px; }
.sentiment-total { display: flex; align-items: baseline; gap: 7px; font-size: 14px; flex-wrap: wrap; }
.sentiment-big { font-family: var(--font-data); font-size: 24px; font-weight: 600; }

/* Idiomas dos reviews */
.lang-list { display: flex; flex-direction: column; gap: 8px; margin-top: var(--sp-4); max-width: 420px; }
.lang-row { display: flex; align-items: center; gap: var(--sp-3); font-size: 12.5px; }
.lang-name { width: 90px; color: var(--text-dim); text-align: right; text-transform: capitalize; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--bg-inset); overflow: hidden; }
.lang-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #3b6f8a, var(--accent)); }
.lang-count { width: 44px; text-align: right; font-family: var(--font-data); color: var(--text); }

/* Backlog do Inbox (dashboard por tenant) */
.backlog-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.backlog-item { font-size: 13px; color: var(--text-dim); }
.backlog-item strong { color: var(--text); font-family: var(--font-data); font-weight: 600; }

/* Freshness por fonte (dashboard por tenant) */
.freshness-cell { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.freshness-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.freshness-cell.fn-fresh .freshness-dot { background: var(--good); }
.freshness-cell.fn-warn .freshness-dot { background: var(--warn); }
.freshness-cell.fn-stale .freshness-dot { background: var(--bad); }
.freshness-cell.fn-none .freshness-dot { background: var(--text-faint); }

/* Graficos Chart.js */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
}
.chart-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-4);
    min-width: 0;
}
.chart-title { font-size: 13.5px; font-weight: 650; color: #eef3f7; }
.chart-sub { font-size: 11.5px; color: var(--text-faint); margin: 2px 0 0; }
.chart-box { position: relative; height: 240px; margin-top: var(--sp-3); }
.chart-box canvas { width: 100% !important; height: 100% !important; }

/* Topbar hamburger button & close button (hidden on desktop) */
.topbar-hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text);
    cursor: pointer;
    flex: 0 0 auto;
}
.topbar-hamburger:hover {
    background: var(--bg-raised);
    color: var(--accent-bright);
}

.sidebar-close-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-dim);
    cursor: pointer;
    margin-left: auto;
}
.sidebar-close-btn:hover {
    color: #fff;
    border-color: var(--border-strong);
}

.sidebar-backdrop {
    display: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
.focus-ring:focus-visible,
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--accent-bright);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .app-shell {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        grid-template-areas: "topbar" "content";
        height: 100dvh;
        overflow: hidden;
    }

    .topbar-toggle { display: none; }
    .topbar-hamburger { display: inline-flex; }
    .sidebar-close-btn { display: inline-flex; }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(5, 8, 12, 0.7);
        backdrop-filter: blur(3px);
        z-index: 998;
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 280px;
        max-width: 86vw;
        height: 100vh;
        max-height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 0 30px rgba(0,0,0,.8);
        border-right: 1px solid var(--border-strong);
        display: flex;
        flex-direction: column;
    }

    .app-shell.mobile-nav-open .app-sidebar {
        transform: translateX(0);
    }

    .app-shell.mobile-nav-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-brand {
        height: 52px;
        padding: 0 var(--sp-4);
        display: flex;
        align-items: center;
        gap: 10px;
    }
    .sidebar-brand .brand-text { display: flex; }

    .sidebar-nav {
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        padding: var(--sp-3) var(--sp-2);
        gap: 3px;
    }
    .nav-section-label { display: block; }
    .nav-item {
        white-space: normal;
        padding: 9px 12px;
        font-size: 14px;
    }
    .nav-item.active::before { display: block; }

    .sidebar-footer {
        display: grid;
        grid-template-columns: 30px minmax(0, 1fr) 32px;
        align-items: center;
        gap: 10px;
        padding: var(--sp-3) var(--sp-4);
        border-top: 1px solid var(--border);
    }
    .sidebar-footer .footer-avatar,
    .sidebar-footer .footer-id { display: flex; }

    /* Topbar on mobile */
    .app-topbar {
        height: 52px;
        padding: 0 var(--sp-3);
        gap: var(--sp-2);
    }
    .topbar-title {
        font-size: 14px;
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .topbar-breadcrumb { display: none; }
    .topbar-lang-wrap .topbar-lang {
        padding: 4px 6px;
        font-size: 11.5px;
    }
    .badge-sync {
        max-width: 130px;
        font-size: 11px;
        padding: 2px 6px;
    }
    .d-none-mobile { display: none !important; }

    .app-content {
        padding: var(--sp-3) var(--sp-3) var(--sp-5);
    }

    /* Studio navigation on mobile */
    .studio-nav {
        padding: 8px 10px;
        margin: calc(-1 * var(--sp-3)) calc(-1 * var(--sp-3)) var(--sp-3);
        top: calc(-1 * var(--sp-3));
        gap: 8px;
    }
    .studio-nav-top {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 6px;
    }
    .studio-nav-back {
        padding: 4px 6px;
        font-size: 11.5px;
    }
    .studio-nav-id {
        min-width: 0;
        gap: 6px;
    }
    .studio-nav-name {
        font-size: 13px;
        max-width: 110px;
    }
    .studio-nav-slug {
        display: none;
    }
    .studio-nav-meta {
        margin-left: 0;
        width: auto;
        justify-content: flex-end;
        gap: 6px;
    }
    .tenant-switch {
        max-width: 115px;
        font-size: 11.5px;
        padding: 4px 6px;
    }
    .studio-nav-groups {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 4px;
        padding: 2px 0 4px;
    }
    .studio-nav-groups::-webkit-scrollbar { display: none; }
    .studio-group {
        flex: 0 0 auto;
        flex-wrap: nowrap;
        gap: 4px;
    }
    .studio-group + .studio-group {
        padding-left: 4px;
        border-left: 1px solid var(--border);
        margin-left: 2px;
    }
    .studio-group:not(:first-child)::before { display: none; }
    .studio-group-label { display: none; }
    .studio-tabs {
        flex-wrap: nowrap;
        gap: 2px;
    }
    .studio-tab {
        padding: 6px 9px;
        font-size: 12px;
        min-height: 32px;
    }

    /* Page head on mobile */
    .page-head {
        flex-direction: column;
        align-items: stretch;
        gap: var(--sp-2);
        margin-bottom: var(--sp-4);
    }
    .page-head h1 {
        font-size: 20px;
        margin-bottom: 2px;
    }
    .page-head .page-sub {
        font-size: 12.5px;
    }
    .page-head-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: var(--sp-2);
        align-items: center;
    }
    .page-head-actions .d-flex {
        flex-wrap: wrap;
        width: 100%;
    }
    .page-head-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
        min-height: 36px;
    }

    /* Stats on mobile */
    .stat-row {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
        gap: var(--sp-2);
        margin-bottom: var(--sp-3);
    }
    .stat {
        padding: var(--sp-3);
    }
    .stat .stat-value {
        font-size: 21px;
    }

    /* Charts on mobile */
    .chart-grid {
        grid-template-columns: 1fr;
        gap: var(--sp-3);
        margin-bottom: var(--sp-4);
    }
    .chart-card {
        padding: var(--sp-3);
    }
    .chart-box {
        height: 220px;
    }

    /* Games shelf on mobile */
    .shelf {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 155px), 1fr));
        gap: var(--sp-2);
    }
    .game-info {
        padding: 8px 10px;
        gap: 6px;
    }

    /* Inbox on mobile */
    .inbox-filters {
        flex-direction: column;
        gap: var(--sp-2);
    }
    .inbox-filters-list {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 3px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    .inbox-filters-list::-webkit-scrollbar { display: none; }
    .inbox-game-filter { width: 100%; }
    .inbox-game-filter select { width: 100%; max-width: 100%; }
    .inbox-status-actions { gap: 5px; }
    .inbox-undo-toast {
        width: calc(100vw - 32px);
        left: 16px;
        transform: none;
        bottom: 16px;
        font-size: 12px;
        justify-content: space-between;
    }

    /* Tables on mobile */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    .table-sm th, .table-sm td {
        padding: 7px 8px;
        font-size: 12.5px;
    }

    /* Subnav on mobile */
    .subnav {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .subnav::-webkit-scrollbar { display: none; }

    /* Modals on mobile */
    .modal-overlay {
        padding-top: 5vh;
        padding-inline: 12px;
    }
    .modal-panel {
        width: 100%;
        max-width: 440px;
        padding: var(--sp-4);
        max-height: 90vh;
        overflow-y: auto;
    }
}

@media (max-width: 768px) {
    /* Prevent iOS auto-zoom on field focus */
    .form-control, input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], select, textarea {
        font-size: 16px !important;
    }
    .btn { min-height: 38px; }
    .btn-sm { min-height: 32px; }
    .btn-xs { min-height: 28px; min-width: 28px; }

    .signin-panel {
        padding: var(--sp-4);
        border-radius: var(--r-md);
    }
    .landing-h {
        font-size: clamp(26px, 7vw, 36px);
    }
    .landing-sub {
        font-size: 15px;
    }
    .landing-grid {
        grid-template-columns: 1fr;
        gap: var(--sp-4);
    }
    .status-rows {
        padding: var(--sp-1) var(--sp-3);
    }
}

/* ==========================================================================
   Global Utilities (Padding, Margin, Display, Alignments)
   ========================================================================== */
.p-0  { padding: 0 !important; }
.p-1  { padding: var(--sp-1) !important; }
.p-2  { padding: var(--sp-2) !important; }
.p-3  { padding: var(--sp-3) !important; }
.p-4  { padding: var(--sp-4) !important; }
.p-5  { padding: var(--sp-5) !important; }
.p-6  { padding: var(--sp-6) !important; }

.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.px-1 { padding-left: var(--sp-1) !important; padding-right: var(--sp-1) !important; }
.px-2 { padding-left: var(--sp-2) !important; padding-right: var(--sp-2) !important; }
.px-3 { padding-left: var(--sp-3) !important; padding-right: var(--sp-3) !important; }
.px-4 { padding-left: var(--sp-4) !important; padding-right: var(--sp-4) !important; }
.px-5 { padding-left: var(--sp-5) !important; padding-right: var(--sp-5) !important; }

.py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
.py-1 { padding-top: var(--sp-1) !important; padding-bottom: var(--sp-1) !important; }
.py-2 { padding-top: var(--sp-2) !important; padding-bottom: var(--sp-2) !important; }
.py-3 { padding-top: var(--sp-3) !important; padding-bottom: var(--sp-3) !important; }
.py-4 { padding-top: var(--sp-4) !important; padding-bottom: var(--sp-4) !important; }
.py-5 { padding-top: var(--sp-5) !important; padding-bottom: var(--sp-5) !important; }

.pt-0 { padding-top: 0 !important; }
.pt-1 { padding-top: var(--sp-1) !important; }
.pt-2 { padding-top: var(--sp-2) !important; }
.pt-3 { padding-top: var(--sp-3) !important; }
.pt-4 { padding-top: var(--sp-4) !important; }
.pt-5 { padding-top: var(--sp-5) !important; }

.pb-0 { padding-bottom: 0 !important; }
.pb-1 { padding-bottom: var(--sp-1) !important; }
.pb-2 { padding-bottom: var(--sp-2) !important; }
.pb-3 { padding-bottom: var(--sp-3) !important; }
.pb-4 { padding-bottom: var(--sp-4) !important; }
.pb-5 { padding-bottom: var(--sp-5) !important; }

.ps-0 { padding-left: 0 !important; }
.ps-1 { padding-left: var(--sp-1) !important; }
.ps-2 { padding-left: var(--sp-2) !important; }
.ps-3 { padding-left: var(--sp-3) !important; }
.ps-4 { padding-left: var(--sp-4) !important; }

.pe-0 { padding-right: 0 !important; }
.pe-1 { padding-right: var(--sp-1) !important; }
.pe-2 { padding-right: var(--sp-2) !important; }
.pe-3 { padding-right: var(--sp-3) !important; }
.pe-4 { padding-right: var(--sp-4) !important; }

.m-0  { margin: 0 !important; }
.m-1  { margin: var(--sp-1) !important; }
.m-2  { margin: var(--sp-2) !important; }
.m-3  { margin: var(--sp-3) !important; }
.m-4  { margin: var(--sp-4) !important; }
.m-5  { margin: var(--sp-5) !important; }
.m-auto { margin: auto !important; }

.mx-0 { margin-left: 0 !important; margin-right: 0 !important; }
.mx-1 { margin-left: var(--sp-1) !important; margin-right: var(--sp-1) !important; }
.mx-2 { margin-left: var(--sp-2) !important; margin-right: var(--sp-2) !important; }
.mx-3 { margin-left: var(--sp-3) !important; margin-right: var(--sp-3) !important; }
.mx-4 { margin-left: var(--sp-4) !important; margin-right: var(--sp-4) !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }

.my-0 { margin-top: 0 !important; margin-bottom: 0 !important; }
.my-1 { margin-top: var(--sp-1) !important; margin-bottom: var(--sp-1) !important; }
.my-2 { margin-top: var(--sp-2) !important; margin-bottom: var(--sp-2) !important; }
.my-3 { margin-top: var(--sp-3) !important; margin-bottom: var(--sp-3) !important; }
.my-4 { margin-top: var(--sp-4) !important; margin-bottom: var(--sp-4) !important; }
.my-5 { margin-top: var(--sp-5) !important; margin-bottom: var(--sp-5) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--sp-1) !important; }
.mt-2 { margin-top: var(--sp-2) !important; }
.mt-3 { margin-top: var(--sp-3) !important; }
.mt-4 { margin-top: var(--sp-4) !important; }
.mt-5 { margin-top: var(--sp-5) !important; }
.mt-auto { margin-top: auto !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--sp-1) !important; }
.mb-2 { margin-bottom: var(--sp-2) !important; }
.mb-3 { margin-bottom: var(--sp-3) !important; }
.mb-4 { margin-bottom: var(--sp-4) !important; }
.mb-5 { margin-bottom: var(--sp-5) !important; }
.mb-auto { margin-bottom: auto !important; }

.ms-0 { margin-left: 0 !important; }
.ms-1 { margin-left: var(--sp-1) !important; }
.ms-2 { margin-left: var(--sp-2) !important; }
.ms-3 { margin-left: var(--sp-3) !important; }
.ms-4 { margin-left: var(--sp-4) !important; }
.ms-auto { margin-left: auto !important; }

.me-0 { margin-right: 0 !important; }
.me-1 { margin-right: var(--sp-1) !important; }
.me-2 { margin-right: var(--sp-2) !important; }
.me-3 { margin-right: var(--sp-3) !important; }
.me-4 { margin-right: var(--sp-4) !important; }
.me-auto { margin-right: auto !important; }

.gap-0 { gap: 0 !important; }
.gap-1 { gap: var(--sp-1) !important; }
.gap-2 { gap: var(--sp-2) !important; }
.gap-3 { gap: var(--sp-3) !important; }
.gap-4 { gap: var(--sp-4) !important; }
.gap-5 { gap: var(--sp-5) !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.flex-wrap { flex-wrap: wrap !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-items-baseline { align-items: baseline !important; }
.justify-content-start { justify-content: flex-start !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-between { justify-content: space-between !important; }

/* ==========================================================================
   Table & Grid Design System
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    font-size: 13.5px;
    color: var(--text);
    background: transparent;
}

table.table thead th {
    background: rgba(14, 20, 27, 0.85);
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    border-top: none;
    white-space: nowrap;
    vertical-align: middle;
}

table.table tbody td {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: middle;
    background: transparent;
    font-size: 13.5px;
}

table.table tbody tr {
    transition: background 0.15s ease;
}

table.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.035);
}

table.table tbody tr:last-child td {
    border-bottom: none;
}

/* Freshness indicator pill */
.freshness-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 550;
    white-space: nowrap;
}

.freshness-cell .freshness-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.freshness-cell.fn-fresh { color: #34d399; }
.freshness-cell.fn-fresh .freshness-dot {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.freshness-cell.fn-warn { color: #fbbf24; }
.freshness-cell.fn-warn .freshness-dot {
    background: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.freshness-cell.fn-stale { color: #94a3b8; }
.freshness-cell.fn-stale .freshness-dot {
    background: #64748b;
}

/* Pill badges with counts */
.count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
/* ---- Sidebar: lista de empresas com health dots (critique P0/P1) ---- */
.nav-tenant-list { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 10px; padding-left: 10px; border-left: 1px solid var(--border); }
.nav-tenant {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: 8px;
    color: var(--text-dim, #b8c4d0); font-size: 13px; text-decoration: none;
    border: 1px solid transparent;
}
.nav-tenant:hover { background: var(--bg-raised, rgba(255,255,255,.04)); color: var(--accent-bright); text-decoration: none; }
.nav-tenant.active { background: var(--bg-raised, rgba(255,255,255,.05)); color: var(--accent-bright); border-color: var(--border); }
.nav-tenant-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--text-faint, #5f748a); }
.nav-tenant-dot.t-ok { background: var(--good); box-shadow: 0 0 6px rgba(111,220,116,.5); }
.nav-tenant-dot.t-warn { background: var(--warn); }
.nav-tenant-dot.t-stale, .nav-tenant-dot.t-none { background: var(--bad); }
.nav-tenant-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-tenant-flag {
    margin-left: auto; flex: 0 0 auto;
    font-family: var(--font-data, monospace); font-size: 10px; line-height: 1;
    color: var(--text-faint, #5f748a); border: 1px solid var(--border); border-radius: 4px; padding: 2px 4px;
}

/* ---- Cartao de studio: acoes secundarias como icones (1 CTA por cartao) ---- */
.studio-foot-secondary { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.icon-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 7px;
    color: var(--text-faint, #5f748a);
    border: 1px solid transparent;
}
.icon-link:hover { color: var(--accent-bright); background: var(--bg-raised, rgba(255,255,255,.05)); border-color: var(--border); text-decoration: none; }

/* ---- Tabela de comparacao entre studios ---- */
.th-sort {
    background: none; border: 0; padding: 0; width: 100%; text-align: inherit;
    color: inherit; font: inherit; cursor: pointer;
}
.th-sort:hover { color: var(--accent-bright); }
.compare-table .compare-studio { font-weight: 600; }

/* ---- Secoes colapsaveis do dashboard (progressive disclosure) ---- */
details.section-collapse > summary.section-head { cursor: pointer; list-style: none; user-select: none; }
details.section-collapse > summary.section-head::-webkit-details-marker { display: none; }
details.section-collapse > summary.section-head h3::after {
    content: "+"; margin-left: 8px; color: var(--text-faint, #5f748a); font-weight: 400;
}
details.section-collapse[open] > summary.section-head h3::after { content: "\2212"; }
.count-chip {
    display: inline-block; min-width: 20px; text-align: center;
    margin-left: 4px; padding: 1px 6px; border-radius: 999px;
    font-size: 11px; font-family: var(--font-data, monospace);
    color: var(--text-faint, #5f748a); border: 1px solid var(--border);
}

/* ---- Barra de fecho da sessao ---- */
.session-summary {
    display: flex; align-items: center; gap: 8px;
    margin-top: var(--sp-4, 20px); padding: 10px 14px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-raised, rgba(255,255,255,.03));
    font-size: 12.5px; color: var(--text-dim, #b8c4d0);
}
.session-summary-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.session-summary-dot.ok { background: var(--good); box-shadow: 0 0 6px rgba(111,220,116,.5); }
.session-summary-dot.warn { background: var(--warn); }
.session-summary-link { margin-left: auto; font-size: 12px; }

/* ---- Chip de idioma do review (Inbox) ---- */
.lang-chip {
    display: inline-block; margin-right: 6px; padding: 1px 7px;
    border-radius: 999px; border: 1px solid var(--border);
    background: var(--bg-raised, rgba(255,255,255,.04));
    font-size: 10.5px; font-family: var(--font-data, monospace);
    color: var(--text-faint, #5f748a); vertical-align: 1px; white-space: nowrap;
}

/* ==========================================================================
   Dark theme compatibility overrides for Bootstrap utility classes
   ========================================================================== */
.bg-white, .bg-light {
    background-color: var(--bg-panel) !important;
    color: var(--text) !important;
}

.text-dark, .text-black {
    color: var(--text) !important;
}

.border-light {
    border-color: var(--border) !important;
}

.card-header.bg-white, .card-header.bg-light {
    background-color: var(--bg-raised) !important;
    border-bottom: 1px solid var(--border) !important;
}

.btn-light {
    background-color: var(--bg-raised) !important;
    color: var(--text) !important;
    border-color: var(--border-strong) !important;
}
.btn-light:hover {
    background-color: var(--bg-hover) !important;
    color: #fff !important;
}

/* ==========================================================================
   Blazor Circuit Reconnect Modal — Cyberpunk / SteamOS Console Theme
   ========================================================================== */
#components-reconnect-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100000;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#components-reconnect-modal.components-reconnect-hide {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex !important;
    opacity: 1;
    pointer-events: auto;
}

.reconnect-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 14, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.reconnect-dialog {
    position: relative;
    z-index: 2;
    width: 90%;
    max-width: 440px;
    background: var(--bg-panel);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 25px rgba(91, 169, 207, 0.2);
    padding: 32px 28px;
    text-align: center;
    overflow: hidden;
    animation: reconnectSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.reconnect-dialog::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #10b981, #5ba9cf, #0071e3);
}

@keyframes reconnectSlideIn {
    from { opacity: 0; transform: scale(0.92) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.reconnect-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.reconnect-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.reconnect-brand-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-bright);
    box-shadow: 0 0 8px var(--accent-bright);
}

.reconnect-brand-name {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-dim);
}

.reconnect-state-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(91, 169, 207, 0.12);
    border: 1px solid rgba(91, 169, 207, 0.25);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--accent-bright);
}

.badge-pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-bright);
    animation: reconnectBlink 1.5s ease-in-out infinite;
}

@keyframes reconnectBlink {
    0%, 100% { opacity: 0.3; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1.15); }
}

/* Visibilidade condicional dos 3 estados Blazor */
.reconnect-state {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .reconnect-state-trying {
    display: block;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-state-failed {
    display: block;
}

#components-reconnect-modal.components-reconnect-rejected .reconnect-state-rejected {
    display: block;
}

/* Radar & Animacoes Visuais */
.reconnect-visual {
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-container {
    position: relative;
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(91, 169, 207, 0.2);
}

.radar-ring.ring-1 { width: 44px; height: 44px; }
.radar-ring.ring-2 { width: 64px; height: 64px; border-style: dashed; }
.radar-ring.ring-3 { width: 84px; height: 84px; animation: pulseRing 3s ease-out infinite; }

.radar-sweep {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0deg, transparent 270deg, rgba(91, 169, 207, 0.35) 360deg);
    animation: radarSweep 2.2s linear infinite;
}

.radar-core {
    position: relative;
    z-index: 2;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-bright);
    box-shadow: 0 0 16px rgba(91, 169, 207, 0.3);
}

@keyframes radarSweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulseRing {
    0% { transform: scale(0.7); opacity: 0.8; }
    100% { transform: scale(1.15); opacity: 0; }
}

.icon-warning-pulse, .icon-success-pulse {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.icon-warning-pulse {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.icon-success-pulse {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.reconnect-dialog h3 {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px 0;
    letter-spacing: -0.01em;
}

.reconnect-desc {
    font-size: 13.5px;
    color: var(--text-dim);
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.reconnect-progress {
    height: 4px;
    background: var(--bg-inset);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-bottom: 16px;
}

.reconnect-progress-bar {
    position: absolute;
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, transparent, var(--accent-bright), transparent);
    animation: reconnectProgressSweep 1.8s ease-in-out infinite;
}

@keyframes reconnectProgressSweep {
    0% { left: -40%; }
    100% { left: 100%; }
}

.reconnect-subtext {
    font-size: 11.5px;
    color: var(--text-faint);
    line-height: 1.4;
}

.reconnect-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-reconnect {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--accent);
    color: #0b0d10;
    border: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.btn-reconnect:hover {
    background: var(--accent-bright);
    transform: translateY(-1px);
}

.btn-reconnect.btn-success {
    background: #10b981;
    color: #fff;
}

.btn-reconnect.btn-success:hover {
    background: #059669;
}

.btn-reload {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-dim);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12.5px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-reload:hover {
    background: var(--bg-raised);
    color: #fff;
    border-color: var(--border);
}
