/* Public Merch Cloud pages (home, sign-in/up, dashboard, account), their header
   (partials/app_header.hbs) and dialogs (request_system_dialog.hbs). Loaded after
   merch-cloud-public.css. Dark is the default; html[data-theme="light"] swaps the palette below. */
:root { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

.dash-body {
    --d-bg: #0b1220;
    --d-surface: #121a2c;
    --d-surface-2: #16203a;
    --d-border: rgba(148, 163, 184, 0.13);
    --d-border-strong: rgba(148, 163, 184, 0.24);
    --d-text: #f1f5f9;
    --d-soft: #cbd5e1;
    --d-muted: #94a3b8;
    --d-primary: #3b82f6;
    --d-primary-hover: #2f6fe4;
    --d-primary-soft: rgba(59, 130, 246, 0.14);
    --d-link: #60a5fa;
    --d-green: #34d399;
    --d-teal: #2dd4bf;
    --d-amber: #fbbf24;
    --d-purple: #c084fc;
    --d-red: #f87171;
    /* The shared account menu/dialog styles read these. */
    --mc-primary: #3b82f6;
    --mc-primary-dark: #2f6fe4;
    --mc-primary-rgb: 59, 130, 246;
    --mc-surface: #131c2f;
    --mc-border: rgba(148, 163, 184, 0.18);
    --mc-bg: #0b1324;
    --mc-bg-alt: #101829;
    --mc-muted: #94a3b8;
    --mc-accent: #3FA0F6;
    /* Surfaces and effects that differ per theme. */
    --d-page-bg:
        radial-gradient(1200px 520px at 78% -8%, rgba(37, 99, 235, 0.12), transparent 60%),
        linear-gradient(180deg, #0c1424 0%, #0b1220 40%, #0a101d 100%);
    --d-nav-bg: rgba(11, 18, 32, 0.82);
    --d-nav-border: rgba(148, 163, 184, 0.07);
    --d-hover: rgba(148, 163, 184, 0.1);
    --d-popover: #131c2f;
    --d-popover-border: rgba(148, 163, 184, 0.16);
    --d-shadow: 0 24px 48px rgba(2, 6, 23, 0.6);
    --d-brand-em: #4d8ff8;
    --d-tab-active-bg: #18243d;
    --d-tab-active-text: #6ea8fe;
    --d-panel: linear-gradient(180deg, rgba(22, 32, 54, 0.92), rgba(17, 25, 43, 0.92));
    --d-card: linear-gradient(180deg, #141f38 0%, #111a2e 100%);
    --d-avatar-base: #16213a;
    --d-skeleton-a: #111a2e;
    --d-skeleton-b: #17223b;
    --d-toggle-bg: rgba(15, 23, 42, 0.5);
    --d-toggle-on-bg: #1f2c48;
    --d-toggle-on-text: #8db9ff;
    --d-dialog: #111a2d;
    --d-dialog-foot: #0f1728;
    --d-backdrop: rgba(2, 6, 23, 0.7);
    --d-input: #0b1324;
    --d-input-readonly: #0e1628;
    --d-input-border: rgba(148, 163, 184, 0.2);
    --d-switch-off: #2a3550;
    --d-switch-knob: #cbd5e1;
    --d-error-text: #fca5a5;
    --d-toast: #1b2742;
    background: var(--d-page-bg) fixed;
    color: var(--d-text);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
.dash-body a { color: var(--d-link); }
.dash-body button, .dash-body input, .dash-body select { font-family: inherit; }
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}
.dash-body [hidden] { display: none !important; }

/* ===== Buttons ===== */
.dash-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 42px;
    padding: 0 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--d-text);
    font-size: 14.5px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.dash-btn:disabled { opacity: 0.55; cursor: default; }
.dash-btn i { font-size: 1.05em; }
.dash-btn-lg { height: 50px; padding: 0 24px; font-size: 15px; }
.dash-btn-sm { height: 34px; padding: 0 12px; font-size: 13px; gap: 6px; }
.dash-btn-primary {
    background: var(--d-primary);
    color: #fff !important;
    box-shadow: 0 8px 22px -10px rgba(59, 130, 246, 0.9);
}
.dash-btn-primary:hover:not(:disabled) { background: var(--d-primary-hover); }
.dash-btn-primary:disabled { background: rgba(148, 163, 184, 0.14); color: var(--d-soft) !important; box-shadow: none; opacity: 1; }
.dash-btn-outline { border-color: rgba(59, 130, 246, 0.7); color: var(--d-link) !important; }
.dash-btn-outline:hover:not(:disabled) { background: var(--d-primary-soft); border-color: var(--d-primary); }
.dash-btn-glass {
    background: rgba(11, 18, 32, 0.28);
    border-color: rgba(203, 213, 225, 0.32);
    color: var(--d-text) !important;
}
.dash-btn-glass:hover:not(:disabled) { background: rgba(255, 255, 255, 0.07); border-color: rgba(203, 213, 225, 0.5); }
.dash-btn-ghost { color: var(--d-soft) !important; }
.dash-btn-ghost:hover:not(:disabled) { background: var(--d-hover); color: var(--d-text) !important; }
.dash-btn-danger { border-color: rgba(248, 113, 113, 0.55); color: var(--d-red) !important; }
.dash-btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.12); }

.dash-icon-btn {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--d-soft);
    font-size: 18px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.dash-icon-btn:hover, .dash-icon-btn[aria-expanded="true"] { background: var(--d-hover); color: var(--d-text); }

/* Theme switch: the icon shows the current theme (moon = dark, sun = light). */
.dash-theme-toggle .bi-sun { display: none; }
[data-theme="light"] .dash-theme-toggle .bi-sun { display: inline-block; }
[data-theme="light"] .dash-theme-toggle .bi-moon-stars { display: none; }
.dash-theme-toggle i { transition: transform 0.3s; }
.dash-theme-toggle:hover i { transform: rotate(-18deg); }

/* ===== App bar ===== */
.dash-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--d-nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--d-nav-border);
}
.dash-nav-inner {
    max-width: 1480px;
    margin: 0 auto;
    height: 62px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 28px;
}
.dash-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--d-text) !important;
    text-decoration: none;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.01em;
    flex-shrink: 0;
    margin-right: 18px;
}
.dash-brand img { width: 36px; height: 36px; border-radius: 9px; display: block; }
.dash-brand em { font-style: normal; color: var(--d-brand-em); }
.dash-tabs { display: flex; align-items: center; gap: 6px; }
.dash-tab {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 40px;
    padding: 0 15px;
    border-radius: 8px;
    color: var(--d-soft) !important;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.dash-tab i { font-size: 15px; }
.forum-tab-dot,
.forum-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 0 0 2px var(--d-bg), 0 0 8px rgba(59, 130, 246, 0.9);
    flex: 0 0 auto;
}
.forum-tab-dot[hidden],
.forum-unread-dot[hidden] { display: none !important; }
.dash-tab:hover { background: var(--d-hover); color: var(--d-text) !important; }
.dash-tab.active { background: var(--d-tab-active-bg); color: var(--d-tab-active-text) !important; }

