/* ===========================================================================
   aurapanel theme. All colors are tokens (two themes); the root carries
   data-theme (set server-side from the aura_theme cookie, so first paint is
   already correct) and data-sidebar for the collapsed shell.
   =========================================================================== */

:root {
  --bg: #0f1117;
  --bg-2: #0b0d12;
  --panel: #161922;
  --panel-2: #1b202b;
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.15);
  --text: #e7e9ef;
  --text-dim: #99a1b0;
  --text-faint: #6a7280;
  --accent: #5b8cff;
  --accent-press: #4d7df0;
  --accent-soft: rgba(91, 140, 255, 0.16);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn: #f5b042;
  --warn-soft: rgba(245, 176, 66, 0.16);
  --danger: #f4787b;
  --danger-soft: rgba(244, 120, 123, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 40px rgba(0, 0, 0, 0.22);
  --row-hover: rgba(255, 255, 255, 0.035);
  --rowpad: 14px;

  /* layout scalars */
  --header-h: 60px;
  --sidebar-w: 236px;
  --sidebar-w-collapsed: 74px;
  --content-maxw: 1480px;
  --content-maxw-narrow: 980px;
  --radius-input: 10px;
  --radius-card: 14px;
  --radius-pill: 99px;

  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

:root[data-theme="light"] {
  --bg: #f3f4f7;
  --bg-2: #e8eaee;
  --panel: #ffffff;
  --panel-2: #f6f7f9;
  --border: rgba(17, 19, 25, 0.1);
  --border-2: rgba(17, 19, 25, 0.17);
  --text: #181b22;
  --text-dim: #5b636f;
  --text-faint: #8b929d;
  --ok: #0f9d63;
  --ok-soft: rgba(15, 157, 99, 0.12);
  --warn: #bd7d12;
  --warn-soft: rgba(189, 125, 18, 0.13);
  --danger: #d6494d;
  --danger-soft: rgba(214, 73, 77, 0.11);
  --accent-soft: rgba(91, 140, 255, 0.13);
  --shadow: 0 1px 2px rgba(17, 19, 25, 0.06), 0 12px 30px rgba(17, 19, 25, 0.07);
  --row-hover: rgba(17, 19, 25, 0.035);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
}

a {
  color: var(--accent);
  text-decoration: none;
}

h1,
h2,
h3 {
  letter-spacing: -0.01em;
}

.mono {
  font-family: var(--font-mono);
}
.muted {
  color: var(--text-dim);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}
textarea {
  resize: vertical;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 8px;
}

/* ---------- App shell ---------------------------------------------------- */
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  height: var(--header-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex: none;
}
.brand-name {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.global-search {
  flex: 1;
  display: flex;
  justify-content: center;
}
.global-search-inner {
  position: relative;
  width: 100%;
  max-width: 440px;
}
.global-search-inner .icon-lead {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  display: flex;
}
.global-search input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px 9px 36px;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.global-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.kbd {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* theme toggle shows the icon matching the active theme (CSS-switched, instant) */
.theme-icon {
  display: none;
}
:root[data-theme="dark"] .theme-icon--sun {
  display: flex;
}
:root[data-theme="light"] .theme-icon--moon {
  display: flex;
}
.divider-v {
  width: 1px;
  height: 26px;
  background: var(--border);
  margin: 0 4px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 4px 3px 3px;
}
.user-chip-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}
.user-chip-role {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.2;
}

/* sidebar */
.shell-body {
  flex: 1;
  display: flex;
  min-height: 0;
}
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  border-right: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 4px;
  overflow-y: auto;
  transition: width 0.2s ease;
}
.sidebar-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-transform: uppercase;
  padding: 6px 10px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 10px 11px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover {
  background: var(--row-hover);
  color: var(--text);
}
.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-item svg {
  flex: none;
}
.sidebar-spacer {
  flex: 1;
}
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 8px;
}
.git-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
}
.git-widget-icon {
  display: flex;
  color: var(--text-dim);
  flex: none;
}
.git-version {
  font-size: 12.5px;
  font-weight: 700;
}
.git-ref {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* collapsed sidebar */
:root[data-sidebar="collapsed"] .sidebar {
  width: var(--sidebar-w-collapsed);
}
:root[data-sidebar="collapsed"] .nav-item {
  justify-content: center;
}
:root[data-sidebar="collapsed"] .nav-item span,
:root[data-sidebar="collapsed"] .sidebar-label,
:root[data-sidebar="collapsed"] .sidebar-footer {
  display: none;
}

.main {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  min-width: 0;
}

/* ---------- Page scaffolding -------------------------------------------- */
.page {
  padding: 28px 40px;
  max-width: var(--content-maxw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.page--narrow {
  max-width: var(--content-maxw-narrow);
}
.page--editor {
  padding: 24px 40px 48px;
  gap: 18px;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.page-title {
  margin: 7px 0 4px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.page-subtitle {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
}

/* ---------- Buttons ------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--text);
  border-radius: var(--radius-input);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover {
  background: var(--panel-2);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
.btn-primary:hover {
  background: var(--accent-press);
  border-color: var(--accent-press);
  color: #fff;
}
.btn-danger {
  background: var(--danger-soft);
  border-color: color-mix(in oklab, var(--danger) 35%, transparent);
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}
.btn-block {
  width: 100%;
}
.btn-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-icon:hover {
  background: var(--panel-2);
  color: var(--text);
}
.btn-icon.is-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn[disabled],
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Fields / inputs --------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.input,
input.input,
textarea.input,
.select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 11px 13px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus,
.select:focus,
textarea.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input--lg {
  font-size: 16px;
  font-weight: 600;
}

/* prefixed input (slug, url) */
.input-prefix {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  overflow: hidden;
  background: var(--panel-2);
}
.input-prefix-addon {
  display: flex;
  align-items: center;
  padding: 0 13px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
  border-right: 1px solid var(--border);
}
.input-prefix input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 11px 13px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.input-prefix input[readonly] {
  color: var(--text-dim);
  cursor: default;
}

/* select with custom chevron */
.select-wrap {
  position: relative;
}
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
}
.select-chevron {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-faint);
  display: flex;
}

/* ---------- Badge -------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--panel-2);
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge--ok {
  color: var(--ok);
  background: var(--ok-soft);
}
.badge--warn {
  color: var(--warn);
  background: var(--warn-soft);
}
.badge--danger {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ---------- Toggle / switch --------------------------------------------- */
.switch {
  width: 44px;
  height: 25px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  position: relative;
  flex: none;
  background: var(--border-2);
  transition: background 0.15s;
}
.switch.is-on {
  background: var(--accent);
}
.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s;
}
.switch.is-on .switch-knob {
  left: 22px;
}

/* ---------- Avatar ------------------------------------------------------- */
.avatar {
  position: relative;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  background: color-mix(in oklab, var(--av-color, var(--accent)) 20%, transparent);
  color: var(--av-color, var(--accent));
}
.avatar--sm {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}
.avatar--lg {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  font-size: 23px;
  font-weight: 800;
}
.avatar-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--panel);
  background: var(--ok);
}
.avatar--lg .avatar-dot,
.avatar .avatar-dot--lg {
  width: 11px;
  height: 11px;
  bottom: -2px;
  right: -2px;
}

