:root {
  --bg: #FAF6F0;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #FFFFFF;
  --ink: #1C1815;
  --ink-muted: #5C5249;
  --ink-subtle: #887C71;
  --accent: #B08446;
  --accent-deep: #86602A;
  --accent-grad: linear-gradient(135deg, #D0A663 0%, #9E7336 100%);
  --line: rgba(166, 123, 62, 0.18);
  --shadow: 0 16px 38px -14px rgba(135, 96, 67, 0.14), 0 4px 12px -4px rgba(28, 24, 21, 0.05);
  --radius: 20px;
  --radius-sm: 12px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(228, 193, 133, 0.18) 0%, transparent 42%),
    radial-gradient(circle at 88% 12%, rgba(232, 199, 172, 0.2) 0%, transparent 40%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Shell */
.admin-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}
@media (min-width: 960px) {
  .admin-shell { grid-template-columns: 260px 1fr; }
}

.sidebar {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
@media (min-width: 960px) {
  .sidebar {
    border-bottom: 0;
    border-right: 1px solid var(--line);
    padding: 1.65rem 1.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand__seal {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--accent-grad);
  color: #FFFDF9;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px -6px rgba(158, 115, 54, 0.55);
  flex-shrink: 0;
}
.brand__name {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.15;
}
.brand__sub {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-weight: 700;
}

.side-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
@media (min-width: 960px) {
  .side-nav { flex-direction: column; }
}
.side-nav a {
  padding: 0.62rem 0.9rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: background 0.18s, color 0.18s;
}
.side-nav a:hover {
  background: rgba(176, 132, 70, 0.1);
  color: var(--ink);
}
.side-nav a.is-active {
  background: var(--accent-grad);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 8px 18px -8px rgba(158, 115, 54, 0.55);
}
.side-nav .pill-cnt {
  font-size: 0.74rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(28, 24, 21, 0.08);
}
.side-nav a.is-active .pill-cnt {
  background: rgba(255, 255, 255, 0.24);
  color: #FFFFFF;
}

.sidebar__foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.82rem;
}
.target-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  background: rgba(176, 132, 70, 0.12);
  color: var(--accent-deep);
  font-weight: 600;
  font-size: 0.76rem;
}
.target-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2E8540;
}

.main {
  padding: clamp(1.25rem, 3vw, 2.25rem);
  max-width: 1180px;
  width: 100%;
}

/* Header & Alerts */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-head h1 {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.8vw, 2.15rem);
  line-height: 1.18;
}
.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent-deep);
}
.muted { color: var(--ink-muted); }

.alert {
  padding: 0.9rem 1.15rem;
  border-radius: 14px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.alert--success { background: #EAF7EE; color: #1A4E27; border: 1px solid #BCE2C5; }
.alert--error   { background: #FDF0EE; color: #7C2017; border: 1px solid #ECC2BC; }
.alert--warn    { background: #FFF8E6; color: #6B4A10; border: 1px solid #ECD59E; }

/* Cards & Grids */
.card {
  background: var(--surface);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.45rem;
  margin-bottom: 1.35rem;
}
.card--ai {
  background: linear-gradient(135deg, rgba(255, 252, 245, 0.96) 0%, rgba(246, 234, 212, 0.85) 100%);
  border: 1px solid rgba(176, 132, 70, 0.35);
}
.card__title {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.28rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem;
}
.kpi__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-subtle);
  font-weight: 700;
}
.kpi__val {
  margin-top: 0.35rem;
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  font-variant-numeric: lining-nums;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.68rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s, box-shadow 0.16s, background 0.16s, opacity 0.16s;
}
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn--primary {
  background: var(--accent-grad);
  color: #FFFFFF;
  box-shadow: 0 10px 22px -8px rgba(158, 115, 54, 0.55);
}
.btn--primary:hover:not(:disabled) { transform: translateY(-1px); }
.btn--ghost {
  background: #FFFFFF;
  border-color: var(--line);
  color: var(--ink);
}
.btn--ghost:hover:not(:disabled) { border-color: var(--accent); }
.btn--danger {
  background: #FCEAE8;
  color: #8E2319;
  border-color: #F0C2BC;
}
.btn--danger:hover:not(:disabled) { background: #F8D5D1; }
.btn--sm { padding: 0.42rem 0.82rem; font-size: 0.8rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 720px) {
  .form-grid--2 { grid-template-columns: 1fr 1fr; }
  .form-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}
.field small {
  font-size: 0.76rem;
  color: var(--ink-subtle);
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.72rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(138, 101, 72, 0.24);
  background: rgba(252, 249, 245, 0.9);
  font-size: 0.92rem;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(176, 132, 70, 0.16);
}
.field textarea { resize: vertical; min-height: 92px; }
.field textarea.article-editor {
  min-height: 360px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  line-height: 1.65;
}

/* Tables & Item Lists */
.list-table {
  width: 100%;
  border-collapse: collapse;
}
.list-table th,
.list-table td {
  text-align: left;
  padding: 0.78rem 0.65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 0.9rem;
}
.list-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-subtle);
}
.thumb-mini {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
  background: #EAE2D7;
}
.tag {
  display: inline-block;
  padding: 0.2rem 0.62rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(176, 132, 70, 0.14);
  color: var(--accent-deep);
}

/* Story Photo Manager Grid */
.photo-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.photo-tile {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.photo-tile.is-cover {
  border: 2px solid var(--accent);
  box-shadow: 0 10px 24px -10px rgba(176, 132, 70, 0.45);
}
.photo-tile__img {
  position: relative;
  aspect-ratio: 3 / 2;
  background: #EAE2D7;
  overflow: hidden;
}
.photo-tile__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-tile__cover-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-grad);
  color: #FFF;
  font-size: 0.7rem;
  font-weight: 700;
}
.photo-tile__body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}
.photo-tile__body textarea {
  width: 100%;
  min-height: 62px;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(138, 101, 72, 0.22);
  background: #FCF9F5;
  resize: vertical;
}
.photo-tile__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(176, 132, 70, 0.42);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.is-drag {
  border-color: var(--accent);
  background: rgba(255, 252, 245, 0.95);
}
.progress-line {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-deep);
}

/* Login Page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(22px);
  border: 1px solid #FFFFFF;
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 2.25rem 2rem;
}
.login-card h1 {
  font-family: var(--font-display);
  margin: 1rem 0 0.25rem;
  font-size: 1.75rem;
}
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.filter-pills a {
  padding: 0.38rem 0.85rem;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 600;
}
.filter-pills a.is-active {
  background: var(--accent-grad);
  color: #FFFFFF;
  border-color: transparent;
}
