:root {
  color-scheme: dark;
  --bg: #080611;
  --bg-elevated: rgba(20, 16, 33, 0.82);
  --bg-panel: rgba(18, 15, 31, 0.94);
  --bg-soft: rgba(137, 92, 255, 0.08);
  --border: rgba(182, 154, 255, 0.16);
  --border-strong: rgba(191, 162, 255, 0.34);
  --text: #f5f3ff;
  --text-muted: #b9b1d8;
  --accent: #aa7cff;
  --accent-strong: #c69eff;
  --accent-wash: rgba(170, 124, 255, 0.18);
  --danger: #ff7aa2;
  --success: #7ff0c5;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 24px;
  --font-sans: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(
      circle at top left,
      rgba(170, 124, 255, 0.18),
      transparent 36%
    ),
    radial-gradient(
      circle at top right,
      rgba(87, 46, 201, 0.22),
      transparent 28%
    ),
    linear-gradient(180deg, #090613 0%, #080611 55%, #06040d 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-sans);
  background:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 36px 36px;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
video {
  max-width: 100%;
  display: block;
}

button,
input,
textarea {
  font: inherit;
}

.site-shell,
.dashboard-shell {
  width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.site-header,
.dashboard-header,
.panel,
.post-card,
.sidebar-card,
.article-shell,
.empty-state,
.dashboard-login-card {
  backdrop-filter: blur(18px);
  background: linear-gradient(
    180deg,
    rgba(22, 18, 36, 0.98),
    rgba(12, 10, 21, 0.96)
  );
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.sidebar-card {
  margin-bottom: 24px;
  border-radius: var(--radius);
}

.site-header,
.dashboard-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 24px 28px 0 28px;
  border-radius: var(--radius);
}

.brand,
.dashboard-header h1,
.article-title,
.section-heading h2,
.dashboard-login-card h1 {
  letter-spacing: -0.04em;
}

.brand {
  font-size: clamp(1.9rem, 3vw, 2.7rem);
  font-weight: 700;
}

.brand-copy,
.muted,
.post-card p,
.site-footer,
.dashboard-status-row {
  color: var(--text-muted);
}

.site-actions,
.dashboard-header-actions,
.panel-header,
.search-row,
.eyebrow-row,
.pager,
.dashboard-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-login-shell {
  margin-top: 24px;
}

.dashboard-login-card h1 {
  margin: 10px 0 12px;
  font-size: clamp(2.3rem, 5vw, 4.7rem);
  line-height: 0.95;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.field-label,
.field span {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button,
button.button,
label.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  background: linear-gradient(180deg, var(--accent), #7c58d8);
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    opacity 140ms ease;
}

.button:hover,
button.button:hover,
label.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 10px rgba(124, 88, 216, 0.2);
}

.button.subtle,
button.button.subtle {
  background: rgba(255, 255, 255, 0.03);
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.button.disabled,
.button:disabled,
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.search-form,
.field,
.toggle,
.dashboard-form-stack,
.preview-panel,
.dashboard-list,
.media-list {
  display: grid;
  gap: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.content-grid,
.dashboard-layout {
  display: grid;
  gap: 24px;
  margin-top: 24px;
  grid-template-columns: minmax(0, 1.9fr) minmax(280px, 0.8fr);
}

.content-main,
.dashboard-editor-shell {
  min-width: 0;
}

.post-grid,
.sidebar-card,
.article-shell {
  display: grid;
  gap: 20px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 20px;
}

.section-heading h2,
.article-title,
.panel-header h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
}

.post-card {
  overflow: hidden;
  border-radius: var(--radius);
}

.post-card-media img,
.hero-image img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.post-card-body,
.sidebar-card,
.article-shell,
.panel,
.dashboard-login-card {
  padding: 24px;
}

.post-card h2 {
  margin: 10px 0 12px;
  font-size: clamp(1.5rem, 3vw, 2.3rem);
}

.tag-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tag {
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.pager {
  justify-content: center;
  margin-top: 24px;
}

.pager-label {
  min-width: 130px;
  text-align: center;
  color: var(--text-muted);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding: 0 6px;
  font-size: 0.95rem;
}

.article-shell,
.empty-state {
  border-radius: var(--radius);
}

.empty-state {
  padding: 0 24px;
}

.back-link {
  color: var(--accent-strong);
  font-family: var(--font-mono);
}

.markdown-body {
  line-height: 1.75;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 1.8em 0 0.6em;
  letter-spacing: -0.03em;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body pre,
.markdown-body blockquote {
  margin: 1em 0;
}

.markdown-body code,
.media-fallback {
  font-family: var(--font-mono);
}

.markdown-body code {
  padding: 0.18em 0.4em;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.markdown-body pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}

.markdown-body blockquote {
  padding-left: 18px;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
}

.dashboard-login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.dashboard-login-card {
  width: min(560px, calc(100vw - 32px));
  border-radius: 32px;
}

.dashboard-tabs {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}

.tab-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.tab-button:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.tab-button.active {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.tab-button span {
  font-weight: 700;
}

.tab-button strong {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-view {
  margin-top: 24px;
}

.dashboard-view-panel {
  min-height: min(720px, calc(100vh - 250px));
}

.config-form {
  max-width: 760px;
}

.dashboard-sidebar {
  display: grid;
  gap: 24px;
}

.panel {
  border-radius: var(--radius);
}

.panel-header {
  justify-content: space-between;
  align-items: start;
  margin-bottom: 18px;
}

.post-row {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.post-row.active {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.post-row-title {
  display: block;
  font-weight: 600;
}

.post-row-meta {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.editor-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.preview-panel {
  min-height: 100%;
  align-content: start;
  grid-auto-rows: max-content;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.18);
}

.toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--text);
}

.toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.action-toggle {
  min-height: 44px;
  padding: 0 4px;
}

.status {
  margin: 0;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
}

.status.success {
  color: #d8fff0;
  background: rgba(127, 240, 197, 0.12);
}

.status.error {
  color: #ffd4e0;
  background: rgba(255, 122, 162, 0.12);
}

.dashboard-status-row:empty {
  display: none;
}

.empty-state.compact {
  padding: 22px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: none;
}

.empty-state.compact h2 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  letter-spacing: 0;
}

.empty-state.compact p {
  margin: 0;
}

.media-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.media-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  align-items: start;
}

.media-card img,
.media-card video,
.media-fallback {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.media-fallback {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
}

.media-card-body {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.loading-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  color: var(--text-muted);
}

@media (max-width: 1080px) {
  .content-grid,
  .dashboard-layout,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .site-footer,
  .site-header,
  .dashboard-header,
  .section-heading {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .site-shell,
  .dashboard-shell {
    width: min(100vw - 20px, 1320px);
    padding-top: 20px;
  }

  .dashboard-tabs {
    grid-template-columns: 1fr;
  }

  .site-header,
  .dashboard-header,
  .post-card-body,
  .sidebar-card,
  .article-shell,
  .panel,
  .dashboard-login-card {
    padding: 18px;
  }

  .button,
  button.button,
  label.button {
    width: 100%;
  }

  .site-actions,
  .dashboard-header-actions,
  .search-row,
  .pager {
    width: 100%;
    flex-direction: column;
  }
}
