:root {
  --bg: #060608;
  --bg-elevated: #0e1014;
  --panel: rgba(20, 22, 28, 0.92);
  --panel-2: #171a21;
  --text: #ece8e1;
  --muted: #8f8b84;
  --gold: #e6c27a;
  --gold-dim: rgba(230, 194, 122, 0.14);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(230, 194, 122, 0.22);
  --danger: #f08a8a;
  --radius-lg: 22px;
  --radius-md: 14px;
  --shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
}

.admin-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(230, 194, 122, 0.09), transparent 55%),
    radial-gradient(ellipse 40% 30% at 100% 50%, rgba(90, 70, 40, 0.06), transparent),
    radial-gradient(ellipse 35% 25% at 0% 80%, rgba(40, 50, 70, 0.08), transparent);
}

.admin-shell {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px 20px 64px;
}

/* Login */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 48px);
}

.login-panel {
  width: 100%;
  max-width: 400px;
  padding: 44px 40px 40px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(230, 194, 122, 0.14);
  border-top: 2px solid rgba(230, 194, 122, 0.45);
  background: linear-gradient(165deg, rgba(26, 28, 34, 0.98) 0%, rgba(12, 13, 16, 0.99) 100%);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255,255,255,0.03) inset;
}

.login-brand {
  text-align: center;
  margin-bottom: 36px;
}

.login-brand img {
  height: 32px;
  width: auto;
  margin-bottom: 24px;
  opacity: 1;
}

.login-eyebrow,
.header-eyebrow {
  margin: 0 0 8px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.login-brand h1 {
  margin: 0 0 12px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.85rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
}

.login-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
  letter-spacing: 0.01em;
}

.google-btn {
  position: relative;
  width: 100%;
  height: 54px;
  border: 1px solid rgba(230, 194, 122, 0.28);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(230, 194, 122, 0.1), rgba(230, 194, 122, 0.04));
  color: var(--text);
  font-size: 0.93rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.15s;
  margin-top: 4px;
}

.google-btn:hover {
  border-color: rgba(230, 194, 122, 0.6);
  background: linear-gradient(180deg, rgba(230, 194, 122, 0.14), rgba(230, 194, 122, 0.07));
  box-shadow: 0 0 20px rgba(230, 194, 122, 0.1);
}

.google-btn:active {
  transform: scale(0.99);
}

.google-btn.loading {
  pointer-events: none;
}

.google-btn.loading .google-content {
  opacity: 0;
}

.google-btn.loading .google-loader {
  opacity: 1;
}

.google-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.google-icon {
  width: 20px;
  height: 20px;
}

.google-loader {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(230, 194, 122, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  opacity: 0;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Header */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(14, 16, 20, 0.72);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

.header-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}

.header-logo-link:hover {
  background: var(--gold-dim);
  border-color: var(--border-strong);
}

.admin-header-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  height: 25px;
  width: auto;
}

.admin-header h1 {
  margin: 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.admin-header-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: flex-end;
  justify-items: end;
  gap: 12px;
}

