:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #e2e8f0;
    --text: #172033;
    --muted: #64748b;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --sidebar: #111827;
    --sidebar-muted: #94a3b8;
    --success: #047857;
    --success-bg: #d1fae5;
    --danger: #b91c1c;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: "Cascadia Code", Consolas, monospace; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 16px; background: var(--sidebar); color: white; }
.brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(135deg, #818cf8, #4f46e5); font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: var(--sidebar-muted); font-size: 12px; }
.sidebar-nav { margin-top: 36px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 9px; color: #cbd5e1; font-weight: 600; }
.nav-link:hover, .nav-link.active { background: #263244; color: white; text-decoration: none; }
.nav-icon { font-size: 20px; line-height: 1; }
.sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid #334155; }
.signed-in-user { display: block; margin-bottom: 10px; overflow: hidden; color: var(--sidebar-muted); font-size: 13px; text-overflow: ellipsis; }
.main-content { min-width: 0; padding: 38px clamp(22px, 4vw, 54px); }

.page-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-header h1 { margin: 2px 0 4px; font-size: clamp(28px, 4vw, 38px); letter-spacing: -0.03em; }
.eyebrow { margin: 0; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.muted { margin: 0; color: var(--muted); }
.record-count { white-space: nowrap; color: var(--muted); font-size: 14px; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.domain-header-tools { display: grid; justify-items: end; gap: 10px; }
.domain-search { display: flex; align-items: center; gap: 8px; }
.domain-search input { width: min(320px, 35vw); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--muted); font-size: 14px; font-weight: 600; }

.card { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 8px 28px rgba(15, 23, 42, .05); }
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 18px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { background: var(--surface-soft); color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: 0; }
.actions-column { width: 130px; }
.actions { white-space: nowrap; font-weight: 700; }
.actions span { padding: 0 5px; color: #cbd5e1; }
.table-subtitle { max-width: 320px; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.path-cell { min-width: 280px; overflow-wrap: anywhere; }
.empty-state { padding: 48px; color: var(--muted); text-align: center; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-neutral { background: #e2e8f0; color: #475569; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 16px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }

.button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; }
.button:hover { text-decoration: none; }
.button-primary { background: var(--primary); color: white; }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { border-color: var(--border); background: var(--surface); color: var(--text); }
.sidebar .button-secondary { border-color: #475569; background: transparent; color: white; }
.button-block { width: 100%; }
.disabled { pointer-events: none; opacity: .45; }

.form-card { max-width: 900px; padding: 28px; }
.form-stack { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 700; }
input, textarea, select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 8px; background: white; color: var(--text); font: inherit; }
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); outline: 3px solid rgba(79, 70, 229, .13); }
input[readonly] { background: var(--surface-soft); color: var(--muted); }
.checkbox-field { display: flex; align-items: center; gap: 9px; }
.checkbox-field input { width: 18px; min-height: 18px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; padding-top: 20px; border-top: 1px solid var(--border); }
.blog-form-card { max-width: 1050px; }
.form-section { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; padding: 8px 0 28px; }
.form-section + .form-section { padding-top: 28px; border-top: 1px solid var(--border); }
.form-section-heading h2 { margin: 0 0 6px; font-size: 17px; }
.form-section-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.code-input { font-family: "Cascadia Code", Consolas, monospace; font-size: 13px; }
.field-validation, .validation-summary { color: var(--danger); font-size: 13px; }
.validation-summary:empty { display: none; }
.alert { margin-bottom: 18px; padding: 12px 14px; border-radius: 9px; }
.alert-success { border: 1px solid #a7f3d0; background: var(--success-bg); color: var(--success); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at top, #eef2ff, var(--bg) 45%); }
.login-card { width: min(100%, 420px); padding: 34px; border: 1px solid var(--border); border-radius: 16px; background: white; box-shadow: 0 22px 60px rgba(15, 23, 42, .12); }
.login-brand { color: var(--text); }
.login-brand small { color: var(--muted); }
.login-card h1 { margin: 28px 0 6px; font-size: 28px; }
.login-card .form-stack { margin-top: 24px; }

@media (max-width: 800px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; width: 100%; height: auto; padding: 16px; }
    .sidebar-nav { margin-top: 16px; }
    .sidebar-footer { margin-top: 20px; }
    .main-content { padding: 24px 16px; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .domain-header-tools { width: 100%; justify-items: stretch; }
    .domain-search { width: 100%; }
    .domain-search input { width: 100%; min-width: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .field-wide { grid-column: auto; }
    .form-section { grid-template-columns: 1fr; gap: 18px; }
    .pagination { justify-content: center; }
}
