/* ============================================================
   Tetractys Editor — Design System (GitHub/Vercel inspired)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600&display=swap');

:root {
    /* Core palette */
    --bg-base: #09090b;
    /* Zinc-950 — deepest bg */
    --bg-surface: #111113;
    /* cards, sidebar */
    --bg-subtle: #18181b;
    /* inputs, inset areas */
    --bg-hover: #1f1f23;
    /* hover states */

    /* Borders */
    --border-muted: #27272a;
    /* subtle dividers */
    --border-base: #3f3f46;
    /* default border */
    --border-focus: #71717a;
    /* focus ring neutral */

    /* Text */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;

    /* Accent — crisp white-leaning blue for actions */
    --accent: #e4e4e7;
    --accent-fg: #09090b;

    /* Semantic */
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;

    /* Radii */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 12px 28px -4px rgb(0 0 0 / 0.6);

    /* Transitions */
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --transition: all 0.15s var(--ease);
}

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

/* ── Base ───────────────────────────────────────────────── */
body {
    font-family: 'Geist', 'Inter', system-ui, -apple-system, sans-serif;
    background-color: #0a0a0a;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0);
    background-size: 20px 20px;
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

body.logged-in {
    align-items: flex-start;
    padding-top: 0rem;
}

/* ── App Shell ──────────────────────────────────────────── */
.app-container {
    width: 100%;
    /* max-width: 1040px; */
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2.5rem 1.25rem;
}

/* ── Header ─────────────────────────────────────────────── */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-muted);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-content h1 {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 0;
}

.header-content p {
    color: var(--text-tertiary);
    font-size: 0.8125rem;
}

/* ── Header Site Identity (dynamic) ─────────────────────── */
.header-site-identity {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.header-site-link {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.25;
    transition: color 0.15s ease;
}

.header-site-link[href]:not([href="#"]):hover {
    color: var(--accent);
}

.header-site-link[href="#"] {
    cursor: default;
    pointer-events: none;
}

/* ── Header Repo Link (GitHub Logo + text) ────────────── */
.header-repo-row {
    display: flex;
    align-items: center;
}

.header-repo-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    text-decoration: none;
    transition: color 0.15s ease;
    line-height: 1;
}

.header-repo-link:hover {
    color: var(--text-secondary);
}

.header-repo-link[href="#"] {
    pointer-events: none;
}


/* ── Sidebar GitHub icon ─────────────────────────────────── */
.sidebar-github-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 1;
}

.sidebar-github-icon[href="#"] {
    pointer-events: none;
    opacity: 0.35;
}



.auth-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-muted);
    color: var(--text-secondary);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.disconnected .status-dot {
    background-color: var(--color-error);
}

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

/* ── Hero Section ────────────────────────────────────────── */
.hero-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    max-width: 400px;
    z-index: 1;
}

.tetractys-accent {
    margin-bottom: 0rem;
    opacity: 0.7;
    margin-top: 10px;
}

.hero-section h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.hero-subtext {
    font-size: 1.125rem;
    color: #a1a1a1;
    margin-bottom: 2.5rem;
    line-height: 1.6;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.btn-hero {
    background: #ffffff;
    color: #000000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-hero:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    background: #f8f8f8;
}

/* ── Main Layout ─────────────────────────────────────────── */
.app-main {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-muted);
    overflow: hidden;
    position: sticky;
    top: 2.5rem;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-muted);
}

.sidebar-header h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-tertiary);
}

.sidebar-main-nav {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    gap: 0.25rem;
}

.sidebar-main-nav-item {
    width: 100%;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-main-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-main-nav-item.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    font-weight: 500;
}

.sitemap-list {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    gap: 1px;
}

.sitemap-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0.8rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    gap: 0.5rem;
    border: 1px solid transparent;
}

.sitemap-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: rgba(128, 203, 196, 0.2);
}

