:root {
    --bg: #f7f7f9;
    --surface: #fff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --accent: #f97316;
    --accent-dark: #ea580c;
    --danger: #dc2626;
    --info-bg: #e0f2fe;
    --success-bg: #dcfce7;
    --error-bg: #fee2e2;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }
.muted { color: var(--muted); font-size: 0.9rem; }

/* Auth */
body.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
    background: var(--surface);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    width: 360px;
}
.login-card h1 { margin: 0 0 4px; font-size: 1.5rem; }
.login-card .subtitle { color: var(--muted); margin: 0 0 24px; }
.login-card label, .login-card input { display: block; width: 100%; }
.login-card label { margin-bottom: 14px; font-size: 0.9rem; color: var(--muted); }

input, textarea, button, select { font-family: inherit; font-size: 1rem; }
input[type=text], input[type=password], input[type=file], textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    margin-top: 4px;
}
textarea { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
button {
    padding: 9px 16px;
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}
button:hover:not(:disabled) { background: var(--accent-dark); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.danger { background: var(--danger); }
button.primary { background: var(--accent); }
button[type=button]:not(.primary):not(.danger),
button[type=button]#preview-refresh,
button[type=button]#pending-revert {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
}

/* Topbar */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.topbar .brand { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.topbar nav { margin-left: auto; display: flex; gap: 18px; align-items: center; }
.topbar .who { color: var(--muted); font-size: 0.9rem; }

main { padding: 24px; max-width: 1280px; margin: 0 auto; }
h1 { margin-top: 0; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.alert.info  { background: var(--info-bg); }
.alert.error { background: var(--error-bg); color: #991b1b; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 16px;
}
.card h3 { margin-top: 0; margin-bottom: 10px; }

/* Sites grid */
.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.site-card {
    display: block;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
}
.site-card:hover { border-color: var(--accent); text-decoration: none; }
.site-card h2 { font-size: 1.1rem; margin: 0 0 4px; }
.site-card .preview-link { margin: 8px 0 0; font-size: 0.85rem; }

/* New AI editor flow */
.editor-header { margin-bottom: 16px; }
.ai-card textarea { margin-bottom: 10px; font-family: inherit; font-size: 1rem; }
.ai-actions { display: flex; align-items: center; gap: 14px; }
.ai-actions button { padding: 10px 18px; font-size: 1rem; }

.pending-change {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--accent);
    background: var(--success-bg);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.pending-info p { margin: 4px 0 0; }
.pending-actions { display: flex; gap: 10px; }

.preview-card { padding: 0; overflow: hidden; }
.preview-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.preview-toolbar h3 { margin: 0; }
.preview-toolbar > div { display: flex; gap: 10px; align-items: center; }
#preview-frame {
    display: block;
    width: 100%;
    height: 70vh;
    min-height: 480px;
    border: 0;
    background: #fff;
}

/* Advanced (collapsible file editor) */
.advanced { margin-top: 24px; }
.advanced > summary {
    cursor: pointer;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 600;
    list-style: none;
}
.advanced > summary::before { content: '▸ '; color: var(--muted); }
.advanced[open] > summary::before { content: '▾ '; }
.advanced .editor-grid { margin-top: 16px; }

.editor-grid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.sidebar { display: flex; flex-direction: column; gap: 12px; }
.file-list { list-style: none; padding: 0; margin: 0; max-height: 360px; overflow: auto; font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; }
.file-list li { padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.file-list li:hover { background: #f1f5f9; }
.file-list li.active { background: var(--accent); color: #fff; }
.file-list li.dim { color: var(--muted); cursor: default; }
.workspace { display: flex; flex-direction: column; gap: 12px; }
.workspace-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: #fff; border: 1px solid var(--border); border-radius: 8px;
}
#editor { min-height: 420px; resize: vertical; }

/* Forms */
.form-grid { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.form-grid label { font-size: 0.9rem; color: var(--muted); }
.form-grid input[type=text], .form-grid input[type=password] { color: var(--text); }
.form-grid fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 10px; }
.form-grid fieldset legend { padding: 0 6px; font-size: 0.85rem; color: var(--muted); }
label.checkbox { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; color: var(--text); }
label.checkbox input { width: auto; }

/* Users table */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.users-table th { background: #f8fafc; font-weight: 600; }
.chip { display: inline-flex; gap: 4px; align-items: center; font-size: 0.8rem; margin-right: 8px; }
.inline-form { display: flex; flex-direction: column; gap: 8px; }
.site-card.new-site-card {
    border: 2px dashed var(--border);
    background: #fafafa;
}
.site-card.new-site-card:hover { border-color: var(--accent); background: #fff; }
.site-card.new-site-card h2 { color: var(--accent-dark); }
.published-flash {
    display: inline-block;
    background: var(--success-bg);
    border: 1px solid #16a34a;
    color: #166534;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
}
.publish-success {
    margin-top: 16px;
    padding: 16px 18px;
    border: 1px solid #16a34a;
    background: var(--success-bg);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.publish-success strong { color: #166534; font-size: 1.05rem; }
.publish-info p { margin: 4px 0 0; }
.publish-actions { display: flex; gap: 10px; align-items: center; }
.publish-actions .btn-link {
    display: inline-block;
    padding: 9px 16px;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
}
.publish-actions .btn-link:hover { background: var(--accent-dark); text-decoration: none; }
.media-card .media-upload { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.media-card .media-upload label { flex: 1; min-width: 200px; }
.media-card .media-upload label input[type=text] { width: 100%; }
.media-card .media-upload button { white-space: nowrap; }
.media-section-title { margin: 18px 0 10px; font-size: 0.95rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.media-tile { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.media-thumb { height: 110px; display: flex; align-items: center; justify-content: center; background: #f8fafc; padding: 8px; }
.media-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.media-thumb .media-ext { font-family: ui-monospace, Menlo, monospace; font-weight: 700; color: var(--muted); font-size: 1rem; }
.media-meta { padding: 8px 10px; }
.media-path { display: block; font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: #f1f5f9; padding: 3px 6px; border-radius: 4px; }
.media-actions { display: flex; gap: 6px; margin-top: 8px; }
.media-actions button { padding: 4px 8px; font-size: 0.75rem; font-weight: 500; }
.form-grid select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    margin-top: 4px;
    font-size: 1rem;
}

/* Dashboard table */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-header h1 { margin: 0 0 4px; }
.page-header .subtitle { color: var(--muted); margin: 0; }
.btn-link.primary-btn {
    display: inline-block;
    padding: 10px 16px;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.btn-link.primary-btn:hover { background: var(--accent-dark); text-decoration: none; }
.sites-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.sites-table th, .sites-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.sites-table thead th { background: #f8fafc; font-weight: 600; color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.sites-table tbody tr:last-child td { border-bottom: 0; }
.sites-table tbody tr:hover { background: #fafafa; }
.sites-table .btn-link {
    display: inline-block;
    padding: 6px 12px;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
}
.sites-table .btn-link:hover { background: var(--accent-dark); text-decoration: none; }

/* Editor side-by-side */
.editor-2col {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
}
.editor-2col .card { margin-bottom: 0; }
.editor-2col .preview-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.editor-2col #preview-frame { width: 100%; flex: 1; min-height: 640px; border: 0; background: #fff; }
@media (max-width: 1000px) {
    .editor-2col { grid-template-columns: 1fr; }
    .editor-2col #preview-frame { min-height: 480px; }
}

/* === Dashboard redesign === */
body { background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%); min-height: 100vh; }

.topbar {
    background: #fff;
    border-bottom: 0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    padding: 14px 28px;
}
.topbar .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
}
.topbar .brand::before {
    content: '';
    display: inline-block;
    width: 10px; height: 10px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}
.topbar nav a {
    color: var(--muted);
    font-weight: 500;
    padding: 4px 0;
    transition: color 0.15s;
}
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar .who {
    color: var(--text);
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 500;
}

/* Dashboard hero */
.dash-hero {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 28px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 32px;
    align-items: center;
    border: 1px solid #fed7aa;
}
@media (max-width: 880px) {
    .dash-hero { grid-template-columns: 1fr; padding: 24px; }
    .dash-stats { flex-wrap: wrap; }
}
.dash-hero h1 { font-size: 1.85rem; margin: 0 0 4px; font-weight: 700; }
.dash-hero-sub { color: var(--muted); margin: 0; font-size: 1.05rem; }
.dash-hero-sub strong { color: var(--text); }

.dash-stats { display: flex; gap: 14px; }
.stat {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 12px;
    padding: 16px 20px;
    min-width: 140px;
    border: 1px solid rgba(254, 215, 170, 0.7);
}
.stat-val { font-size: 1.7rem; font-weight: 700; line-height: 1.1; color: var(--text); }
.stat-val.stat-text { font-size: 1.1rem; }
.stat-val .ok { color: #16a34a; }
.stat-val .warn { color: #dc2626; }
.stat-label {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 6px;
    font-weight: 700;
}

/* Sites grid section */
.dash-sites-section { margin-top: 8px; }
.dash-sites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.dash-sites-header h2 { font-size: 1.35rem; margin: 0; font-weight: 700; }
.primary-btn {
    display: inline-flex;
    align-items: center;
    padding: 11px 20px;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.28);
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.primary-btn:hover {
    background: var(--accent-dark);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.38);
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}
.dash-tile {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
}
.dash-tile:hover {
    text-decoration: none;
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.10);
}
.dash-tile-banner {
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.dash-tile-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.22), transparent 65%);
    pointer-events: none;
}
.dash-tile-monogram {
    font-size: 2.6rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.dash-tile-body {
    padding: 18px 18px 8px;
}
.dash-tile-body h3 {
    margin: 0 0 6px;
    font-size: 1.1rem;
    font-weight: 600;
}
.dash-tile-slug {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    color: var(--muted);
}
.dash-tile-footer {
    padding: 12px 18px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    margin-top: 10px;
}
.dash-tile-url {
    font-size: 0.78rem;
    color: var(--muted);
    font-family: ui-monospace, Menlo, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}
.dash-tile-edit { color: var(--accent-dark); font-weight: 600; font-size: 0.9rem; }

.dash-empty {
    background: #fff;
    border-radius: 14px;
    padding: 60px 24px;
    text-align: center;
    border: 2px dashed var(--border);
}
.dash-empty-icon { font-size: 2.4rem; margin-bottom: 10px; }
.dash-empty h3 { margin: 0 0 8px; font-size: 1.2rem; }
.dash-empty p { color: var(--muted); margin: 0 0 18px; max-width: 420px; margin-left: auto; margin-right: auto; }

/* === v3 enterprise SaaS redesign === */
:root {
    --sidebar-bg: #0b1220;
    --sidebar-text: #94a3b8;
    --sidebar-text-bright: #f8fafc;
    --sidebar-active-bg: rgba(255, 255, 255, 0.07);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.04);
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --bg-body: #f6f7f9;
    --surface: #fff;
    --border: #e5e7eb;
    --border-light: #f1f5f9;
    --text-strong: #0f172a;
    --text: #334155;
    --muted: #64748b;
    --green: #10b981;
    --green-soft: #ecfdf5;
    --red: #ef4444;
    --amber: #f59e0b;
}

body.app-body {
    background: var(--bg-body);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
    font-feature-settings: 'cv11', 'ss01', 'ss03';
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--sidebar-border);
}
.sidebar-top { padding: 22px 20px 18px; border-bottom: 1px solid var(--sidebar-border); }
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--sidebar-text-bright);
    font-weight: 700;
    font-size: 0.98rem;
    letter-spacing: -0.01em;
    text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; color: var(--sidebar-text-bright); }
.sidebar-brand-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.22);
}
.sidebar-nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 7px;
    color: var(--sidebar-text);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
}
.sidebar-link:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-text-bright); text-decoration: none; }
.sidebar-link.active { background: var(--sidebar-active-bg); color: var(--sidebar-text-bright); font-weight: 600; }
.sidebar-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.9; }

.sidebar-footer {
    padding: 14px 12px 16px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.sidebar-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.sidebar-user-meta { min-width: 0; }
.sidebar-username { font-size: 0.85rem; font-weight: 600; color: var(--sidebar-text-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-userrole { font-size: 0.7rem; color: var(--sidebar-text); margin-top: 1px; }
.sidebar-logout {
    width: 32px; height: 32px;
    border-radius: 7px;
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
}
.sidebar-logout:hover { background: var(--sidebar-active-bg); color: var(--sidebar-text-bright); text-decoration: none; }
.sidebar-logout svg { width: 16px; height: 16px; }

/* Main content area */
.app-main { flex: 1; min-width: 0; max-width: none; padding: 0; margin: 0; }
.app-content { padding: 32px 36px; max-width: 1440px; margin: 0 auto; }

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 26px;
    flex-wrap: wrap;
    gap: 16px;
}
.eyebrow {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}
.page-title {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-strong);
    margin: 0;
    letter-spacing: -0.02em;
}
.primary-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: var(--text-strong);
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    border: 0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.05);
    transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}
.primary-btn:hover { background: #1e293b; text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 8px rgba(15, 23, 42, 0.12); }
.primary-btn svg { width: 14px; height: 14px; }

/* Stat chip row */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}
.stat-chip {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
}
.stat-chip-icon {
    width: 38px; height: 38px;
    border-radius: 9px;
    background: var(--border-light);
    color: var(--text-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-chip-icon svg { width: 18px; height: 18px; }
.stat-chip-icon.ok { background: var(--green-soft); color: var(--green); }
.stat-chip-icon.warn { background: #fef3c7; color: var(--amber); }
.stat-chip-val { font-size: 1rem; font-weight: 600; color: var(--text-strong); line-height: 1.25; font-feature-settings: 'tnum'; }
.stat-chip-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; font-weight: 600; }

/* Dashboard controls + search */
.dashboard-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 14px;
}
.search-wrap {
    position: relative;
    flex: 1;
    max-width: 360px;
}
.search-wrap svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--muted);
    pointer-events: none;
}
.search-wrap input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.12s, box-shadow 0.12s;
    margin-top: 0;
}
.search-wrap input:focus {
    outline: none;
    border-color: var(--text-strong);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}
