/* --- Ukrainian typography override -----------------------------------
   Baloo 2 is primarily designed for Latin + Devanagari; its Cyrillic
   glyphs are thin, off-balance, and often swap in generic fallbacks.
   Rubik has proper Cyrillic coverage designed for Ukrainian and keeps
   a similar rounded/friendly character so brand feel is preserved.
   Driven by <html lang="uk"> — set on every layout that renders UI.

   To add more Baloo 2 usage sites: either append the selector below or
   just slot the element's parent into the enumerated list. Targeted
   enumeration is intentional — we don't want this override touching
   Inter body text. */
:lang(uk) .logo span,
:lang(uk) .topbar-brand,
:lang(uk) .auth-logo span,
:lang(uk) .guide-nav-logo span,
:lang(uk) .guide-title {
    font-family: 'Rubik', 'Baloo 2', sans-serif;
    font-weight: 700;
}

/* --- CSS Variables (Design Tokens) --- */
:root {
    /* Backgrounds */
    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-elevated: #f1f5f9;
    --bg-input: #ffffff;
    --bg-hover: #f1f5f9;

    /* Borders */
    --border-default: #e2e8f0;
    --border-hover: #cbd5e1;
    --border-active: #6366f1;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-heading: #0f172a;

    /* Accent Colors */
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-subtle: rgba(99, 102, 241, 0.08);

    /* Semantic Colors */
    --success: #16a34a;
    --success-subtle: rgba(22, 163, 74, 0.08);
    --danger: #dc2626;
    --danger-subtle: rgba(220, 38, 38, 0.08);
    --warning: #ca8a04;
    --warning-subtle: rgba(202, 138, 4, 0.08);

    /* Spacing & Sizing */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
}

/* --- Icon semantic colors -----------------------------------------------
   Bootstrap Icons SVGs inherit `currentColor`, so they take whatever
   color CSS sets on the icon (or its parent). These classes give common
   semantic icons a consistent meaning-color across the whole app:
   trash is always danger, check is always success, etc. Decorative
   role icons (people, palette, etc.) keep using `currentColor` and
   inherit from the surface they live in. See docs/icons.md.
   ---------------------------------------------------------------------- */
