/* ===== Design System ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.08);
    --border-active: rgba(79, 172, 254, 0.4);
    --text-primary: #f0f0f5;
    --text-secondary: #8a8a9a;
    --text-muted: #7b7b8f; /* bumped from #5a5a6a to meet WCAG AA 4.5:1 on dark bg */
    --accent: #4facfe;
    --accent-2: #00f2fe;
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --danger: #ff4757;
    --success: #2ed573;
    --warning: #ffa502;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    /* Render native browser controls (scrollbars, select dropdowns, date
       pickers, file inputs) with the OS dark variant so nothing pops white. */
    color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* ===== Skip navigation (accessibility) ===== */
.skip-nav {
    position: absolute;
    top: -100%;
    left: 0;
    padding: 8px 16px;
    background: var(--accent);
    color: #000;
    font-weight: 600;
    font-size: 14px;
    z-index: 9999;
    text-decoration: none;
    border-radius: 0 0 var(--radius-sm) 0;
    transition: top 0.15s;
}
.skip-nav:focus {
    top: 0;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

.animated-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 400px; height: 400px;
    background: #4facfe;
    top: -10%; left: -5%;
    animation-delay: 0s;
}

.orb-2 {
    width: 350px; height: 350px;
    background: #00f2fe;
    bottom: -10%; right: -5%;
    animation-delay: -7s;
}

.orb-3 {
    width: 300px; height: 300px;
    background: #7c3aed;
    top: 50%; left: 60%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(50px, -30px) scale(1.1); }
    50% { transform: translate(-20px, 40px) scale(0.95); }
    75% { transform: translate(30px, 20px) scale(1.05); }
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: rgba(18, 18, 26, 0.85);
    backdrop-filter: blur(40px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: var(--shadow), 0 0 80px rgba(79, 172, 254, 0.05);
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: inline-block;
    animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(79, 172, 254, 0.3)); }
    50% { filter: drop-shadow(0 0 16px rgba(79, 172, 254, 0.6)); }
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font);
    transition: all 0.2s;
    outline: none;
}

.input-group textarea {
    min-height: 96px;
    resize: vertical;
    line-height: 1.4;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: var(--text-muted);
}

/* Native <select> dropdown panels fall back to OS-white on some platforms —
   force dark option rows so open menus match the theme. */
select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.password-input-wrap {
    position: relative;
}

.password-input-wrap input {
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.password-toggle:hover {
    background: rgba(79, 172, 254, 0.12);
    color: var(--accent);
}

.password-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.error-msg {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}

#login-form button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: #000;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

#login-form button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(79, 172, 254, 0.3);
}

#login-form button[type="submit"]:active {
    transform: translateY(0);
}

#login-form button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-loader {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

.login-helper-links {
    margin-top: 16px;
    text-align: center;
}

