:root {
  --bg: #0d0d0d;
  --bg-card: #121212;
  --bg-card-soft: #161616;
  --foreground: #ffffff;
  --muted: #a1a1a1;
  --border: rgba(212, 175, 55, 0.22);
  --gold: #d4af37;
  --gold-dim: rgba(212, 175, 55, 0.85);
  --danger: #b22222;
  --danger-soft: rgba(178, 34, 34, 0.9);
  --success: #22c55e;
  --primary: var(--gold);
  --primary-glow: #f0d875;
}
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--foreground);
  background: var(--bg);
  min-height: 100vh;
}

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

main.page:has(#dashboard-screen:not(.hidden)) {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

#dashboard-screen {
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
  position: relative;
}

.sidebar {
  width: 260px;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  border-right: 1px solid var(--border);
  padding: 20px 14px 16px;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 20;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 20px;
  border-bottom: 1px solid hsl(46 25% 18% / 0.45);
  margin-bottom: 16px;
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sidebar-brand-title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: var(--gold);
}

.sidebar-brand-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

button.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 11px 12px;
  border-radius: 10px;
  background: transparent;
  color: var(--foreground);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

button.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(212, 175, 55, 0.12);
}

button.nav-item.is-active {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.35);
  box-shadow: inset 3px 0 0 var(--gold);
  color: var(--gold);
}

.nav-icon-svg {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.9;
}

button.nav-item:not(.is-active) .nav-icon-svg {
  color: var(--foreground);
  opacity: 0.75;
}

.nav-section-label {
  margin: 16px 12px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}
.nav-label {
  flex: 1;
  min-width: 0;
}

.sidebar-footer {
  padding-top: 12px;
  margin-top: auto;
  border-top: 1px solid hsl(46 25% 18% / 0.45);
}

button.nav-item-logout {
  color: var(--foreground);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
}

button.nav-item-logout:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(212, 175, 55, 0.25);
}

.main-wrap {
  margin-left: 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 13, 13, 0.97);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-lead {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.menu-toggle {
  padding: 8px 10px;
  min-width: auto;
  border-radius: 10px;
  flex-shrink: 0;
}

.topbar-user-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, #8a7340 100%);
  color: #0d0d0d;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-block-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--foreground);
  line-height: 1.2;
}

.user-role {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
}

.user-chevron {
  flex-shrink: 0;
  opacity: 0.5;
  color: var(--muted);
}

.topbar-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-compact {
  padding: 10px 14px;
  font-size: 13px;
  border-radius: 10px;
}

.content-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.content-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 28px 32px;
}

.dashboard-toast {
  margin: 8px 0 0;
  min-height: 0;
  font-size: 13px;
}

.dashboard-toast:empty {
  display: none;
}

.card-title {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 700;
}

.card-session .session-layout {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.session-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.session-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
  flex-shrink: 0;
}

.session-posts-count {
  margin: 10px 0 0;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}

.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.btn-session {
  padding: 10px 16px;
  font-size: 13px;
  border-radius: 10px;
  font-weight: 600;
}

.btn-gold {
  border: 0;
  border-radius: 10px;
  background: var(--gold);
  color: #0d0d0d;
  font-weight: 700;
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
}

.btn-gold:hover {
  filter: brightness(1.06);
}

.btn-danger-outline {
  border-radius: 10px;
  background: transparent;
  color: #fff;
  border: 1px solid var(--danger);
  font-weight: 600;
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
}

.btn-danger-outline:hover {
  background: rgba(178, 34, 34, 0.15);
}

.column-heading {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.see-all {
  margin-top: 12px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--gold);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.see-all:hover {
  text-decoration: underline;
}

.dash-col {
  min-width: 0;
}

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 15;
}

body.sidebar-open .sidebar-scrim {
  display: block;
}

.app-footer {
  max-width: 1320px;
  margin: 24px auto 0;
  padding: 20px 28px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.app-version {
  color: var(--muted);
  font-weight: 500;
}

.mini-item-media {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.mini-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-card-soft);
}

.mini-thumb-placeholder {
  background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
}

.mini-item-body {
  min-width: 0;
  flex: 1;
}

.mini-item-body strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.mini-slug {
  font-size: 12px;
  color: var(--muted);
  display: block;
}

.mini-views {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
}

.list-empty {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  background: var(--bg-card-soft);
}

.list-empty-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  color: var(--muted);
  opacity: 0.85;
}

.accent-gold {
  color: var(--gold);
}

