:root {
    --background: #f8f9ff;
    --surface: #ffffff;
    --surface-low: #eff4ff;
    --surface-container: #e5eeff;
    --surface-high: #dce9ff;
    --surface-highest: #d3e4fe;
    --ink: #0b1c30;
    --muted: #434655;
    --outline: #c3c6d7;
    --outline-strong: #737686;
    --inverse: #213145;
    --navy: #0f172a;
    --primary: #004ac6;
    --primary-action: #2563eb;
    --teal: #00788c;
    --teal-soft: #acedff;
    --danger: #ba1a1a;
    --success: #15803d;
    --warning: #a16207;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 6px rgba(15, 23, 42, .05);
}

.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

.subsidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    font-size: 13px;
    color: #434655;
    border-radius: 6px;
    margin: 1px 0;
    transition: all 120ms ease;
    text-decoration: none;
}
.subsidebar-item:hover {
    background: #E7EEFE;
    color: #151C27;
}
.subsidebar-item.active {
    background: #DBE1FF;
    color: #004AC6;
    font-weight: 600;
}
.subsidebar-item .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    opacity: 0.5;
}
.subsidebar-item.active .dot { opacity: 1; }

.drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: #9CA3AF;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border-left: 2px solid transparent;
    transition: all 150ms ease;
    text-decoration: none;
}
.drawer-item:hover {
    background: rgba(255,255,255,0.05);
    color: #FFFFFF;
}
.drawer-item.active {
    background: rgba(0,74,198,0.12);
    color: #2563EB;
    border-left-color: #2563EB;
}
.drawer-sub-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: #9CA3AF;
    font-size: 14px;
    border-radius: 8px;
    transition: all 150ms ease;
    text-decoration: none;
}
.drawer-sub-item::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.4;
    flex-shrink: 0;
}
.drawer-sub-item:hover {
    background: rgba(255,255,255,0.05);
    color: #FFFFFF;
}
.drawer-sub-item.active {
    color: #2563EB;
    font-weight: 600;
}
.drawer-sub-item.active::before { opacity: 1; }

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 12px;
    text-decoration: none;
    transition: color 150ms;
}

