/* ==========================================================================
   DDG Admin - "Bubblegum Boutique" (same design system as the public site,
   pond), tuned for admin density. Blush ground, plum ink, purple/pink/mint/
   butter brand colors, pill buttons with the chunky 3D shadow.
   ========================================================================== */

@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/baloo2.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('../fonts/nunito.woff2') format('woff2');
}

:root {
  /* grounds (same as pond) */
  --bg: #FFF6FA;            /* blush ground */
  --card: #FFFFFF;
  --card-2: #F6E9F8;        /* soft lavender panel */
  --line: #F0DFEE;

  /* ink */
  --ink: #46335E;           /* deep plum */
  --sub: #7A6795;
  --faint: #A393BC;

  /* brand */
  --purple: #8A5BC4;  --purple-deep: #613E93;
  --pink:   #FF8FB2;  --pink-deep:   #D9678D;
  --mint:   #58CCA0;  --mint-deep:   #349C74;  --mint-ink: #1F4A3A;
  --butter: #FFE59A;  --butter-ink:  #5C4310;

  /* semantic */
  --danger: #D9506A;  --danger-deep: #B03A52;  --danger-soft: #FAE3E9;
  --good: #349C74;    --good-soft: #DDF5EA;

  --shadow: 0 8px 22px rgba(138, 91, 196, .10);
  --font-display: 'Baloo 2', 'Segoe UI', sans-serif;
  --font-body: 'Nunito', 'Segoe UI', sans-serif;

  /* aliases used by components below */
  --accent: var(--purple);
  --accent-deep: var(--purple-deep);
  --accent-soft: var(--card-2);
  --gold: var(--butter);
  --gold-soft: #FFF3D6;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 800; line-height: 1.15; }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 8px; }
a { color: var(--purple-deep); }
a:focus-visible, button:focus-visible {
  outline: 3px solid var(--purple); outline-offset: 2px; border-radius: 6px;
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 18px; }

/* top bar - white over the blush ground, sticky, pill nav like pond */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(1.3) blur(9px);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 0;
}
.topbar .wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar img { height: 34px; }
.topbar .appname { font-family: var(--font-display); font-weight: 800; font-size: 16px; color: var(--purple-deep); white-space: nowrap; }
.topbar nav { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.topbar nav a {
  font-family: var(--font-display);
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 14px;
  padding: 7px 12px; border-radius: 999px; white-space: nowrap;
  transition: background .14s, color .14s;
}
.topbar nav a:hover { background: var(--card-2); }
.topbar nav a.active { background: var(--card-2); color: var(--purple-deep); }
.topbar .who { font-size: 12.5px; color: var(--faint); white-space: nowrap; }
@media (max-width: 1250px) { .topbar .who { display: none; } }  /* keep one row */
.topbar .btn-ghost { color: var(--sub); border-color: var(--line); box-shadow: none; }
.topbar .btn-ghost:hover { color: var(--danger); border-color: var(--danger); }

main { padding: 22px 0 60px; }

/* cards & tables */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 16px;
}
table.grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.grid th {
  text-align: left; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--sub); padding: 7px 10px; border-bottom: 2px solid var(--line);
  position: sticky; top: 0; background: var(--card); z-index: 1;  /* headers stay visible on long lists */
}
table.grid td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.grid tr:hover td { background: var(--bg); }

/* wrap wide tables so tablets/phones scroll the table, not the page */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table.grid { min-width: 640px; }

