/* ==========================================================================
   The Peach Tree Deals — admin styles
   ========================================================================== */

:root {
  --peach-50: #fff8f4;
  --peach-100: #ffefe7;
  --peach-200: #fbd9cb;
  --peach-300: #f4b8a1;
  --peach-400: #eb9278;
  --peach-500: #de7255;
  --peach-600: #c85a3f;
  --peach-700: #a3452f;
  --ink: #2f2723;
  --ink-soft: #6b5d56;
  --bg: #f6f1ed;
  --card: #ffffff;
  --line: #e8dcd4;
  --success: #2f7d5a;
  --danger: #b23b3b;
  --warn: #a86a12;
  --font-body: "Karla", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Playfair Display", Georgia, serif;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 4px 14px rgba(74, 45, 31, 0.06);
  --shadow: 0 14px 34px rgba(74, 45, 31, 0.1);
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}

img { max-width: 100%; display: block; }
a { color: var(--peach-700); text-decoration: none; }
a:hover { color: var(--peach-600); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  margin: 0 0 0.4em;
  color: var(--ink);
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }

.muted { color: var(--ink-soft); }
.small { font-size: 0.82rem; }
code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.85em;
  background: var(--peach-50);
  padding: 2px 5px;
  border-radius: 4px;
  word-break: break-all;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.admin-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  background: #2f2723;
  color: #e9ddd6;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  padding: 4px 8px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-brand:hover { color: #fff; }
.admin-brand__mark {
  color: var(--peach-500);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 4px;
  border-radius: 50%;
  overflow: hidden;
  background: #fffaf6;
  flex-shrink: 0;
}
.admin-brand__mark img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 50%; }
.admin-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.02rem;
  line-height: 1.2;
}
.admin-brand small {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b9a69c;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 0;
  flex: 1;
  overflow-y: auto;
}

.admin-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 9px;
  color: #d8c9c0;
  font-size: 0.9rem;
  font-weight: 600;
}