.user-pill {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.btn:hover {
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
}

.btn-primary {
  background: linear-gradient(180deg, #3a3224, #252018);
  border-color: var(--border-strong);
  color: var(--gold);
  padding: 11px 22px;
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(240, 138, 138, 0.28);
  background: rgba(240, 138, 138, 0.06);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Product tabs */
.product-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.product-tab {
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 7px;
}

.product-tab:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.product-tab.active {
  background: var(--gold-dim);
  border-color: rgba(201,169,106,0.35);
  color: var(--gold);
}

/* Confessions inline panel */
.confessions-inline-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.confessions-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.confession-tab {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.confession-tab:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.confession-tab.active {
  background: var(--gold-dim);
  border-color: rgba(201,169,106,0.35);
  color: var(--gold);
}

.confessions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.confession-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 2px solid rgba(201,169,106,0.3);
  border-radius: 12px;
}

.confession-item-text {
  font-family: "Libre Baskerville", serif;
  font-size: 14px;
  line-height: 1.7;
  color: #c8c2b8;
}

.confession-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.confession-item-date {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 11px;
  color: #555;
}

.confession-item-actions {
  display: flex;
  gap: 8px;
}

/* Confessions: search row */
.confessions-search-row {
  margin-bottom: 16px;
}
.confessions-search-row input {
  width: 100%;
  padding: 8px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.confessions-search-row input:focus {
  border-color: var(--border-strong);
}

/* Confessions: bulk action bar */
.confessions-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(201,169,106,0.06);
  border: 1px solid rgba(201,169,106,0.2);
  border-radius: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.conf-selected-label {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 12px;
  color: var(--muted);
}
.conf-bulk-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Confessions: checkbox on items */
.confession-item-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.confession-check {
  width: 14px;
  height: 14px;
  accent-color: #c9a96a;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 3px;
}

/* Confessions: analytics panel */
.confessions-analytics {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.conf-stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.conf-stat {
  flex: 1;
  min-width: 80px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  text-align: center;
}
.conf-stat-val {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}
.conf-stat-lbl {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.conf-stat.pending .conf-stat-val { color: #c9a96a; }
.conf-stat.approved .conf-stat-val { color: #8ecfa8; }
.conf-stat.rejected .conf-stat-val { color: #f87878; }

.conf-section-title {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 12px;
}

/* Trend bars */
.conf-trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 64px;
}
.conf-trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}
.conf-trend-bar {
  width: 100%;
  background: rgba(201,169,106,0.4);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: background 0.15s;
}
.conf-trend-bar:hover { background: rgba(201,169,106,0.7); }
.conf-trend-day {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}

/* Top confessions list */
.conf-top-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.conf-top-item:last-child { border-bottom: none; }
.conf-top-likes {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 11px;
  color: #c9a96a;
  flex-shrink: 0;
  min-width: 36px;
}
.conf-top-text {
  font-family: "Libre Baskerville", serif;
  font-size: 12px;
  color: #c8c2b8;
  line-height: 1.5;
}

/* Dashboard layout */
.dashboard {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 20px;
  align-items: start;
}

.story-sidebar {
  position: sticky;
  top: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.story-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.story-count {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.story-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.filter-chip {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.filter-chip:hover,
.filter-chip.active {
  border-color: var(--border-strong);
  background: var(--gold-dim);
  color: var(--text);
}

.story-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.story-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.story-search input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(230, 194, 122, 0.07);
}

.story-search input::placeholder {
  color: var(--muted);
  opacity: 0.65;
}

.story-search input::-webkit-search-cancel-button {
  opacity: 0.5;
  cursor: pointer;
}

.story-list-items {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}

.change-panel {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.14);
}

.change-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.change-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid var(--border-strong);
  font-variant-numeric: tabular-nums;
}

.change-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 20px;
  font-size: 0.78rem;
}

.change-empty {
  color: var(--muted);
  font-size: 0.78rem;
}

.change-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  transition: background 0.15s;
}

.change-item.is-active {
  background: rgba(230, 194, 122, 0.06);
}

.change-story-select {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px 6px 6px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  border-radius: 8px;
  transition: background 0.15s;
}

.change-story-select:hover {
  background: rgba(255, 255, 255, 0.04);
}

.change-title {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.change-type {
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--gold-dim);
  color: var(--gold);
}

.change-type-deleted {
  background: rgba(240, 138, 138, 0.12);
  color: var(--danger);
}

.change-type-added {
  background: rgba(138, 240, 168, 0.10);
  color: #7fcea8;
}

.change-reset-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.change-reset-btn:hover {
  border-color: var(--border-strong);
  background: rgba(240, 138, 138, 0.1);
  color: var(--danger);
}

.change-actions {
  margin-top: 10px;
}

.mini-btn {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.mini-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--gold-dim);
  color: var(--text);
}

.mini-btn.danger {
  color: var(--danger);
  border-color: rgba(240, 138, 138, 0.22);
}

.mini-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.story-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 14px 18px;
  cursor: pointer;
  transition: background 0.15s;
}

.story-item:hover,
.story-item.active {
  background: var(--gold-dim);
}

.story-item.active {
  box-shadow: inset 3px 0 0 var(--gold);
}

.story-item strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.35;
}

.story-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.story-badges {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.story-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.story-badge.is-featured {
  color: var(--gold);
  border-color: var(--border-strong);
  background: rgba(230, 194, 122, 0.08);
}

.story-badge.is-latest {
  color: #a8d4a8;
  border-color: rgba(168, 212, 168, 0.2);
  background: rgba(168, 212, 168, 0.07);
}

.story-badge.is-views {
  color: rgba(255,255,255,0.4);
  border-color: rgba(255,255,255,0.1);
  letter-spacing: 0.02em;
}

.story-badge.is-draft {
  color: rgba(255,180,0,0.8);
  border-color: rgba(255,180,0,0.25);
}

.story-meta-line {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.story-list-empty {
  padding: 22px 18px;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

/* Editor */
.editor-main {
  min-width: 0;
}

.editor-panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.editor-empty {
  padding: 48px 32px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

#story-editor {
  padding: 28px 28px 24px;
}

.editor-section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.editor-section:last-of-type {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-title {
  margin: 0 0 18px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.field {
  margin-bottom: 16px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label,
.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(230, 194, 122, 0.08);
}

.field-hint {
  margin: 6px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

.hint-link {
  color: var(--gold);
  text-decoration: none;
  opacity: 0.8;
}

.hint-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.field-combo {
  position: relative;
}

.combo-wrap {
  position: relative;
}

.combo-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 200;
  background: #12141a;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
}

.combo-option {
  display: block;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
}

.combo-option:hover,
.combo-option:focus {
  background: var(--gold-dim);
  outline: none;
  color: var(--gold);
}

.combo-empty {
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--muted);
}

.field-compact textarea,
.textarea-compact {
  min-height: 96px;
  max-height: 140px;
  resize: vertical;
  line-height: 1.6;
  font-family: inherit;
  font-size: 0.88rem;
  padding: 12px 12px;
}

.field textarea:not(.textarea-compact):not(.textarea-article) {
  min-height: 280px;
  resize: vertical;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
}

.textarea-article {
  min-height: 320px;
  resize: vertical;
  line-height: 1.72;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 0.9rem;
  letter-spacing: 0.008em;
}

/* Shared control box (date + image) */
.control-box {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-2);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.grid-align-top {
  align-items: start;
}

.grid-align-top > .field {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.date-cover-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 50%;
}

.date-control-field {
  min-width: 0;
}

.cover-control-field {
  min-width: 0;
}

.field-inline-btn {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(230, 194, 122, 0.35);
}

.field-inline-btn:hover {
  text-decoration-color: var(--gold);
}

.control-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--gold-dim);
  color: var(--gold);
}

.control-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-align: left;
}

.control-label {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
}

.control-sub {
  font-size: 0.76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Date field */
.date-field {
  position: relative;
}

.date-field-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.date-field-trigger:hover,
.date-field-trigger:focus-visible {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(230, 194, 122, 0.08);
}

.date-picker-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  z-index: 50;
  width: min(100%, 252px);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #1c1f26 0%, #12141a 100%);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
}

.date-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.date-picker-month-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.date-nav-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.date-nav-btn:hover {
  border-color: var(--border-strong);
  color: var(--gold);
}

.date-picker-weekdays,
.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.date-picker-weekdays {
  margin-bottom: 6px;
}

.date-picker-weekdays span {
  text-align: center;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.date-day {
  aspect-ratio: 1;
  min-height: 27px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.72rem;
  cursor: pointer;
}

.date-day:hover:not(:disabled) {
  background: var(--gold-dim);
}

.date-day.is-selected {
  background: linear-gradient(180deg, #3a3224, #252018);
  color: var(--gold);
  border: 1px solid var(--border-strong);
}

.date-day.is-today:not(.is-selected) {
  border: 1px solid rgba(230, 194, 122, 0.35);
}

.date-day.is-outside {
  color: rgba(154, 154, 165, 0.45);
}

.date-day:disabled {
  opacity: 0.25;
  cursor: default;
}

.date-day.is-empty {
  visibility: hidden;
  pointer-events: none;
}

/* Image upload */
.image-upload-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.image-preview-wrap {
  width: min(100%, 180px);
  aspect-ratio: 3 / 4;
  align-self: center;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}

.image-preview-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-empty {
  padding: 28px 12px;
  text-align: center;
  border-radius: 10px;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.image-remove-btn {
  color: var(--danger);
  border-color: rgba(240, 138, 138, 0.2);
}

.image-remove-btn:hover {
  background: rgba(240, 138, 138, 0.06);
  border-color: rgba(240, 138, 138, 0.35);
}

.field-required {
  color: var(--gold);
  margin-left: 1px;
  font-weight: 400;
}

.image-upload-status {
  margin: 0;
  min-height: 0;
}

.image-path-label {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-all;
}

/* Story editor + live preview */
.story-editor-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.story-write,
.story-preview-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.story-write .textarea-article {
  min-height: 460px;
  height: 460px;
  padding: 28px 30px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(20, 22, 28, 0.98) 0%, rgba(14, 15, 18, 1) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.03),
    0 20px 40px rgba(0,0,0,0.24);
  color: rgba(236, 232, 225, 0.92);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 0.88rem;
  line-height: 1.9;
  letter-spacing: 0.01em;
  resize: none;
}

.story-write .textarea-article::placeholder {
  color: rgba(143, 139, 132, 0.62);
  font-style: italic;
}

.story-write .textarea-article:focus {
  border-color: rgba(230, 194, 122, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.03),
    0 0 0 3px rgba(230, 194, 122, 0.06),
    0 24px 48px rgba(0,0,0,0.32);
}

.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(143, 139, 132, 0.72);
}

.story-preview-frame {
  min-height: 460px;
  height: 460px;
  max-height: 460px;
  overflow: auto;
  padding: 42px 42px 50px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.05);
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.03), transparent 38%),
    linear-gradient(180deg, #090909 0%, #000000 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.03),
    0 24px 48px rgba(0,0,0,0.34);
}

.story-live-preview {
  margin: 0 auto;
  width: 100%;
  max-width: 720px;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: #9a9aa5;
}

.story-live-preview p {
  margin: 0 0 26px;
}

.story-live-preview p:last-child {
  margin-bottom: 0;
}

.story-live-preview em {
  font-style: italic;
}

.story-live-preview strong {
  font-weight: 600;
  color: #e8e8ec;
}

.story-live-preview blockquote {
  margin: 42px 0;
  padding-left: 22px;
  border-left: 2px solid rgba(230, 194, 122, 0.3);
  color: rgba(154, 154, 165, 0.72);
  font-style: italic;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.slug-row {
  margin: -4px 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed var(--border);
}

.slug-preview {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--gold);
  word-break: break-all;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-2.grid-align-top {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: start;
}

.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  user-select: none;
}

.toggle-pill:has(input:checked) {
  border-color: var(--border-strong);
  background: var(--gold-dim);
  color: var(--text);
}

.publish-toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s, background 0.2s;
}

.publish-toggle-row:has(.publish-toggle-input:checked) {
  border-color: rgba(74,222,128,0.4);
  background: rgba(74,222,128,0.06);
}

.publish-toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.publish-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.publish-toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.12);
  transition: background 0.22s ease;
}