.link-button {
    background: none;
    border: none;
    color: var(--accent);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

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

.inline-message {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.inline-message.success {
    background: rgba(46, 213, 115, 0.12);
    border: 1px solid rgba(46, 213, 115, 0.28);
    color: #8df0b2;
}

.inline-message.error {
    background: rgba(255, 71, 87, 0.12);
    border: 1px solid rgba(255, 71, 87, 0.28);
    color: #ff9ba4;
}

.inline-message.info {
    background: rgba(79, 172, 254, 0.12);
    border: 1px solid rgba(79, 172, 254, 0.28);
    color: #a9d4ff;
}

/* ===== Dashboard Layout ===== */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-header .user-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.sidebar-section {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-section h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.tenant-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tenant-item {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
}

.tenant-item:hover {
    background: var(--bg-card-hover);
}

.tenant-item.active {
    background: rgba(79, 172, 254, 0.12);
    border: 1px solid rgba(79, 172, 254, 0.2);
}

.tenant-item .count {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.06);
    padding: 2px 8px;
    border-radius: 12px;
}

.sidebar-actions {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-account > .btn + .btn {
    margin-top: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #000;
    width: 100%;
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(79, 172, 254, 0.25);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    width: 100%;
    margin-top: 8px;
}

.btn-ghost:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(255, 71, 87, 0.1);
    color: var(--danger);
    border: 1px solid rgba(255, 71, 87, 0.2);
}

.btn-danger:hover {
    background: rgba(255, 71, 87, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-full {
    width: 100%;
}

.btn-inline {
    width: auto;
    margin-top: 0;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

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

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.page-header .badge {
    background: rgba(79, 172, 254, 0.12);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.page-header-button {
    width: auto;
    min-height: 28px;
    padding: 6px 16px;
    font-size: 12px;
    margin-top: 0;
}

.branding-card {
    padding: 20px;
    margin-bottom: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.branding-card-layout {
    display: flex;
    align-items: center;
    gap: 20px;
}

.branding-preview {
    width: 120px;
    height: 120px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.branding-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.02);
}

.branding-fallback {
    width: 76px;
    height: 76px;
    border-radius: 22px;
    background: var(--accent-gradient);
    color: #07111f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.branding-copy {
    flex: 1;
    min-width: 0;
}

.branding-copy h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.branding-copy p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.branding-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.branding-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.print-logo-panel {
    margin-top: 16px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.print-logo-header h4 {
    font-size: 14px;
    margin-bottom: 6px;
}

.print-logo-header p {
    margin: 0;
    font-size: 13px;
}

.print-logo-status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.print-logo-status-row img {
    width: 76px;
    height: 44px;
    object-fit: contain;
    padding: 6px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.print-logo-status-row .branding-hint {
    margin-top: 0;
}

.branding-domain-settings {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.branding-domain-settings .input-group {
    margin-top: 0;
}

.public-link-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.public-link-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.public-link-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.public-link-item a {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    word-break: break-all;
}

.public-link-item a:hover {
    text-decoration: underline;
}

.collapsible-section {
    overflow: hidden;
}

.collapsible-toggle {
    width: 100%;
    border: none;
    background: none;
    color: inherit;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    text-align: left;
    cursor: pointer;
}

.collapsible-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.collapsible-copy strong {
    font-size: 18px;
    color: var(--text-primary);
}

.collapsible-copy span:last-child {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.collapsible-eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.collapsible-chevron {
    width: 12px;
    height: 12px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: rotate(45deg);
    transition: transform 0.18s ease, border-color 0.18s ease;
    flex-shrink: 0;
    margin-right: 6px;
}

.collapsible-toggle:hover .collapsible-chevron {
    border-color: var(--accent);
}

.collapsible-body {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.collapsible-section.is-collapsed .collapsible-body {
    display: none;
}

.collapsible-section.is-collapsed .collapsible-chevron {
    transform: rotate(-45deg);
}

.toggle-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.toggle-copy {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.5;
}

.switch {
    position: relative;
    display: inline-flex;
    width: 52px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.switch-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.switch input:checked + .switch-slider {
    background: rgba(46, 213, 115, 0.18);
    border-color: rgba(46, 213, 115, 0.38);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(22px);
}

.analytics-panel {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.analytics-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.analytics-header h3 {
    font-size: 18px;
    margin-bottom: 6px;
}

.analytics-header p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

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

.analytics-actions select {
    min-width: 128px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font);
}

.usage-status-card {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(79, 172, 254, 0.08);
    border: 1px solid rgba(79, 172, 254, 0.18);
    color: #b9dbff;
    font-size: 13px;
    line-height: 1.5;
}

.usage-status-card.is-success {
    background: rgba(46, 213, 115, 0.08);
    border-color: rgba(46, 213, 115, 0.18);
    color: #9df2bd;
}

.usage-status-card.is-error {
    background: rgba(255, 71, 87, 0.08);
    border-color: rgba(255, 71, 87, 0.18);
    color: #ffadb5;
}

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

.usage-card {
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.usage-card-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.usage-card strong {
    font-size: 18px;
    color: var(--text-primary);
}

.usage-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.usage-section {
    min-width: 0;
    padding: 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.usage-section h4 {
    margin-bottom: 14px;
    font-size: 14px;
}

.usage-bar-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.usage-bar-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.usage-bar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
}

.usage-bar-header span {
    color: var(--text-secondary);
}

.usage-bar-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.usage-bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent-gradient);
}

.usage-bar-meta {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.usage-table-wrap {
    overflow-x: auto;
}

.usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.usage-table th,
.usage-table td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
    vertical-align: top;
}

.usage-table th {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.usage-table td {
    color: var(--text-secondary);
}

.usage-empty {
    padding: 18px 0 4px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ===== Analytics sessions-per-day bar chart ===== */

.analytics-grid-stacked {
    grid-template-columns: 1fr;
}

.analytics-sessions-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 140px;
    padding-bottom: 22px; /* room for date labels */
    position: relative;
}

.analytics-day-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    min-width: 0;
    cursor: default;
}

.analytics-day-count {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1;
    margin-bottom: 2px;
    min-height: 13px;
}

.analytics-day-bar-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

.analytics-day-bar {
    display: block;
    width: 100%;
    min-height: 0;
    border-radius: 3px 3px 0 0;
    background: var(--accent-gradient);
    transition: opacity 0.1s ease;
}

.analytics-day-col:hover .analytics-day-bar {
    opacity: 0.75;
}

.analytics-day-label {
    position: absolute;
    bottom: 0;
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    line-height: 1;
    pointer-events: none;
}

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

.billing-summary-card {
    padding: 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.billing-summary-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.billing-summary-card strong {
    color: var(--text-primary);
    font-size: 20px;
}

.billing-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
}

.billing-renewal-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
}

.billing-status-pill[data-state="active"],
.billing-status-pill[data-state="trialing"] {
    background: rgba(46, 213, 115, 0.12);
    color: #8df0b2;
}

.billing-status-pill[data-state="canceling"] {
    background: rgba(255, 165, 2, 0.14);
    color: #ffc766;
}

.billing-status-pill[data-state="past_due"],
.billing-status-pill[data-state="paused"] {
    background: rgba(255, 71, 87, 0.12);
    color: #ff9ba4;
}

.billing-status-pill[data-state="not_connected"] {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.billing-renewal-pill[data-state="auto_renews"] {
    background: rgba(46, 213, 115, 0.12);
    color: #8df0b2;
}

.billing-renewal-pill[data-state="does_not_renew"] {
    background: rgba(255, 165, 2, 0.14);
    color: #ffc766;
}

.billing-renewal-pill[data-state="payment_issue"],
.billing-renewal-pill[data-state="ended"] {
    background: rgba(255, 71, 87, 0.12);
    color: #ff9ba4;
}

.billing-renewal-pill[data-state="not_connected"],
.billing-renewal-pill[data-state="unknown"] {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.billing-plan-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.billing-plan-cell strong {
    color: var(--text-primary);
    font-size: 13px;
}

.billing-plan-cell span,
.billing-date-cell span {
    color: var(--text-muted);
    font-size: 12px;
}

.billing-date-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.backup-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.backup-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.backup-card-main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.backup-card-main strong {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}

.backup-card-main span {
    color: var(--text-secondary);
    font-size: 12px;
}

.backup-card-main .backup-kind-badge {
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.backup-card-main .backup-kind-badge.backup-kind-auto {
    color: #f0c674;
    background: rgba(240, 198, 116, 0.12);
    border: 1px solid rgba(240, 198, 116, 0.35);
}

.backup-card-main .backup-kind-badge.backup-kind-uploaded {
    color: #8abeb7;
    background: rgba(138, 190, 183, 0.12);
    border: 1px solid rgba(138, 190, 183, 0.35);
}

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

/* Tool Type Tabs */
.tool-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    width: fit-content;
}

.tool-tab {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    background: none;
    font-family: var(--font);
}

.tool-tab:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.tool-tab.active {
    background: var(--accent-gradient);
    color: #000;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    transition: all 0.2s;
    margin-bottom: 24px;
    cursor: pointer;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(79, 172, 254, 0.04);
}

.upload-zone .upload-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 14px;
}

.upload-zone .browse-link {
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
}

.upload-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
}

.upload-controls input[type="text"],
.upload-controls select {
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s;
}

.upload-controls input[type="text"]:focus,
.upload-controls select:focus {
    border-color: var(--accent);
}

.upload-controls select option {
    background: var(--bg-secondary);
}

/* Category Cards */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.15s;
}

.category-card:hover {
    border-color: rgba(255,255,255,0.12);
    background: var(--bg-card-hover);
}

.category-toggle {
    gap: 14px;
}

.category-card-body {
    margin-top: 16px;
    padding-top: 16px;
}

.category-image-panel {
    margin-bottom: 14px;
}

.category-image-preview {
    width: 100%;
    min-height: 150px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-image-preview.is-empty {
    border-style: dashed;
}

.category-image-preview img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    display: block;
    background: rgba(255, 255, 255, 0.02);
}

.category-image-empty {
    padding: 18px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.category-image-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.category-image-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.category-mode-panel {
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(79, 172, 254, 0.16);
    background: rgba(79, 172, 254, 0.06);
}

.category-mode-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.category-mode-copy strong {
    font-size: 13px;
    color: var(--text-primary);
}

.category-mode-copy span {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
}

.category-mode-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.category-flag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
}

.category-flag input {
    width: 16px;
    height: 16px;
}

.category-mode-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.category-mode-actions {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-mode-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(148, 163, 184, 0.14);
    color: var(--text-muted);
}

.category-mode-status[data-state="saving"],
.category-card[data-outdoor-save-pending="true"] .category-mode-status {
    background: rgba(79, 172, 254, 0.14);
    color: var(--accent);
}

.category-mode-status[data-state="saved"] {
    background: rgba(34, 197, 94, 0.14);
    color: #16a34a;
}

.category-mode-status[data-state="error"] {
    background: rgba(239, 68, 68, 0.14);
    color: #ef4444;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.category-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.category-header .file-count {
    font-size: 12px;
    color: var(--accent);
    background: rgba(79, 172, 254, 0.1);
    padding: 2px 10px;
    border-radius: 12px;
}

.file-list {
    max-height: 160px;
    overflow-y: auto;
    font-size: 12px;
    color: var(--text-secondary);
}

.files-list {
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.files-list::-webkit-scrollbar {
    width: 4px;
}

.files-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.files-list::-webkit-scrollbar-track {
    background: transparent;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.file-item:last-child {
    border-bottom: none;
}

.file-item .file-name {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .file-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.file-item .file-link-button {
    padding: 4px 8px;
    min-height: 24px;
    font-size: 11px;
    white-space: nowrap;
}

.file-item .delete-file {
    color: var(--danger);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    background: none;
    border: none;
    font-size: 14px;
    padding: 2px 6px;
}

.file-item:hover .delete-file {
    opacity: 1;
}

.category-footer {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

#modal-create-user {
    z-index: 1001;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
}

.modal-lg {
    max-width: 760px;
}

.modal h2 {
    font-size: 20px;
    margin-bottom: 20px;
}

.modal-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.modal .input-group {
    margin-bottom: 16px;
}

.modal .input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.modal .input-group input,
.modal .input-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
}

.modal .input-group input:focus,
.modal .input-group select:focus {
    border-color: var(--accent);
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 13px;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

.user-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
}

.user-card-main {
    min-width: 0;
    flex: 1;
}

.user-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.user-card-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.mini-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(79, 172, 254, 0.12);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
}

.mini-badge.role-superadmin {
    background: rgba(79, 172, 254, 0.12);
    color: var(--accent);
}

.mini-badge.role-admin {
    background: rgba(46, 213, 115, 0.12);
    color: #8df0b2;
}

.mini-badge.is-muted {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.user-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.compact-empty {
    padding: 24px 12px;
}

/* ===== Getting Started Checklist ===== */
.onboarding-checklist {
    margin-bottom: 24px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.06) 0%, rgba(0, 242, 254, 0.04) 100%);
    border: 1px solid rgba(79, 172, 254, 0.2);
    border-radius: var(--radius);
}

.onboarding-checklist-header {
    margin-bottom: 18px;
}

.onboarding-checklist-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.onboarding-checklist-header p {
    font-size: 13px;
    color: var(--text-secondary);
}

.onboarding-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.onboarding-step {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.onboarding-step:hover {
    background: rgba(79, 172, 254, 0.08);
    border-color: rgba(79, 172, 254, 0.25);
}

.onboarding-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.onboarding-step.is-done .onboarding-step-num {
    background: rgba(46, 213, 115, 0.2);
    color: var(--success);
    border: 1px solid rgba(46, 213, 115, 0.3);
}

.onboarding-step-body {
    flex: 1;
    min-width: 0;
}

.onboarding-step-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.onboarding-step.is-done .onboarding-step-title {
    color: var(--text-muted);
    text-decoration: line-through;
}

.onboarding-step-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.onboarding-step-arrow {
    font-size: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.onboarding-step.is-done .onboarding-step-arrow {
    display: none;
}

/* ===== Help Page ===== */
.help-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 0 48px;
}

.help-section {
    margin-bottom: 32px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.help-section h2 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.help-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    margin-top: 16px;
}

.help-section h3:first-of-type {
    margin-top: 0;
}

.help-section p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 8px;
}

.help-section p:last-child {
    margin-bottom: 0;
}

.help-section ol,
.help-section ul {
    margin: 6px 0 10px 18px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.65;
}

.help-section li {
    margin-bottom: 4px;
}

.help-section a {
    color: var(--accent);
    text-decoration: none;
}

.help-section a:hover {
    text-decoration: underline;
}

.help-contact-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: rgba(79, 172, 254, 0.06);
    border: 1px solid rgba(79, 172, 254, 0.2);
    border-radius: var(--radius-sm);
    margin-top: 12px;
}

.help-contact-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.help-contact-body {
    flex: 1;
    min-width: 0;
}

.help-contact-body strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.help-contact-body p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== Hamburger Toggle ===== */
.sidebar-hamburger {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 0;
}

.sidebar-hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: opacity 0.15s;
}

/* ===== Responsive — 768px ===== */
@media (max-width: 768px) {
    .sidebar-hamburger {
        display: flex;
    }

    .dashboard {
        flex-direction: column;
        position: relative;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 280px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        border-right: 1px solid var(--border);
        border-bottom: none;
        overflow-y: auto;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    /* Scrim behind open sidebar */
    .sidebar-scrim {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 99;
        background: rgba(0, 0, 0, 0.5);
    }

    .sidebar-scrim.is-visible {
        display: block;
    }

    .main-content {
        padding: 16px;
        padding-top: 64px; /* room for hamburger */
        width: 100%;
    }

    .page-header,
    .page-header-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .categories-grid { grid-template-columns: 1fr; }

    .branding-card {
        flex-direction: column;
        align-items: stretch;
    }

    .branding-card-layout {
        flex-direction: column;
        align-items: stretch;
    }

    .branding-preview {
        width: 100%;
        height: 180px;
    }

    .analytics-header,
    .analytics-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .usage-grid {
        grid-template-columns: 1fr;
    }

    /* Make all tables horizontally scrollable */
    .usage-table-wrap,
    table {
        overflow-x: auto;
        display: block;
        -webkit-overflow-scrolling: touch;
    }

    .modal {
        padding: 24px 20px;
        max-width: calc(100vw - 24px);
        margin: 12px;
    }

    .modal-header-row,
    .user-card,
    .backup-card {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-header-actions,
    .user-card-actions,
    .backup-card-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .btn-inline {
        width: 100%;
    }

    .tool-tabs {
        width: 100%;
        overflow-x: auto;
    }
}

/* ===== Responsive — 480px ===== */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .main-content {
        padding: 12px;
        padding-top: 60px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .sidebar-header h2 {
        font-size: 16px;
    }

    .analytics-panel,
    .branding-card {
        padding: 14px;
    }

    .modal {
        padding: 18px 14px;
    }

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

    .input-group input,
    .input-group select,
    .input-group textarea,
    .modal .input-group input,
    .modal .input-group select,
    .modal .input-group textarea {
        width: 100%;
        font-size: 16px; /* prevent iOS zoom */
    }

    .btn {
        padding: 10px 12px;
        font-size: 13px;
    }

    .upload-zone {
        padding: 20px 12px;
    }

    .upload-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .upload-controls input[type="text"],
    .upload-controls select {
        width: 100%;
    }

    .category-card {
        padding: 14px;
    }

    .usage-summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }

    .toast {
        font-size: 12px;
        padding: 10px 14px;
    }
}

/* ===== Layout Assistant Wizard ===== */
.wizard-page {
    padding: 0;
    min-height: 100vh;
}

.wizard-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 0;
}

.wizard-topbar-back {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    margin: -8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    transition: color 0.15s;
}

.wizard-topbar-back:hover { color: var(--text-primary); }

.wizard-topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
}

.wizard-topbar-step {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.wizard-progress {
    height: 3px;
    background: rgba(255,255,255,0.08);
    margin: 12px 20px 0;
    border-radius: 2px;
    overflow: hidden;
}

.wizard-progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.wizard-body {
    padding: 32px 20px 120px;
    max-width: 480px;
    margin: 0 auto;
}

.wizard-step-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px;
    line-height: 1.2;
}

.wizard-step-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 28px;
}

/* Tool type cards */
.tool-type-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.tool-type-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--bg-secondary);
    border: 2px solid rgba(255,255,255,0.06);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    min-height: 76px;
}

.tool-type-card:hover { border-color: rgba(79,172,254,0.4); background: rgba(79,172,254,0.05); }
.tool-type-card:active { transform: scale(0.98); }
.tool-type-card.is-selected { border-color: var(--accent); background: rgba(79,172,254,0.1); }

.tool-type-icon {
    font-size: 26px;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}

.tool-type-text { flex: 1; }
.tool-type-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.tool-type-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.tool-type-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.15);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
}

.tool-type-card.is-selected .tool-type-check {
    border-color: var(--accent);
    background: var(--accent);
}

.tool-type-check::after {
    content: '';
    width: 6px;
    height: 10px;
    border: 2px solid #000;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
    opacity: 0;
    transition: opacity 0.15s;
}

.tool-type-card.is-selected .tool-type-check::after { opacity: 1; }

/* Fixture info */
.fixture-info-card {
    display: flex;
    gap: 24px;
    background: rgba(79,172,254,0.07);
    border: 1px solid rgba(79,172,254,0.2);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-top: 12px;
}

.fixture-info-item { flex: 1; }
.fixture-info-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.6px; }
.fixture-info-value { font-size: 17px; font-weight: 600; color: var(--text-primary); margin-top: 2px; }