.admin-nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.admin-nav a.is-active { background: var(--peach-500); color: #fff; }

.admin-nav__badge {
  background: #fff;
  color: var(--peach-700);
  font-size: 0.68rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
}

.admin-sidebar__foot {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.82rem;
}

.admin-sidebar__foot a,
.admin-sidebar__foot button {
  color: #c8b7ad;
  background: transparent;
  border: 0;
  padding: 0;
  font-family: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.admin-sidebar__foot a:hover,
.admin-sidebar__foot button:hover { color: #fff; }

.admin-main { min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 30px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.admin-topbar h1 { margin: 0; font-size: 1.3rem; }
.admin-topbar__user { font-size: 0.82rem; color: var(--ink-soft); }

.admin-content {
  padding: 26px 30px 60px;
  max-width: 1320px;
  width: 100%;
}

/* --------------------------------------------------------------------------
   Flash
   -------------------------------------------------------------------------- */

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 18px;
  border: 1px solid transparent;
}

.flash--success { background: #e8f5ee; color: #1f6044; border-color: #bfe3d0; }
.flash--error { background: #fbeaea; color: #8f2f2f; border-color: #efc4c4; }
.flash--info { background: #eef3fb; color: #2c4a78; border-color: #c9d8ef; }

.flash__close {
  border: 0;
  background: transparent;
  font-size: 1.2rem;
  color: inherit;
  cursor: pointer;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   Cards / grids
   -------------------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.card__head h2,
.card__head h3 { margin: 0; }

.admin-grid {
  display: grid;
  gap: 18px;
}

.admin-grid--2 { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-card--accent {
  background: linear-gradient(135deg, var(--peach-600), var(--peach-500));
  border-color: transparent;
  color: #fff;
}

.stat-card--accent .stat-card__label,
.stat-card--accent .stat-card__hint { color: rgba(255, 255, 255, 0.82); }

.stat-card__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--ink-soft);
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1.15;
}

.stat-card__hint { font-size: 0.76rem; color: var(--ink-soft); }

/* --------------------------------------------------------------------------
   Page header / filters
   -------------------------------------------------------------------------- */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-header h2 { margin: 0 0 3px; }
.page-header p { margin: 0; }
.page-header__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.filter-bar input[type="search"],
.filter-bar input[type="text"],
.filter-bar select {
  font-family: inherit;
  font-size: 0.86rem;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  min-width: 170px;
}

.filter-bar input[type="search"] { flex: 1; min-width: 220px; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn--primary { background: var(--peach-500); color: #fff; }
.btn--primary:hover { background: var(--peach-600); color: #fff; }

.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--peach-300); color: var(--peach-700); }

.btn--danger { background: #fff; border-color: #ecc4c4; color: var(--danger); }
.btn--danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn--small { padding: 6px 12px; font-size: 0.76rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.link-arrow { font-weight: 700; font-size: 0.84rem; color: var(--peach-700); }
.link-muted {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
}
.link-muted:hover { color: var(--danger); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.admin-table th {
  text-align: left;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.admin-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: 0; }

.table-product {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.table-product__img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--peach-50);
  flex-shrink: 0;
}

.table-product__img img { width: 100%; height: 100%; object-fit: cover; }
.table-product__title { font-weight: 700; color: var(--ink); }
.table-product__title:hover { color: var(--peach-600); }

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

.table-actions form { margin: 0; }

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eee9e6;
  color: #5f5751;
  white-space: nowrap;
}

.badge--success { background: #e2f3e9; color: #1f6044; }
.badge--warn { background: #fff2d9; color: #8a5a10; }
.badge--info { background: #e8effa; color: #2c4a78; }
.badge--danger { background: #fbe4e4; color: #8f2f2f; }
.badge--muted { background: #eee9e6; color: #5f5751; }

.badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.admin-form { margin-bottom: 10px; }

.admin-form__main { min-width: 0; }
.admin-form__side { min-width: 0; }

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 13px;
}

.field > span { color: var(--ink-soft); }

.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--peach-400);
  box-shadow: 0 0 0 3px rgba(235, 146, 120, 0.16);
}

.field textarea { resize: vertical; }
.field textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: 0.84rem; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-row--3 { grid-template-columns: 1fr 1fr 1fr; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.86rem;
  margin-bottom: 10px;
  cursor: pointer;
}

.check input { margin-top: 3px; accent-color: var(--peach-500); }

.check-list { display: flex; flex-direction: column; gap: 2px; }

.stack { display: flex; flex-direction: column; gap: 2px; }
.stack .btn { margin-top: 8px; }
.stack .btn + .btn { margin-top: 8px; }

.image-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.image-preview {
  width: 150px;
  height: 150px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--peach-50);
  border: 1px solid var(--line);
}

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

.image-fields { min-width: 0; }

.variant-rows { display: flex; flex-direction: column; gap: 12px; }

.variant-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--peach-50);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.variant-row__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.variant-row .field { margin-bottom: 0; }
.variant-row .btn { align-self: flex-end; }

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  border-color: #ecc4c4;
}

.danger-zone h3 { margin-bottom: 2px; }
.danger-zone p { margin: 0; }

/* --------------------------------------------------------------------------
   Dashboard widgets
   -------------------------------------------------------------------------- */

.chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 180px;
  padding-top: 10px;
}

.chart__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
}

.chart__bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}

.chart__bar {
  width: 100%;
  min-height: 3px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--peach-400), var(--peach-500));
}

.chart__label { font-size: 0.68rem; color: var(--ink-soft); }

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--peach-50);
  color: var(--ink);
}

.quick-action:hover { border-color: var(--peach-300); color: var(--ink); }
.quick-action strong { font-size: 0.86rem; }
.quick-action span { font-size: 0.76rem; color: var(--ink-soft); }

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.rank-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
}

.rank-list li:last-child { border-bottom: 0; }