.sitemap-item.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    font-weight: 500;
    border-color: rgba(229, 115, 153, 0.26);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.sitemap-item.active::before {
    content: '';
    display: block;
    width: 2px;
    height: 14px;
    background: var(--text-primary);
    border-radius: 1px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border-muted);
}

/* Sidebar action buttons (Settings, Sync All) */
.sidebar-nav-actions {
    display: flex;
    flex-direction: column;
    gap: 1px;
    border-top: 1px solid var(--border-muted);
    padding: 0.5rem;
}

.sidebar-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

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

/* Deployment status in sidebar */
.sidebar-status {
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--border-muted);
}

.sidebar-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.625rem;
}

.sidebar-status-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-tertiary);
}

.sidebar-status .deployment-message {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    margin-top: 0.5rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-status .status-badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
}

/* Raw file editor textareas */
.raw-editor {
    font-family: 'SF Mono', 'Geist Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    background: var(--bg-base);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    padding: 0.75rem;
    width: 100%;
    resize: vertical;
    tab-size: 2;
    transition: var(--transition);
}

.raw-editor:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgb(113 113 122 / 0.15);
    color: var(--text-primary);
}

.raw-editor-label {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.375rem;
}

.raw-editor-label label {
    display: flex;
    align-items: center;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0;
}



/* ── Content Area ────────────────────────────────────────── */
.content-area {
    flex: 1;
    min-width: 0;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    border: 1px solid var(--border-muted);
    transition: var(--transition);
}

.card h2 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.description {
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.setup-shell {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setup-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(circle at top left, rgba(229, 115, 153, 0.18), transparent 34%),
        radial-gradient(circle at bottom right, rgba(128, 203, 196, 0.18), transparent 34%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
}

.setup-eyebrow {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #80cbc4;
}

.setup-hero h2 {
    font-size: 1.85rem;
    line-height: 1.1;
    margin-bottom: 0.75rem;
}

.setup-hero .description {
    max-width: 44rem;
    margin-bottom: 0;
}

.setup-hero-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    min-width: 12rem;
}

.setup-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.95fr);
    gap: 1.25rem;
}

.setup-panel {
    padding: 1.25rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-muted);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
}

.setup-panel-header {
    margin-bottom: 1rem;
}

.setup-panel-copy {
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    line-height: 1.6;
    margin-top: 0.35rem;
}

.repo-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem;
}

.repo-site-card {
    width: 100%;
    text-align: left;
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
        rgba(255, 255, 255, 0.01);
    color: inherit;
    cursor: pointer;
    transition: transform 0.16s var(--ease), border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.repo-site-card:hover {
    transform: translateY(-2px);
    border-color: rgba(128, 203, 196, 0.45);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}

.repo-site-card-top {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.repo-site-card-top>div {
    min-width: 0;
}

.repo-site-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.repo-site-card-owner {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.repo-site-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(229, 115, 153, 0.28);
    background: rgba(229, 115, 153, 0.1);
    color: #f2c0d0;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.repo-site-card-body p {
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.55;
    min-height: 2.6rem;
}

.repo-site-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-tertiary);
    font-size: 0.72rem;
}

.repo-empty-state {
    grid-column: 1 / -1;
    padding: 1.5rem;
    border: 1px dashed var(--border-base);
    border-radius: var(--radius-lg);
    color: var(--text-tertiary);
    background: rgba(255, 255, 255, 0.02);
    text-align: center;
}

/* ── Form Elements ───────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

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

input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    background: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgb(113 113 122 / 0.15);
}

textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.readonly-input {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Layout Helpers ──────────────────────────────────────── */
.row {
    display: flex;
    gap: 0.75rem;
}

.col {
    flex: 1;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input,
.input-group select {
    flex: 1;
}

.grid {
    display: grid;
    gap: 0.75rem;
}

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

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.8125rem;
}

.text-muted {
    color: var(--text-tertiary);
}

.w-full {
    width: 100%;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1;
}

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

.btn-sm {
    padding: 0.3125rem 0.625rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

/* Primary — bright/white fill */
.btn-primary {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
    background: #d4d4d8;
    border-color: #d4d4d8;
}

/* Secondary — subtle outlined */
.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-base);
}