.publish-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.22s ease;
}

.publish-toggle-input:checked + .publish-toggle-track {
  background: #6fcf97;
}

.publish-toggle-input:checked + .publish-toggle-track::after {
  transform: translateX(16px);
}

.publish-toggle-text {
  font-size: 13px;
  color: var(--muted);
  transition: color 0.2s;
}

.publish-toggle-row:has(.publish-toggle-input:checked) .publish-toggle-text {
  color: #6fcf97;
}

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

.editor-footer {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.editor-footer-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.last-edited-meta {
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.7;
}

.status {
  min-height: 1.2em;
  font-size: 0.86rem;
  color: var(--muted);
}

.banner-status {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.banner-status:empty {
  display: none;
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: #a8d4a8;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .admin-header {
    flex-direction: column;
  }

  .admin-header-meta {
    align-items: flex-start;
    width: 100%;
    grid-template-columns: 1fr;
    justify-items: start;
  }

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

  .story-sidebar {
    position: static;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .grid-2.grid-align-top {
    grid-template-columns: 1fr;
  }

  .story-editor-split {
    grid-template-columns: 1fr;
  }

  .story-preview-frame {
    height: 420px;
    min-height: 420px;
    max-height: 420px;
    padding: 24px 20px 32px;
  }

  .story-live-preview {
    max-width: 100%;
    font-size: 0.8rem;
    line-height: 1.72;
  }
}

/* ── Access modal ─────────────────────────────────────────────────────────── */
.access-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.access-modal.hidden { display: none; }

.access-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

.access-panel {
  position: relative;
  width: 440px;
  max-width: calc(100vw - 32px);
  background: var(--panel-2);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  overflow: hidden;
}

.access-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.access-panel-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.access-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

.access-close:hover { color: var(--text); background: rgba(255,255,255,0.06); }

.access-panel-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.access-add-row {
  display: flex;
  gap: 8px;
}

.access-email-input {
  flex: 1;
  padding: 9px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.access-email-input:focus { border-color: rgba(230,194,122,0.4); }
.access-email-input::placeholder { color: var(--muted); opacity: 0.5; }

.access-status {
  font-size: 12px;
  min-height: 16px;
}
.access-status.ok { color: #6fcf97; }
.access-status.error { color: #eb5757; }

.access-section { display: flex; flex-direction: column; gap: 8px; }

.access-section-label {
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.6;
}

.access-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.access-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}

.access-item-super { opacity: 0.6; }

.access-badge {
  font-size: 10px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(230,194,122,0.7);
  background: rgba(230,194,122,0.08);
  padding: 2px 8px;
  border-radius: 999px;
}

.access-empty {
  font-size: 13px;
  color: var(--muted);
  opacity: 0.5;
  padding: 8px 0;
}

.access-item-email {
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-item-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.mini-btn.deploy-on {
  color: var(--gold);
  border-color: var(--border-strong);
  background: var(--gold-dim);
}

/* ── Subscribers modal ───────────────────────────────────────────────────── */
.subscribers-panel {
  width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.subscribers-panel .access-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: none;
}

.sub-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  background: var(--gold-dim);
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  margin-left: 8px;
}

.sub-notify-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notify-form {
  background: var(--panel-3, rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notify-form.hidden { display: none; }

.notify-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notify-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.notify-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.6;
}

.notify-select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 8px 10px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.notify-select:focus {
  border-color: var(--border-strong);
}

.notify-textarea {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  padding: 8px 10px;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
}

.notify-textarea:focus {
  border-color: var(--border-strong);
}

.notify-textarea::placeholder {
  color: var(--muted);
  opacity: 0.4;
}

.notify-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#notify-status {
  flex-basis: 100%;
}

.subscribers-list {
  flex: 1;
}

/* Already-sent indicator next to story select */
.notify-already-sent {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.5;
  margin-top: 5px;
  display: block;
}

.notify-already-sent.has-sent {
  color: #c9a96a;
  opacity: 0.8;
}

/* Recipients count in notify actions */
.notify-recipients {
  font-size: 12px;
  color: var(--muted);
  opacity: 0.6;
}

/* Sub list header: select info + select all/none */
.sub-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 4px;
  min-height: 28px;
}

.sub-select-info {
  font-size: 12px;
  color: #c9a96a;
}

.sub-select-actions {
  display: flex;
  gap: 10px;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.6;
  font-family: inherit;
  transition: opacity 0.15s;
}

.link-btn:hover { opacity: 1; }

/* Subscriber row checkbox */
.sub-check-label {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.sub-checkbox {
  width: 14px;
  height: 14px;
  accent-color: #c9a96a;
  cursor: pointer;
  flex-shrink: 0;
}

/* Already-notified row highlight */
.sub-item.already-sent .sub-item-email::after {
  content: " · sent";
  font-size: 10px;
  color: #c9a96a;
  opacity: 0.6;
  margin-left: 4px;
}

.sub-loading {
  padding: 16px 0;
  font-size: 13px;
  color: var(--muted);
  opacity: 0.6;
}

.sub-loading.error { color: var(--danger); opacity: 1; }

.sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sub-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.sub-item-email {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-item-date {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.6;
}

/* ── Confirm modal ────────────────────────────────────────────────────────── */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-modal.hidden { display: none; }

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.confirm-panel {
  position: relative;
  width: 360px;
  max-width: calc(100vw - 32px);
  padding: 36px 28px 28px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
  animation: confirm-in 0.18s ease;
}

@keyframes confirm-in {
  from { opacity: 0; transform: scale(0.96) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.confirm-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.confirm-close:hover { color: var(--text); }

.confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(240, 138, 138, 0.1);
  border: 1px solid rgba(240, 138, 138, 0.2);
  color: var(--danger);
}

.confirm-title {
  margin: 0 0 10px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text);
}

.confirm-body {
  margin: 0 0 24px;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--muted);
}

.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Drops ──────────────────────────────────────────────────────────────── */

.drops-toolbar {
  display: flex;
  align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.drops-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  overflow: hidden;
}

.drops-sidebar {
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.drop-meta-line {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

#drop-qty-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

#drop-last-edited {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 6px;
}

@media (max-width: 700px) {
  .drops-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .drops-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 220px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   APP SHELL — premium admin layout
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --nav-bg: #06070b;       /* all left-column sidebars */
  --content-bg: #08090e;  /* all main content areas */
  --card-bg: rgba(11,13,18,0.97);
  --bar: 54px;             /* nav-brand = panel-header = tab-bar */
  --bdr: rgba(255,255,255,0.07);
  --bdr-strong: rgba(255,255,255,0.12);
  --text-dim: rgba(236,232,225,0.4);
  --text-faint: rgba(236,232,225,0.18);
}

/* ─── Login ────────────────────────────────────────────────────────────────── */

.login-wrap {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
#login-view.hidden { display: none; }

/* ─── App shell ─────────────────────────────────────────────────────────────── */

.app-shell {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: 172px 1fr;
  height: 100vh;
  overflow: hidden;
}

.admin-header,
.product-tabs,
.admin-shell { display: none !important; }

/* ─── Left nav ──────────────────────────────────────────────────────────────── */

.app-nav {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--nav-bg);
  border-right: 1px solid var(--bdr);
  overflow: hidden;
}

/* Brand row — exact same height as panel-header via --bar */
.nav-brand {
  height: var(--bar);
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
}

.nav-logo-link {
  display: flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
}

.nav-logo-img {
  height: 24px;
  width: auto;
  display: block;
  opacity: 0.92;
}

.nav-items {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-footer-section { flex-shrink: 0; }

.nav-section-label {
  padding: 12px 16px 5px;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-faint);
  user-select: none;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 16px;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 0.82rem;
  font-family: "Inter", -apple-system, sans-serif;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: color 0.12s, background 0.12s;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.03);
  color: rgba(236,232,225,0.6);
}

.nav-btn.active {
  color: var(--text);
  background: rgba(230,194,122,0.07);
}

.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 20px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.12s;
}

.nav-btn.active .nav-icon { opacity: 1; }
.nav-btn:hover .nav-icon { opacity: 0.7; }

.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: #07080c;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  line-height: 1.5;
  flex-shrink: 0;
}

.nav-user {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-email-text {
  font-size: 0.68rem;
  color: var(--text-faint);
  word-break: break-all;
  line-height: 1.4;
}

.nav-logout-btn {
  font-size: 0.75rem;
  padding: 6px 0;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--bdr);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: "Inter", -apple-system, sans-serif;
  text-align: center;
  width: 100%;
}

.nav-logout-btn:hover {
  color: var(--text);
  border-color: var(--bdr-strong);
}

/* ─── App content ───────────────────────────────────────────────────────────── */

.app-content {
  position: relative;
  overflow: hidden;
  height: 100vh;
  background: var(--content-bg);
}

.product-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.product-panel.hidden { display: none; }

/* Panel top bar — matches nav-brand height exactly */
.panel-header {
  height: var(--bar);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
  gap: 12px;
  background: var(--nav-bg);
}

/* Panel title: big, readable, clearly a header */
.panel-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: rgba(236,232,225,0.55);
  flex-shrink: 0;
}

.panel-status {
  flex: 1;
  font-size: 0.76rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-status.success { color: #74b98a; }
.panel-status.error   { color: var(--danger); }

.panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Panel body: block so height:100% works on children */
.panel-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ─── btn overrides for panel-header ────────────────────────────────────────── */

.panel-header .btn {
  height: 30px;
  padding: 0 12px;
  font-size: 0.75rem;
  border-radius: 6px;
}

.panel-header .btn-ghost {
  color: var(--text-dim);
  border-color: var(--bdr);
  background: transparent;
}

.panel-header .btn-ghost:hover {
  color: var(--text);
  border-color: var(--bdr-strong);
  background: rgba(255,255,255,0.04);
}

.panel-header .btn-primary {
  background: rgba(230,194,122,0.12);
  border: 1px solid rgba(230,194,122,0.28);
  color: var(--gold);
  font-weight: 500;
}

.panel-header .btn-primary:hover {
  background: rgba(230,194,122,0.18);
  border-color: rgba(230,194,122,0.45);
}

/* ─── STORIES ───────────────────────────────────────────────────────────────── */

.panel-body .story-list-header { display: none; }

.panel-body > .dashboard {
  height: 100%;
  overflow: hidden;
  gap: 0 !important;
  align-items: stretch !important;
}

.story-sidebar {
  position: static !important;
  top: auto !important;
  border-radius: 0 !important;
  border: none !important;
  border-right: 1px solid var(--bdr) !important;
  height: 100% !important;
  overflow-y: auto !important;
  background: var(--nav-bg) !important;
  backdrop-filter: none !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Filter chips */
.story-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
}

.filter-chip {
  padding: 4px 10px;
  border: 1px solid var(--bdr);
  border-radius: 20px;
  background: none;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.filter-chip:hover {
  color: rgba(236,232,225,0.65);
  border-color: var(--bdr-strong);
}

.filter-chip.active {
  background: rgba(230,194,122,0.1);
  border-color: rgba(230,194,122,0.3);
  color: var(--gold);
}

/* Search */
.story-search {
  padding: 10px 14px;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
}

.story-search input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--bdr);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.8rem;
  padding: 6px 10px;
  outline: none;
  font-family: "Inter", sans-serif;
  transition: border-color 0.12s, background 0.12s;
}

.story-search input:focus {
  border-color: var(--bdr-strong);
  background: rgba(255,255,255,0.06);
}

/* Change panel */
.change-panel {
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
}

.change-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* Story list items */
.story-list-items {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

/* Editor area */
.editor-main {
  height: 100%;
  overflow-y: auto;
  background: var(--content-bg);
}

/* ─── CONFESSIONS ───────────────────────────────────────────────────────────── */

.panel-body.confessions-body {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--content-bg);
}

/* Tab bar — visually distinct from header */
.confessions-tabs {
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid var(--bdr);
  padding: 0 20px;
  flex-shrink: 0;
  background: rgba(6,7,11,0.6);
  gap: 0;
  margin-bottom: 0;
}

.confession-tab {
  padding: 12px 16px 11px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.12s, border-color 0.12s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.confession-tab:hover { color: rgba(236,232,225,0.65); }

.confession-tab.active {
  color: var(--text);
  border-bottom-color: var(--gold);
  font-weight: 500;
}

/* Search row */
.confessions-search-row {
  padding: 12px 20px;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
  background: rgba(8,9,14,0.4);
  margin-bottom: 0;
}

.confessions-search-row input {
  width: 100%;
  max-width: 400px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--bdr);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 7px 12px;
  outline: none;
  font-family: "Inter", sans-serif;
  transition: border-color 0.12s;
}

.confessions-search-row input:focus {
  border-color: var(--bdr-strong);
}

/* Bulk bar */
.confessions-bulk-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 20px;
  background: rgba(230,194,122,0.06);
  border-bottom: 1px solid rgba(230,194,122,0.15);
  border-radius: 0;
  flex-shrink: 0;
  margin-bottom: 0;
}

.conf-selected-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gold);
}