/* ---------- Card / definition row --------------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card-title {
  font-size: 14px;
  font-weight: 700;
}
.def-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.def-row-label {
  font-size: 13px;
  color: var(--text-dim);
}
.def-row-value {
  font-size: 13.5px;
  font-weight: 600;
  text-align: right;
}
.def-row-value.is-mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ---------- Flash -------------------------------------------------------- */
.flash {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13.5px;
}
.flash-error {
  color: var(--danger);
  border-color: color-mix(in oklab, var(--danger) 45%, transparent);
  background: var(--danger-soft);
}
.flash-success {
  color: var(--ok);
  border-color: color-mix(in oklab, var(--ok) 45%, transparent);
  background: var(--ok-soft);
}

/* ---------- Toolbar / chips (news) -------------------------------------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.toolbar > form {
  display: contents;
}
.toolbar-spacer {
  flex: 1;
}
.search-field {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 320px;
}
.search-field .icon-lead {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  display: flex;
}
.search-field input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px 9px 35px;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.chip-group {
  display: flex;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 4px;
}
.chip {
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.chip:hover {
  color: var(--text);
}
.chip.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

/* ---------- News grid table --------------------------------------------- */
.news-table {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.news-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px 132px 132px 92px;
  gap: 16px;
  align-items: center;
  padding: var(--rowpad) 20px;
}
.news-head {
  padding-top: 12px;
  padding-bottom: 12px;
  background: var(--panel-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.news-body-row {
  border-top: 1px solid var(--border);
  transition: background 0.12s;
}
.news-body-row:hover {
  background: var(--row-hover);
}
.news-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.news-slug {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-dim {
  font-size: 13px;
  color: var(--text-dim);
}
.cell-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.news-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 12.5px;
  color: var(--text-dim);
}

/* ---------- Login -------------------------------------------------------- */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(
    820px 460px at 50% -8%,
    color-mix(in oklab, var(--accent) 16%, transparent),
    transparent
  );
}
.login-col {
  width: 100%;
  max-width: 404px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.login-brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  box-shadow: 0 6px 20px color-mix(in oklab, var(--accent) 45%, transparent);
}
.login-brand-name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.login-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
}
.login-sub {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-dim);
}
.login-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.login-footer {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
}
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Article editor ---------------------------------------------- */
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.editor-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  text-decoration: none;
}
.back-link:hover {
  color: var(--text);
}
/* Quill (snow) editor, themed dark to match the panel */
.editor-quill {
  background: var(--panel-2);
  border-radius: 11px;
}
.ql-toolbar.ql-snow {
  border-color: var(--border);
  border-top-left-radius: 11px;
  border-top-right-radius: 11px;
  background: var(--panel);
}
.ql-container.ql-snow {
  border-color: var(--border);
  border-bottom-left-radius: 11px;
  border-bottom-right-radius: 11px;
  font-family: var(--font-ui);
  font-size: 15px;
}
.ql-editor {
  min-height: 300px;
  color: var(--text);
  line-height: 1.7;
}
.ql-editor.ql-blank::before {
  color: var(--text-faint);
  font-style: normal;
}
.ql-snow .ql-stroke {
  stroke: var(--text-dim);
}
.ql-snow .ql-fill {
  fill: var(--text-dim);
}
.ql-snow .ql-picker {
  color: var(--text-dim);
}
.ql-snow .ql-picker-options {
  background: var(--panel);
  border-color: var(--border) !important;
}
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke {
  stroke: var(--accent);
}
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill {
  fill: var(--accent);
}
.ql-snow .ql-picker-label:hover,
.ql-snow .ql-picker-item:hover,
.ql-snow.ql-toolbar button:hover,
.ql-snow.ql-toolbar button.ql-active {
  color: var(--accent);
}
.ql-snow a {
  color: var(--accent);
}
.ql-snow .ql-tooltip {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
}
.ql-snow .ql-tooltip input[type="text"] {
  background: var(--panel-2);
  border-color: var(--border);
  color: var(--text);
}