.btn-secondary:hover:not(:disabled) {
    background: #27272a;
    border-color: var(--border-focus);
}

/* Ghost — transparent */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-muted);
}

/* Danger */
.btn-danger {
    background: transparent;
    color: var(--color-error);
    border-color: transparent;
}

.btn-danger:hover:not(:disabled) {
    background: rgb(239 68 68 / 0.08);
    border-color: rgb(239 68 68 / 0.2);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.75rem;
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-muted);
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-muted);
}

.divider span {
    padding: 0 0.875rem;
}

/* ── Editor Specific ─────────────────────────────────────── */
.editor-header {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.header-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    background: var(--bg-hover);
    color: var(--text-tertiary);
    padding: 0.1875rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-muted);
    font-family: 'SF Mono', 'Geist Mono', 'Fira Code', monospace;
}

/* Content list panel in main editor */
.content-list-panel {
    margin-bottom: 1.25rem;
    padding: 0.75rem 0.75rem 0.5rem;
    border-radius: var(--radius-lg);
    background: var(--bg-subtle);
    border: 1px solid var(--border-muted);
}

.content-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.content-list-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-tertiary);
}

/* Normalize list layout inside Content/Schemas/Templates panels */
.content-list-panel .sitemap-list {
    padding: 0.25rem 0;
    gap: 2px;
}

.content-workspace-toolbar {
    display: grid;
    grid-template-columns: minmax(240px, 1.8fr) minmax(140px, 0.8fr) minmax(160px, 0.9fr);
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.content-workspace-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
}

.content-summary-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgba(128, 203, 196, 0.12);
    color: var(--text-secondary);
    border: 1px solid rgba(128, 203, 196, 0.24);
    font-size: 0.76rem;
    font-weight: 600;
}

.content-section-heading {
    padding: 0.85rem 1rem 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

.content-row {
    display: flex;
    justify-content: space-between;
    gap: 0.9rem;
    width: 100%;
    align-items: flex-start;
}

.content-row-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    flex: 1;
}

.content-row-path {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    font-family: 'SF Mono', 'Geist Mono', 'Fira Code', monospace;
}

.content-row-meta {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* ── Editor Tabs ─────────────────────────────────────────── */
.editor-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-muted);
}

.tab-btn {
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: var(--transition);
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

.tab-content.hidden {
    display: none;
}

/* Preview tab */
.preview-stage {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.preview-toolbar-copy {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.preview-expand-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.preview-container {
    width: 100%;
}

#preview-iframe {
    width: 100%;
    min-height: 55vh;
    height: 70vh;
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.preview-stage.is-expanded {
    position: fixed;
    inset: 1rem;
    z-index: 110;
    background: rgb(9 9 11 / 0.96);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    backdrop-filter: blur(10px);
}

.preview-stage.is-expanded .preview-container {
    flex: 1;
    min-height: 0;
}

.preview-stage.is-expanded #preview-iframe {
    height: 100%;
    min-height: 100%;
}

body.preview-expanded {
    overflow: hidden;
}

/* ── Inline Preview Floating Save Bar ────────────────────── */
.inline-save-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
    padding: 0.5rem 0.875rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-focus);
    border-radius: var(--radius-lg);
    position: sticky;
    bottom: 1rem;
    z-index: 5;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
    pointer-events: none;
}

.preview-stage.is-expanded .inline-save-bar {
    margin-top: 0;
}

.inline-save-bar.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.inline-save-hint {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
}

.inline-save-actions {
    display: flex;
    gap: 0.5rem;
}

.inline-save-context {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    flex: 1 1 18rem;
}

.inline-save-context-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-right: 0.15rem;
}

.inline-save-chip {
    border: 1px solid var(--border-base);
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 0.3rem 0.55rem;
    cursor: pointer;
    font-size: 0.78rem;
    line-height: 1.2;
}

.inline-save-chip[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}


