:root {
  --ink: #06233a;
  --blue: #0079b8;
  --cyan: #13b9c8;
  --bg: #eef8fb;
  --line: #cfe0e7;
  --white: #fff;
  --danger: #9f2f2f;
  --success: #08744f;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: linear-gradient(145deg, #f7fcfe, #e7f5f9); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 28px; background: rgba(255,255,255,.94); box-shadow: 0 24px 70px rgba(6,35,58,.13); }
.admin-mark { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--cyan)); font-size: 28px; box-shadow: 0 10px 24px rgba(0,121,184,.22); }
.admin-mark.small { display: inline-grid; width: 36px; height: 36px; border-radius: 11px; font-size: 19px; }
.eyebrow { margin: 22px 0 6px; color: var(--blue); font-size: .73rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.login-card h1, .admin-intro h1 { margin: 0; font-size: clamp(2rem, 6vw, 3.5rem); line-height: 1; }
.muted { color: #587083; }
.login-card form { display: grid; gap: 18px; margin: 28px 0 20px; }
label { display: grid; gap: 8px; font-weight: 700; }
input, select, textarea { width: 100%; padding: 13px 14px; border: 1px solid #b8ccd5; border-radius: 11px; background: #fff; color: var(--ink); font: inherit; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, .rich-editor:focus { outline: 3px solid rgba(19,185,200,.22); border-color: var(--cyan); }
button { border: 0; border-radius: 11px; padding: 12px 17px; background: var(--ink); color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
button:hover { background: #0a466c; }
.back { color: var(--blue); font-weight: 700; text-decoration: none; }
.notice { margin: 18px 0; padding: 14px 16px; border-radius: 12px; font-weight: 700; }
.notice.error { background: #fff0f0; color: var(--danger); border: 1px solid #f2caca; }
.notice.success { background: #e9fbf4; color: var(--success); border: 1px solid #bce7d5; }
.admin-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 13px max(24px, calc((100vw - 1180px)/2)); background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.admin-header > div { display: flex; align-items: center; gap: 12px; }
.admin-header nav { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; }
.admin-header a { color: var(--ink); font-weight: 750; text-decoration: none; }
.admin-theme-toggle { width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.admin-main { width: min(1180px, calc(100% - 32px)); margin: 48px auto 90px; }
.admin-intro { margin-bottom: 30px; }
.admin-intro p:last-child { max-width: 700px; color: #587083; }
.panel { margin: 22px 0; padding: 26px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.95); box-shadow: 0 12px 34px rgba(6,35,58,.06); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.panel-heading .eyebrow { margin: 0 0 5px; }
.panel h2 { margin: 0; }
.grid-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-fields .panel-heading, .grid-fields .wide { grid-column: 1/-1; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; background: #edf7fa; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; }
.toolbar button { padding: 8px 11px; background: #fff; color: var(--ink); border: 1px solid #c6d9e1; font-size: .88rem; }
.rich-editor { min-height: 150px; padding: 20px; border: 1px solid #b8ccd5; border-radius: 0 0 12px 12px; background: #fff; line-height: 1.6; }
.rich-editor details { margin: 8px 0; padding: 8px; border-bottom: 1px solid var(--line); }
.rich-editor summary { font-weight: 800; }
.hidden-input { display: none; }
.save-bar { position: sticky; bottom: 14px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 24px 0; padding: 14px 18px; border-radius: 15px; background: rgba(6,35,58,.96); color: #fff; box-shadow: 0 12px 35px rgba(6,35,58,.2); }
.save-bar button { background: var(--cyan); color: #032438; }
.log-filter { display: grid; grid-template-columns: 180px 1fr auto; gap: 10px; }
.logs-panel pre { max-height: 500px; overflow: auto; margin-top: 18px; padding: 18px; border-radius: 12px; background: #071926; color: #c9f2e8; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.field-help { margin: -7px 0 0; color: #587083; font-size: .88rem; }
.admin-dashboard { display: grid; grid-template-columns: 1.4fr repeat(3,1fr); gap: 14px; margin-bottom: 28px; }
.admin-dashboard article { display: grid; align-content: center; gap: 5px; min-height: 128px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.95); box-shadow: 0 12px 32px rgba(6,35,58,.055); }
.admin-dashboard small { color: #587083; font-size: .72rem; font-weight: 850; text-transform: uppercase; letter-spacing: .09em; }
.admin-dashboard strong { font-size: 1.35rem; line-height: 1.2; }
.admin-dashboard span { color: #587083; font-size: .78rem; }
.dashboard-status { grid-template-columns: auto 1fr !important; align-items: center !important; }
.dashboard-status > div { display: grid; gap: 5px; }
.dashboard-orb { width: 36px; height: 36px; border-radius: 50%; background: #82939c !important; }
.dashboard-status[data-state="up"] .dashboard-orb { background: #0a9d72 !important; box-shadow: 0 0 0 8px rgba(10,157,114,.12); }
.dashboard-status[data-state="down"] .dashboard-orb { background: #c94747 !important; box-shadow: 0 0 0 8px rgba(201,71,71,.1); }
.toggle-field { display: flex !important; align-items: flex-start; flex-direction: row; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f5fafc; }
.toggle-field input { width: 21px; height: 21px; flex: 0 0 auto; margin-top: 1px; }
.toggle-field span { display: grid; gap: 2px; }
.toggle-field small { color: #587083; font-weight: 500; }
.button-link { display: inline-flex; align-items: center; justify-content: center; padding: 11px 15px; border-radius: 11px; background: var(--ink); color: #fff; text-decoration: none; font-weight: 800; }
.security-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.security-grid article { padding: 22px; border: 1px solid var(--line); border-radius: 15px; background: #f8fcfd; }
.security-grid h3 { margin: 12px 0 7px; }
.security-grid p, .security-grid li { color: #4d6676; line-height: 1.55; }
.security-grid ul { padding-left: 20px; }
.security-state { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.security-state.active { background: #dff8ed; color: #08744f; }
.security-state.inactive { background: #edf2f4; color: #587083; }
.inline-security-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 18px; }
.totp-setup { margin-top: 15px; padding: 14px; border-radius: 12px; background: #eef8fb; }
.totp-setup p { margin-top: 0; }
.totp-setup details { margin-top: 12px; }
.totp-setup code { display: block; overflow-wrap: anywhere; margin-top: 8px; padding: 10px; border-radius: 8px; background: #071926; color: #c9f2e8; }
.audit-block { margin-top: 24px; }
.audit-list { display: grid; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.audit-list > div { display: grid; grid-template-columns: 120px 1fr 150px; gap: 12px; padding: 10px 13px; border-bottom: 1px solid var(--line); font-size: .82rem; }
.audit-list > div:last-child { border-bottom: 0; }
.audit-result { width: max-content; padding: 3px 7px; border-radius: 999px; background: #edf2f4; text-transform: capitalize; font-weight: 850; }
.audit-result.erfolgreich { background: #dff8ed; color: #08744f; }
.audit-result.fehlgeschlagen, .audit-result.gesperrt { background: #fff0f0; color: #9f2f2f; }
.translation-panel { display: grid; gap: 14px; }
.translation-language { border: 1px solid var(--line); border-radius: 15px; background: #f8fcfd; overflow: hidden; }
.translation-language > summary { display: flex; align-items: center; gap: 10px; padding: 16px 18px; cursor: pointer; font-weight: 800; }
.translation-language > summary strong { min-width: 38px; color: var(--blue); }
.translation-language-body { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 0 18px 20px; }
.translation-editor { grid-column: 1 / -1; }
.translation-editor h3 { margin: 8px 0; }

html[data-theme="dark"] { --ink: #e8f5fa; --blue: #49b8ed; --cyan: #39d3dc; --bg: #071a27; --line: #274554; --white: #102c3b; --danger: #ff9b9b; --success: #72e1b7; color-scheme: dark; }
html[data-theme="dark"] body { background: linear-gradient(145deg,#071a27,#0b2432); }
html[data-theme="dark"] .admin-header, html[data-theme="dark"] .panel, html[data-theme="dark"] .admin-dashboard article, html[data-theme="dark"] .login-card { background: rgba(14,40,54,.96); }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea, html[data-theme="dark"] .rich-editor, html[data-theme="dark"] .toolbar button, html[data-theme="dark"] .admin-theme-toggle { background: #09202d; color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .toolbar, html[data-theme="dark"] .toggle-field, html[data-theme="dark"] .security-grid article, html[data-theme="dark"] .totp-setup { background: #0c2837; }
html[data-theme="dark"] .translation-language { background: #0c2837; }
html[data-theme="dark"] .muted, html[data-theme="dark"] .field-help, html[data-theme="dark"] .admin-dashboard small, html[data-theme="dark"] .admin-dashboard span, html[data-theme="dark"] .security-grid p, html[data-theme="dark"] .security-grid li { color: #a1bac7; }
html[data-theme="dark"] button:not(.admin-theme-toggle):not(.danger-button), html[data-theme="dark"] .button-link { background: #0878bb; color: #fff; }
html[data-theme="dark"] button:not(.admin-theme-toggle):not(.danger-button):hover, html[data-theme="dark"] .button-link:hover { background: #0a92d8; }
html[data-theme="dark"] .toolbar button { background: #09202d; color: var(--ink); }
html[data-theme="dark"] .save-bar button { background: var(--cyan); color: #032438; }

@media (max-width: 980px) {
  .admin-dashboard { grid-template-columns: 1fr 1fr; }
  .admin-header nav a[href^="#"] { display: none; }
}
@media (max-width: 720px) {
  .admin-header { padding: 10px 14px; }
  .admin-header nav a:not(:last-child), .admin-header nav button { display: none; }
  .admin-main { width: min(100% - 20px,1180px); margin-top: 28px; }
  .panel { padding: 18px; }
  .grid-fields, .admin-dashboard, .security-grid { grid-template-columns: 1fr; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .log-filter, .inline-security-form { grid-template-columns: 1fr; }
  .save-bar { align-items: stretch; flex-direction: column; }
  .save-bar span { font-size: .85rem; }
  .audit-list > div { grid-template-columns: 1fr; gap: 5px; }
  .button-link { width: 100%; }
  .translation-language-body { grid-template-columns: 1fr; }
}