.dash-nav-tools { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.dash-bell-wrap { position: relative; }
.dash-bell-dot {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--d-primary);
    box-shadow: 0 0 0 2px var(--d-bg), 0 0 8px rgba(59, 130, 246, 0.9);
}
.dash-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 320px;
    max-width: calc(100vw - 24px);
    background: var(--d-popover);
    border: 1px solid var(--d-popover-border);
    border-radius: 12px;
    box-shadow: var(--d-shadow);
    padding: 6px;
    z-index: 50;
}
.dash-popover-head { padding: 8px 10px 10px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--d-border); margin-bottom: 6px; }
.dash-popover-empty { margin: 0; padding: 18px 10px; text-align: center; color: var(--d-muted); font-size: 13px; }
.dash-notice { display: flex; gap: 10px; padding: 10px; border-radius: 8px; font-size: 13px; }
.dash-notice + .dash-notice { border-top: 1px solid var(--d-border); }
.dash-notice > i,
.dash-notice-open > i { font-size: 17px; margin-top: 1px; }
.dash-notice.pending > i { color: var(--d-amber); }
.dash-notice.ok > i { color: var(--d-green); }
.dash-notice.bad > i { color: var(--d-red); }
.dash-notice strong { display: block; font-size: 13px; }
.dash-notice p { margin: 2px 0; color: var(--d-soft); }
.dash-notice small { color: var(--d-muted); font-size: 12px; }
.dash-notice-open {
    display: flex;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.dash-notice.reply { align-items: flex-start; }
.dash-notice.reply:hover { background: var(--d-hover); }
.dash-notice-delete {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    margin: -2px 0 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--d-muted);
    cursor: pointer;
    display: grid;
    place-items: center;
}
.dash-notice-delete:hover,
.dash-notice-delete:focus-visible { background: var(--d-hover); color: var(--d-text); }
.dash-notice.unread { box-shadow: inset 3px 0 0 var(--d-primary); }

/* Messages dialog styles live in messages.css (centered chat, not the old header popover). */
.dash-notice.reply > i,
.dash-notice.reply .dash-notice-open > i { color: #7eb6ff; }

.dash-account-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 280px;
    height: 44px;
    padding: 0 10px 0 4px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--d-text);
    font-size: 13.5px;
    cursor: pointer;
    transition: background 0.15s;
}
.dash-account-toggle:hover, .dash-account-toggle[aria-expanded="true"] { background: var(--d-hover); }
.dash-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(145deg, #4f76d6, #3457b2);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
}
.dash-account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-account-toggle .bi-chevron-down { font-size: 11px; color: var(--d-muted); transition: transform 0.15s; }
.dash-account-toggle[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }
.dash-body .mc-account-menu { background: var(--d-popover); border-color: var(--d-popover-border); border-radius: 12px; box-shadow: var(--d-shadow); }
.dash-body .mc-account-menu-head { border-color: var(--d-border); }
.dash-body .mc-menu-item { font-size: 13.5px; }

/* ===== Layout ===== */
.dash-main { max-width: 1480px; width: 100%; margin: 0 auto; padding: 22px 20px 28px; }