/* ── Radio Cards ─────────────────────────────────────────── */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-subtle);
}

.radio-card:hover {
    border-color: var(--border-base);
    background: var(--bg-hover);
}

.radio-card input[type="radio"] {
    width: auto;
    padding: 0;
    margin-top: 0.1875rem;
    accent-color: var(--text-primary);
    flex-shrink: 0;
}

.radio-card:has(input:checked) {
    border-color: var(--border-focus);
    background: var(--bg-hover);
}

.radio-content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.radio-title {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.radio-desc {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.ftp-settings-panel {
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-muted);
}

/* ── Image Upload ────────────────────────────────────────── */
.image-upload-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-subtle);
    padding: 0.875rem;
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-base);
    transition: var(--transition);
}

.image-upload-container:hover {
    border-color: var(--border-focus);
}

.image-preview {
    height: 150px;
    border-radius: var(--radius-md);
    background-color: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.placeholder-text {
    color: var(--text-tertiary);
    font-size: 0.8125rem;
}

.image-actions {
    display: flex;
    gap: 0.5rem;
}

.image-actions input[type="text"] {
    flex: 1;
}

/* ── Deployment Status ───────────────────────────────────── */
.deployment-status {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-muted);
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.875rem;
}

.status-header h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.status-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.1875rem 0.625rem;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-badge.idle {
    background: rgb(113 113 122 / 0.12);
    color: var(--text-tertiary);
}

.status-badge.syncing {
    background: rgb(245 158 11 / 0.12);
    color: var(--color-warning);
}

.status-badge.building {
    background: rgb(59 130 246 / 0.12);
    color: var(--color-info);
}

.status-badge.live {
    background: rgb(34 197 94 / 0.12);
    color: var(--color-success);
}

.status-bar-container {
    height: 2px;
    background: var(--border-muted);
    border-radius: 1px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.status-progress {
    height: 100%;
    width: 0%;
    transition: width 0.4s var(--ease), background 0.2s;
    border-radius: 1px;
}

.status-badge.syncing~.status-bar-container .status-progress {
    background: var(--color-warning);
    width: 33%;
}

.status-badge.building~.status-bar-container .status-progress {
    background: var(--color-info);
    width: 66%;
}

.status-badge.live~.status-bar-container .status-progress {
    background: var(--color-success);
    width: 100%;
}

.deployment-message {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin: 0;
}

/* ── Toast Notifications ─────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 50;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-base);
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8125rem;
    animation: toastIn 0.25s var(--ease) forwards;
    transform: translateX(120%);
    min-width: 260px;
    max-width: 380px;
}

.toast.success {
    border-left: 3px solid var(--color-success);
}

.toast.error {
    border-left: 3px solid var(--color-error);
}

.toast.info {
    border-left: 3px solid var(--color-info);
}

.toast.hiding {
    animation: toastOut 0.2s var(--ease) forwards;
}

@keyframes toastIn {
    to {
        transform: translateX(0);
    }
}

@keyframes toastOut {
    to {
        transform: translateX(120%);
    }
}

/* ── Loading Overlay ─────────────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgb(9 9 11 / 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    gap: 1rem;
}

.overlay p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border-base);
    border-radius: 50%;
    border-top-color: var(--text-primary);
    animation: spin 0.7s linear infinite;
}

.btn-loader {
    width: 14px;
    height: 14px;
    border: 2px solid rgb(0 0 0 / 0.25);
    border-radius: 50%;
    border-top-color: var(--accent-fg);
    animation: spin 0.7s linear infinite;
}

/* For ghost/secondary buttons */
.btn-secondary .btn-loader,
.btn-ghost .btn-loader {
    border: 2px solid rgb(255 255 255 / 0.2);
    border-top-color: var(--text-primary);
}

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

/* ── Utilities ───────────────────────────────────────────── */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.2s var(--ease);
}

/* Rich Text Editor (schema tab) */
.rich-text-editor {
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    padding: 0.5rem;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
    margin-bottom: 1rem;
}

