/* Mova HQ — Admin styles
   Native light / dark mode (default: dark for HQ feel, respects user choice)
*/

/* ---------- Dark (HQ default) ---------- */
:root,
[data-theme="dark"] {
    --hq-bg: #0f1117;
    --hq-sidebar: #161922;
    --hq-surface: #1c1f2a;
    --hq-border: #2a2e3a;
    --hq-text: #e8eaed;
    --hq-muted: #9aa0a6;
    --hq-accent: #3b82f6;
    --hq-accent-hover: #60a5fa;
    --hq-success: #22c55e;
    --hq-danger: #ef4444;
    --hq-warning: #f59e0b;
    --hq-input-bg: #12151c;
    --hq-hover: rgba(255, 255, 255, 0.04);
    --hq-radius: 8px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    color-scheme: dark;
}

/* ---------- Light ---------- */
[data-theme="light"] {
    --hq-bg: #f4f5f7;
    --hq-sidebar: #ffffff;
    --hq-surface: #ffffff;
    --hq-border: #e5e7eb;
    --hq-text: #111827;
    --hq-muted: #6b7280;
    --hq-accent: #2563eb;
    --hq-accent-hover: #1d4ed8;
    --hq-success: #16a34a;
    --hq-danger: #dc2626;
    --hq-warning: #d97706;
    --hq-input-bg: #f9fafb;
    --hq-hover: rgba(0, 0, 0, 0.04);
    color-scheme: light;
}

/* System light when no stored preference — HQ stays dark-first unless light is chosen */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]):not([data-theme="light"]) {
        /* Keep HQ dark by default for admin; user can toggle */
    }
}

*, *::before, *::after { box-sizing: border-box; }

body.hq {
    margin: 0;
    font-family: var(--font);
    background: var(--hq-bg);
    color: var(--hq-text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Guest / Auth */
.hq-guest {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
}

.hq-guest .theme-toggle {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
}

.auth-card {
    background: var(--hq-surface);
    border: 1px solid var(--hq-border);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

.tagline {
    color: var(--hq-muted);
    margin: 0 0 1.5rem;
    font-size: 0.9375rem;
}

/* Authenticated layout */
.hq-authenticated {
    display: flex;
    min-height: 100vh;
}

.hq-sidebar {
    width: 220px;
    background: var(--hq-sidebar);
    border-right: 1px solid var(--hq-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
}

.hq-brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--hq-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.hq-brand a {
    color: var(--hq-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.hq-nav {
    flex: 1;
    padding: 0.65rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    overflow-y: auto;
}

.hq-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.75rem;
    color: var(--hq-muted);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}

.hq-nav .nav-link i {
    width: 1.1rem;
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.9;
}

.hq-nav .nav-link:hover {
    background: var(--hq-hover);
    color: var(--hq-text);
}

.hq-nav .nav-link.active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--hq-accent);
}

[data-theme="light"] .hq-nav .nav-link.active {
    background: rgba(37, 99, 235, 0.1);
}

/* Collapsible nav groups */
.nav-group {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--hq-muted);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.nav-group-toggle:hover {
    background: var(--hq-hover);
    color: var(--hq-text);
}

.nav-group-label {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.nav-group-label i {
    width: 1.1rem;
    text-align: center;
    font-size: 0.8rem;
    text-transform: none;
}

.nav-chevron {
    font-size: 0.65rem;
    transition: transform 0.18s ease;
    opacity: 0.7;
}

.nav-group.is-open .nav-chevron {
    transform: rotate(180deg);
}

.nav-group-items {
    display: none;
    flex-direction: column;
    gap: 0.1rem;
    padding-left: 0.35rem;
    margin-bottom: 0.25rem;
}

.nav-group.is-open .nav-group-items {
    display: flex;
}

.nav-group-items .nav-link {
    padding-left: 1.85rem;
    font-size: 0.84rem;
}

.hq-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--hq-border);
    font-size: 0.85rem;
    color: var(--hq-muted);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.hq-user a {
    color: var(--hq-muted);
    text-decoration: none;
    font-size: 0.8rem;
}

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

.hq-main {
    margin-left: 220px;
    flex: 1;
    min-width: 0;
}

.hq-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.75rem;
    border-bottom: 1px solid var(--hq-border);
    background: var(--hq-surface);
    gap: 1rem;
}

.hq-topbar h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.hq-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.hq-content {
    padding: 1.5rem 1.75rem 2.5rem;
}

/* Theme toggle (shared look) */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 8px;
    border: 1px solid var(--hq-border);
    background: var(--hq-input-bg);
    color: var(--hq-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    padding: 0;
    flex-shrink: 0;
}

.theme-toggle:hover {
    color: var(--hq-text);
    border-color: var(--hq-muted);
}

.theme-toggle svg {
    width: 1.05rem;
    height: 1.05rem;
    display: block;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* Default (no data-theme): HQ is dark, show sun */
:root:not([data-theme]) .theme-toggle .icon-sun { display: block; }
:root:not([data-theme]) .theme-toggle .icon-moon { display: none; }

/* Buttons */
.btn-primary, .btn-ghost, .btn-danger, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

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

.btn-primary:hover {
    background: var(--hq-accent-hover);
    border-color: var(--hq-accent-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--hq-muted);
    border-color: var(--hq-border);
}

.btn-ghost:hover {
    color: var(--hq-text);
    border-color: var(--hq-muted);
}

.btn-danger {
    background: transparent;
    color: var(--hq-danger);
    border-color: var(--hq-border);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--hq-danger);
}

.btn-secondary {
    background: var(--hq-surface);
    color: var(--hq-text);
    border-color: var(--hq-border);
}

.btn-secondary:hover {
    border-color: var(--hq-muted);
}

.btn-block { width: 100%; }

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--hq-muted);
    margin-bottom: 0.35rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group input[type="search"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group input[type="time"],
.form-group input[type="tel"],
.form-group input:not([type]),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--hq-border);
    border-radius: 9px;
    background: var(--hq-input-bg);
    color: var(--hq-text);
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group input[type="time"] {
    min-height: 2.55rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--hq-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: var(--hq-surface, var(--hq-input-bg));
}

/* Password with eye toggle */
.password-field {
    position: relative;
}
.password-field input {
    padding-right: 2.6rem;
}
.password-toggle {
    position: absolute;
    right: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--hq-muted);
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 0;
}
.password-toggle:hover {
    color: var(--hq-text);
    background: rgba(0,0,0,0.04);
}
.password-toggle .fa-eye-slash { display: none; }
.password-toggle.is-visible .fa-eye { display: none; }
.password-toggle.is-visible .fa-eye-slash { display: inline; }