/* ===== Hero ===== */
.dash-hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 256px;
    padding: 36px 48px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(96, 165, 250, 0.22);
    background:
        radial-gradient(560px 300px at 82% 38%, rgba(59, 130, 246, 0.32), transparent 70%),
        radial-gradient(420px 220px at 60% 120%, rgba(37, 99, 235, 0.22), transparent 70%),
        linear-gradient(100deg, #0f1b33 0%, #132649 48%, #1a3a6e 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 24px 60px -30px rgba(37, 99, 235, 0.55);
}
.dash-hero::before {
    /* Soft sweep of light across the banner, like the reference glow. */
    content: '';
    position: absolute;
    inset: -40% -10% auto 30%;
    height: 180%;
    background: radial-gradient(closest-side, rgba(147, 197, 253, 0.08), transparent);
    transform: rotate(-12deg);
    pointer-events: none;
}
.dash-hero-copy { position: relative; z-index: 1; max-width: 620px; }
.dash-hero-kicker { margin: 0 0 6px; color: var(--d-soft); font-size: 15px; }
.dash-hero h1 { margin: 0 0 8px; font-size: 40px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
.dash-hero-actions { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 26px; }

.dash-hero-art {
    position: absolute;
    right: 16px;
    top: 50%;
    width: 430px;
    height: 230px;
    transform: translateY(-50%);
    pointer-events: none;
}
.dash-glass {
    position: absolute;
    border-radius: 14px;
    border: 1px solid rgba(147, 197, 253, 0.32);
    background: linear-gradient(150deg, rgba(96, 165, 250, 0.3), rgba(30, 64, 175, 0.2) 60%, rgba(15, 23, 42, 0.25));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 24px 40px -14px rgba(2, 6, 23, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.dash-glass-back { left: 112px; top: 2px; width: 116px; height: 96px; transform: rotate(-3deg); }
.dash-glass-ring {
    position: absolute;
    left: 16px;
    top: 14px;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid rgba(219, 234, 254, 0.75);
    color: #dbeafe;
    font-size: 12px;
}
.dash-glass-words {
    left: 214px;
    top: 14px;
    width: 212px;
    height: 142px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: #dbe7ff;
    font-size: 20px;
    font-weight: 500;
    line-height: 1.45;
    background: linear-gradient(160deg, rgba(59, 130, 246, 0.2), rgba(30, 58, 138, 0.14) 70%);
    border-color: rgba(147, 197, 253, 0.2);
}
.dash-glass-front {
    left: 0;
    top: 76px;
    width: 222px;
    height: 146px;
    transform: perspective(700px) rotateY(16deg) rotate(-8deg);
    background: linear-gradient(150deg, rgba(96, 165, 250, 0.42), rgba(37, 99, 235, 0.26) 55%, rgba(15, 23, 42, 0.35));
    border-color: rgba(191, 219, 254, 0.42);
}
.dash-cube { position: absolute; left: 20px; top: 26px; filter: drop-shadow(0 10px 14px rgba(2, 6, 23, 0.55)); }
.dash-bars { position: absolute; right: 26px; bottom: 26px; display: flex; align-items: flex-end; gap: 6px; }
.dash-bars i { display: block; width: 9px; border-radius: 2px; background: linear-gradient(180deg, #6aa5ff, #2f6fe4); box-shadow: 0 0 10px rgba(59, 130, 246, 0.55); }
.dash-bars i:nth-child(1) { height: 16px; }
.dash-bars i:nth-child(2) { height: 26px; }
.dash-bars i:nth-child(3) { height: 38px; }
.dash-hero-script {
    position: absolute;
    left: 262px;
    top: 176px;
    margin: 0;
    font-family: 'Caveat', 'Segoe Script', cursive;
    font-size: 22px;
    line-height: 1.05;
    color: #c7d6ee;
    transform: rotate(-9deg);
    white-space: nowrap;
}

.dash-current {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--d-soft);
    font-size: 14px;
}
.dash-current i { color: var(--d-link); margin-right: 4px; }
.dash-current strong { color: var(--d-text); }
.dash-current-actions { display: flex; gap: 8px; }

/* ===== Systems ===== */
.dash-systems { margin-top: 30px; }
.dash-systems-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.dash-systems-head h2 { margin: 0 0 2px; font-size: 25px; font-weight: 700; letter-spacing: -0.015em; }
.dash-systems-head p { margin: 0; color: var(--d-soft); font-size: 14.5px; opacity: 0.85; }
.dash-systems-tools { display: flex; align-items: center; gap: 18px; }
.dash-sort { position: relative; display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--d-soft); }
.dash-sort select {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    color: var(--d-text);
    font-size: 13.5px;
    font-weight: 600;
    padding: 6px 22px 6px 2px;
    cursor: pointer;
    outline: none;
}
.dash-sort select option { background: var(--d-popover); color: var(--d-text); }
.dash-sort select:focus-visible { box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.6); border-radius: 6px; }
.dash-sort i { position: absolute; right: 2px; font-size: 11px; color: var(--d-soft); pointer-events: none; }
.dash-view-toggle { display: inline-flex; padding: 3px; border-radius: 9px; border: 1px solid var(--d-border-strong); background: var(--d-toggle-bg); }
.dash-view-toggle button {
    display: grid;
    place-items: center;
    width: 36px;
    height: 32px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--d-muted);
    font-size: 15px;
    cursor: pointer;
}
.dash-view-toggle button[aria-pressed="true"] { background: var(--d-toggle-on-bg); color: var(--d-toggle-on-text); }
.dash-view-toggle button:hover { color: var(--d-text); }

.dash-error { color: var(--d-red); font-size: 14px; margin: 14px 0 0; }

.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 18px; }
.dash-system {
    --accent: #3fa0f6;
    --accent-ink: var(--accent-ink-dark, #6eb8f8);
    --on-accent: #0b1220;
    display: flex;
    flex-direction: column;
    padding: 22px 24px;
    border-radius: 14px;
    background: var(--d-card);
    border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 6%, transparent), 0 18px 44px -22px color-mix(in srgb, var(--accent) 55%, transparent);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    min-width: 0;
}
.dash-system:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 75%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent), 0 22px 50px -20px color-mix(in srgb, var(--accent) 70%, transparent); }
.dash-system .dash-open:not(:disabled) { background: var(--accent); color: var(--on-accent) !important; box-shadow: 0 8px 22px -10px color-mix(in srgb, var(--accent) 90%, transparent); }
.dash-system .dash-open:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 86%, var(--on-accent)); }
.dash-system a { color: var(--accent-ink); }
.dash-system.muted { border-color: var(--d-border-strong); box-shadow: none; }
.dash-system.muted:hover { transform: none; }
.dash-system-top { display: flex; align-items: center; gap: 16px; min-width: 0; }
.dash-system-avatar {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent) 16%, var(--d-avatar-base));
    border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
    color: color-mix(in srgb, var(--accent) 85%, #fff);
    font-size: 22px;
    font-weight: 600;
    overflow: hidden;
}
.dash-system-avatar.has-logo { background: transparent; border-color: transparent; }
.dash-system-avatar.has-logo img { width: 100%; height: 100%; object-fit: contain; }
.dash-system-title { flex: 1; min-width: 0; }
.dash-system-title h3 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-system-id { display: block; color: var(--d-muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-status { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.dash-status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.dash-status.ok { color: var(--accent-ink, var(--d-green)); }
.dash-status.pending { color: var(--d-amber); }
.dash-status.bad { color: var(--d-red); }

.dash-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; min-height: 26px; }
.dash-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 6px;
    background: rgba(148, 163, 184, 0.1);
    color: var(--d-soft);
    font-size: 12.5px;
    font-weight: 500;
}
.dash-chip i { font-size: 12px; opacity: 0.85; }
.dash-chip.role { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-ink); }
.dash-chip.role.owner { background: #f1c40f; color: #1a1a1a; }
.dash-chip.role.owner i { color: #1a1a1a; opacity: 1; }
.dash-chip.current { background: rgba(52, 211, 153, 0.12); color: var(--d-green); }

.dash-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--d-border);
}
.dash-metric { display: flex; align-items: center; gap: 14px; min-width: 0; }
.dash-metric + .dash-metric { border-left: 1px solid var(--d-border); padding-left: 24px; }
.dash-metric:only-child { grid-column: 1 / -1; }
.dash-metric-icon { color: var(--d-soft); font-size: 20px; width: 24px; text-align: center; }
.dash-metric:last-child:not(:only-child) .dash-metric-icon { color: var(--accent-ink); }
.dash-metric strong { display: block; font-size: 15.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-metric small { display: block; font-size: 13px; color: var(--d-muted); }

.dash-system-actions { display: flex; gap: 14px; margin-top: 18px; }
.dash-open { flex: 1; height: 46px; }
.dash-more-wrap { position: relative; }
.dash-more {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    border: 1px solid var(--d-border);
    background: rgba(148, 163, 184, 0.08);
    color: var(--d-text);
    font-size: 18px;
    cursor: pointer;
}
.dash-more:hover, .dash-more[aria-expanded="true"] { background: rgba(148, 163, 184, 0.15); }
.dash-card-menu { top: auto; bottom: calc(100% + 8px); min-width: 210px; }

.dash-empty { margin: 4px 0 0; padding: 22px 24px; border-radius: 14px; border: 1.5px dashed var(--d-border-strong); color: var(--d-soft); font-size: 14px; text-align: center; }
.dash-empty[hidden] { display: none; }

.dash-skeleton { min-height: 278px; border-color: var(--d-border); box-shadow: none; background: linear-gradient(100deg, var(--d-skeleton-a) 30%, var(--d-skeleton-b) 50%, var(--d-skeleton-a) 70%); background-size: 300% 100%; animation: dash-shimmer 1.4s linear infinite; }
@keyframes dash-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* List layout */
.dash-grid.list { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.dash-grid.list .dash-system {
    display: grid;
    grid-template-columns: minmax(220px, 1.3fr) minmax(160px, 1fr) minmax(260px, 1.2fr) auto;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
}
.dash-grid.list .dash-system-top { gap: 14px; }
.dash-grid.list .dash-system-avatar { width: 44px; height: 44px; font-size: 18px; }
.dash-grid.list .dash-status { order: 3; margin: 0; align-self: center; font-size: 13px; }
.dash-grid.list .dash-chips { margin: 0; }
.dash-grid.list .dash-metrics { margin: 0; padding: 0; border: 0; }
.dash-grid.list .dash-system-actions { margin: 0; }
.dash-grid.list .dash-open { flex: 0 0 auto; height: 40px; min-width: 170px; }
.dash-grid.list .dash-more { width: 40px; height: 40px; }
.dash-grid.list .dash-skeleton { min-height: 76px; }

/* ===== Help footer ===== */
.dash-help { display: flex; align-items: center; gap: 14px; margin-top: 26px; padding: 6px 0; }
.dash-help-icon { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; background: rgba(148, 163, 184, 0.14); color: var(--d-soft); font-size: 17px; }
.dash-help strong { display: block; font-size: 14px; font-weight: 600; }
.dash-help p { margin: 0; font-size: 13px; color: var(--d-muted); }
.dash-help a { text-decoration: none; }
.dash-help a:hover { text-decoration: underline; }

.dash-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 60;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--d-toast);
    border: 1px solid var(--d-border-strong);
    color: var(--d-text);
    font-size: 13.5px;
    box-shadow: var(--d-shadow);
}