/* buttons - pond's chunky pills, admin-sized */
.btn {
  display: inline-block; font-family: var(--font-display); font-weight: 800;
  font-size: 14.5px; text-decoration: none; text-align: center;
  border: none; border-radius: 999px; padding: 9px 20px; cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
.btn:active { transform: translateY(2px); }
.btn-purple { background: var(--purple); color: #fff; box-shadow: 0 3px 0 var(--purple-deep); }
.btn-mint   { background: var(--mint);   color: var(--mint-ink); box-shadow: 0 3px 0 var(--mint-deep); }
.btn-pink   { background: var(--pink);   color: #fff; box-shadow: 0 3px 0 var(--pink-deep); }
.btn-butter { background: var(--butter); color: var(--butter-ink); box-shadow: 0 3px 0 #D9B44E; }
.btn-ghost  { background: transparent; color: var(--purple-deep); border: 2px solid var(--purple); box-shadow: none; }
/* destructive triggers LOOK destructive - red tint says "think first" */
.btn-danger { background: var(--danger-soft); color: var(--danger); border: 2px solid var(--danger); box-shadow: none; }
.btn-danger-solid { background: var(--danger); color: #fff; box-shadow: 0 3px 0 var(--danger-deep); }
.btn:hover { filter: brightness(1.05); }
.btn-sm { font-size: 13px; padding: 6px 14px; }
.btn-sm.btn-purple, .btn-sm.btn-mint, .btn-sm.btn-pink, .btn-sm.btn-butter,
.btn-sm.btn-danger-solid { box-shadow: 0 2px 0 var(--purple-deep); }
.btn-sm.btn-mint { box-shadow: 0 2px 0 var(--mint-deep); }
.btn-sm.btn-pink { box-shadow: 0 2px 0 var(--pink-deep); }
.btn-sm.btn-butter { box-shadow: 0 2px 0 #D9B44E; }
.btn-sm.btn-danger-solid { box-shadow: 0 2px 0 var(--danger-deep); }

/* status chips - pill-with-dot */
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 800;
  font-size: 11px; letter-spacing: .05em;
  border-radius: 999px; padding: 3px 10px; text-transform: uppercase;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-on { background: var(--good-soft); color: var(--good); }
.chip-off { background: var(--card-2); color: var(--sub); }

/* forms */
.field { margin-bottom: 10px; }
.field label {
  display: block; font-weight: 800; font-size: 12.5px; color: var(--sub); margin-bottom: 2px;
}
input[type="text"], input[type="number"], input[type="email"], input[type="password"],
input[type="search"], input[type="date"], input[type="datetime-local"], select, textarea {
  width: 100%; font-family: var(--font-body); font-size: 14px; color: var(--ink);
  background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 8px 12px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(138, 91, 196, .18);
}

/* checkboxes render as toggle switches site-wide */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 38px; height: 22px; border-radius: 999px; border: none;
  background: var(--line); position: relative; cursor: pointer;
  transition: background .18s; margin: 0; flex: none; vertical-align: middle;
}
input[type="checkbox"]::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(70,51,94,.35);
  transition: transform .18s;
}
input[type="checkbox"]:checked { background: var(--purple); }
input[type="checkbox"]:checked::after { transform: translateX(16px); }
input[type="checkbox"]:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }

/* editor sections */
details.section {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden;
}
details.section > summary {
  cursor: pointer; list-style: none; padding: 12px 18px;
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  display: flex; justify-content: space-between; align-items: center;
}
details.section > summary::after { content: "▸"; color: var(--sub); transition: transform .15s; }
details.section[open] > summary::after { transform: rotate(90deg); }
details.section > .section-body {
  padding: 4px 18px 16px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px;
}
.savebar {
  position: sticky; bottom: 0; background: var(--card); border-top: 2px solid var(--line);
  padding: 10px 18px; display: flex; gap: 10px; align-items: center;
  box-shadow: 0 -6px 18px rgba(70, 51, 94, .10); border-radius: 16px 16px 0 0;
}

.flash-ok { border-left: 4px solid var(--mint); }
.flash-err { border-left: 4px solid var(--danger); }
.hint { font-size: 13px; color: var(--sub); }

/* dashboard KPI tiles (same stats as the old admin dashboard) */
.kpi-groups {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.kpi-group { margin-bottom: 0; }
.kpi-group-title {
  font-family: var(--font-display); font-weight: 800; font-size: 13px;
  color: var(--sub); text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 8px;
}
.kpi-tiles { display: flex; gap: 8px; flex-wrap: wrap; }
.kpi {
  /* fit-content so real-world numbers (70,241) never spill past the border */
  flex: 1; min-width: fit-content; background: var(--card-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px;
}
.kpi-value {
  font-family: var(--font-display); font-weight: 800; font-size: 20px;
  line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--purple-deep);
}
.kpi-label { font-size: 11.5px; color: var(--sub); font-weight: 700; }

/* big friendly search bar */
.searchbar { display: flex; gap: 10px; align-items: center; }
.searchbar input[type="search"] {
  flex: 1; font-size: 15px; padding: 11px 16px; border-radius: 999px;
}
.searchbar .btn { padding: 11px 24px; }

/* sale cards (Sales page) */
.sale-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.sale-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 18px; display: flex; flex-direction: column; gap: 8px;
}
.sale-card.is-active { border-left: 5px solid var(--mint); }
.sale-card.is-inactive { border-left: 5px solid var(--line); }
.sale-card .sale-name {
  font-family: var(--font-display); font-weight: 800; font-size: 17px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.sale-card .sale-meta {
  display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--sub);
}
.sale-card .sale-meta strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.sale-card .sale-actions {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto;
  padding-top: 8px; border-top: 1px dashed var(--line);
}

/* topbar global search - find a consignor/item from anywhere */
.topsearch { margin-left: auto; }
.topsearch input[type="search"] {
  width: 180px; font-size: 13px; padding: 7px 14px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--card-2);
  color: var(--ink); font-family: var(--font-body);
}
.topsearch input[type="search"]::placeholder { color: var(--faint); }
.topsearch input[type="search"]:focus {
  outline: none; background: #fff; border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(138, 91, 196, .18);
}
.topbar nav { margin-left: 0; }

/* dashboard launchpad - the big "what do you want to do?" buttons */
.launchpad {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.launch-btn {
  position: relative; display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 16px; text-decoration: none; color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.launch-btn:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(138, 91, 196, .18);
}
.launch-btn .li-emoji { font-size: 22px; line-height: 1; }
.launch-btn .li-label { font-family: var(--font-display); font-weight: 800; font-size: 15px; }
.launch-btn .li-hint { font-size: 12px; color: var(--sub); }
.launch-btn .li-badge {
  position: absolute; top: 10px; right: 12px;
  background: var(--danger); color: #fff; font-weight: 800; font-size: 12px;
  border-radius: 999px; padding: 2px 9px;
}

/* current-sale lifecycle hero */
.phase-hero { border-left: 5px solid var(--purple); }
.phase-track {
  display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 6px;
}
.phase-step {
  flex: 1; min-width: 120px; text-align: center; padding: 8px 10px;
  border-radius: 12px; background: var(--card-2); border: 2px solid var(--line);
  font-weight: 700; font-size: 13px; color: var(--sub);
}
.phase-step.done { border-color: var(--mint); color: var(--mint-deep); background: var(--good-soft); }
.phase-step.now {
  border-color: var(--purple-deep); color: #fff; background: var(--purple);
  font-family: var(--font-display); font-weight: 800;
}
.phase-step .ps-dates { display: block; font-size: 11.5px; font-weight: 600; opacity: .85; }

/* styled confirmation dialog (replaces window.confirm) */
dialog.confirm-dialog {
  border: none; border-radius: 18px; padding: 22px 26px; max-width: 440px;
  box-shadow: 0 18px 44px rgba(70, 51, 94, .28); font-family: var(--font-body);
  color: var(--ink); font-size: 15px;
}
dialog.confirm-dialog::backdrop { background: rgba(70, 51, 94, .45); }
dialog.confirm-dialog p { margin: 0 0 18px; line-height: 1.5; }
dialog.confirm-dialog .confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