/* Responsive form grids */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1rem;
}
.form-grid .form-group { margin-bottom: 0; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 720px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
}

.form-section {
    border: 0.5px solid var(--hq-border);
    border-radius: 10px;
    padding: 1rem 1.1rem 1.15rem;
    margin-bottom: 1.15rem;
    background: var(--hq-surface, transparent);
}
.form-section > h4,
.form-section > .form-section-title {
    margin: 0 0 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--hq-muted);
}

/* Account cards — modern stacked layout */
.mailbox-account-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--hq-border);
}
.mailbox-account-card:last-child { border-bottom: none; }
.mailbox-account-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.mailbox-account-meta {
    flex: 1;
    min-width: 0;
}
.mailbox-account-meta strong {
    display: block;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mailbox-account-meta .email {
    font-size: 0.8rem;
    color: var(--hq-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mailbox-account-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-left: calc(32px + 0.75rem);
    font-size: 0.8rem;
}
.mailbox-account-actions a,
.mailbox-account-actions button.linkish {
    background: none;
    border: none;
    padding: 0;
    color: var(--hq-accent);
    cursor: pointer;
    font: inherit;
    font-size: inherit;
    text-decoration: none;
}
.mailbox-account-actions a:hover,
.mailbox-account-actions button.linkish:hover {
    text-decoration: underline;
}
.mailbox-account-actions .sep {
    color: var(--hq-muted);
    user-select: none;
}
.mailbox-account-actions form { display: inline; margin: 0; }

/* Rich account switcher */
.mailbox-account-switcher {
    position: relative;
    display: flex;
    align-items: center;
}
.mailbox-switcher-btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0.55rem 0.3rem 0.3rem;
    border: 1px solid var(--hq-border);
    border-radius: 999px;
    background: var(--hq-surface, var(--hq-input-bg));
    color: var(--hq-text);
    cursor: pointer;
    font: inherit;
    max-width: min(320px, 100%);
}
.mailbox-switcher-btn:hover {
    border-color: var(--hq-accent);
}
.mailbox-switcher-btn .mailbox-avatar,
.mailbox-switcher-btn .mailbox-avatar-fallback {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}
.mailbox-switcher-text {
    min-width: 0;
    text-align: left;
    line-height: 1.2;
}
.mailbox-switcher-text .name {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mailbox-switcher-text .email {
    display: block;
    font-size: 0.72rem;
    color: var(--hq-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mailbox-switcher-btn > .chev {
    margin-left: 0.15rem;
    color: var(--hq-muted);
    font-size: 0.7rem;
}
.mailbox-switcher-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 260px;
    max-width: 340px;
    background: var(--hq-surface, #fff);
    border: 1px solid var(--hq-border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    padding: 0.35rem;
    z-index: 40;
}
.mailbox-switcher-menu[hidden] { display: none; }
.mailbox-switcher-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
}
.mailbox-switcher-item:hover,
.mailbox-switcher-item.is-active {
    background: rgba(59, 130, 246, 0.08);
}
.mailbox-switcher-item .mailbox-avatar,
.mailbox-switcher-item .mailbox-avatar-fallback {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

/* Mailbox search — match Line 1 HQ search feel */
.mailbox-search {
    position: relative;
    margin-bottom: 0.65rem;
}
.mailbox-search > i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--hq-muted);
    font-size: 13px;
    pointer-events: none;
}
.mailbox-search input[type="search"] {
    width: 100%;
    height: 36px;
    padding: 0 14px 0 40px;
    border: none;
    border-radius: 9px;
    background: var(--hq-bg, var(--hq-input-bg));
    font-size: 13.5px;
    color: var(--hq-text);
    font-family: inherit;
    transition: box-shadow 0.15s, background 0.15s;
    box-sizing: border-box;
}
.mailbox-search input[type="search"]::placeholder { color: var(--hq-muted); }
.mailbox-search input[type="search"]:focus {
    outline: none;
    background: var(--hq-surface, #fff);
    box-shadow: 0 0 0 2px var(--hq-accent);
}

.input-title {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    letter-spacing: -0.02em;
    border: none !important;
    background: transparent !important;
    padding: 0.25rem 0 !important;
    box-shadow: none !important;
}

.slug-field {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.slug-prefix {
    color: var(--hq-muted);
    font-size: 0.9rem;
}

.slug-field input {
    flex: 1;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.12);
    color: var(--hq-success);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    color: var(--hq-danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--hq-surface);
    border: 1px solid var(--hq-border);
    border-radius: var(--hq-radius);
    padding: 1.15rem 1.25rem;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--hq-muted);
}

/* Panel / table */
.panel {
    background: var(--hq-surface);
    border: 1px solid var(--hq-border);
    border-radius: var(--hq-radius);
    padding: 1.25rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.panel-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.filters {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.filter {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    color: var(--hq-muted);
    text-decoration: none;
    background: transparent;
    border: 1px solid var(--hq-border);
}

.filter.active, .filter:hover {
    color: var(--hq-text);
    border-color: var(--hq-accent);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 0.65rem 0.85rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--hq-muted);
    border-bottom: 1px solid var(--hq-border);
    font-weight: 600;
}

.data-table td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--hq-border);
    vertical-align: middle;
}

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

.data-table a {
    color: var(--hq-text);
    text-decoration: none;
    font-weight: 500;
}

.data-table a:hover { color: var(--hq-accent); }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--hq-hover);
    color: var(--hq-muted);
}