.small { font-size: 0.82rem; }

/* Site cards */
.site-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.site-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.site-card:hover {
    text-decoration: none;
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    border-color: #cbd5e1;
}
.site-card-banner {
    height: 90px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.site-card-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.2), transparent 65%);
    pointer-events: none;
}
.site-card-mono {
    font-size: 1.9rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
    font-feature-settings: 'tnum';
}
.status-pill {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-strong);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 8px 3px 22px;
    border-radius: 999px;
    z-index: 1;
}
.status-pill .dot {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}
.site-card-body { padding: 16px 18px 8px; }
.site-card-body h3 {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-strong);
    letter-spacing: -0.01em;
}
.site-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--muted);
}
.site-card-meta .dot-sep { opacity: 0.5; }
.site-card-footer {
    padding: 12px 18px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-light);
    margin-top: 10px;
}
.site-card-footer code {
    background: var(--border-light);
    color: var(--muted);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
}
.site-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-strong);
    font-weight: 600;
    font-size: 0.82rem;
}
.site-card-cta svg { transition: transform 0.15s; }
.site-card:hover .site-card-cta svg { transform: translateX(2px); }

/* Empty state */
.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 60px 24px;
    text-align: center;
}
.empty-state-icon { color: var(--muted); margin-bottom: 14px; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-strong); margin: 0 0 8px; }
.empty-state p { color: var(--muted); margin: 0 0 18px; max-width: 420px; margin-left: auto; margin-right: auto; }