@media (max-width: 767px) {
    main { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

* { box-sizing: border-box; }
html { min-height: 100%; overflow-x: hidden; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--ink);
    font-family: Inter, Arial, sans-serif;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
img, video, canvas, iframe, svg { max-width: 100%; }
pre, code { white-space: pre-wrap; overflow-wrap: anywhere; }
h1, h2, h3, .font-display { font-family: Manrope, Inter, sans-serif; letter-spacing: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

.admin-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: rgba(15, 23, 42, .97);
    color: #eaf1ff;
    border-top: 1px solid rgba(255,255,255,.1);
}
.brand { display: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-action); color: #fff; }
.sidebar nav { width: min(620px, 100%); display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.sidebar-logout { display: none; }
.nav-link {
    min-width: 0;
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 50px;
    padding: 6px 4px;
    border-radius: 12px;
    color: #dbeafe;
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
}
.nav-link .material-symbols-outlined { font-size: 21px; }
.nav-link:hover,
.nav-link.active { background: rgba(255,255,255,.09); color: #fff; }
.nav-link.active { box-shadow: inset 0 3px 0 #06b6d4; }
.main { min-width: 0; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px;
    background: rgba(248, 249, 255, .9);
    border-bottom: 1px solid var(--outline);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.topbar-title { display: flex; align-items: center; gap: 8px; color: var(--primary); font-size: clamp(1.25rem, 4vw, 2rem); font-weight: 900; }
.topbar-title::before { content: 'rocket_launch'; font-family: 'Material Symbols Outlined'; font-size: 22px; font-weight: 400; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.content {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 28px 24px 104px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}
.page-head h1 {
    margin: 0 0 4px;
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.25;
    font-weight: 800;
    color: var(--ink);
}
.page-head p { margin: 0; color: var(--muted); font-size: .92rem; }
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: var(--teal);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
    background: var(--surface);
    border: 1px solid rgba(195, 198, 215, .65);
    border-radius: 12px;
    padding: 18px;
    box-shadow: var(--shadow);
}
.soft-panel {
    background: var(--surface-low);
    border: 1px solid rgba(195, 198, 215, .45);
    border-radius: 16px;
    padding: 16px;
}
.metric { min-height: 142px; transition: transform .2s ease; }
.metric:active { transform: scale(.98); }
.metric-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.metric-icon { color: var(--primary-action); }
.metric-label { color: var(--muted); font-size: .78rem; font-weight: 700; }
.metric strong { display: block; font-family: Manrope, sans-serif; font-size: 2rem; line-height: 1.1; }
.metric small { color: var(--outline-strong); font-size: .76rem; font-weight: 700; }

.btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(195, 198, 215, .9);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform .2s ease, background .2s ease, border-color .2s ease;
}
.btn:hover { border-color: rgba(0, 74, 198, .35); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary-action); border-color: var(--primary-action); color: #fff; box-shadow: 0 8px 18px rgba(37,99,235,.18); }
.btn-danger { background: #fff1f1; color: var(--danger); border-color: #f1b5b5; }
.btn-ghost { background: transparent; color: inherit; }
.btn-icon { width: 42px; padding: 0; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
th, td { padding: 14px 12px; border-bottom: 1px solid #edf1f7; vertical-align: middle; }

.list-stack { display: grid; gap: 16px; }
.list-card {
    background: var(--surface);
    border: 1px solid rgba(195, 198, 215, .5);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}
.list-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.list-card-title { margin: 0; font-family: Manrope, sans-serif; font-size: 1.35rem; line-height: 1.45; }
.list-card-kicker {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--surface-high);
    color: #5c647a;
    font-size: .65rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.list-meta { display: grid; gap: 7px; margin: 12px 0; color: var(--muted); font-size: .88rem; }
.list-meta-row { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.list-meta-row .material-symbols-outlined { font-size: 17px; color: var(--outline-strong); }
.list-card-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 16px; border-top: 1px solid rgba(195,198,215,.45); }
.updated-at { color: var(--outline-strong); font-size: .78rem; font-weight: 700; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    border-radius: 10px;
    padding: 5px 9px;
    font-size: .72rem;
    font-weight: 900;
    text-transform: uppercase;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-published, .badge-active { background: rgba(22,163,74,.1); color: #16a34a; }
.badge-draft, .badge-pending { background: rgba(234,179,8,.14); color: var(--warning); }
.badge-unpublished, .badge-inactive, .badge-archived { background: rgba(186,26,26,.1); color: var(--danger); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 7px; }
label { font-size: .84rem; color: var(--muted); font-weight: 800; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--outline);
    border-radius: 12px;
    padding: 12px 13px;
    background: var(--surface);
    color: var(--ink);
}
input[type="file"] { min-width: 0; }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(37,99,235,.18); border-color: var(--primary-action); }
.help-card { background: #eef7ff; border-color: #bfdbfe; color: var(--muted); }

.tabs { display: flex; gap: 16px; overflow-x: auto; border-bottom: 1px solid var(--outline); margin-bottom: 20px; }
.tab-button { border: 0; background: transparent; padding: 0 4px 12px; color: var(--muted); font-weight: 900; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-button.active { color: var(--primary-action); border-color: var(--primary-action); }
.tab-panel[hidden] { display: none; }
.editor-card { overflow: hidden; padding: 0; background: #0f172a; border-color: #334155; box-shadow: 0 16px 40px rgba(15,23,42,.18); }
.editor-head { display: flex; justify-content: space-between; align-items: center; padding: 13px 15px; color: #f8f9ff; border-bottom: 1px solid rgba(255,255,255,.12); }
.editor-field textarea { min-height: 260px; border: 0; border-radius: 0; font-family: "JetBrains Mono", monospace; }
.CodeMirror { height: 360px; font-family: "JetBrains Mono", monospace; font-size: 14px; }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; background: #dcfce7; color: var(--success); font-weight: 800; }
.error-list { background: #fee2e2; color: var(--danger); padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; }
#page-content {
    animation: fadeIn .2s ease-out;
    transition: opacity .16s ease, transform .16s ease;
}
.page-content-exiting {
    opacity: 0;
    transform: translateY(4px);
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.media-preview {
    display: flex;
    gap: 12px;
    align-items: center;
}
.media-preview.hidden { display: none; }
.media-preview img {
    flex: 0 0 auto;
    width: 96px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--outline);
    background: var(--surface-low);
}

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.media-card { padding: 14px; }
.thumb { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: 10px; background: var(--surface-low); border: 1px solid rgba(195,198,215,.5); }
.copy-input { font-size: .78rem; }

.dns-guide { display: grid; gap: 12px; }
.dns-guide-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px; background: var(--surface); border: 1px solid rgba(195,198,215,.45); border-radius: 12px; }
.dns-guide-item .material-symbols-outlined { color: var(--primary-action); }

@media (min-width: 980px) {
    .admin-shell { display: grid; grid-template-columns: 280px 1fr; }
    .sidebar {
        position: sticky;
        top: 0;
        right: auto;
        bottom: auto;
        width: 280px;
        height: 100vh;
        display: block;
        padding: 24px 16px;
        border-top: 0;
        background: #213145;
    }
    .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 48px; font-size: 1.35rem; font-weight: 900; }
    .sidebar nav { display: grid; grid-template-columns: 1fr; gap: 12px; width: 100%; }
    .sidebar-logout { display: block; position: absolute; left: 16px; right: 16px; bottom: 22px; }
    .nav-link { display: flex; justify-content: flex-start; gap: 16px; min-height: 48px; padding: 12px 16px; font-size: 1rem; border-left: 4px solid transparent; border-radius: 0 12px 12px 0; color: #d8e2f7; }
    .nav-link.active { box-shadow: none; border-left-color: #4cd7f6; background: #2563eb; color: #fff; }
    .topbar { display: none; }
    .content { width: min(1440px, 100%); padding: 34px 40px 56px; }
    .grid-6 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .dashboard-layout, .domains-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
    .desktop-table-card { padding: 0; overflow: hidden; }
    .desktop-table-card table { font-size: 1rem; }
    .desktop-table-card thead { background: #eff4ff; }
    .desktop-table-card th { font-size: .82rem; padding: 18px 24px; }
    .desktop-table-card td { padding: 20px 24px; }
    .desktop-side { display: grid; gap: 24px; }
    .quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .quick-tile { min-height: 108px; display: grid; place-items: center; text-align: center; border: 1px solid rgba(195,198,215,.65); border-radius: 12px; background: #fff; color: var(--primary-action); font-weight: 800; }
    .dns-copy { display: grid; gap: 12px; }
    .copy-box { padding: 14px; border: 1px dashed #b4c5ff; border-radius: 10px; background: #eef4ff; }
    .copy-box small { display: block; margin-bottom: 6px; color: var(--muted); font-weight: 900; text-transform: uppercase; }
    .copy-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #004ac6; font-family: "JetBrains Mono", monospace; overflow-wrap: anywhere; }
}

@media (max-width: 760px) {
    body { width: 100%; }
    main, section, article, form, table, .card, .list-card { min-width: 0; }
    h1, h2, h3, p, a, span, strong { overflow-wrap: anywhere; }
    table { min-width: 680px; }
    .page-head { display: grid; align-items: start; }
    .form-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .topbar .btn-ghost { width: 42px; padding: 0; }
    .topbar .btn-ghost span + span, .logout-text { display: none; }
    .list-card-top { display: grid; }
    .list-card-actions { display: grid; }
    .actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .actions .btn, .actions form, .actions button { width: 100%; }
    .btn { width: 100%; }
    .settings-tabs { margin-inline: -2px; }
    .CodeMirror { max-width: calc(100vw - 32px); }
    .CodeMirror-scroll { max-width: 100%; }
    .media-preview { align-items: flex-start; }
}