.panel {
  display: block;
}

.hidden {
  display: none;
}

.brand-header {
  text-align: center;
  margin: 24px auto 20px;
}

.brand-subtitle {
  color: var(--muted);
  margin: 8px 0 0;
}

.logo {
  max-width: 240px;
  width: 100%;
}

.logo.small {
  max-width: 170px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  margin-top: 18px;
  box-shadow: 0 12px 32px -18px rgba(0, 0, 0, 0.9);
}

.login-footer {
  max-width: 520px;
  margin: 28px auto 24px;
  padding: 0 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

h1,
h2 {
  margin: 0 0 6px;
}

.muted {
  color: var(--muted);
}

form {
  margin-top: 20px;
  display: grid;
  gap: 12px;
}

label {
  font-weight: 600;
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: hsl(0 0% 10%);
  color: var(--foreground);
  padding: 12px;
  outline: none;
}

input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

button {
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #c9a227, var(--gold), #c9a227);
  color: #0d0d0d;
  font-weight: 700;
  padding: 12px 16px;
  cursor: pointer;
}

button.ghost {
  background: hsl(0 0% 12%);
  color: var(--foreground);
  border: 1px solid var(--border);
}

button.danger {
  background: var(--danger);
  color: #fff;
}

.bell-btn {
  position: relative;
  min-width: 44px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--foreground);
}

.bell-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: hsl(0 75% 55%);
  color: #fff;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.message {
  min-height: 20px;
  color: var(--primary-glow);
  margin: 4px 0 0;
}

.posts-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.post-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-card-soft);
}

.post-item strong {
  display: block;
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    max-width: min(280px, 88vw);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    z-index: 25;
    flex-direction: column;
    flex-wrap: nowrap;
    padding: 16px 12px;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.45);
  }

  .sidebar-brand {
    flex: none;
    width: 100%;
    margin-bottom: 8px;
    padding: 8px 10px 16px;
    border-bottom: 1px solid var(--border);
    border-right: none;
  }

  .sidebar-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    flex: 1;
    justify-content: flex-start;
    overflow-y: auto;
  }

  button.nav-item {
    width: 100%;
  }

  .nav-section-label {
    margin-top: 12px;
  }

  .sidebar-footer {
    width: 100%;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .main-wrap {
    margin-left: 0;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .topbar-tools {
    justify-content: flex-end;
    margin-left: auto;
  }

  .session-layout {
    flex-direction: column;
  }

  .session-actions {
    justify-content: flex-start;
  }

  .app-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: hsl(0 0% 10%);
  color: var(--foreground);
  padding: 12px;
  outline: none;
  font-family: inherit;
}

textarea.code {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.5;
}

select {
  cursor: pointer;
}

textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px hsl(46 90% 65% / 0.2);
}

.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.editor-form {
  margin-top: 8px;
}

.field-inline {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.field-inline .grow {
  flex: 1;
  min-width: 200px;
}

.slug-btn {
  margin-bottom: 2px;
  white-space: nowrap;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

.section-title {
  margin: 20px 0 8px;
  font-size: 1.1rem;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: -4px 0 8px;
}

.hint code {
  font-size: 11px;
}

.file-label {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.file-label input[type="file"] {
  display: block;
  margin-top: 6px;
  width: 100%;
}

.form-actions {
  margin-top: 8px;
}

.small {
  font-size: 12px;
}

.post-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.post-item .post-meta {
  flex: 1;
  min-width: 200px;
}

.post-item .post-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--bg-card-soft);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 88px;
}

.kpi-card-inner {
  min-width: 0;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.kpi-value {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.kpi-icon-wrap {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}

.kpi-icon-wrap svg {
  width: 22px;
  height: 22px;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-item {
  border: 1px solid hsl(46 30% 18% / 0.35);
  border-radius: 10px;
  padding: 10px;
  background: hsl(0 0% 7%);
  font-size: 13px;
}

.mini-item .muted {
  font-size: 12px;
}

.mini-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .dashboard-columns {
    grid-template-columns: 1fr;
  }
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -2px;
}

button.mini {
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.html-editor {
  min-height: 280px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: hsl(0 0% 10%);
  color: var(--foreground);
  padding: 12px;
  outline: none;
  line-height: 1.6;
}

.html-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px hsl(46 90% 65% / 0.2);
}

.html-editor img {
  max-width: 100%;
  border-radius: 8px;
  margin: 8px 0;
}