/* Inherit Inter inside other pages */
h1, h2, h3, h4 { color: var(--text-strong); letter-spacing: -0.01em; }
h1 { font-weight: 700; }

/* Narrow screens: icon-only sidebar */
@media (max-width: 1024px) {
    .app-sidebar { width: 64px; }
    .sidebar-brand-text, .sidebar-link span, .sidebar-user-meta { display: none; }
    .sidebar-link { justify-content: center; padding: 10px; }
    .sidebar-user { justify-content: center; }
    .sidebar-footer { flex-direction: column; gap: 8px; }
    .app-content { padding: 24px 20px; }
}

/* === Modal (restored) === */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    padding: 24px;
    z-index: 1000;
    overflow-y: auto;
}
.modal:not([hidden]) {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.modal-content {
    background: var(--surface);
    border-radius: 14px;
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.25);
    margin: auto;
}
.modal-content.wide { max-width: 960px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-strong);
    letter-spacing: -0.01em;
}
.modal-close {
    background: transparent;
    border: 0;
    font-size: 1.4rem;
    color: var(--muted);
    cursor: pointer;
    padding: 4px 10px;
    line-height: 1;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
}
.modal-close:hover { background: var(--border-light); color: var(--text-strong); }

/* Single full-width stat chip (override) */
.stat-row { grid-template-columns: 1fr; }
.stat-row .stat-chip { padding: 18px 22px; }
.stat-row .stat-chip-val { font-size: 1.4rem; }