.rank-list__num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--peach-100);
  color: var(--peach-700);
  font-weight: 700;
  font-size: 0.72rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.rank-list__title { flex: 1; }
.rank-list__qty { color: var(--ink-soft); font-size: 0.78rem; }
.rank-list__total { font-weight: 700; }

.admin-empty {
  text-align: center;
  padding: 34px 20px;
  color: var(--ink-soft);
}

.admin-empty h3 { color: var(--ink); }
.admin-empty p { max-width: 50ch; margin: 0 auto 14px; }

/* --------------------------------------------------------------------------
   Order detail helpers
   -------------------------------------------------------------------------- */

.totals {
  max-width: 320px;
  margin-left: auto;
  padding-top: 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
  padding: 5px 0;
  color: var(--ink-soft);
}

.summary-row--total {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 10px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
}

.address-block {
  font-style: normal;
  color: var(--ink-soft);
  line-height: 1.7;
  margin: 0;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.84rem;
}

.detail-list > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 7px;
}

.detail-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.detail-list span { color: var(--ink-soft); }
.detail-list strong, .detail-list a { text-align: right; }

.info-box {
  background: var(--peach-50);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.84rem;
  margin-top: 12px;
}

.info-box ol { margin: 8px 0 0; padding-left: 20px; }
.info-box li { margin-bottom: 5px; }

.code-sample {
  background: #2f2723;
  color: #f3e6df;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.76rem;
  overflow-x: auto;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 18px 0 30px;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.admin-pagination a { font-weight: 700; color: var(--peach-700); }

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */

.admin-login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #fff3ec, #f6e3d8 60%, #f2d5c7);
  padding: 24px;
}

.admin-login-card {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.admin-login-brand { text-align: center; margin-bottom: 22px; }
.admin-login-brand .admin-brand__mark { width: 72px; height: 72px; margin: 0 auto 10px; padding: 6px; }
.admin-login-brand h1 { font-size: 1.5rem; margin-bottom: 4px; }
.admin-login-brand p { color: var(--ink-soft); font-size: 0.88rem; margin: 0; }

.admin-login-form .btn { margin-top: 8px; }

.admin-login-note {
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
  margin: 16px 0 0;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .admin-grid--2 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }
  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px 0 4px;
  }
  .admin-nav a { padding: 8px 12px; font-size: 0.82rem; }
  .admin-sidebar__foot {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .admin-content { padding: 20px 16px 50px; }
  .admin-topbar { padding: 14px 16px; }
  .variant-row__grid { grid-template-columns: 1fr 1fr; }
  .image-row { grid-template-columns: 1fr; }
  .image-preview { width: 120px; height: 120px; }
}

@media (max-width: 620px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .field-row, .field-row--3 { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .variant-row__grid { grid-template-columns: 1fr; }
  .page-header { align-items: flex-start; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input, .filter-bar select, .filter-bar .btn { width: 100%; }
  .danger-zone { flex-direction: column; align-items: flex-start; }
}

@media print {
  .admin-sidebar,
  .admin-topbar,
  .page-header__actions,
  .btn,
  .flash { display: none !important; }
  .admin-shell { display: block; }
  .admin-content { padding: 0; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  body { background: #fff; }
}

/* --------------------------------------------------------------------------
   Silver coins admin
   -------------------------------------------------------------------------- */

.checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.88rem;
  margin: 4px 0 16px;
  cursor: pointer;
}

.checkbox input { width: 16px; height: 16px; accent-color: var(--peach-500); }

.text-ok { color: var(--success); }
.text-warn { color: var(--warn); }

.coin-status {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.coin-status li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
}

.coin-status li:last-child { border-bottom: 0; }
.coin-status li > span { color: var(--ink-soft); }
.coin-status li > strong { text-align: right; }

.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ==========================================================================
   Email list & audience
   ========================================================================== */

.copy-list {
  width: 100%;
  min-height: 80px;
  margin: 0 0 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink);
  resize: vertical;
}

.tag-pill {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--peach-100, #ffefe7);
  border: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}