.badge-published { background: rgba(34, 197, 94, 0.15); color: var(--hq-success); }
.badge-draft { background: rgba(156, 163, 175, 0.15); color: var(--hq-muted); }
.badge-scheduled { background: rgba(245, 158, 11, 0.15); color: var(--hq-warning); }
.badge-trash { background: rgba(239, 68, 68, 0.12); color: var(--hq-danger); }

/* Content form */
.form-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
}

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

.form-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-card {
    background: var(--hq-surface);
    border: 1px solid var(--hq-border);
    border-radius: var(--hq-radius);
    padding: 1rem;
}

.sidebar-card h3 {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--hq-muted);
    font-weight: 600;
}

/* Editor */
.editor-toolbar-wrap {
    border: 1px solid var(--hq-border);
    border-bottom: none;
    border-radius: var(--hq-radius) var(--hq-radius) 0 0;
    background: var(--hq-input-bg);
    overflow: hidden;
}

.editor-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.15rem;
    padding: 0.4rem 0.5rem;
    background: transparent;
    border: none;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.editor-toolbar-line1 {
    border-bottom: 1px solid var(--hq-border);
}

.editor-toolbar-line2 {
    min-height: 2.35rem;
}

.toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    flex-shrink: 0;
}

.toolbar-sep {
    width: 1px;
    height: 1.25rem;
    background: var(--hq-border);
    margin: 0 0.3rem;
    flex-shrink: 0;
}