.rich-text-toolbar {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.rich-text-toolbar .btn {
    font-weight: 600;
    min-width: 2.5rem;
}

.rich-text-content {
    min-height: 180px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: #fff;
}

.rich-text-raw {
    width: 100%;
    min-height: 180px;
    max-height: 400px;
    resize: vertical;
    font-family: monospace;
    font-size: 0.95rem;
    margin-top: 0.6rem;
}

.blocks-editor {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.html-snippet-editor {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.html-snippet-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.html-snippet-empty-state {
    padding: 0.9rem 1rem;
    border: 1px dashed var(--border-base);
    border-radius: var(--radius-lg);
    color: var(--text-tertiary);
    background: var(--bg-subtle);
    font-size: 0.875rem;
}

.html-snippet-actions,
.html-snippet-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.html-snippet-item {
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    background: var(--bg-subtle);
    padding: 0.9rem;
}

.html-snippet-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.html-snippet-item-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
}

.html-snippet-item-controls {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.html-snippet-textarea {
    width: 100%;
    min-height: 9rem;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.92rem;
    margin-bottom: 0.75rem;
}

.html-snippet-chip {
    border: 1px solid var(--border-base);
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 0.35rem 0.65rem;
    cursor: pointer;
    font-size: 0.8rem;
}

.blocks-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.blocks-empty-state {
    padding: 0.9rem 1rem;
    border: 1px dashed var(--border-base);
    border-radius: var(--radius-lg);
    color: var(--text-tertiary);
    background: var(--bg-subtle);
    font-size: 0.875rem;
}

.blocks-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.block-item {
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    background: var(--bg-subtle);
    padding: 0.85rem;
}

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

.block-item-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
}

.block-item-controls {
    display: flex;
    gap: 0.35rem;
}

.block-image-editor,
.block-image-meta {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.block-image-meta {
    margin-top: 0.85rem;
}

/* Quill styling for inline preview editing */
.ql-toolbar {
    display: none !important;
    border: none;
}

.ql-toolbar.ql-focus,
.tetractys-editable:focus~.ql-toolbar {
    display: flex !important;
    position: fixed;
    top: 8px;
    left: 8px;
    background: rgba(28, 31, 38, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    z-index: 9999;
    gap: 0.2rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
}

.ql-container {
    border: none;
    font-family: inherit;
    font-size: inherit;
}

.ql-editor {
    padding: 0;
    min-height: auto;
}

.ql-editor.ql-blank::before {
    display: none;
}

.tetractys-editable.ql-editor {
    display: inline;
}

.ql-toolbar.ql-snow .ql-stroke {
    stroke: #fff;
}

.ql-toolbar.ql-snow .ql-fill {
    fill: #fff;
}

.ql-toolbar.ql-snow .ql-picker-label {
    color: #fff;
}

.ql-toolbar.ql-snow .ql-formats button:hover,
.ql-toolbar.ql-snow .ql-formats button.ql-active {
    color: #80cbc4;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Nav editor list */
.nav-editor-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── Nav Editor Row (dynamically injected by editor.js) ──── */
.nav-editor-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.nav-editor-row input[type="text"] {
    flex: 1;
}

.btn-remove-nav {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition);
    font-family: inherit;
    padding: 0;
}

.btn-remove-nav:hover {
    background: rgb(239 68 68 / 0.08);
    border-color: rgb(239 68 68 / 0.2);
    color: var(--color-error);
}

/* ── Step Status (dynamically injected) ──────────────────── */
.step {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.step.success {
    color: var(--color-success);
}

.step.failed {
    color: var(--color-error);
}

/* ── Utility Classes (also injected via innerHTML) ─────────── */
.p-4 {
    padding: 1rem;
}

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

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

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

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

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-base);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-focus);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    body {
        padding: 1.25rem 0.875rem;
    }

    .app-main {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
    }

    .card {
        padding: 1.25rem;
    }

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

    .content-workspace-toolbar {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }

    .setup-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .setup-hero-actions {
        width: 100%;
        align-items: stretch;
    }

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

    .repo-card-grid {
        grid-template-columns: 1fr;
    }

    .repo-site-card-meta {
        flex-direction: column;
    }
}

/* Page Settings Gear Icon */
.btn-page-settings {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8125rem;
    opacity: 0;
    transition: var(--transition);
    padding: 2px;
    border-radius: 4px;
    line-height: 1;
}

.sitemap-item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.92rem;
    font-weight: 600;
}

.sitemap-item:hover .btn-page-settings {
    opacity: 0.6;
}

.btn-page-settings:hover {
    opacity: 1 !important;
    background: var(--bg-hover);
}

/* Page Settings Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    z-index: 1000;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    z-index: 1001;
    overflow: hidden;
    opacity: 1;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
}

.modal-body {
    padding: 1.5rem;
    background: var(--bg-surface);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-muted);
    background: var(--bg-subtle);
}

#preview-tag-modal {
    max-width: 680px;
    background: var(--bg-surface);
    opacity: 1;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* Detail views (content, schemas, templates) */
.editor-detail.hidden {
    display: none;
}

/* ── Configuration Panel (Per-Page Schema & Template) ───── */
.config-panel {
    padding: 2rem;
}

.config-panel h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.config-panel .form-group {
    margin-bottom: 1.5rem;
}

.config-panel label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.config-panel .form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.config-panel .form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(228, 228, 231, 0.1);
}