/* Cover image dropzone + preview */
.dropzone {
  border: 1px dashed var(--border-2);
  border-radius: 11px;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  cursor: pointer;
  overflow: hidden;
  background: repeating-linear-gradient(
    135deg,
    var(--panel-2),
    var(--panel-2) 9px,
    transparent 9px,
    transparent 18px
  );
}
.dropzone.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.cover-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
}
.cover-preview {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  display: block;
}

/* ---------- Users -------------------------------------------------------- */
.user-search {
  position: relative;
}
.user-search .icon-lead {
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  display: flex;
}
.user-search input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 15px 48px 15px 50px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.user-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.user-search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: pointer;
}
.users-grid {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.results-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 260px);
}
.results-head {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.results-list {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 120px;
}
.result-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 10px;
  cursor: pointer;
  font-family: inherit;
  background: transparent;
  color: inherit;
  text-decoration: none;
  transition: background 0.12s;
}
.result-item:hover {
  background: var(--row-hover);
}
.result-item.is-active {
  background: var(--accent-soft);
  border-color: color-mix(in oklab, var(--accent) 38%, transparent);
}
.result-email {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-username {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.results-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.6;
}
.detail-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.profile-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.chip-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
}
.profile-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 5px;
  color: var(--text-dim);
  font-size: 13px;
}
.cards-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
}
.empty-state {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 64px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  min-height: 340px;
}
.empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}
.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* Account controls: inline control + action button rows */
.control-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.control-row > .input,
.control-row > .select-wrap {
  flex: 1;
}