.editor-toolbar button,
.editor-toolbar .toolbar-tab,
.editor-toolbar .toolbar-group-pick {
    background: transparent;
    border: 1px solid transparent;
    color: var(--hq-text) !important;
    opacity: 0.78;
    padding: 0.4rem 0.55rem;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8125rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 1.85rem;
    min-height: 1.85rem;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease, border-color 0.12s ease;
}

.editor-toolbar .toolbar-tab {
    font-weight: 550;
    letter-spacing: 0.01em;
    padding: 0.4rem 0.7rem;
}

.editor-toolbar button i,
.editor-toolbar button .fa-solid,
.editor-toolbar button .fa-regular {
    font-size: 0.85rem;
    color: inherit !important;
    opacity: 1;
}

.editor-toolbar button:hover,
.editor-toolbar .toolbar-tab:hover,
.editor-toolbar .toolbar-group-pick:hover {
    background: var(--hq-hover);
    opacity: 1;
    color: var(--hq-text) !important;
    border-color: var(--hq-border);
}

.editor-toolbar button:active,
.editor-toolbar button.is-active,
.editor-toolbar .toolbar-tab.is-active,
.editor-toolbar .toolbar-group-pick.is-active {
    background: rgba(59, 130, 246, 0.18);
    opacity: 1;
    color: var(--hq-accent) !important;
    border-color: transparent;
}

.editor-toolbar .toolbar-tab.is-active {
    box-shadow: inset 0 -2px 0 var(--hq-accent);
    border-radius: 5px 5px 0 0;
}

/* Panels inside line 2 */
.toolbar-panel {
    display: none;
    align-items: center;
    gap: 0.1rem;
    flex-wrap: nowrap;
    width: 100%;
}
.toolbar-panel.is-active {
    display: inline-flex;
}

.toolbar-back {
    margin-right: 0.15rem;
}

/* Desktop: show group tabs, hide mobile quick + back buttons + groups list */
.toolbar-mobile-quick { display: none; }
.toolbar-groups-desktop { display: inline-flex; }
.toolbar-panel .toolbar-back { display: none; }
.toolbar-panel-groups { display: none !important; }

/* Mobile */
@media (max-width: 768px) {
    .toolbar-groups-desktop { display: none !important; }
    .toolbar-mobile-quick { display: inline-flex; }

    .editor-toolbar-line2 {
        display: none;
    }
    .editor-toolbar-wrap.is-mobile-more-open .editor-toolbar-line2 {
        display: flex;
    }

    .toolbar-panel .toolbar-back {
        display: inline-flex;
    }
    .toolbar-panel-groups.is-active {
        display: inline-flex !important;
    }

    /* On mobile, text panel hides B/I/U (already on line 1) — optional polish via data attrs later */
    .editor-toolbar-wrap.is-mobile-more-open .toolbar-more-btn {
        background: rgba(59, 130, 246, 0.18);
        color: var(--hq-accent) !important;
        opacity: 1;
    }
}

.editor-toolbar-wrap + .editor-body,
.editor-body {
    min-height: 360px;
    padding: 1.15rem 1.25rem;
    background: var(--hq-input-bg);
    border: 1px solid var(--hq-border);
    border-radius: 0 0 var(--hq-radius) var(--hq-radius);
    outline: none;
    line-height: 1.7;
    font-size: 0.975rem;
    overflow-wrap: break-word;
}

.editor-body:focus {
    border-color: var(--hq-accent);
}

.editor-body.is-empty:before {
    content: attr(data-placeholder);
    color: var(--hq-muted);
    pointer-events: none;
    float: left;
    height: 0;
}

/* Editor content preview styles */
.editor-body h2 {
    font-size: 1.45rem;
    margin: 1.25rem 0 0.5rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}
.editor-body h3 {
    font-size: 1.2rem;
    margin: 1.1rem 0 0.4rem;
    font-weight: 600;
}
.editor-body h4 {
    font-size: 1.05rem;
    margin: 1rem 0 0.35rem;
    font-weight: 600;
}
.editor-body p { margin: 0 0 0.85rem; }
.editor-body ul, .editor-body ol { margin: 0 0 0.85rem; padding-left: 1.4rem; }
.editor-body li { margin-bottom: 0.25rem; }
.editor-body blockquote {
    margin: 1rem 0;
    padding: 0.6rem 1rem;
    border-left: 3px solid var(--hq-accent);
    color: var(--hq-muted);
    background: var(--hq-hover);
    border-radius: 0 6px 6px 0;
}
.editor-body pre {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    background: var(--hq-hover, #f3f4f6);
    border: 1px solid var(--hq-border);
    border-left: none;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--hq-text, #111827);
}
.editor-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}
.editor-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88em;
}
.editor-body :not(pre) > code {
    background: var(--hq-hover);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}