/* Room params grid */
.room-params-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.room-params-grid .span-full { grid-column: 1 / -1; }

/* Arrangement */
.arrangement-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.arrangement-btn {
    padding: 14px 12px;
    background: var(--bg-secondary);
    border: 2px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.arrangement-btn:hover { border-color: rgba(79,172,254,0.4); }
.arrangement-btn.is-active { border-color: var(--accent); background: rgba(79,172,254,0.1); }

.manual-arrangement-fields {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 8px;
}

.arrangement-separator {
    font-size: 20px;
    color: var(--text-secondary);
    text-align: center;
    padding-bottom: 10px;
}

/* Wizard footer (fixed bottom nav) */
.wizard-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    background: rgba(10,10,15,0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    gap: 12px;
    z-index: 100;
    max-width: 480px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    box-sizing: border-box;
}

/* On desktop (sidebar present) the footer should be inside main content */
@media (min-width: 769px) {
    .wizard-footer {
        position: fixed;
        bottom: 0;
        left: 280px; /* sidebar width */
        right: 0;
        max-width: none;
        transform: none;
        left: 280px;
    }
}

.wizard-footer .btn {
    min-height: 52px;
    font-size: 16px;
    flex: 1;
    border-radius: var(--radius);
}

.wizard-footer .btn-back {
    flex: 0 0 auto;
    min-width: 80px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
    border-radius: var(--radius);
    min-height: 52px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s;
}

.wizard-footer .btn-back:hover { background: rgba(255,255,255,0.08); }

/* Success state */
.wizard-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px;
    min-height: 60vh;
}