/* ===== Page header + panels (views/account.hbs) ===== */
.dash-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 8px 0 24px; }
.dash-page-head h1 { margin: 0 0 4px; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.dash-page-head p { margin: 0; color: var(--d-soft); font-size: 14.5px; max-width: 720px; opacity: 0.85; }
.dash-panel { margin-top: 24px; padding: 22px 24px; border-radius: 14px; background: var(--d-panel); border: 1px solid var(--d-border); }

/* Account settings page (views/account.hbs) */
.acct-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.acct-card { margin-top: 0; display: flex; flex-direction: column; }
.acct-card-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.acct-card-head h2 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.acct-card-head p { margin: 0; color: var(--d-muted); font-size: 13.5px; }
.acct-card-icon { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; background: var(--d-primary-soft); color: var(--d-link); font-size: 18px; }
.acct-fields { margin: 0; padding: 0; border: 0; min-width: 0; }
.acct-fields:disabled { opacity: 0.6; }
.acct-confirm { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--d-border); }
.acct-success { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; color: var(--d-green); font-size: 13.5px; }
.acct-success::before { content: '\F26A'; font-family: 'bootstrap-icons'; }
.acct-success[hidden] { display: none; }
.acct-notice-card, .acct-totp-card { margin-top: 24px; }
.acct-level { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 10px; padding: 12px 14px; border: 1px solid var(--d-border); border-radius: 12px; cursor: pointer; }
.acct-level:last-child { margin-bottom: 0; }
.acct-level:has(input:checked) { border-color: var(--d-primary); background: rgba(59, 130, 246, 0.08); }
.acct-level.is-off { opacity: 0.55; cursor: not-allowed; }
.acct-level input { margin-top: 3px; accent-color: var(--d-primary); }
.acct-level strong { display: block; font-size: 14px; }
.acct-level small { display: block; margin-top: 2px; color: var(--d-muted); font-size: 12.5px; line-height: 1.4; }
.acct-totp-status { margin: 0 0 14px; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--d-muted); }
.acct-totp-status.on { color: var(--d-green); }
.acct-totp-setup { display: grid; grid-template-columns: 192px minmax(0, 1fr); gap: 20px; align-items: start; }
.acct-totp-setup img { width: 192px; height: 192px; border-radius: 12px; background: #fff; padding: 8px; }
.dash-account-page .acct-actions { justify-content: center; }

/* ===== Dialogs ===== */
dialog.dash-dialog {
    width: min(480px, calc(100vw - 24px));
    max-height: calc(100vh - 32px);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--d-popover-border);
    background: var(--d-dialog);
    color: var(--d-text);
    box-shadow: var(--d-shadow);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}
dialog.dash-dialog::backdrop { background: var(--d-backdrop); backdrop-filter: blur(3px); }
.rq-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.rq-head h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.rq-subtitle { margin: 0; color: var(--d-muted); font-size: 13.5px; }
.rq-head .dash-icon-btn { margin: -6px -8px 0 0; flex-shrink: 0; }

.rq-field { margin-bottom: 14px; }
.rq-field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--d-soft); }
.rq-input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--d-input-border);
    background: var(--d-input);
    color: var(--d-text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
select.rq-input { padding-right: 8px; }
.rq-input:focus { border-color: var(--d-primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }
.rq-input[readonly] { color: var(--d-soft); background: var(--d-input-readonly); }
.rq-mono { font-family: Consolas, 'Courier New', monospace; text-transform: uppercase; max-width: 130px; }
.rq-hint { margin-top: 5px; font-size: 12.5px; color: var(--d-muted); }
.rq-status { min-height: 18px; margin-top: 4px; font-size: 12.5px; color: var(--d-muted); }
.rq-status.ok { color: var(--d-green); }
.rq-status.bad { color: var(--d-red); }
.rq-status a { color: var(--d-link); }
.rq-error { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.3); color: var(--d-error-text); font-size: 13.5px; }
.rq-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; }