/* ── Sidebar Controls (Draft & Deploy) ─────────────────── */
.sidebar-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    border-top: 1px solid var(--border-muted);
}

.btn-block {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-icon {
    font-size: 1rem;
    line-height: 1;
}

.btn-draft {
    background: var(--bg-hover);
    border: 1px solid var(--border-muted);
}

.btn-draft:hover {
    background: var(--bg-subtle);
    border-color: var(--border-base);
}

.btn-dark {
    background: #111;
    border: 1px solid #333;
    color: #fafafa;
}

.btn-dark:hover {
    background: #000;
    border-color: #444;
}

/* ── Deploy Split Button ─────────────────────────────────── */
.deploy-split-btn {
    display: flex;
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid #333;
}

.deploy-split-btn .deploy-main {
    flex: 1;
    border: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 0.75rem;
}

.deploy-split-btn .deploy-chevron {
    flex-shrink: 0;
    border: none;
    border-left: 1px solid #333;
    border-radius: 0;
    padding: 0.55rem 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.deploy-split-btn .deploy-chevron svg {
    transition: transform 0.2s ease;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.deploy-split-btn .deploy-chevron[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* ── Deploy Commit Message Panel ─────────────────────────── */
.deploy-message-panel {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.22s ease, opacity 0.18s ease, margin 0.22s ease;
    margin-top: 0;
}

.deploy-message-panel.open {
    max-height: 80px;
    opacity: 1;
    margin-top: 0.5rem;
}

.deploy-commit-input {
    font-size: 0.775rem;
    padding: 0.4rem 0.6rem;
    background: var(--bg-base);
    border-color: var(--border-muted);
}

.deploy-commit-input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(228, 228, 231, 0.1);
}

.deploy-commit-hint {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    margin: 0.25rem 0 0;
    line-height: 1.3;
}



/* ── Deployment Console ─────────────────────────────────── */
.deployment-console {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    z-index: 1001;
    overflow: hidden;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.deployment-console.hidden {
    display: none;
}

.deployment-console-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-subtle);
}

.deployment-console-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.deployment-console-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.deployment-console-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-muted);
    background: var(--bg-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.deployment-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.deployment-checklist li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.deployment-checklist li.pending {
    color: var(--text-tertiary);
    opacity: 0.6;
}

.deployment-checklist li.in-progress {
    color: var(--color-info);
    border-color: var(--color-info);
    background: rgba(59, 130, 246, 0.05);
}

.deployment-checklist li.success {
    color: var(--color-success);
    border-color: var(--color-success);
    background: rgba(34, 197, 94, 0.05);
}

.deployment-checklist li.error {
    color: var(--color-error);
    border-color: var(--color-error);
    background: rgba(239, 68, 68, 0.05);
}

.deployment-checklist li::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid currentColor;
    flex-shrink: 0;
}

.deployment-checklist li.in-progress::before {
    border: 2px solid transparent;
    border-right-color: currentColor;
    border-top-color: currentColor;
    animation: spin 0.6s linear infinite;
}

.deployment-checklist li.success::before {
    content: '✓';
    background: var(--color-success);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.deployment-checklist li.error::before {
    content: '✕';
    background: var(--color-error);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

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

/* ── Draft Badges & Indicators ──────────────────────────── */
.sitemap-item.has-draft::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--color-warning);
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: auto;
}


.badge.draft-badge {
    background: var(--color-warning);
    color: var(--accent-fg);
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    text-transform: uppercase;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 1.5rem;
        min-height: 60vh;
    }

    .hero-section h1 {
        font-size: 2.5rem;
    }

    .hero-subtext {
        font-size: 1rem;
    }

    .btn-hero {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    .tetractys-accent {
        /*margin-bottom: 1.5rem;*/
    }

    .tetractys-accent svg {
        width: 100px;
        height: 100px;
    }
}

/* Rich Text Editor */
.rich-text-editor {
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
}

.rich-text-toolbar {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-muted);
    background: var(--bg-surface);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.rich-text-toolbar .btn {
    padding: 0.25rem 0.5rem;
    min-width: 2rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-base);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.rich-text-toolbar .btn:hover {
    background: var(--accent);
    color: var(--accent-fg);
}

.rich-text-content {
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.5;
    outline: none;
    white-space: pre-wrap;
}

.rich-text-content:focus {
    border-color: var(--border-focus);
}

/* ── Sidebar Git Action Links (Roll Back · Merge) ───────── */
.sidebar-git-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.1rem 0;
}