.wizard-success-icon { font-size: 56px; margin-bottom: 16px; }
.wizard-success-title { font-size: 24px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.wizard-success-body { font-size: 15px; color: var(--text-secondary); margin-bottom: 32px; line-height: 1.6; }

/* Locked state */
.wizard-locked {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px;
    min-height: 60vh;
}

.wizard-locked-icon { font-size: 48px; margin-bottom: 16px; }
.wizard-locked-title { font-size: 22px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.wizard-locked-body { font-size: 14px; color: var(--text-secondary); line-height: 1.6; max-width: 320px; }

/* Loading skeleton */
.wizard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    min-height: 60vh;
    color: var(--text-secondary);
    gap: 12px;
}

.wizard-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(79,172,254,0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== PWA install affordance ===== */
.pwa-install-wrap {
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-top: 10px;
}

.pwa-install-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--border-active);
    color: var(--text-primary);
}

.pwa-install-btn:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.pwa-install-btn span { color: var(--accent); font-weight: 700; }

.pwa-install-dismiss {
    flex: 0 0 auto;
    width: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.pwa-install-dismiss:hover { color: var(--text-primary); border-color: var(--border-active); }

/* iOS "Add to Home Screen" instructions sheet */
.pwa-ios-sheet {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: end center;
    background: rgba(0, 0, 0, 0.6);
    padding: 16px;
}

.pwa-ios-card {
    width: 100%;
    max-width: 420px;
    margin-bottom: max(16px, env(safe-area-inset-bottom));
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.pwa-ios-card h3 { margin: 0 0 12px; color: var(--text-primary); font-size: 18px; }
.pwa-ios-card ol { margin: 0 0 16px; padding-left: 20px; color: var(--text-secondary); line-height: 1.7; }
.pwa-ios-card ol strong { color: var(--text-primary); }

@media (min-width: 640px) {
    .pwa-ios-sheet { place-items: center; }
    .pwa-ios-card { margin-bottom: 0; }
}
