.admin-body { background: #eef2f6; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 30px 18px; }
.login-card { width: min(100%, 450px); padding: 34px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: 0 28px 90px rgba(16, 38, 56, .12); }
.login-brand { margin-bottom: 40px; }
.login-copy h1 { margin: 9px 0 8px; font-size: 2rem; letter-spacing: -.035em; }
.login-copy p { margin: 0 0 25px; color: var(--muted); }
.login-note { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: .8rem; }

.dashboard { 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: 26px 18px 20px; border-right: 1px solid #dbe3ea; background: #fff; }
.sidebar-brand { padding: 0 8px; margin-bottom: 36px; }
.sidebar-nav { display: grid; gap: 5px; }
.sidebar-link, .sidebar-secondary { width: 100%; border: 0; background: transparent; text-align: left; border-radius: 9px; padding: 10px 11px; color: #61707d; font-weight: 650; font-size: .91rem; cursor: pointer; transition: var(--transition); }
.sidebar-link:hover, .sidebar-secondary:hover { background: #f2f5f7; color: #1e2d39; }
.sidebar-link.active { background: color-mix(in srgb, var(--primary) 9%, #fff); color: var(--primary); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 3px; }
.danger-text { color: #a33f3f; }

.dashboard-main { min-width: 0; padding: 36px clamp(24px, 4vw, 58px) 60px; }
.dashboard-topbar { max-width: 1380px; margin: 0 auto 24px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.dashboard-topbar h1 { margin: 7px 0 0; font-size: clamp(1.8rem, 3vw, 2.55rem); letter-spacing: -.035em; }
.save-indicator { border: 1px solid #d9e1e7; border-radius: 999px; padding: 7px 11px; background: #fff; color: #71808d; font-size: .77rem; font-weight: 700; }
.save-indicator.busy { color: var(--primary); }
.save-indicator.success { color: var(--success); }
.save-indicator.error { color: var(--danger); }
.admin-section { display: none; max-width: 1380px; margin: 0 auto; }
.admin-section.active { display: block; animation: reveal 240ms ease both; }
.panel-card { padding: 26px; border: 1px solid #dbe3ea; border-radius: 16px; background: #fff; box-shadow: 0 6px 24px rgba(25, 48, 66, .035); }
.panel-card + .panel-card { margin-top: 18px; }
.panel-heading { display: flex; justify-content: space-between; gap: 22px; margin-bottom: 24px; }
.panel-heading h2 { margin: 0 0 5px; font-size: 1.22rem; letter-spacing: -.02em; }
.panel-heading p { margin: 0; color: #71808d; font-size: .87rem; }
.compact-heading { align-items: center; margin-bottom: 18px; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.field-span-2 { grid-column: 1 / -1; }
.color-control { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: center; }
.color-control input[type="color"] { width: 44px; height: 44px; border: 1px solid #d9e1e7; padding: 3px; background: white; border-radius: 9px; cursor: pointer; }
.color-hex { text-transform: uppercase; }
.actions-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.preview-theme-card { margin-top: 18px; }
.theme-preview { border-radius: 14px; padding: 28px; border: 1px solid var(--border); background: var(--background); }
.theme-preview h3 { color: var(--primary); margin: 9px 0 6px; font-size: 2rem; letter-spacing: -.04em; }
.theme-preview p { margin: 0 0 20px; color: var(--muted); }
.fake-button { pointer-events: none; }

.pages-admin-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(310px, .75fr); gap: 18px; align-items: start; }
.page-editor-card, .pages-list-card { margin: 0 !important; }
.slug-row { display: grid; grid-template-columns: auto 1fr; align-items: center; border: 1px solid #d9e1e7; border-radius: 10px; overflow: hidden; background: #f7f9fa; }
.slug-row > span { padding: 0 0 0 12px; color: #71808d; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .84rem; }
.slug-row .text-input { border: 0; border-radius: 0; background: transparent; box-shadow: none; padding-left: 2px; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.editor-status { color: #7a8996; font-size: .75rem; }
.code-editor { height: 410px; display: grid; grid-template-columns: 48px minmax(0, 1fr); overflow: hidden; border: 1px solid #cfd8df; border-radius: 11px; background: #f8fafb; }
.line-numbers { margin: 0; padding: 14px 10px 14px 0; overflow: hidden; text-align: right; user-select: none; border-right: 1px solid #dce3e8; background: #f1f4f6; color: #96a2ac; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.code-input-wrap { position: relative; min-width: 0; overflow: hidden; }
.code-highlight, .code-textarea { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 14px 15px; border: 0; outline: 0; overflow: auto; white-space: pre; tab-size: 2; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.code-highlight { pointer-events: none; color: #31414e; background: transparent; }
.code-textarea { resize: none; color: transparent; caret-color: #102c41; background: transparent; -webkit-text-fill-color: transparent; }
.code-textarea::selection { background: rgba(34, 103, 150, .20); }
.tok-tag { color: #175f93; font-weight: 650; }
.tok-attr { color: #8a5414; }
.tok-string { color: #43792e; }
.tok-comment { color: #87939c; font-style: italic; }
.checkbox-row { display: flex; align-items: center; }
.switch-label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: #44535f; font-size: .87rem; font-weight: 650; }
.switch-label input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { width: 38px; height: 22px; border-radius: 999px; background: #cbd4db; position: relative; transition: var(--transition); }
.switch-ui::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); transition: var(--transition); }
.switch-label input:checked + .switch-ui { background: var(--button); }
.switch-label input:checked + .switch-ui::after { transform: translateX(16px); }

.count-pill { min-width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #dbe3e8; border-radius: 999px; background: #f7f9fa; color: #61717f; font-size: .78rem; font-weight: 800; }
.pages-admin-list { display: grid; gap: 10px; }
.admin-page-item { border: 1px solid #dde4e9; border-radius: 12px; padding: 14px; background: #fff; }
.admin-page-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.admin-page-title { margin: 0; font-size: .96rem; }
.admin-page-slug { margin-top: 3px; color: #7b8995; font-size: .75rem; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.status-dot { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: .69rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #667683; }
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #aab5bd; }
.status-dot.active { color: #2d7455; }
.status-dot.active::before { background: #32a36f; }
.admin-page-description { margin: 11px 0 13px; color: #6e7c88; font-size: .79rem; }
.admin-page-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.mini-button { border: 1px solid #dbe3e8; border-radius: 8px; background: #f8fafb; color: #53636f; padding: 5px 8px; cursor: pointer; font-size: .73rem; font-weight: 700; }
.mini-button:hover { background: #eef3f6; }
.mini-button.danger { color: #9a4141; }
.small-empty { padding: 32px 12px; text-align: center; color: #7a8995; font-size: .84rem; }

.narrow-form { max-width: 520px; }
.security-card { max-width: 820px; }

.preview-dialog { width: min(1100px, calc(100% - 34px)); height: min(800px, calc(100vh - 34px)); padding: 0; border: 1px solid #d4dde4; border-radius: 16px; box-shadow: 0 32px 100px rgba(11, 29, 42, .28); overflow: hidden; background: #fff; }
.preview-dialog::backdrop { background: rgba(12, 27, 39, .52); backdrop-filter: blur(4px); }
.dialog-header { height: 78px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 0 20px; border-bottom: 1px solid #dfe5ea; }
.dialog-header h2 { margin: 3px 0 0; font-size: 1.1rem; }
.icon-button { width: 36px; height: 36px; border: 1px solid #dce3e8; border-radius: 9px; background: #f7f9fa; cursor: pointer; font-size: 1.4rem; }
.preview-frame { width: 100%; height: calc(100% - 78px); border: 0; display: block; }

@media (max-width: 1050px) {
  .pages-admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid #dbe3ea; padding: 14px; }
  .sidebar-brand { margin-bottom: 12px; }
  .sidebar-nav { display: flex; gap: 5px; overflow-x: auto; }
  .sidebar-link { width: auto; white-space: nowrap; }
  .sidebar-bottom { display: none; }
  .dashboard-main { padding: 26px 18px 48px; }
}
@media (max-width: 640px) {
  .login-card { padding: 27px 22px; }
  .settings-grid { grid-template-columns: 1fr; }
  .field-span-2 { grid-column: auto; }
  .panel-card { padding: 20px 16px; }
  .dashboard-topbar { align-items: start; }
  .save-indicator { display: none; }
  .code-editor { height: 360px; grid-template-columns: 40px minmax(0, 1fr); }
}
