/* =========================================================================
   Admin dashboard styles
   ========================================================================= */
:root {
  --bg: #f4f5f7; --surface: #fff; --surface-2: #eef0f3; --ink: #1c2024;
  --ink-soft: #4a5058; --muted: #868e96; --line: #dde1e6;
  --brand: #1f6feb; --brand-ink: #0a4bb3; --ok: #1f7a48; --no: #c23b3b; --warn: #b8860b;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a; --surface: #1c1f24; --surface-2: #23272e; --ink: #e8eaed;
    --ink-soft: #b6bcc4; --muted: #868e96; --line: #333941;
    --brand: #6ba5ff; --brand-ink: #a9c8ff; --ok: #45b877; --no: #e06b6b; --warn: #d9a441;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body.admin { margin: 0; font-family: var(--sans); background: var(--bg); color: var(--ink); line-height: 1.5; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
a { color: var(--brand-ink); }
p { margin: 0 0 .8rem; }
code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: .05rem .3rem; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.error { color: var(--no); font-weight: 600; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; color: var(--muted); font-weight: 700; }

/* Topbar */
.admin-topbar { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding: .7rem 1.2rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.admin-brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.admin-brand span { color: var(--muted); font-weight: 500; }
.admin-nav { display: flex; gap: .3rem; flex-wrap: wrap; flex: 1; }
.admin-nav a { text-decoration: none; color: var(--ink-soft); padding: .35rem .7rem; border-radius: 999px; font-weight: 600; font-size: .9rem; }
.admin-nav a:hover { background: var(--surface-2); }
.admin-nav a.active { background: var(--brand); color: #fff; }
.admin-account { display: flex; align-items: center; gap: .6rem; }
.admin-account a { text-decoration: none; }

.flash { padding: .7rem 1.2rem; font-weight: 600; }
.flash-ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.flash-err { background: color-mix(in srgb, var(--no) 15%, transparent); color: var(--no); }

.admin-main { max-width: 1080px; margin: 1.5rem auto; padding: 0 1.2rem; }
.admin-foot { max-width: 1080px; margin: 2rem auto; padding: 1rem 1.2rem; border-top: 1px solid var(--line); }

/* Cards + layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); margin-bottom: 1.2rem; }
.card.narrow { max-width: 480px; }
.card.warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
.card.ok-banner { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; align-items: end; }
.stack { display: grid; gap: 1rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.actions-bar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.inline { display: inline; }

/* Stat tiles */
.stat { display: flex; flex-direction: column; gap: .2rem; }
.stat-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-value.ok, .ok { color: var(--ok); }
.stat-value.no, .no { color: var(--no); }

/* Forms */
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .8rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .5rem .6rem; width: 100%; margin-top: .2rem; }
input[readonly] { background: var(--surface-2); color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 1px; }
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.check input { width: auto; margin: 0; }
.check-inline { display: inline-flex; margin: 0; }
.check-inline input { width: auto; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; cursor: pointer; padding: .5rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.btn-ghost { background: transparent; }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
.btn-lg { padding: .7rem 1.3rem; font-size: 1.02rem; }
.btn-danger { color: var(--no); border-color: color-mix(in srgb, var(--no) 40%, var(--line)); }
.btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Lists / tables */
.link-list { list-style: none; padding: 0; display: grid; gap: .5rem; }
.error-list, .warn-list { padding-left: 1.1rem; display: grid; gap: .3rem; }
.error-list li { color: var(--no); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.table th { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.row-current { background: color-mix(in srgb, var(--ok) 8%, transparent); }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); }
.badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.no { background: color-mix(in srgb, var(--no) 16%, transparent); color: var(--no); }

/* Collection rows */
.rows, .act-rows { display: grid; gap: .4rem; }
.row-head { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.row-head span { padding: 0 .2rem; }
.data-row { align-items: center; }
.data-row input, .data-row select { margin-top: 0; }
.act-grid { display: grid; grid-template-columns: 1fr 1.3fr 1.6fr 1fr 1fr .6fr .5fr 1fr .6fr; gap: .4rem; }

/* Affiliate blocks */
.aff-block { background: var(--surface-2); }
.aff-settings { margin-top: .6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .5rem .7rem; background: var(--surface); }
.aff-settings summary { cursor: pointer; font-weight: 600; font-size: .88rem; }
.dest-aff { margin-bottom: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.dest-aff summary { cursor: pointer; }

/* Destinations grid */
.dest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.dest-card { display: flex; gap: 0; flex-direction: column; padding: 0; overflow: hidden; }
.dest-thumb { height: 120px; background-size: cover; background-position: center; background-color: var(--surface-2); }
.dest-info { padding: .9rem 1rem; }
.dest-title { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.dest-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .7rem; align-items: center; }
.dest-actions form { display: inline; }
.preview-photo, .offer-img { max-width: 220px; border-radius: var(--radius-sm); margin-top: .5rem; }

/* Preview */
.preview-controls { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; gap: .3rem; }
.preview-stage { display: flex; justify-content: center; }
.preview-frame { width: 100%; }
.preview-stage.is-mobile .preview-frame { max-width: 390px; border: 8px solid #222; border-radius: 28px; padding: 1rem; background: var(--bg); }
.preview-h { margin-top: 1.4rem; color: var(--muted); font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; }
.dcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dcard-photo { aspect-ratio: 3/2; background-size: cover; background-position: center; background-color: var(--surface-2); }
.dcard-body { padding: 1rem; }
.dcard-title { font-weight: 700; font-size: 1.2rem; display: flex; gap: .5rem; align-items: center; }
.chip { font-size: .68rem; background: var(--surface-2); color: var(--ink-soft); padding: .1rem .5rem; border-radius: 999px; text-transform: uppercase; }
.dcard-meta { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: .5rem; }

/* Board (shared look with public) */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: .5rem; }
.board-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.slot { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .5rem; margin-bottom: .5rem; }
.slot-filled { border-style: solid; background: var(--surface-2); }
.slot-label { font-size: .75rem; color: var(--muted); font-weight: 700; }
.slot .cost { color: var(--brand-ink); font-weight: 700; font-size: .8rem; }
.tag { font-size: .7rem; background: var(--surface-2); color: var(--ink-soft); padding: .05rem .4rem; border-radius: 999px; }

/* Offers */
.offer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.offer-head { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.ad-label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border: 1px solid var(--line); padding: .05rem .4rem; border-radius: 4px; }
.offer-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.widget-frame { width: 100%; border: 0; border-radius: var(--radius-sm); background: #fff; }
.widget-fallback { padding: 1rem; background: var(--surface-2); border-radius: var(--radius-sm); color: var(--ink-soft); }

/* Login */
.admin-login { display: flex; align-items: center; min-height: 100vh; }
.login-wrap { max-width: 400px; margin: 0 auto; padding: 2rem 1rem; width: 100%; }

@media (max-width: 800px) {
  .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .act-grid { grid-template-columns: 1fr 1fr; }
}