.sidebar-git-link {
    background: none;
    border: none;
    padding: 0.15rem 0.25rem;
    font-size: 0.7rem;
    font-family: inherit;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, background 0.15s ease;
    letter-spacing: 0.01em;
}

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

.sidebar-git-divider {
    color: var(--border-base);
    font-size: 0.65rem;
    user-select: none;
    line-height: 1;
}

/* ── Larger modal variant ───────────────────────────────── */
.modal.modal-lg {
    max-width: 620px;
}

/* ── Commit List (Rollback Modal) ───────────────────────── */
.commit-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 360px;
    overflow-y: auto;
}

.commit-item {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border: 1.5px solid var(--border-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    background: var(--bg-subtle);
}

.commit-item:hover {
    border-color: var(--border-base);
    background: var(--bg-hover);
}

.commit-item.selected {
    border-color: var(--accent);
    background: rgba(228, 228, 231, 0.06);
    box-shadow: 0 0 0 2px rgba(228, 228, 231, 0.12);
}

.commit-item-radio {
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.commit-item-body {
    flex: 1;
    min-width: 0;
}

.commit-item-message {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
}

.commit-item-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    align-items: center;
    flex-wrap: wrap;
}

.commit-item-sha {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    background: var(--bg-base);
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-muted);
    font-size: 0.675rem;
    letter-spacing: 0.02em;
}

.commit-item-current {
    background: rgba(34, 197, 94, 0.12);
    color: var(--color-success);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Git Modal States ───────────────────────────────────── */
.git-modal-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.git-modal-empty {
    padding: 1.5rem 0;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    text-align: center;
}

/* ── Merge Modal ────────────────────────────────────────── */
.merge-preview-info {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
}

.merge-preview-arrow {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.merge-arrow-icon {
    font-size: 1rem;
    color: var(--text-tertiary);
}

.branch-badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    letter-spacing: 0.01em;
}

.branch-badge-source {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.branch-badge-target {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.22);
}