.editor-body figure {
    margin: 1.25rem 0;
}
.editor-body figure img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
}
.editor-body figcaption {
    font-size: 0.8rem;
    color: var(--hq-muted);
    margin-top: 0.4rem;
}
.editor-body .gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem;
    margin: 1rem 0;
}
.editor-body .gallery figure { margin: 0; }
.editor-body .video-embed,
.editor-body .embed {
    margin: 1.25rem 0;
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}
.editor-body .video-embed iframe,
.editor-body .video-embed video,
.editor-body .embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
}
.editor-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}
.editor-body th,
.editor-body td {
    border: 1px solid var(--hq-border);
    padding: 0.5rem 0.7rem;
    text-align: left;
}
.editor-body th {
    background: var(--hq-hover);
    font-weight: 600;
}
.editor-body aside.callout {
    margin: 1.15rem 0;
    padding: 0.85rem 1.1rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 8px;
}
.editor-body aside.callout p { margin: 0; }
.editor-body a.btn {
    display: inline-block;
    padding: 0.55rem 1.15rem;
    background: var(--hq-accent);
    color: #fff !important;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}
.editor-body .faq-item {
    margin: 1rem 0;
    border: 1px solid var(--hq-border);
    border-radius: 8px;
    overflow: hidden;
}
.editor-body .faq-question {
    margin: 0;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: var(--hq-hover);
}
.editor-body .faq-answer {
    padding: 0.75rem 1rem;
}
.editor-body .faq-answer p:last-child { margin-bottom: 0; }
.editor-body hr {
    border: none;
    border-top: 1px solid var(--hq-border);
    margin: 1.5rem 0;
}

/* Media grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.media-card {
    background: var(--hq-surface);
    border: 1px solid var(--hq-border);
    border-radius: var(--hq-radius);
    overflow: hidden;
}

.media-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.media-placeholder {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hq-bg);
    color: var(--hq-muted);
    font-weight: 600;
}

.media-info {
    padding: 0.5rem 0.75rem;
}

.media-name {
    display: block;
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-path {
    display: block;
    font-size: 0.6875rem;
    color: var(--hq-muted);
    margin-top: 0.2rem;
    word-break: break-all;
}

.empty {
    color: var(--hq-muted);
    text-align: center;
    padding: 2rem;
}

.empty a { color: var(--hq-accent); }

/* ---------- HQ topbar mobile toggle ---------- */
.hq-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.hq-topbar-left h1 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hq-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    border: 1px solid var(--hq-border);
    background: var(--hq-surface);
    color: var(--hq-text);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.hq-menu-toggle:hover {
    background: var(--hq-hover);
}

.hq-menu-toggle i {
    font-size: 1rem;
}

.hq-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 35;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.hq-sidebar-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

body.hq-sidebar-open {
    overflow: hidden;
}

/* ---------- Tablet (≤900px): narrower sidebar when visible ---------- */
@media (max-width: 900px) {
    .form-layout { grid-template-columns: 1fr; }
    .hq-sidebar { width: 240px; }
    .hq-main { margin-left: 0; }
    .hq-menu-toggle { display: inline-flex; }

    .hq-sidebar {
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        box-shadow: none;
        z-index: 50;
    }

    .hq-sidebar.is-open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.25);
    }

    .hq-topbar {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .hq-content {
        padding: 1rem;
    }
}