/* Audit log list */
.audit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}
.audit-main {
  min-width: 0;
}
.audit-action {
  font-size: 13.5px;
  font-weight: 600;
}
.audit-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
}
.audit-when {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
  flex: none;
}
.audit-empty {
  padding: 28px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.hr {
  height: 1px;
  background: var(--border);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.actions-end {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- Article preview modal --------------------------------------- */
/* Client-side preview of the public-site rendering (Card / Article views). */
.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background: rgba(8, 9, 13, 0.62);
  backdrop-filter: blur(4px);
}
.preview-overlay[hidden] {
  display: none;
}
.preview-dialog {
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow), 0 0 0 1px var(--border), 0 24px 60px
    color-mix(in oklab, var(--accent) 22%, transparent);
  overflow: hidden;
}

/* Card / Article tab strip */
.preview-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.preview-tab {
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: 8px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.preview-tab:hover {
  color: var(--text);
}
.preview-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.preview-tabs-spacer {
  flex: 1;
}

.preview-body {
  overflow-y: auto;
  min-height: 0;
}
.preview-pane[hidden] {
  display: none;
}

/* Card view sits centered on the panel bg, like a listing tile.
   `:not([hidden])` so the hidden state always wins over this display rule. */
.preview-pane[data-preview-pane="card"]:not([hidden]) {
  display: flex;
  justify-content: center;
  padding: 36px 24px;
  background: var(--bg);
}

/* Shared badge row + badges (used by both views) */
.pv-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 7px;
  z-index: 1;
}
.pv-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
/* Category badge colors (fixed identity colors, not theme tokens). */
.pv-badge--event {
  background: #f5b042;
  color: #1a1205;
}
.pv-badge--maintenance {
  background: #ef5b6b;
  color: #fff;
}
.pv-badge--news {
  background: var(--accent);
  color: #fff;
}

/* ---- Card (small listing tile) ---- */
.pv-card {
  width: 400px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.pv-card-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
}
.pv-card-cover.is-empty,
.pv-hero.is-empty {
  background-image: linear-gradient(
    135deg,
    var(--accent),
    color-mix(in oklab, var(--accent) 45%, var(--panel-2))
  ) !important;
}
.pv-card-body {
  padding: 20px;
}
.pv-date {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}
.pv-card-title {
  margin: 8px 0 10px;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
}
.pv-card-excerpt {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pv-readmore {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---- Article (full large view) ---- */
.pv-article {
  display: flex;
  flex-direction: column;
}
.pv-hero {
  position: relative;
  height: 300px;
  flex: none;
  background-size: cover;
  background-position: center;
}
.pv-hero-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(8, 9, 13, 0.5);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(3px);
  transition: background 0.15s;
}
.pv-hero-close:hover {
  background: rgba(8, 9, 13, 0.75);
}
.pv-article-body {
  padding: 26px 32px 8px;
}
.pv-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-dim);
}
.pv-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.pv-meta-item:first-child {
  color: var(--accent);
}
.pv-meta-dot {
  color: var(--text-faint);
}
.pv-article-title {
  margin: 14px 0 20px;
  font-size: 37px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--text);
}

/* Article footer */
.pv-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 32px 24px;
}
.pv-share {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pv-share:hover {
  color: var(--text);
}
.pv-footer-actions {
  display: flex;
  gap: 10px;
}

/* ---------- Rendered article body (scoped to the preview content) ------- */
.article-content {
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text-dim);
}
.article-content > :first-child {
  margin-top: 0;
}
.article-content p {
  margin: 0 0 16px;
}
.article-content strong {
  color: var(--text);
  font-weight: 700;
}
.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.article-content h2,
.article-content h3 {
  position: relative;
  margin: 28px 0 12px;
  padding-left: 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--text);
}
.article-content h2 {
  font-size: 19px;
}
.article-content h3 {
  font-size: 16px;
}
.article-content h2::before,
.article-content h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15em;
  bottom: 0.15em;
  width: 4px;
  border-radius: 3px;
  background: var(--accent);
}
.article-content ul,
.article-content ol {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}
.article-content li {
  position: relative;
  padding-left: 26px;
  margin: 0 0 9px;
}
.article-content ul > li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  background: var(--accent);
  transform: rotate(45deg);
}
.article-content ol {
  counter-reset: pv-ol;
}
.article-content ol > li {
  counter-increment: pv-ol;
  padding-left: 32px;
}
.article-content ol > li::before {
  content: counter(pv-ol);
  position: absolute;
  left: 0;
  top: 0.1em;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 800;
}
.article-content blockquote {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--accent-soft);
  color: var(--text);
  font-style: italic;
}
.article-content blockquote p:last-child {
  margin-bottom: 0;
}

/* ---------- Responsive --------------------------------------------------- */
@media (max-width: 860px) {
  .editor-grid,
  .users-grid,
  .cards-2,
  .controls-grid {
    grid-template-columns: 1fr;
  }
  .global-search {
    display: none;
  }
  .page {
    padding: 20px 16px;
  }
  .pv-hero {
    height: 200px;
  }
  .pv-article-body,
  .pv-footer {
    padding-left: 18px;
    padding-right: 18px;
  }
  .pv-article-title {
    font-size: 27px;
  }
}