.icon-danger  { color: var(--danger,  #dc2626); }
.icon-success { color: var(--success, #16a34a); }
.icon-warning { color: var(--warning, #ca8a04); }
.icon-accent  { color: var(--accent,  #5876d6); }
.icon-muted   { color: var(--text-muted, #64748b); }
/* Pie palette deeper variants — readable on white/cream backgrounds.
   Each icon has ONE assigned color across the app (see docs/icons.md). */
.icon-c-blue   { color: #4a64bf; }
.icon-c-purple { color: #7a4f8e; }
.icon-c-pink   { color: #c0539f; }
.icon-c-gold   { color: #b56823; }
.icon-c-green  { color: #5a8f1f; }
.icon-c-brown  { color: #783c18; }

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-secondary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

/* --- Typography --- */
h1,
h2,
h3,
h4 {
    color: var(--text-heading);
    font-weight: 600;
    line-height: 1.3;
}

h1 {
    font-size: 1.5rem;
}

h2 {
    font-size: 1.125rem;
}

h3 {
    font-size: 1rem;
}

/* --- Layout --- */
.container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 24px 20px;
    overflow-x: hidden;
}

/* --- Topbar --- */
.topbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.topbar-brand {
    font-family: 'Baloo 2', cursive;
    font-weight: 700;
    font-size: 1.1rem;
    /* Gradient wordmark — same blueberry → pink-berry as the
       landing H1 highlights and the landing topbar logo. The
       `background-clip: text` + `text-fill-color: transparent`
       trick makes the gradient visible only through text glyphs;
       the <img> child stays unaffected because it's an opaque
       element rendered on top of the parent's background. The
       solid `color` value below is the fallback for browsers
       that don't support background-clip: text. */
    color: #5876d6;
    background: linear-gradient(135deg, #5876d6, #e07bc3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-brand img,
.topbar-brand svg {
    width: 24px;
    height: 24px;
    object-fit: contain;
    /* Reset text-fill-color inheritance — the parent set it to
       transparent for the gradient text trick, but img/svg
       shouldn't inherit that. */
    -webkit-text-fill-color: initial;
}

.topbar-nav {
    display: flex;
    gap: 4px;
    align-items: center;
}

.topbar-nav .nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.topbar-nav .nav-link:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.topbar-nav .nav-link.active {
    color: var(--text-heading);
    background: var(--accent-subtle);
}

/* --- Topbar Mobile Menu Button --- */
.topbar-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-heading);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.topbar-menu-btn:hover {
    background: var(--bg-hover);
}

.topbar-menu-btn svg {
    width: 22px;
    height: 22px;
    display: block;
}

.topbar-menu-btn .icon-close {
    display: none;
}

.topbar-menu-btn.active .icon-open {
    display: none;
}

.topbar-menu-btn.active .icon-close {
    display: block;
}

/* --- Cards --- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    transition: border-color var(--transition-normal);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h2 {
    margin: 0;
}

.card-compact {
    padding: 16px 20px;
}

.card-flush {
    padding: 0;
    overflow: hidden;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    /* Re-assert color: the global `a:hover { color: var(--accent-hover) }`
       rule would otherwise turn button text blue-on-blue (invisible) when
       .btn-primary is used on an <a>. */
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    opacity: 0.85;
    color: #fff; }

.btn-outline {
    background: transparent;
    border-color: var(--border-default);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.75rem;
}

.btn-icon {
    padding: 6px;
    width: 32px;
    height: 32px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 16px;
}

.form-group label,
.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M3 4.5L6 8l3-3.5H3z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

/* --- Tables --- */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    padding: 10px 16px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--border-default);
    color: var(--text-secondary);
    vertical-align: middle;
}

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

tbody tr:hover {
    background: var(--bg-hover);
}

/* --- Detail Table (key-value pairs) --- */
.detail-table th {
    text-transform: none;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    width: 160px;
    letter-spacing: 0;
    text-align: left;
}

.detail-table td {
    font-size: 0.8125rem;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-admin {
    background: var(--warning-subtle);
    color: var(--warning);
}

.badge-user {
    background: var(--accent-subtle);
    color: var(--accent);
}

/* --- Alerts ---
   Toasts (flash messages) live in toasts.css, shared by every layout;
   these are the plain boxes an admin form shows inline (its errors). */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md, 8px);
    font-size: 0.8125rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success {
    background: rgba(22, 163, 74, 0.12);
    border: 1px solid rgba(63, 185, 80, 0.35);
    color: var(--success, #3fb950);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(248, 81, 73, 0.35);
    color: var(--danger, #f85149);
}

.alert-info {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(88, 166, 255, 0.35);
    color: var(--accent, #58a6ff);
}

/* --- Token Display --- */
.token-display {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 16px;
}

.token-value {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    flex: 1;
    word-break: break-all;
    color: var(--text-muted);
    line-height: 1.5;
    user-select: all;
}

/* --- Link Cards --- */
.link-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    margin-bottom: 10px;
    background: var(--bg-primary);
    border: 2px solid #e4e4e4;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.link-card:hover {
    border-color: var(--accent);
    background: var(--bg-elevated);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.link-card .link-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-heading);
}

.link-card .link-url {
    font-size: 0.6875rem;
    color: var(--text-muted);
    word-break: break-all;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* --- Actions Row --- */
.actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* --- Status dot --- */
.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.status-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.status-dot.green {
    color: var(--success);
}

.status-dot.blue {
    color: var(--accent);
}

/* --- Monospace text --- */
.mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.text-bold {
    font-weight: 600;
}

.text-heading {
    color: var(--text-heading);
}

/* --- Auth Layout --- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(22, 163, 74, 0.03) 0%, transparent 60%),
        var(--bg-primary);
}

.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.auth-card h1 {
    font-size: 1.375rem;
    margin-bottom: 6px;
}

.auth-card .subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.875rem;
}

/* --- Utilities --- */
.flex {
    display: flex;
}

.flex-between {
    justify-content: space-between;
}

.flex-center {
    align-items: center;
}

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

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-16 {
    margin-bottom: 16px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .topbar {
        padding: 0 12px;
        height: 48px;
    }

    .topbar-brand {
        font-size: 0.875rem;
    }

    .topbar-menu-btn {
        display: block;
    }

    .topbar-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-surface);
        flex-direction: column;
        padding: 12px 16px;
        gap: 4px;
        border-bottom: 1px solid var(--border-default);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
        z-index: 99;
        animation: topbar-menu-in 0.2s ease-out;
    }

    .topbar-nav.open {
        display: flex;
    }

    .topbar-nav .nav-link {
        padding: 10px 14px;
        font-size: 0.875rem;
        border-radius: var(--radius-md);
        width: 100%;
    }

    .topbar-nav .btn {
        width: 100%;
        justify-content: center;
        margin-top: 4px;
    }

    .topbar-nav form {
        width: 100%;
    }

    .topbar-nav form .btn {
        width: 100%;
        justify-content: center;
    }

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

    .container {
        padding: 16px 12px;
    }

    .card {
        padding: 16px;
        border-radius: var(--radius-md);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-card {
        padding: 28px 20px;
    }

    .auth-header {
        margin-bottom: 28px;
    }

    .auth-logo img {
        width: 32px;
        height: 32px;
    }

    .auth-logo span {
        font-size: 1.25rem;
    }

    .token-display {
        flex-direction: column;
    }

    .token-value {
        width: 100%;
    }

    thead th,
    tbody td {
        padding: 8px 12px;
    }

    .hide-mobile {
        display: none !important;
    }

    /* Dashboard: Status Strip → compact stat grid on mobile */
    .status-strip {
        flex-direction: column;
        gap: 10px;
        padding: 12px 0;
        align-items: stretch !important;
        justify-content: flex-start !important;
    }

    .status-strip > div:first-child {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px !important;
    }

    .status-item {
        font-size: 0.75rem;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 2px;
        background: var(--bg-surface);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-md);
        padding: 8px 4px;
        border-left: none !important;
        padding-left: 4px !important;
    }

    .status-item .item-label {
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    .status-item .item-value {
        font-size: 0.9375rem;
    }

    /* Subscription status items span full width */
    .status-item[style*="border-left"] {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        text-align: left;
        padding: 10px 12px;
        gap: 8px;
    }

    .status-badge {
        align-self: flex-start;
    }

    /* Dashboard: Tabs → scrollable on mobile */
    .tabs {
        margin-bottom: 16px;
    }

    

    

    

    /* Grid console overflow */
    .grid-console {
        height: auto;
        min-height: 40px;
    }

    /* btn-xs */
    .btn-xs {
        padding: 4px 10px;
        font-size: 0.6875rem;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 0 10px;
    }

    .topbar-nav .nav-link {
        padding: 4px 6px;
        font-size: 0.75rem;
    }

    .container {
        padding: 12px 10px;
    }

    .card {
        padding: 14px;
    }

    .btn {
        padding: 7px 12px;
        font-size: 0.75rem;
    }

    h1 {
        font-size: 1.25rem;
    }

    h2 {
        font-size: 1rem;
    }

    .auth-card {
        padding: 24px 16px;
        border-radius: var(--radius-lg);
    }

    .auth-wrapper {
        padding: 16px 12px;
    }

    /* Status items already handled at 768px, just refine */
    .status-strip > div:first-child {
        gap: 6px !important;
    }

    .status-item {
        padding: 6px 4px;
    }

    .status-item .item-label {
        font-size: 0.5625rem;
    }

    .status-item .item-value {
        font-size: 0.8125rem;
    }

    /* Control module tweaks */
    

    

    

    .btn-launch-grid {
        height: 44px;
        font-size: 0.8125rem;
    }

    /* Setup guide */
    .setup-guide-content {
        padding: 12px;
    }

    .setup-guide-toggle {
        font-size: 0.75rem;
    }

    /* OBS drag compact */
    .obs-drag-compact {
        padding: 10px 14px;
    }

    .obs-drag-compact-text {
        font-size: 0.75rem;
    }

    }

@media (max-width: 360px) {
    .auth-card {
        padding: 20px 14px;
    }

    .topbar-nav .nav-link {
        padding: 3px 5px;
        font-size: 0.6875rem;
    }

    

    .btn-launch-grid {
        height: 40px;
        font-size: 0.75rem;
    }
}

/* --- Breadcrumbs --- */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    padding: 12px 0 0;
}

.breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumbs a:hover {
    color: var(--accent);
}

.breadcrumbs .separator {
    color: var(--border-hover);
    font-size: 0.75rem;
}

.breadcrumbs .current {
    color: var(--text-heading);
    font-weight: 500;
}

/* --- Status Badges --- */
.badge-pending {
    background: var(--warning-subtle);
    color: var(--warning);
}

.badge-accepted {
    background: var(--success-subtle);
    color: var(--success);
}

.badge-revoked {
    background: var(--danger-subtle);
    color: var(--danger);
}

/* --- Tabs --- */
.tabs {
    margin-bottom: 24px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Section Title --- */
.section-title {
    margin-bottom: 20px;
}

.section-title h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.section-title p {
    color: var(--text-muted);
    font-size: 0.875rem;
}
/* --- OBS Setup UI --- */

.step-content {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* --- Auth Header & Brand --- */
.auth-header {
    text-align: center;
    margin-bottom: 20px;
    animation: fadeInDown 0.6s ease-out;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    transition: transform var(--transition-normal);
}

.auth-logo:hover {
    transform: translateY(-1px);
}

.auth-logo img {
    width: 52px;
    height: 52px;
    filter: drop-shadow(0 4px 6px rgba(99, 102, 241, 0.2));
}

.auth-logo span {
    font-family: 'Baloo 2', cursive;
    font-size: 1.75rem;
    font-weight: 700;
    color: #5876d6;
    letter-spacing: -0.02em;
    /* Pie-palette gradient — same blueberry → pink-berry as the
       landing H1 highlights, the topbar-brand wordmark, and the
       guide-nav-logo. Was using the deprecated indigo (`var(--accent)`
       = `#6366f1`) + #a855f7 purple — replaced 2026-05-01 for
       brand consistency. */
    background: linear-gradient(135deg, #5876d6, #e07bc3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dashboard Redesign - Control Center */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.status-badge.live {
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.2);
}

.status-badge .pulse-dot {
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
}

.status-badge.live .pulse-dot {
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

/* OBS Link Expansion */

.obs-link-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-heading);
  word-break: break-all;
  line-height: 1.5;
}

/* Broadcast Station - Premium Controls */

.btn-console {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-console:hover {
  background: var(--bg-elevated);
  color: var(--accent);
}

.btn-launch-studio {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 48px;
  background: linear-gradient(90deg, var(--accent) 0%, #4f46e5 100%);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 700;
  text-decoration: none;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-launch-studio:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
  color: white;
}

/* --- Admin users wide layout ---
   Override the default 1040px container for /admin/users where the
   dense table benefits from more horizontal room. Gated on a body
   class set via content_for(:body_class) in the view. */
body.page-admin-users-wide .container {
  max-width: min(1600px, calc(100vw - 32px));
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 20px;
  overflow: hidden;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
}

.status-item .item-label {
  color: var(--text-muted);
  font-weight: 500;
}

.status-item .item-value {
  color: var(--text-heading);
  font-weight: 700;
}

/* Setup Guide Accordion */

.setup-guide-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  transition: opacity var(--transition-fast);
}

.setup-guide-toggle:hover {
  opacity: 0.8;
}

.setup-guide-content {
  display: none;
  margin-top: 12px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  animation: slideDown 0.2s ease-out;
}

.setup-guide-content.active {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Compact Drag Helper */
.obs-drag-compact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-top: 4px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.obs-drag-compact:hover {
  border-color: var(--accent);
  background: var(--bg-surface);
  transform: translateY(-1px);
}

.obs-drag-compact-text { font-size: 0.8125rem; font-weight: 600; color: var(--text-heading); }

/* Rack-Mount Control Panel */

.btn-rack {
  width: 48px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-default);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-rack:first-child { border-left: none; }

.btn-rack:hover {
  background: var(--bg-elevated);
  color: var(--accent);
}

/* 2x2 Command Grid
   Both modules stretch to equal height for visual balance. Inside each
   module, content is anchored to the TOP (.control-module is flex-column
   flex-start; .module-body's content is flex-start) — so when one card is
   taller than the other (e.g. Step 2 with accordions vs Step 1 without
   scenes), the empty space sits at the bottom of the shorter card rather
   than awkwardly floating its content in the middle. */

.module-body {
  /* No flex-grow: body shrinks to its content height so the button sits
     directly below the description rather than floating mid-card when
     this module's card got stretched by its taller sibling. */
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}

/* Specific Module Overrides */

.btn-launch-grid {
  width: 100%;
  height: 48px;
  background: linear-gradient(90deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  transition: all var(--transition-bounce);
}

.btn-launch-grid:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
  color: white;
}

/* Compact Console for Grid */
.grid-console {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 40px;
}

/* --- Step badges (guides) --- */
.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

/* --- Subscription alarm banner (dashboard top) ---------------------
   Only rendered for subscription states that actually need user action:
   cancelled / past_due / expired. Informational states (trial, active)
   live inline in the status-strip. */
.sub-alarm {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 0.8125rem;
  border: 1px solid;
}
.sub-alarm-warning {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.3);
  color: #7c4a03;
}
.sub-alarm-danger {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.3);
  color: #7f1d1d;
}
.sub-alarm-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.sub-alarm-text {
  flex: 1;
  line-height: 1.4;
}
.sub-alarm-text strong {
  font-weight: 700;
}
.sub-alarm-cta {
  white-space: nowrap;
  font-weight: 600;
  text-decoration: none;
  color: inherit;
  padding: 6px 12px;
  border: 1px solid currentColor;
  border-radius: 6px;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  font-size: 0.75rem;
}
/* Per-variant hover colors — explicit hex rather than currentColor tricks,
   which mis-resolve when `color` and `background` are both set in the same
   :hover rule (currentColor picks up the new color, not the old one). */
.sub-alarm-warning .sub-alarm-cta:hover {
  background: #7c4a03;
  border-color: #7c4a03;
  color: #fff;
}
.sub-alarm-danger .sub-alarm-cta:hover {
  background: #7f1d1d;
  border-color: #7f1d1d;
  color: #fff;
}

/* "Where do you stream?" chips, 2026-10-20 */

.platform-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.platform-chip { position: relative; display: inline-flex; cursor: pointer; }
.platform-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.platform-chip span {
  padding: 5px 12px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary, var(--text-primary));
  background: var(--bg-surface);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.platform-chip input:checked + span { background: rgba(88, 118, 214, 0.12); border-color: var(--accent, #5876d6); color: var(--accent, #5876d6); }
.platform-chip input:focus-visible + span { outline: 2px solid var(--accent, #5876d6); outline-offset: 2px; }

/* --- Sorting & Pagination --- */
.sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color var(--transition-fast);
}

.sort-link:hover {
  color: var(--accent);
}

.sort-link.active {
  color: var(--text-heading);
  font-weight: 700;
}

/* Pagy Pagination Styles */
.pagy {
  /* PagyWand Generated Variables */
  --B: 1;
  --H: 214.83;
  --S: 40%;
  --L: 70%;
  --A: 1;
  --spacing: 0.125rem;
  --padding: 0.75rem;
  --rounding: 1.125rem;
  --border-width: 0rem;
  --font-size: 0.875rem;
  --font-weight: 450;
  --line-height: 1.75;

  /* Calculated Color Variables */
  --text:               hsl(var(--H) var(--S) calc(var(--L) - (25% * var(--B))) / var(--A));
  --text-hover:         hsl(var(--H) var(--S) calc(var(--L) - (30% * var(--B))) / var(--A));
  --text-current:       hsl(var(--H) var(--S) calc(100% * (var(--B) + 1)) / var(--A));
  --background:         hsl(var(--H) var(--S) calc(var(--L) + (30% * var(--B))) / var(--A));
  --background-hover:   hsl(var(--H) var(--S) calc(var(--L) + (20% * var(--B))) / var(--A));
  --background-current: hsl(var(--H) var(--S) var(--L) / var(--A));
  --background-input:   hsl(var(--H) var(--S) calc(var(--L) + (45% * var(--B))) / var(--A));

  /* Base Properties */
  color: var(--text);
  font-size: var(--font-size);
  line-height: var(--line-height);
  font-weight: var(--font-weight);
  display: flex;
}

/* Element Rules */

.pagy > :not([hidden]) ~ :not([hidden]) {
  margin-inline-start: var(--spacing);
}

.pagy a:not([role="separator"]) { /* all but gaps */
  display: block;
  text-decoration: none;
  background-color: var(--background);
  padding: calc(var(--padding) / 3) var(--padding);
  border: var(--border-width) solid var(--background-current);
  border-radius: var(--rounding);
  color: inherit;
}

.pagy a[href]:hover { /* all links on hover */
  background-color: var(--background-hover);
  color: var(--text-hover)
}

.pagy a:not([href]) { /* all but links */
  cursor: default;
}

.pagy a[role="link"]:not([aria-current]) { /* disabled links */
  opacity: .6;
}

.pagy a[aria-current] {  /* current page */
  background-color: var(--background-current);
  color: var(--text-current);
  border-color: var(--text);
}

.pagy label {
  white-space: nowrap;
  display: inline-block;
  border: var(--border-width) solid var(--background-current);
  border-radius: var(--rounding);
  background-color: var(--background);
  padding: calc((var(--padding) / 3) - var(--border-width)) var(--padding);
}

.pagy label input {
  all: unset;
  border: var(--border-width) solid var(--background-current);
  border-radius: calc(var(--rounding) / 2) !important;
  background-color: var(--background-input);
}