/* ---------- Phone (≤640px) ---------- */
@media (max-width: 640px) {
    .hq-sidebar {
        width: min(280px, 86vw);
    }

    .hq-topbar-actions .btn-ghost {
        font-size: 0.8rem;
        padding: 0.35rem 0.55rem;
    }

    .hq-content {
        padding: 0.75rem;
    }

    .auth-card {
        margin: 1rem;
        padding: 1.5rem;
    }

    .panel {
        padding: 1rem;
    }

    table.table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ---------- Desktop restore ---------- */
@media (min-width: 901px) {
    .hq-menu-toggle { display: none !important; }
    .hq-sidebar-backdrop { display: none !important; }
}


/* Media picker modal */
.media-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}
.media-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}
.media-modal {
    background: var(--hq-surface);
    border: 1px solid var(--hq-border);
    border-radius: 12px;
    width: 100%;
    max-width: 820px;
    max-height: min(88vh, 720px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.media-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--hq-border);
}
.media-modal-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}
.media-modal-close {
    background: transparent;
    border: none;
    color: var(--hq-muted);
    cursor: pointer;
    font-size: 1.15rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    line-height: 1;
}
.media-modal-close:hover {
    background: var(--hq-hover);
    color: var(--hq-text);
}
.media-modal-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--hq-border);
    flex-wrap: wrap;
}
.media-modal-toolbar .btn-primary {
    position: relative;
    overflow: hidden;
}
.media-modal-toolbar input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.media-modal-search {
    flex: 1;
    min-width: 140px;
}
.media-modal-search input {
    width: 100%;
    padding: 0.45rem 0.7rem;
    background: var(--hq-input-bg);
    border: 1px solid var(--hq-border);
    border-radius: 6px;
    color: var(--hq-text);
    font-size: 0.875rem;
}
.media-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    min-height: 220px;
}
.media-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}
.media-picker-item {
    border: 2px solid var(--hq-border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: var(--hq-input-bg);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
    position: relative;
}
.media-picker-item:hover {
    border-color: var(--hq-muted);
}
.media-picker-item.is-selected {
    border-color: var(--hq-accent);
    box-shadow: 0 0 0 1px var(--hq-accent);
}
.media-picker-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}
.media-picker-item .media-picker-placeholder {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hq-muted);
    font-size: 0.75rem;
    font-weight: 600;
}
.media-picker-item .media-picker-name {
    display: block;
    padding: 0.35rem 0.45rem;
    font-size: 0.7rem;
    color: var(--hq-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.media-picker-item .check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--hq-accent);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}
.media-picker-item.is-selected .check {
    display: flex;
}
.media-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    border-top: 1px solid var(--hq-border);
}
.media-modal-footer .selection-count {
    font-size: 0.85rem;
    color: var(--hq-muted);
}
.media-modal-footer .actions {
    display: flex;
    gap: 0.5rem;
}
.media-modal-status {
    font-size: 0.85rem;
    color: var(--hq-muted);
    padding: 0.5rem 0;
}
.media-modal-status.is-error { color: var(--hq-danger); }
.media-modal-status.is-success { color: var(--hq-success); }
.media-picker-empty {
    text-align: center;
    color: var(--hq-muted);
    padding: 2.5rem 1rem;
}


/* —— Settings grid cards —— */
.settings-form { max-width: 1100px; }
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    align-items: start;
}
.settings-card { margin: 0; }
.settings-card-title {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.settings-card-title i { opacity: 0.75; font-size: 0.9em; }
.settings-card-hint {
    font-size: 0.8rem;
    color: var(--hq-muted);
    margin: -0.35rem 0 0.75rem;
}
.settings-actions { margin-top: 1.25rem; }

/* —— Collapsible content-edit sidebar panels —— */
.form-sidebar .panel.collapsible {
    padding: 0;
    overflow: hidden;
}
.form-sidebar .panel.collapsible > .panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.7rem 0.85rem;
    margin: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
}
.form-sidebar .panel.collapsible > .panel-head:hover {
    background: var(--hq-muted-bg, rgba(0,0,0,0.03));
}
.form-sidebar .panel.collapsible > .panel-head h3 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
}
.form-sidebar .panel.collapsible > .panel-body {
    padding: 0 0.85rem 0.85rem;
}
.form-sidebar .panel.collapsible:not(.is-open) > .panel-body {
    display: none;
}
.form-sidebar .panel.collapsible .panel-chevron {
    font-size: 0.7rem;
    opacity: 0.6;
    transition: transform 0.15s ease;
}
.form-sidebar .panel.collapsible.is-open .panel-chevron {
    transform: rotate(180deg);
}
/* Keep Publish actions visible when collapsed? body holds them — ok */

/* ---------- HQ layer tabs (icon + text → panel under rule) ---------- */
.hq-layers {
    max-width: 960px;
}

.hq-layer-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 0.85rem;
}

.hq-layer-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--hq-border);
    border-radius: 8px;
    background: var(--hq-input-bg);
    color: var(--hq-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s, box-shadow 0.12s;
}

.hq-layer-tab i {
    font-size: 0.9rem;
    width: 1rem;
    text-align: center;
    opacity: 0.9;
}

.hq-layer-tab:hover {
    color: var(--hq-text);
    border-color: var(--hq-muted);
}

.hq-layer-tab.is-active {
    color: var(--hq-accent);
    border-color: var(--hq-accent);
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 0 1px var(--hq-accent);
}