.rq-dialog { width: min(820px, calc(100vw - 24px)) !important; height: min(780px, calc(100vh - 32px)); padding: 0 !important; overflow: hidden; }
.rq-dialog[open] { display: flex; flex-direction: column; }
.rq-dialog .rq-head { padding: 24px 26px 0; margin-bottom: 18px; }
.rq-stepper { display: flex; gap: 0; margin: 0; padding: 0 26px 18px; list-style: none; border-bottom: 1px solid var(--d-border); counter-reset: none; }
.rq-stepper li { position: relative; flex: 1; display: flex; align-items: center; gap: 10px; color: var(--d-muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.rq-stepper li:not(:last-child)::after { content: ''; flex: 1; height: 1px; margin: 0 12px; background: var(--d-border-strong); }
.rq-dot { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; border: 1.5px solid var(--d-border-strong); font-size: 12.5px; }
.rq-stepper li.active { color: var(--d-text); }
.rq-stepper li.active .rq-dot { background: var(--d-primary); border-color: var(--d-primary); color: #fff; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18); }
.rq-stepper li.done { color: var(--d-soft); }
.rq-stepper li.done .rq-dot { border-color: var(--d-primary); color: var(--d-link); }
.rq-stepper li.done::after { background: rgba(59, 130, 246, 0.6); }
.rq-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.rq-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 26px 4px; }
.rq-dialog .rq-actions { margin: 0; padding: 16px 26px; border-top: 1px solid var(--d-border); background: var(--d-dialog-foot); }
.rq-step { display: none; }
.rq-step.active { display: block; }
.rq-step h3 { margin: 0 0 2px; font-size: 16px; font-weight: 700; }
.rq-step-description { margin: 0 0 18px; color: var(--d-muted); font-size: 13.5px; }
.rq-color-row { display: flex; align-items: center; gap: 10px; }
.rq-color { width: 46px; height: 42px; padding: 3px; border-radius: 8px; border: 1px solid var(--d-input-border); background: var(--d-input); cursor: pointer; }
.rq-note { display: flex; gap: 10px; margin: 18px 0 14px; padding: 12px 14px; border-radius: 10px; background: rgba(59, 130, 246, 0.08); border: 1px solid rgba(59, 130, 246, 0.25); color: var(--d-soft); font-size: 13px; }
.rq-note i { color: var(--d-link); font-size: 16px; }
.rq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.rq-span { grid-column: 1 / -1; }

.rq-feature { margin-bottom: 10px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--d-border); background: rgba(148, 163, 184, 0.04); transition: border-color 0.15s, background 0.15s; }
.rq-feature.on { border-color: rgba(59, 130, 246, 0.4); background: rgba(59, 130, 246, 0.05); }
.rq-feature-head { display: flex; align-items: center; gap: 14px; }
.rq-feature-icon { display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0; border-radius: 10px; background: var(--d-primary-soft); color: var(--d-link); font-size: 17px; }
.rq-feature-text { flex: 1; min-width: 0; }
.rq-feature-text h4 { margin: 0; font-size: 14.5px; font-weight: 600; }
.rq-feature-text p { margin: 1px 0 0; color: var(--d-muted); font-size: 13px; }
.rq-feature-options { display: grid; gap: 8px; margin: 12px 0 0 52px; padding-top: 12px; border-top: 1px dashed var(--d-border-strong); }
.rq-feature-option { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.rq-feature-option strong { display: block; font-size: 13.5px; font-weight: 600; }
.rq-feature-option small { display: block; color: var(--d-muted); font-size: 12.5px; }
.rq-switch {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
    margin: 0;
    border-radius: 999px;
    background: var(--d-switch-off);
    border: 1px solid var(--d-border-strong);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.rq-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--d-switch-knob); transition: transform 0.15s, background 0.15s; }
.rq-switch:checked { background: var(--d-primary); border-color: var(--d-primary); }
.rq-switch:checked::after { transform: translateX(18px); background: #fff; }
.rq-switch:disabled { opacity: 0.6; cursor: default; }
.rq-switch:focus-visible, .rq-check:focus-visible { outline: 2px solid var(--d-link); outline-offset: 2px; }
.rq-check { width: 17px; height: 17px; accent-color: var(--d-primary); cursor: pointer; }

.rq-table-wrap { overflow-x: auto; }
.rq-fields-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rq-fields-table th { padding: 4px 6px 8px; text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--d-muted); white-space: nowrap; }
.rq-fields-table td { padding: 4px 6px; vertical-align: top; }
.rq-fields-table td:nth-child(2) { min-width: 190px; }
.rq-fields-table .center { text-align: center; vertical-align: middle; }
.rq-fields-table .rq-input { height: 36px; font-size: 13.5px; }
.rq-options { margin-top: 6px; }
.rq-order { white-space: nowrap; }
.rq-icon-btn { border: 0; background: none; color: var(--d-muted); padding: 7px 5px; line-height: 1; cursor: pointer; border-radius: 6px; }
.rq-icon-btn:hover:not(:disabled) { color: var(--d-text); background: var(--d-hover); }
.rq-icon-btn.remove:hover:not(:disabled) { color: var(--d-red); }
.rq-icon-btn:disabled { opacity: 0.3; cursor: default; }
.rq-lock { display: inline-block; padding: 7px 5px; color: var(--d-muted); cursor: help; }
.rq-fields-table tr.locked .rq-input { color: var(--d-soft); background: var(--d-input-readonly); }
.rq-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.rq-chips:empty { display: none; }
.rq-chip { border: 1px solid var(--d-border-strong); background: none; color: var(--d-soft); border-radius: 999px; padding: 3px 12px; font: 600 12.5px Consolas, 'Courier New', monospace; cursor: pointer; }
.rq-chip:hover:not(:disabled) { border-color: var(--d-primary); color: var(--d-text); }
.rq-chip.selected { border-color: var(--d-primary); background: var(--d-primary-soft); color: var(--d-text); }
.rq-chip:disabled { opacity: 0.45; text-decoration: line-through; cursor: default; }
.rq-inline-actions { display: flex; gap: 8px; margin-top: 10px; }
.rq-clients-table td:nth-child(1) { min-width: 180px; }
.rq-clients-table td:nth-child(2) { min-width: 0; width: 130px; }
.rq-clients-table .rq-mono { max-width: none; width: 100%; }
.rq-client-empty { margin: 10px 0 0; color: var(--d-muted); font-size: 13.5px; }
.rq-client-empty[hidden] { display: none; }
.rq-step[data-step="1"] .rq-step-description { margin-bottom: 12px; }
.rq-client-examples {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 0 0 14px;
}
.rq-client-example {
    margin: 0;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--d-border);
    background: rgba(148, 163, 184, 0.04);
}
.rq-client-example figcaption {
    margin: 8px 2px 0;
    color: var(--d-soft);
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    line-height: 1.35;
}
.rq-client-art {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    font-family: Inter, 'Segoe UI', system-ui, sans-serif;
}
.rq-ex-scene { fill: var(--d-surface-2); }
.rq-ex-build { fill: var(--d-input); stroke: var(--d-border-strong); stroke-width: 1.2; }
.rq-ex-roof { fill: var(--d-primary); }
.rq-ex-window { fill: color-mix(in srgb, var(--d-link) 35%, transparent); }
.rq-ex-door { fill: var(--d-surface-2); }
.rq-ex-label { fill: var(--d-soft); font-size: 11px; font-weight: 700; }
.rq-ex-person-head { fill: var(--d-soft); }
.rq-ex-person-body { fill: var(--d-muted); }
.rq-ex-cube-top { fill: var(--d-link); }
.rq-ex-cube-left { fill: var(--d-primary); }
.rq-ex-cube-right { fill: var(--d-primary-hover); }
.rq-ex-arrow { fill: none; stroke: var(--d-link); stroke-width: 2.4; }
.rq-ex-arrow-head { fill: var(--d-link); }
.rq-ex-shelf { fill: var(--d-border-strong); }
.rq-ex-box { fill: var(--d-muted); }
.rq-ex-box-in { fill: var(--d-primary); }
.rq-ex-box-amber { fill: var(--d-amber); }
.rq-ex-box-teal { fill: var(--d-teal); }
.rq-ex-box-green { fill: var(--d-green); }
.rq-ex-box-purple { fill: var(--d-purple); }
.rq-ex-box-empty { fill: none; stroke: var(--d-muted); stroke-width: 1.5; stroke-dasharray: 2.4 1.8; stroke-linejoin: round; }
.rq-staff-row td { vertical-align: middle; padding-top: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--d-border); }
.rq-staff-name { font-weight: 600; color: var(--d-text); line-height: 1.3; }
.rq-staff-note { margin-top: 2px; color: var(--d-muted); font-size: 12.5px; line-height: 1.35; }
.rq-staff-acronym { color: var(--d-soft); font-family: Consolas, 'Courier New', monospace; font-size: 13.5px; font-weight: 600; letter-spacing: 0.02em; }
.rq-ex-screen { fill: var(--d-input); stroke: var(--d-border-strong); stroke-width: 1.2; }
.rq-ex-screen-bar { fill: var(--d-primary-soft); }
.rq-ex-dot { fill: var(--d-link); }
.rq-ex-field { fill: var(--d-surface-2); }
.rq-ex-btn { fill: var(--d-primary); }
.rq-ex-btn-label { fill: #fff; font-size: 8px; font-weight: 700; }
.rq-ex-base { fill: var(--d-muted); }
.rq-ex-list { fill: var(--d-input); stroke: var(--d-border-strong); stroke-width: 1.2; }
.rq-ex-tiny { fill: var(--d-muted); font-size: 9px; font-weight: 700; }
.rq-ex-tiny-on { fill: var(--d-text); font-size: 9px; font-weight: 600; }
.rq-ex-tiny-off { fill: var(--d-muted); font-size: 9px; font-weight: 600; }
.rq-ex-row-on { fill: var(--d-primary-soft); }
.rq-ex-row-off { fill: color-mix(in srgb, var(--d-muted) 22%, transparent); }
.rq-ex-check { fill: none; stroke: var(--d-green); }
.rq-ex-lock { fill: var(--d-muted); stroke: var(--d-muted); }
.rq-preview-table { margin-top: 6px; border-collapse: collapse; font-size: 12.5px; }
.rq-preview-table th, .rq-preview-table td { padding: 7px 12px; border: 1px solid var(--d-border-strong); white-space: nowrap; }
.rq-preview-table th { background: rgba(59, 130, 246, 0.1); font-weight: 600; }
.rq-preview-table td { color: var(--d-muted); }
.rq-review-block { margin-bottom: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--d-border); background: rgba(148, 163, 184, 0.04); font-size: 13.5px; }
.rq-review-block h4 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.rq-review-block ul { margin: 0; padding-left: 18px; color: var(--d-soft); }
.rq-review-block li + li { margin-top: 3px; }
.rq-link { border: 0; background: none; color: var(--d-link); font-size: 13px; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.rq-link:hover { text-decoration: underline; }
.rq-swatch { display: inline-block; width: 0.9em; height: 0.9em; margin-right: 0.35em; border-radius: 3px; vertical-align: -0.1em; }
.rq-success { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 36px 32px 48px; text-align: center; }
.rq-success-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: rgba(52, 211, 153, 0.12); border: 1.5px solid rgba(52, 211, 153, 0.5); color: var(--d-green); font-size: 32px; }
.rq-success h3 { margin: 0 0 8px; font-size: 19px; }
.rq-success p { margin: 0 auto 22px; max-width: 520px; color: var(--d-soft); font-size: 14px; }
.rq-success code { color: var(--d-link); font-size: 14.5px; }