/* === v4: AI progress, error, viewport switcher === */

/* AI progress card */
.ai-progress {
    margin-top: 16px;
    padding: 18px;
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border: 1px solid #fed7aa;
    border-radius: 10px;
}
.ai-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}
.ai-progress-label { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ai-progress-spinner {
    flex-shrink: 0;
    width: 20px; height: 20px;
    border: 2px solid rgba(154, 52, 18, 0.18);
    border-top-color: #c2410c;
    border-radius: 50%;
    animation: ai-spin 0.85s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-progress-title { font-weight: 600; color: #7c2d12; line-height: 1.3; font-size: 0.95rem; }
.ai-progress-sub { color: #9a3412; font-size: 0.82rem; margin-top: 2px; }
.ai-progress-time {
    font-feature-settings: 'tnum';
    color: #9a3412;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.6);
    padding: 4px 10px;
    border-radius: 999px;
    flex-shrink: 0;
}
.ai-progress-bar {
    height: 6px;
    background: rgba(154, 52, 18, 0.15);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.ai-progress-bar-fill {
    position: absolute;
    top: 0; bottom: 0;
    width: 35%;
    background: linear-gradient(90deg, transparent 0%, #f97316 50%, transparent 100%);
    animation: ai-indeterminate 1.6s ease-in-out infinite;
}
@keyframes ai-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}
.ai-progress-note {
    margin: 12px 0 0;
    font-size: 0.78rem;
    color: #9a3412;
    line-height: 1.4;
}

/* Error card */
.ai-error {
    margin-top: 16px;
    padding: 14px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}
.ai-error strong { color: #991b1b; display: block; font-size: 0.95rem; }
.ai-error p { color: #b91c1c; margin: 4px 0 0; font-size: 0.85rem; }
.ai-error button { background: #fff; color: #991b1b; border: 1px solid #fecaca; padding: 6px 12px; font-size: 0.82rem; flex-shrink: 0; }

/* Preview toolbar — re-styled */
.preview-toolbar {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    gap: 12px;
}
.preview-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
.preview-actions button, .preview-actions .icon-link {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s;
}
.preview-actions button:hover, .preview-actions .icon-link:hover {
    background: var(--border-light);
    border-color: #cbd5e1;
    text-decoration: none;
}
.preview-actions button svg, .preview-actions .icon-link svg { width: 14px; height: 14px; }

/* Viewport segmented toggle */
.viewport-toggle {
    display: inline-flex;
    background: var(--border-light);
    border-radius: 8px;
    padding: 3px;
    gap: 1px;
}
.viewport-toggle button {
    background: transparent;
    color: var(--muted);
    border: 0;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}
.viewport-toggle button:hover { color: var(--text); }
.viewport-toggle button.active {
    background: var(--surface);
    color: var(--text-strong);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.viewport-toggle button svg { width: 15px; height: 15px; }

/* Viewport frames */
.preview-viewport { background: var(--surface); transition: background 0.18s; height: 640px; display: flex; align-items: stretch; justify-content: center; overflow: hidden; }
.preview-viewport.vp-desktop iframe { width: 100%; height: 100%; border: 0; }
.preview-viewport.vp-tablet,
.preview-viewport.vp-phone {
    background: #1e293b;
    padding: 24px;
    align-items: center;
}
.preview-viewport.vp-tablet iframe {
    width: 100%;
    max-width: 768px;
    height: 100%;
    border: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.preview-viewport.vp-phone iframe {
    width: 100%;
    max-width: 375px;
    height: 100%;
    border: 0;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* AI card primary button alignment */
.ai-card .primary-btn { padding: 11px 22px; }
.ai-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.ai-actions p { margin: 0; }

/* Pending banner: rename Accept feel + new commit button */
.pending-change .primary-btn { padding: 9px 18px; }
.pending-actions { display: flex; gap: 10px; align-items: center; }

@media (max-width: 900px) {
    .preview-viewport { height: 520px; }
}

/* === v5: profile / users / mfa / deploy === */

/* Login brand row */
.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--text-strong);
    margin-bottom: 24px;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}
.login-brand .sidebar-brand-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.22);
}

/* OTP input */
.otp-input {
    font-size: 1.6rem;
    letter-spacing: 0.5em;
    text-align: center;
    font-feature-settings: 'tnum';
    font-family: ui-monospace, Menlo, monospace;
    padding: 14px;
}
.linklike {
    background: transparent;
    color: var(--accent-dark);
    border: 0;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.85rem;
    padding: 0;
}

/* Form row (3-up) */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

/* Users table v2 */
.users-table-v2 { width: 100%; border-collapse: collapse; }
.users-table-v2 th, .users-table-v2 td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border-light); }
.users-table-v2 th { background: #f8fafc; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.users-table-v2 tbody tr { cursor: pointer; transition: background 0.12s; }
.users-table-v2 tbody tr:hover { background: var(--surface-hover, #fafbfc); }
.users-table-v2 .row-action { color: var(--accent-dark); font-weight: 600; font-size: 0.85rem; text-align: right; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; }
.badge-ok { background: var(--green-soft); color: #065f46; }

/* MFA panel */
.mfa-current { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px; background: var(--green-soft); border-radius: 8px; border: 1px solid #a7f3d0; }
.mfa-status { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.mfa-status .status-pill { padding-left: 22px; position: relative; background: #fff; }
.mfa-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 8px; }
.mfa-choice {
    display: flex; flex-direction: column; gap: 6px;
    text-align: left;
    padding: 16px 18px;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    width: 100%;
    transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
    font-weight: 500;
}
.mfa-choice:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06); }
.mfa-choice strong { color: var(--text-strong); font-size: 1rem; }
.mfa-choice .muted { font-size: 0.82rem; }

.totp-enroll { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.totp-qr { width: 200px; height: 200px; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 8px; }
.totp-secret code { display: inline-block; padding: 8px 12px; background: var(--border-light); border-radius: 6px; font-size: 1rem; letter-spacing: 0.1em; }
.totp-secret .muted { margin-bottom: 8px; }

/* Danger zone */
.danger-card { border-color: #fecaca; background: #fef2f2; }
.danger-card h3 { color: #991b1b; }

/* Deploy page */
.dns-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 0.9rem; }
.dns-table th, .dns-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-light); text-align: left; }
.dns-table th { background: #f8fafc; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.dns-table code { background: #f1f5f9; padding: 2px 8px; border-radius: 4px; font-size: 0.85rem; }
.code-block { background: #0f172a; color: #e2e8f0; padding: 16px 18px; border-radius: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 0.82rem; line-height: 1.5; overflow-x: auto; white-space: pre; }

/* === Multi-select dropdown (site access, etc.) === */
.multiselect { position: relative; margin-bottom: 4px; }
.multiselect-field-label { display: block; font-size: 0.78rem; color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.multiselect details {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.multiselect details[open] { border-color: var(--text-strong); box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08); }
.multiselect summary {
    list-style: none;
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    gap: 12px;
}
.multiselect summary::-webkit-details-marker { display: none; }
.multiselect-count { font-size: 0.92rem; color: var(--text); font-weight: 500; }
.multiselect[data-disabled="1"] summary { background: var(--border-light); cursor: not-allowed; color: var(--muted); }
.multiselect[data-disabled="1"] .multiselect-count { color: var(--muted); }
.multiselect-chevron { width: 16px; height: 16px; color: var(--muted); transition: transform 0.18s; flex-shrink: 0; }
.multiselect details[open] .multiselect-chevron { transform: rotate(180deg); }

.multiselect-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.10);
    z-index: 50;
    overflow: hidden;
}
.multiselect-search {
    width: 100%;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
    margin: 0;
    background: #f8fafc;
    border-radius: 0;
    outline: none;
}
.multiselect-options {
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
}
.multiselect-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 0.85rem; }
.multiselect-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    margin: 0;
    transition: background 0.12s;
}
.multiselect-option:hover { background: var(--border-light); }
.multiselect-option input { width: auto; margin: 0; flex-shrink: 0; }
.multiselect-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.multiselect-text strong { font-size: 0.9rem; font-weight: 600; color: var(--text-strong); line-height: 1.3; }
.multiselect-slug { background: var(--border-light); padding: 1px 6px; border-radius: 3px; font-size: 0.68rem; color: var(--muted); align-self: flex-start; font-family: ui-monospace, Menlo, monospace; margin-top: 1px; }

/* === v6: modern form inputs === */
input[type=text],
input[type=email],
input[type=password],
input[type=search],
input[type=url],
input[type=tel],
input[type=number],
input[type=date],
textarea,
select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    margin-top: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-strong);
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
    line-height: 1.4;
}

select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

input[type=text]:hover:not(:focus):not(:disabled),
input[type=email]:hover:not(:focus):not(:disabled),
input[type=password]:hover:not(:focus):not(:disabled),
input[type=search]:hover:not(:focus):not(:disabled),
input[type=url]:hover:not(:focus):not(:disabled),
input[type=tel]:hover:not(:focus):not(:disabled),
input[type=number]:hover:not(:focus):not(:disabled),
textarea:hover:not(:focus):not(:disabled),
select:hover:not(:focus):not(:disabled) {
    border-color: #cbd5e1;
}

input[type=text]:focus,
input[type=email]:focus,
input[type=password]:focus,
input[type=search]:focus,
input[type=url]:focus,
input[type=tel]:focus,
input[type=number]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--text-strong);
    box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.08);
}

input:disabled, textarea:disabled, select:disabled {
    background: var(--border-light);
    color: var(--muted);
    cursor: not-allowed;
}

input::placeholder, textarea::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* Label refinement — clean caps-style eyebrows above inputs */
.form-grid > label, .login-card label, .form-row > label {
    font-size: 0.78rem;
    color: var(--text);
    font-weight: 600;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0;
}
.form-grid > label.checkbox, .login-card label.checkbox, .form-row > label.checkbox {
    font-weight: 400;
    margin-bottom: 0;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.95rem;
    color: var(--text);
}

/* Input with leading icon */
.input-with-icon { position: relative; display: block; margin-top: 6px; }
.input-with-icon input {
    padding-left: 42px;
    margin-top: 0;
}
.input-with-icon-svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 17px; height: 17px;
    color: var(--muted);
    pointer-events: none;
}
.input-with-icon input:focus ~ .input-with-icon-svg,
.input-with-icon:focus-within .input-with-icon-svg { color: var(--text-strong); }

/* Login card polish */
.login-card {
    padding: 38px 36px 32px;
    box-shadow: 0 28px 56px rgba(15, 23, 42, 0.10), 0 0 0 1px rgba(15, 23, 42, 0.04);
    border-radius: 16px;
    background: #fff;
}
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card form > button { margin-top: 6px; padding: 12px; font-size: 0.95rem; }
.login-card h1 { font-size: 1.5rem; margin: 0 0 4px; letter-spacing: -0.02em; font-weight: 700; }
.login-card .subtitle { color: var(--muted); margin: 0 0 26px; font-size: 0.92rem; }
.login-card .login-brand { margin-bottom: 28px; font-size: 0.92rem; }

/* === v7: dashboard sites table === */
.sites-table-card { padding: 0; overflow: hidden; }
.sites-table-v3 { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.sites-table-v3 thead th {
    background: #fafbfc;
    padding: 12px 18px;
    text-align: left;
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.sites-table-v3 thead th.num { text-align: right; }
.sites-table-v3 tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
.sites-table-v3 tbody tr {
    cursor: pointer;
    transition: background 0.12s;
}
.sites-table-v3 tbody tr:hover { background: #fafbfc; }
.sites-table-v3 tbody tr:last-child td { border-bottom: 0; }
.sites-table-v3 td.num { text-align: right; font-feature-settings: 'tnum'; color: var(--text-strong); font-weight: 500; }
.sites-table-v3 td.muted { color: var(--muted); }
.sites-table-v3 td code {
    background: var(--border-light);
    color: var(--muted);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
}

.site-cell { display: flex; align-items: center; gap: 12px; }
.site-avatar {
    width: 34px; height: 34px;
    border-radius: 8px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.site-label { font-weight: 600; color: var(--text-strong); }

.sites-table-v3 .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 6px;
    background: var(--green-soft);
    color: #065f46;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}
.sites-table-v3 .badge .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}
.sites-table-v3 .row-action {
    color: var(--text-strong);
    font-weight: 600;
    font-size: 0.82rem;
    text-align: right;
    white-space: nowrap;
}
.sites-table-v3 .row-action svg { vertical-align: middle; margin-left: 3px; transition: transform 0.12s; }
.sites-table-v3 tbody tr:hover .row-action svg { transform: translateX(2px); }

@media (max-width: 720px) {
    .sites-table-v3 th, .sites-table-v3 td { padding: 12px; }
    .sites-table-v3 .row-action svg { display: none; }
}

/* === v8: editor changes-table layout === */
.prompt-card { padding: 22px 24px; }
.prompt-card textarea { font-size: 0.95rem; padding: 12px 14px; }
.prompt-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.prompt-actions p { margin: 0; }

.changes-card { padding: 0; overflow: hidden; }
.changes-header {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 16px 22px 12px;
    border-bottom: 1px solid var(--border-light);
}
.changes-header h3 { margin: 0; }
.changes-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.changes-table thead th {
    background: #fafbfc;
    padding: 10px 18px;
    text-align: left;
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
}
.changes-table tbody td { padding: 12px 18px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.changes-table tbody tr.changes-row { cursor: pointer; transition: background 0.12s; }
.changes-table tbody tr.changes-row:hover { background: #fafbfc; }
.changes-table tbody tr:last-child td { border-bottom: 0; }
.changes-table .instr-cell { color: var(--text-strong); font-weight: 500; max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.changes-table td code { background: var(--border-light); color: var(--muted); padding: 2px 8px; border-radius: 4px; font-size: 0.78rem; }
.changes-table .row-action { color: var(--muted); text-align: right; }
.changes-table tbody tr.changes-row:hover .row-action { color: var(--text-strong); }
.changes-empty td { padding: 32px 22px; text-align: center; color: var(--muted); }

/* Status badges */
.changes-table .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}
.badge-running { background: #fff7ed; color: #9a3412; }
.badge-running .spinner-dot {
    width: 8px; height: 8px;
    border: 1.5px solid rgba(154,52,18,.3);
    border-top-color: #c2410c;
    border-radius: 50%;
    animation: spin-dot .8s linear infinite;
}
@keyframes spin-dot { to { transform: rotate(360deg); } }
.badge-done { background: #fef3c7; color: #92400e; padding-left: 6px; }
.badge-done .dot { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
.badge-committed { background: var(--green-soft); color: #065f46; }
.badge-reverted { background: var(--border-light); color: var(--muted); }
.badge-failed { background: #fef2f2; color: #991b1b; }

/* Inline expanded detail row */
.changes-detail td { padding: 0 !important; background: #fafbfc; border-bottom: 1px solid var(--border-light); }
.changes-detail-content { padding: 18px 22px; }
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 14px;
}
.detail-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; margin-bottom: 4px; }
.detail-value { color: var(--text-strong); font-size: 0.92rem; line-height: 1.5; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid var(--border-light); margin-top: 6px; padding-top: 14px; }
.detail-actions button { font-size: 0.85rem; padding: 7px 14px; }
.detail-actions button.primary-btn { background: var(--accent); color: #fff; }

.changes-table th:last-child, .changes-table td:last-child { width: 1%; white-space: nowrap; padding-left: 8px; }

/* Old colored-state cards: dead CSS, but neutralize in case the elements still appear elsewhere */
#ai-progress, #pending-change, #publish-success, #ai-error { display: none !important; }

/* === v9: taller live preview === */
.preview-viewport { height: clamp(640px, 82vh, 1280px); }
@media (max-width: 900px) {
    .preview-viewport { height: clamp(480px, 70vh, 900px); }
}

/* === v10: cleaner expanded detail row + tighter spacing === */
.changes-detail-content { padding: 18px 22px 20px; max-width: 100%; }
.changes-detail-content .detail-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    column-gap: 18px;
    align-items: baseline;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-light);
}
.changes-detail-content .detail-row:last-of-type { border-bottom: 0; }
.changes-detail-content .detail-label {
    font-size: 0.74rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin: 0;
    padding-top: 1px;
}
.changes-detail-content .detail-value {
    color: var(--text-strong);
    font-size: 0.93rem;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
}
.changes-detail-content .detail-code {
    background: var(--border-light);
    color: var(--muted);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.82rem;
}
.changes-detail-content .detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.changes-detail-content .detail-actions button { font-size: 0.85rem; padding: 8px 14px; }

@media (max-width: 680px) {
    .changes-detail-content .detail-row { grid-template-columns: 1fr; row-gap: 4px; }
}

/* === New-site modal tabs === */
.new-site-tabs {
    display: flex;
    gap: 4px;
    background: var(--border-light);
    padding: 4px;
    border-radius: 9px;
    margin-bottom: 16px;
}
.new-site-tabs .tab {
    flex: 1;
    background: transparent;
    color: var(--muted);
    border: 0;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.new-site-tabs .tab:hover { color: var(--text); }
.new-site-tabs .tab.active {
    background: var(--surface);
    color: var(--text-strong);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.tab-panel p { margin-top: 0; }

/* === v11: delete site flow + archived section === */
.danger-zone {
    border: 1px solid #fecaca;
    background: #fef2f2;
}
.danger-zone h3 { color: #991b1b !important; font-size: 1rem; }
.danger-zone .danger {
    background: #dc2626;
    color: #fff;
    border: 0;
    padding: 9px 18px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
}
.danger-zone .danger:hover { background: #b91c1c; }

.delete-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 6px;
}
.delete-choice-form { display: contents; }
.delete-choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    text-align: left;
    padding: 18px 18px 16px;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    width: 100%;
    transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s, background 0.12s;
    font-weight: 500;
}
.delete-choice:hover {
    border-color: var(--text-strong);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
.delete-choice strong { color: var(--text-strong); font-size: 1rem; }
.delete-choice p { color: var(--muted); margin: 0; font-size: 0.85rem; line-height: 1.5; font-weight: 400; }
.delete-choice-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--border-light);
    color: var(--text-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}
.delete-choice-icon svg { width: 18px; height: 18px; }
.delete-choice-icon.danger { background: #fef2f2; color: #dc2626; }
.delete-choice-danger:hover { border-color: #dc2626; }
.delete-choice-danger:hover strong { color: #991b1b; }

#delete-confirm-submit.danger:not(:disabled) { background: #dc2626; color: #fff; border: 0; }
#delete-confirm-submit.danger:not(:disabled):hover { background: #b91c1c; }

/* Archived section */
.archived-section { margin-top: 26px; }
.archived-section > summary {
    cursor: pointer;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--muted);
    list-style: none;
    display: inline-block;
}
.archived-section > summary::before { content: '▸ '; }
.archived-section[open] > summary::before { content: '▾ '; }
.archived-section > summary strong { color: var(--text-strong); }
.archived-section .sites-table-v3 tbody tr { cursor: default; }
.archived-section .sites-table-v3 tbody tr:hover { background: transparent; }
.archived-section button[type=submit] {
    background: #fff;
    color: var(--text-strong);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
}
.archived-section button[type=submit]:hover { border-color: var(--text-strong); }