[data-theme="light"] .hq-layer-tab.is-active {
    background: rgba(37, 99, 235, 0.08);
}

.hq-layer-rule {
    border: none;
    border-top: 1px solid var(--hq-border);
    margin: 0 0 1.15rem;
}

.hq-layer-panels {
    min-height: 8rem;
}

.hq-layer-panel {
    background: var(--hq-surface);
    border: 1px solid var(--hq-border);
    border-radius: var(--hq-radius);
    padding: 1.15rem 1.25rem;
}

.hq-layer-panel[hidden] {
    display: none !important;
}

.hq-layer-panel h3 {
    margin: 0 0 0.85rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--hq-muted);
    font-weight: 600;
}

.hq-layer-actions {
    margin-top: 1.15rem;
}

/* Icon + text on hover for compact controls */
.hq-icon-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.hq-icon-label .hq-icon-label-text {
    font-size: 0.8rem;
    font-weight: 500;
}

@media (max-width: 640px) {
    .hq-layer-tab {
        flex: 1 1 auto;
        justify-content: center;
        min-width: calc(50% - 0.4rem);
    }
}

/* Sidebar: optional compact — icon with text on hover */
.hq-sidebar.is-compact {
    width: 64px;
}
.hq-sidebar.is-compact .hq-brand a,
.hq-sidebar.is-compact .nav-group-label span,
.hq-sidebar.is-compact .nav-link span,
.hq-sidebar.is-compact .nav-chevron,
.hq-sidebar.is-compact .hq-user span,
.hq-sidebar.is-compact .hq-user a {
    /* handled below */
}
.hq-sidebar.is-compact .nav-link span,
.hq-sidebar.is-compact .nav-group-label span:last-child,
.hq-sidebar.is-compact .hq-brand a {
    position: absolute;
    left: calc(100% + 0.5rem);
    background: var(--hq-surface);
    border: 1px solid var(--hq-border);
    padding: 0.35rem 0.55rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 60;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 0.8rem;
    color: var(--hq-text);
}
.hq-sidebar.is-compact .nav-link,
.hq-sidebar.is-compact .nav-group-label {
    position: relative;
    justify-content: center;
}
.hq-sidebar.is-compact .nav-link:hover span,
.hq-sidebar.is-compact .nav-group-toggle:hover .nav-group-label span:last-child {
    opacity: 1;
}
.hq-sidebar.is-compact .nav-group-items { display: none !important; }
.hq-sidebar.is-compact .nav-group.is-open .nav-group-items { display: none !important; }
.hq-sidebar.is-compact .hq-main-offset { margin-left: 64px; }

/* Topbar View site — icon + text */
.hq-topbar-actions .btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.theme-toggle.hq-icon-label {
    width: auto;
    padding: 0 0.6rem;
    gap: 0.35rem;
}
.hq-menu-toggle.hq-icon-label {
    width: auto;
    padding: 0 0.65rem;
    gap: 0.4rem;
}
@media (max-width: 640px) {
    .theme-toggle .hq-icon-label-text,
    .hq-menu-toggle .hq-icon-label-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0,0,0,0);
    }
    .theme-toggle.hq-icon-label,
    .hq-menu-toggle.hq-icon-label {
        width: 2.25rem;
        padding: 0;
        position: relative;
    }
    .theme-toggle:hover .hq-icon-label-text,
    .theme-toggle:focus-visible .hq-icon-label-text,
    .hq-menu-toggle:hover .hq-icon-label-text,
    .hq-menu-toggle:focus-visible .hq-icon-label-text {
        position: absolute;
        width: auto;
        height: auto;
        clip: auto;
        overflow: visible;
        top: calc(100% + 0.35rem);
        left: 50%;
        transform: translateX(-50%);
        background: var(--hq-surface);
        border: 1px solid var(--hq-border);
        border-radius: 6px;
        padding: 0.3rem 0.5rem;
        white-space: nowrap;
        z-index: 70;
        font-size: 0.75rem;
        color: var(--hq-text);
    }
}

.hq-search-snippet {
  display: block;
  font-size: 0.78rem;
  color: var(--hq-muted);
  margin-top: 0.15rem;
  line-height: 1.35;
  white-space: normal;
}

/* --- HQ header: mobile user menu consolidates preview + theme --- */
.hq-mobile-only { display: none !important; }
.hq-desktop-only { display: inline-flex; }