.conf-bulk-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Confessions list scrollable */
.confessions-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─── DROPS ─────────────────────────────────────────────────────────────────── */

.drops-toolbar { display: none !important; }

.panel-body > .drops-layout {
  height: 100%;
  display: grid;
  grid-template-columns: 220px 1fr;
  overflow: hidden;
}

/* Drop sidebar — matches story-sidebar style */
.drops-sidebar,
.story-sidebar.drops-sidebar {
  border-right: 1px solid var(--bdr) !important;
  border-radius: 0 !important;
  height: 100% !important;
  overflow-y: auto !important;
  background: var(--nav-bg) !important;
  backdrop-filter: none !important;
  display: flex !important;
  flex-direction: column !important;
  position: static !important;
}

/* Hide old drops sidebar header — panel-header already shows "DROPS" */
.drops-sidebar .story-list-header { display: none !important; }

/* Drop list */
.drops-sidebar .story-list-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* ─── MASTER ─────────────────────────────────────────────────────────────────── */

.master-body {
  height: 100%;
  overflow-y: auto;
  padding: 28px 24px;
  background: var(--content-bg);
}

.master-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 1080px;
}

.master-section {
  background: var(--card-bg);
  border: 1px solid var(--bdr);
  border-radius: 10px;
  overflow: hidden;
}

.master-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--bdr);
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(255,255,255,0.015);
}

.master-section-head h2 {
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.master-section-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.master-section-body {
  padding: 16px 18px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

/* Confessions analytics — fills remaining height when shown */
.panel-body.confessions-body .confessions-analytics {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px;
}

/* ─── Kill banner-status ─────────────────────────────────────────────────────── */

.banner-status {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  font-size: 0.76rem !important;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

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

@media (max-width: 700px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-nav { display: none; }
}