/* ===== Responsive ===== */
@media (max-width: 1240px) {
    .dash-hero-art { right: 12px; transform: translateY(-50%) scale(0.85); transform-origin: right center; }
    .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-grid.list .dash-system { grid-template-columns: minmax(200px, 1.2fr) minmax(140px, 1fr) auto; }
    .dash-grid.list .dash-metrics { display: none; }
}

@media (max-width: 1100px) {
    .dash-tab span { display: none; }
    .dash-tab { padding: 0 12px; }
    .dash-nav-inner { gap: 16px; }
}

@media (max-width: 900px) {
    .dash-hero-art { opacity: 0.35; right: -60px; }
    .dash-account-email { display: none; }
    .dash-account-toggle { padding-right: 8px; }
}

@media (max-width: 720px) {
    .dash-nav-inner { height: auto; flex-wrap: wrap; row-gap: 8px; padding: 10px 14px; }
    .dash-brand { font-size: 18px; }
    .dash-brand img { width: 32px; height: 32px; }
    .dash-tabs { order: 3; width: 100%; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
    .dash-tabs::-webkit-scrollbar { display: none; }
    .dash-tab span { display: inline; }
    .dash-tab { height: 36px; padding: 0 8px; gap: 6px; font-size: 13px; }
    .dash-nav-tools { display: contents; }
    .dash-theme-toggle { margin-left: auto; }
    .dash-hide-sm { display: none; }

    .dash-main { padding: 16px 14px 24px; }
    .dash-hero { min-height: 0; padding: 28px 22px; border-radius: 14px; }
    .dash-hero-art { display: none; }
    .dash-hero h1 { font-size: 30px; }
    .dash-hero-actions { gap: 10px; }
    .dash-hero-actions .dash-btn { flex: 1 1 100%; }
    .dash-systems { margin-top: 28px; }
    .dash-systems-head h2 { font-size: 21px; }
    .dash-systems-tools { width: 100%; justify-content: space-between; }
    .dash-grid, .dash-grid.list { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .dash-system { padding: 20px; }
    .dash-grid.list .dash-system { grid-template-columns: minmax(0, 1fr) auto; gap: 12px 14px; padding: 14px 16px; }
    .dash-grid.list .dash-chips { display: none; }
    .dash-grid.list .dash-open { flex: 1; min-width: 0; padding: 0 14px; }
    .dash-grid.list .dash-system-actions { grid-column: 1 / -1; }
    .dash-page-head h1 { font-size: 25px; }
    .dash-panel, .dev-log-card { padding: 18px 16px; }
    .acct-grid { grid-template-columns: minmax(0, 1fr); }
    .acct-totp-setup { grid-template-columns: minmax(0, 1fr); }
    .acct-totp-setup img { margin: 0 auto; }
    .forum-row-title-line { flex-wrap: wrap; }
    .forum-row-title-line strong { white-space: normal; }

    .rq-dialog .rq-head, .rq-body { padding-left: 18px; padding-right: 18px; }
    .rq-stepper { padding: 0 18px 14px; }
    .rq-stepper li span:last-child { display: none; }
    .rq-stepper li.active span:last-child { display: inline; }
    .rq-dialog .rq-actions { padding: 14px 18px; }
    .rq-grid { grid-template-columns: 1fr; }
    .rq-feature-options { margin-left: 0; }
    .rq-client-examples { grid-template-columns: 1fr; }
}

@media (max-width: 350px) {
    .dash-metric + .dash-metric { padding-left: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .dash-body *, .dash-body *::before, .dash-body *::after { transition: none !important; animation: none !important; }
}

/* ===== Light theme ===== */
[data-theme="light"] .dash-body {
    --d-bg: #f4f7fb;
    --d-surface: #ffffff;
    --d-surface-2: #f1f5f9;
    --d-border: rgba(15, 23, 42, 0.09);
    --d-border-strong: rgba(15, 23, 42, 0.16);
    --d-text: #0f172a;
    --d-soft: #334155;
    --d-muted: #64748b;
    --d-primary: #2563eb;
    --d-primary-hover: #1d4ed8;
    --d-primary-soft: rgba(37, 99, 235, 0.1);
    --d-link: #1d4ed8;
    --d-green: #047857;
    --d-teal: #0f766e;
    --d-amber: #b45309;
    --d-purple: #7e22ce;
    --d-red: #dc2626;
    --mc-primary: #2563eb;
    --mc-primary-dark: #1d4ed8;
    --mc-primary-rgb: 37, 99, 235;
    --mc-on-primary: #ffffff;
    --mc-surface: #ffffff;
    --mc-surface-hover: #f1f5f9;
    --mc-border: rgba(15, 23, 42, 0.12);
    --mc-bg: #f8fafc;
    --mc-bg-alt: #f1f5f9;
    --mc-text: #0f172a;
    --mc-muted: #64748b;
    --mc-accent: #2563eb;
    --mc-danger: #dc2626;
    --d-page-bg:
        radial-gradient(1200px 520px at 78% -8%, rgba(59, 130, 246, 0.1), transparent 60%),
        linear-gradient(180deg, #f8fafc 0%, #f3f6fb 45%, #eef2f8 100%);
    --d-nav-bg: rgba(255, 255, 255, 0.86);
    --d-nav-border: rgba(15, 23, 42, 0.08);
    --d-hover: rgba(15, 23, 42, 0.06);
    --d-popover: #ffffff;
    --d-popover-border: rgba(15, 23, 42, 0.1);
    --d-shadow: 0 20px 44px -16px rgba(15, 23, 42, 0.25), 0 2px 6px rgba(15, 23, 42, 0.06);
    --d-brand-em: #2563eb;
    --d-tab-active-bg: #e8f0fe;
    --d-tab-active-text: #1d4ed8;
    --d-panel: #ffffff;
    --d-card: #ffffff;
    --d-avatar-base: #ffffff;
    --d-skeleton-a: #eef2f7;
    --d-skeleton-b: #f8fafc;
    --d-toggle-bg: #eef2f7;
    --d-toggle-on-bg: #ffffff;
    --d-toggle-on-text: #1d4ed8;
    --d-dialog: #ffffff;
    --d-dialog-foot: #f8fafc;
    --d-backdrop: rgba(15, 23, 42, 0.4);
    --d-input: #ffffff;
    --d-input-readonly: #f1f5f9;
    --d-input-border: rgba(15, 23, 42, 0.18);
    --d-switch-off: #cbd5e1;
    --d-switch-knob: #ffffff;
    --d-error-text: #b91c1c;
    --d-toast: #ffffff;
}
[data-theme="light"] .dash-panel { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px -18px rgba(15, 23, 42, 0.18); }
[data-theme="light"] .dash-view-toggle button[aria-pressed="true"] { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.14); }

/* The hero stays a blue banner in light mode, a brighter one, so it keeps light text. */
[data-theme="light"] .dash-hero {
    --d-text: #ffffff;
    --d-soft: #dbeafe;
    color: #ffffff;
    border-color: rgba(37, 99, 235, 0.25);
    background:
        radial-gradient(560px 300px at 82% 38%, rgba(147, 197, 253, 0.45), transparent 70%),
        radial-gradient(420px 220px at 60% 120%, rgba(191, 219, 254, 0.3), transparent 70%),
        linear-gradient(100deg, #1e4fd6 0%, #2f6cf0 48%, #4a8df8 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 24px 50px -28px rgba(37, 99, 235, 0.65);
}
[data-theme="light"] .dash-hero .dash-btn-primary { background: #ffffff; color: #1d4ed8 !important; box-shadow: 0 10px 24px -12px rgba(15, 23, 42, 0.45); }
[data-theme="light"] .dash-hero .dash-btn-primary:hover { background: #eff6ff; }
[data-theme="light"] .dash-hero .dash-btn-glass { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.55); }
[data-theme="light"] .dash-hero .dash-btn-glass:hover { background: rgba(255, 255, 255, 0.22); border-color: #ffffff; }
[data-theme="light"] .dash-hero-script { color: #e0ecff; }

/* Company cards: filled with the company's primary color; text, chips and dividers use the
   black-or-white --on-accent from dashboard.js, and the button is filled with --on-accent. */
[data-theme="light"] .dash-system {
    --accent-ink: var(--on-accent);
    --card-fg-soft: color-mix(in srgb, var(--on-accent) 78%, var(--accent));
    --card-line: color-mix(in srgb, var(--on-accent) 22%, transparent);
    background: var(--accent);
    color: var(--on-accent);
    border-color: color-mix(in srgb, var(--accent) 80%, #000);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 14px 32px -20px color-mix(in srgb, var(--accent) 75%, #000);
}
[data-theme="light"] .dash-system:not(.dash-skeleton):hover { border-color: color-mix(in srgb, var(--accent) 70%, #000); }
[data-theme="light"] .dash-system.muted { border-color: color-mix(in srgb, var(--accent) 80%, #000); }
[data-theme="light"] .dash-system.dash-skeleton { background: linear-gradient(100deg, var(--d-skeleton-a) 30%, var(--d-skeleton-b) 50%, var(--d-skeleton-a) 70%); background-size: 300% 100%; border-color: var(--d-border); }
[data-theme="light"] .dash-system-id,
[data-theme="light"] .dash-system .dash-metric small,
[data-theme="light"] .dash-system .dash-metric-icon { color: var(--card-fg-soft); }
[data-theme="light"] .dash-system .dash-status { color: var(--on-accent); }
[data-theme="light"] .dash-system .dash-status-dot { box-shadow: none; }
[data-theme="light"] .dash-system .dash-chip,
[data-theme="light"] .dash-system .dash-chip.role,
[data-theme="light"] .dash-system .dash-chip.current { background: color-mix(in srgb, var(--on-accent) 15%, transparent); color: var(--on-accent); }
[data-theme="light"] .dash-system .dash-chip.role.owner,
.dash-chip.role.owner { background: #f1c40f; color: #1a1a1a; }
[data-theme="light"] .dash-system .dash-metrics,
[data-theme="light"] .dash-system .dash-metric + .dash-metric { border-color: var(--card-line); }
[data-theme="light"] .dash-system .dash-open:not(:disabled) { background: var(--on-accent); color: var(--accent-button-ink) !important; box-shadow: 0 8px 20px -12px rgba(15, 23, 42, 0.6); }
[data-theme="light"] .dash-system .dash-open:hover:not(:disabled) { background: color-mix(in srgb, var(--on-accent) 88%, var(--accent)); }
[data-theme="light"] .dash-system .dash-open:disabled { background: color-mix(in srgb, var(--on-accent) 14%, transparent); border-color: transparent; color: var(--on-accent) !important; opacity: 0.8; }
[data-theme="light"] .dash-system .dash-more { border-color: var(--card-line); background: color-mix(in srgb, var(--on-accent) 10%, transparent); color: var(--on-accent); }
[data-theme="light"] .dash-system .dash-more:hover,
[data-theme="light"] .dash-system .dash-more[aria-expanded="true"] { background: color-mix(in srgb, var(--on-accent) 18%, transparent); }
[data-theme="light"] .dash-system .dash-card-menu { color: var(--d-text); }
[data-theme="light"] .dash-system-avatar { background: color-mix(in srgb, var(--on-accent) 16%, var(--accent)); border-color: var(--card-line); }
[data-theme="light"] .dash-system-avatar.has-logo { background: #ffffff; border-color: transparent; padding: 4px; }
[data-theme="light"] .dash-system:hover { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 20px 40px -22px color-mix(in srgb, var(--accent) 70%, transparent); }
[data-theme="light"] .dash-system.muted { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); }
[data-theme="light"] .dash-system-avatar { color: var(--accent-ink); }

/* Public dev log. Uses the dashboard palette, so light and dark follow data-theme. */
.dev-log-kicker { margin: 0 0 6px; color: var(--d-muted); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.dev-log-version { margin: 0 0 16px; font-size: clamp(3rem, 8vw, 5.25rem); font-weight: 800; letter-spacing: -0.04em; line-height: 0.95; color: var(--d-text); }
.dev-log-timeline { list-style: none; margin: 4px 0 0; padding: 0; }
.dev-log-timeline-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    column-gap: 18px;
}
.dev-log-rail { position: relative; }
.dev-log-rail::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: #7f8f4c;
}
.dev-log-timeline-item:first-child .dev-log-rail::before { top: 34px; }
.dev-log-timeline-item:last-child .dev-log-rail::before { bottom: auto; height: 34px; }
.dev-log-timeline-item:only-child .dev-log-rail::before { display: none; }
.dev-log-rail-dot {
    position: absolute;
    top: 28px;
    left: 50%;
    z-index: 1;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-radius: 50%;
    background: #8ea344;
}
.dev-log-timeline-item:first-child .dev-log-rail-dot { background: #3b82f6; box-shadow: 0 0 10px rgba(59, 130, 246, 0.75); }
.dev-log-version-block { min-width: 0; padding: 0 0 22px; }
.dev-log-timeline-item:last-child .dev-log-version-block { padding-bottom: 0; }
.dev-log-card {
    padding: 22px 24px;
    border-radius: 14px;
    background: var(--d-panel);
    border: 1px solid var(--d-border);
}
.dev-log-chat { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--d-border); }
.dev-log-chat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dev-log-chat-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.dev-log-chat-head span { color: var(--d-muted); font-size: 13px; }
.dev-log-chat-quota { margin: 0 0 14px; color: var(--d-muted); font-size: 13.5px; }
.dev-log-chat-form { margin-top: 14px; }
.dev-log-chat .rq-textarea { min-height: 84px; }
[data-theme="light"] .dev-log-card { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px -18px rgba(15, 23, 42, 0.18); }
.dev-log-timeline .dev-log-version { margin-bottom: 10px; font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.05; }
.dev-log-timeline .dev-log-summary { margin-bottom: 16px; font-size: 1.02rem; }
.dev-log-summary { margin: 0 0 28px; max-width: 46rem; font-size: 1.15rem; line-height: 1.6; color: var(--d-soft); white-space: pre-wrap; }
.dev-log-group h2, .dev-log-group h3 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 700; color: var(--d-text); }
.dev-log-group ul { margin: 0 0 22px; padding-left: 0; list-style: none; }
.dev-log-entry {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-left: 3px solid #7f8f4c;
    border-radius: 0 10px 10px 0;
    background: rgba(127, 143, 76, 0.1);
}
.dev-log-entry-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dev-log-entry-title { color: var(--d-text); font-size: 1rem; }
.dev-log-entry-body { margin: 6px 0 0; color: var(--d-soft); white-space: pre-wrap; }
.dev-log-severity { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.dev-log-severity-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    height: 1.7rem;
    padding: 0 6px;
    border-radius: 7px;
    background: #747f35;
    color: #f7f8ef;
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.dev-log-severity-scale {
    display: inline-block;
    width: 72px;
    height: 8px;
    border-radius: 99px;
    background: linear-gradient(90deg, #8ea344 var(--sev, 0%), rgba(127, 143, 76, 0.28) var(--sev, 0%));
    box-shadow: inset 0 0 0 1px rgba(116, 127, 53, 0.35);
}
.dev-log-empty { margin: 0; color: var(--d-muted); }

/* Forum Page — same olive language as the Dev Log entries, list not a card stack. */
.forum-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
    gap: 28px;
    align-items: start;
}
.forum-board-head { margin: 0 0 14px; }
.forum-board-head h2 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.forum-board-head p { margin: 0; color: var(--d-muted); font-size: 13.5px; }
.forum-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--d-border); }
.forum-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 18px;
    gap: 12px;
    align-items: center;
    padding: 14px 8px 14px 4px;
    border-bottom: 1px solid var(--d-border);
    color: var(--d-text) !important;
    text-decoration: none;
    transition: background 0.15s;
}
.forum-row:hover { background: rgba(127, 143, 76, 0.08); }
.forum-row.is-pinned {
    background: rgba(127, 143, 76, 0.12);
    box-shadow: inset 3px 0 0 #7f8f4c;
}
.forum-row-pin {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(127, 143, 76, 0.16);
    color: #c5d36a;
    font-size: 16px;
}
.forum-row.is-pinned .forum-row-pin { background: #747f35; color: #f7f8ef; }
.forum-row-main { min-width: 0; }
.forum-row-title-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.forum-row-title-line strong {
    font-size: 16px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.forum-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 4px;
    color: var(--d-muted);
    font-size: 13px;
}
.forum-row-go { color: var(--d-muted); font-size: 14px; }
.forum-type {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(127, 143, 76, 0.18);
    color: #d5e08a;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.forum-type-bug { background: rgba(248, 113, 113, 0.16); color: #fca5a5; }
.forum-type-request { background: rgba(251, 191, 36, 0.16); color: #fbbf24; }
.forum-type-discussion { background: rgba(127, 143, 76, 0.2); color: #d5e08a; }
.forum-type-other { background: rgba(148, 163, 184, 0.14); color: var(--d-soft); }
.forum-type-announcement { background: #747f35; color: #f7f8ef; }
.forum-compose { margin-top: 0; }
.forum-form .rq-actions { margin-top: 8px; }
.forum-back { margin: 0 0 18px; }
.forum-back a { display: inline-flex; align-items: center; gap: 8px; color: var(--d-soft); text-decoration: none; font-size: 14px; font-weight: 600; }
.forum-back a:hover { color: var(--d-text); }
.forum-thread-head { margin: 0 0 18px; }
.forum-thread-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.forum-thread-title h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.forum-pin-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #c5d36a;
    font-size: 13px;
    font-weight: 600;
}
.forum-thread-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin: 10px 0 0;
    color: var(--d-muted);
    font-size: 13.5px;
}
.forum-comments { margin: 28px 0 20px; }
.forum-comments h2 { margin: 0 0 12px; font-size: 18px; font-weight: 700; }
.forum-comment-list { list-style: none; margin: 0; padding: 0; }
.forum-post {
    margin: 0 0 10px;
    padding: 12px 14px;
    border-left: 3px solid #7f8f4c;
    border-radius: 0 10px 10px 0;
    background: rgba(127, 143, 76, 0.1);
}
.forum-post.is-opening { background: rgba(127, 143, 76, 0.16); }
.forum-post-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; color: var(--d-muted); font-size: 13px; }
.forum-post-head strong { color: var(--d-text); font-size: 14px; }
.forum-post-body { margin: 8px 0 0; color: var(--d-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
textarea.rq-textarea { height: auto; min-height: 120px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
[data-theme="light"] .forum-row:hover { background: rgba(116, 127, 53, 0.08); }
[data-theme="light"] .forum-row.is-pinned { background: rgba(116, 127, 53, 0.1); }
[data-theme="light"] .forum-row-pin { background: rgba(116, 127, 53, 0.14); color: #5c6628; }
[data-theme="light"] .forum-row.is-pinned .forum-row-pin { background: #747f35; color: #f7f8ef; }
[data-theme="light"] .forum-type { color: #5c6628; background: rgba(116, 127, 53, 0.14); }
[data-theme="light"] .forum-type-bug { background: rgba(220, 38, 38, 0.12); color: #b91c1c; }
[data-theme="light"] .forum-type-request { background: rgba(180, 83, 9, 0.12); color: #b45309; }
[data-theme="light"] .forum-type-announcement { background: #747f35; color: #f7f8ef; }
[data-theme="light"] .forum-pin-badge { color: #5c6628; }

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