:root {
    --bg: #f3f5f6;
    --surface: #fff;
    --text: #172127;
    --muted: #68757c;
    --border: #d8e0e3;
    --sidebar: #202a2f;
    --primary: #087f78;
    --primary-dark: #075d59;
    --accent: #d45b3f;
    --warning: #a66b00;
    --danger: #b33a3a;
    --radius: 6px;
    --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--text); font-family: var(--font); background: var(--bg); line-height: 1.5; }
a { color: var(--primary-dark); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; }
.admin-page { min-height: 100vh; }
.admin-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: 230px; display: flex; flex-direction: column; background: var(--sidebar); color: #edf3f4; }
.brand { min-height: 74px; display: flex; align-items: center; gap: 10px; padding: 0 20px; color: inherit; text-decoration: none; font-size: 18px; font-weight: 800; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--primary); color: #fff; border-radius: 4px; font-size: 22px; }
.admin-nav { display: grid; padding: 10px; gap: 3px; }
.admin-nav a { min-height: 42px; display: flex; align-items: center; padding: 0 12px; border-left: 3px solid transparent; color: #cdd7da; text-decoration: none; font-size: 14px; font-weight: 650; }
.admin-nav a:hover { background: #29363c; color: #fff; }
.admin-nav a.active { background: #2e3c42; color: #fff; border-color: #f2c14e; }
.sidebar-account { margin-top: auto; padding: 18px 20px; border-top: 1px solid #39464c; display: grid; }
.sidebar-account span { font-weight: 750; }
.sidebar-account small { color: #aebbc0; }
.sidebar-account form { margin-top: 10px; }
.sidebar-account button { padding: 0; border: 0; background: none; color: #dce5e7; text-decoration: underline; cursor: pointer; }
.admin-shell { margin-left: 230px; min-width: 0; }
.admin-topbar { height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--border); }
.admin-topbar > div { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-topbar h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 21px; }
.nav-toggle { display: none; width: 38px; height: 38px; padding: 0; border: 1px solid var(--border); border-radius: 4px; background: #fff; cursor: pointer; }
.view-site { font-size: 14px; font-weight: 650; white-space: nowrap; }
.admin-content { width: min(calc(100% - 48px), 1240px); margin: 0 auto; padding: 28px 0 60px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.toolbar p { margin: 0; color: var(--muted); }
.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 7px 13px; border: 1px solid var(--border); border-radius: 4px; background: #fff; color: var(--text); text-decoration: none; font-weight: 700; cursor: pointer; }
.button:hover { border-color: #9aa8ae; }
.button.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.danger { border-color: #e1b4b4; color: var(--danger); }
.button.small { min-height: 32px; padding: 4px 9px; font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat { padding: 18px; border: 1px solid var(--border); border-top: 4px solid var(--primary); border-radius: var(--radius); background: #fff; }
.stat:nth-child(2) { border-top-color: var(--accent); }
.stat:nth-child(3) { border-top-color: #9879b8; }
.stat:nth-child(4) { border-top-color: #d29c25; }
.stat strong { display: block; font-size: 28px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; }
.panel { margin-bottom: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.panel-header { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: #fafbfb; }
.panel-header h2 { margin: 0; font-size: 16px; }
.panel-body { padding: 18px; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; }
.data-table th, .data-table td { padding: 11px 13px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.data-table th { background: #f7f9f9; color: #4b585e; font-size: 12px; text-transform: uppercase; }
.data-table tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; align-items: center; gap: 6px; }
.row-actions form { margin: 0; }
.status { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 3px; background: #edf1f2; color: #4a585e; font-size: 12px; font-weight: 750; }
.status.published, .status.active { background: #e4f3ef; color: #17675f; }
.status.inactive { background: #f6e8e8; color: #8d3333; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stacked-form, .field { display: grid; gap: 6px; }
.stacked-form { gap: 16px; }
.field.full { grid-column: 1 / -1; }
label, .field-label { color: #354148; font-size: 13px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid #b9c5c9; border-radius: 4px; background: #fff; color: var(--text); }
input, select { height: 40px; padding: 0 10px; }
textarea { min-height: 120px; padding: 10px; resize: vertical; }
textarea.html-editor { min-height: 420px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(8, 127, 120, .2); border-color: var(--primary); }
.help { margin: 0; color: var(--muted); font-size: 12px; }
.checkbox-list { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checkbox-list label { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.checkbox-list input { width: 17px; height: 17px; }
.form-actions { display: flex; align-items: center; gap: 9px; padding-top: 6px; }
.tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--border); background: #f7f9f9; }
.tabs button { min-height: 44px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; }
.tabs button.active { border-color: var(--accent); color: var(--text); background: #fff; }
.tab-panel { padding: 18px; }
.tab-panel[hidden] { display: none; }
.alert { margin-bottom: 18px; padding: 11px 14px; border: 1px solid var(--border); border-left-width: 4px; background: #fff; }
.alert.error { border-left-color: var(--danger); color: #7c2929; }
.alert.success { border-left-color: var(--primary); }
.empty { padding: 26px; color: var(--muted); text-align: center; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #edf1f2; }
.auth-panel { width: min(100%, 430px); padding: 28px; border: 1px solid var(--border); border-top: 5px solid var(--primary); border-radius: var(--radius); background: #fff; box-shadow: 0 10px 30px rgba(23,33,39,.09); }
.auth-panel .brand { min-height: auto; padding: 0; color: var(--text); }
.auth-panel h1 { margin: 28px 0 6px; font-size: 24px; }
.auth-panel > p { margin-top: 0; color: var(--muted); }
.back-link { display: inline-block; margin-top: 20px; font-size: 13px; }

@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .admin-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .nav-open .admin-sidebar { transform: translateX(0); box-shadow: 10px 0 25px rgba(0,0,0,.2); }
    .admin-shell { margin-left: 0; }
    .nav-toggle { display: grid; place-items: center; }
    .admin-topbar { padding: 0 16px; }
    .admin-content { width: min(calc(100% - 28px), 1240px); padding-top: 20px; }
    .form-grid { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
}
@media (max-width: 460px) {
    .stats-grid { grid-template-columns: 1fr; }
    .view-site { font-size: 0; }
    .view-site::after { content: 'Site'; font-size: 13px; }
}