.hq-user-dropdown button.hq-dropdown-theme {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    padding: 0.55rem 0.85rem;
    cursor: pointer;
    text-align: left;
}
.hq-user-dropdown button.hq-dropdown-theme:hover {
    background: var(--hq-bg, rgba(0,0,0,.04));
}

@media (max-width: 720px) {
    .hq-mobile-only { display: flex !important; }
    .hq-desktop-only { display: none !important; }
    .hq-user-name { display: none; }
    .hq-line1-right .hq-icon-btn.hq-desktop-only { display: none !important; }
    .hq-user-dropdown a,
    .hq-user-dropdown button.hq-dropdown-theme {
        display: flex !important;
        align-items: center;
        gap: 0.55rem;
        padding: 0.65rem 0.9rem;
        width: 100%;
        box-sizing: border-box;
    }
}

/* ===== Backups page: no horizontal overflow; stacked actions on mobile ===== */
.hq-content .backup-table-wrap,
.hq-content .panel .backup-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}
.hq-content .backup-table {
    width: 100%;
    max-width: 100%;
    table-layout: auto;
}
.hq-content .backup-actions-inner {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.4rem;
    align-items: center;
    max-width: 100%;
}
.hq-content .backup-actions-inner form {
    margin: 0;
    display: inline-flex;
}
.hq-content .backup-file code {
    word-break: break-all;
    overflow-wrap: anywhere;
    white-space: normal !important;
    font-size: 0.78rem;
}
.hq-content .mova-export-card {
    margin-top: 1.5rem;
}
.hq-content .mova-export-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 0.85rem;
    align-items: flex-end;
}
.hq-content .mova-export-fields .form-group {
    margin: 0 !important;
    margin-bottom: 0 !important;
}
.hq-content .mova-export-fields .form-group label {
    margin-bottom: 0.35rem;
}
.hq-content .mova-export-check {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
    cursor: pointer;
    flex: 1 1 100%;
    margin: 0 0 0.15rem;
}

/* Generic data-table: allow wrap so action cells don't force page width */
.hq-content .data-table td {
    white-space: normal;
}
.hq-content .data-table td:last-child {
    white-space: normal;
}

@media (max-width: 720px) {
    .hq-content .backup-table thead {
        display: none !important;
    }
    .hq-content .backup-table,
    .hq-content .backup-table tbody,
    .hq-content .backup-table tr,
    .hq-content .backup-table td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    .hq-content .backup-table tr {
        border: 1px solid var(--hq-border);
        border-radius: 10px;
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        background: var(--hq-surface);
    }
    .hq-content .backup-table td {
        border: none !important;
        padding: 0.3rem 0 !important;
    }
    .hq-content .backup-table td.backup-file::before {
        content: "File · ";
        font-size: 0.75rem;
        color: var(--hq-muted);
    }
    .hq-content .backup-table td.backup-size::before {
        content: "Size · ";
        font-size: 0.75rem;
        color: var(--hq-muted);
    }
    .hq-content .backup-table td.backup-date::before {
        content: "Created · ";
        font-size: 0.75rem;
        color: var(--hq-muted);
    }
    .hq-content .backup-actions-inner {
        width: 100%;
        margin-top: 0.5rem;
    }
    .hq-content .backup-actions-inner > a,
    .hq-content .backup-actions-inner > form {
        flex: 1 1 calc(50% - 0.4rem);
        min-width: 5.5rem;
    }
    .hq-content .backup-actions-inner .btn-ghost,
    .hq-content .backup-actions-inner .btn-secondary,
    .hq-content .backup-actions-inner .btn-danger,
    .hq-content .backup-actions-inner a,
    .hq-content .backup-actions-inner button {
        width: 100%;
        justify-content: center;
        text-align: center;
        box-sizing: border-box;
    }
    .hq-content .mova-export-fields {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .hq-content .mova-export-fields .form-group {
        margin: 0 !important;
        flex: none !important;
        min-width: 0 !important;
        width: 100%;
    }
    .hq-content .mova-export-fields .btn-primary {
        width: 100%;
        margin-top: 0.15rem;
    }
    .hq-content .mova-export-check {
        margin-bottom: 0.25rem;
    }
    .hq-content .panel,
    .hq-content .toolbar,
    .hq-content .mova-export-card {
        max-width: 100%;
        overflow-x: hidden;
    }
}

.hq-content .mova-export-password {
    margin: 0 !important;
    min-width: min(100%, 16rem);
    flex: 1 1 12rem;
}
@media (max-width: 720px) {
    .hq-content .mova-export-password {
        flex: none !important;
        min-width: 0 !important;
        width: 100%;
    }
}
