/* =====================================================================
   Admin dashboard (light)
   ===================================================================== */

body.admin { background: var(--bg); }

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

/* ----------------------------- Sidebar --------------------------- */
.side {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.side__brand {
  display: flex; align-items: center; gap: 11px;
  padding: 2px 8px 4px;
  color: var(--text);
  text-decoration: none;
}
.side__brand:hover { text-decoration: none; color: var(--text); }
.side__brand strong { display: block; font-family: var(--font-head); font-size: .98rem; line-height: 1.2; }
.side__brand small { display: block; font-size: .74rem; color: var(--text-faint); }
.side__mark {
  width: 36px; height: 36px; border-radius: 11px; flex: 0 0 auto;
  background: linear-gradient(145deg, #1ddc80, var(--accent) 55%, #00a354);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 8px 18px -8px rgba(0, 192, 99, .8), inset 0 1px 0 rgba(255,255,255,.25);
}
.side__cta { margin: 0 2px; }

.nav { display: grid; gap: 2px; }
.nav__label {
  font-size: .68rem; font-weight: 700; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .09em;
  padding: 14px 12px 6px; margin: 0;
}
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: .9rem; font-weight: 500;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.nav a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav a.is-active { background: var(--accent-wash); color: var(--accent-deep); font-weight: 600; }
.nav a.is-active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav a.is-active svg { color: var(--accent); }
.nav svg { flex: 0 0 auto; color: #94a3b8; }

.side__foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 10px; }
.side__user { display: flex; align-items: center; gap: 10px; padding: 0 6px; min-width: 0; }
.side__who { min-width: 0; }
.side__who strong { display: block; font-size: .86rem; line-height: 1.25; }
.side__who small {
  display: block; font-size: .75rem; color: var(--text-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center;
  font-weight: 700; font-size: .9rem;
  color: var(--accent-deep);
  background: linear-gradient(145deg, #e3f8ed, #c9f1dc);
  border: 1px solid #b7e9cf;
}
.avatar--sm { width: 32px; height: 32px; font-size: .8rem; }

/* ----------------------------- Top bar --------------------------- */
.main-wrap { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 32px;
  min-height: 62px;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar__crumb { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--text-faint); min-width: 0; }
.topbar__crumb strong { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.mode-pill {
  font-size: .72rem; font-weight: 700; letter-spacing: .03em;
  padding: 4px 10px; border-radius: 999px;
  color: #9a5f00; background: var(--warn-wash); border: 1px solid #f2d9a4;
}
.mode-pill.is-live { color: #047a42; background: var(--ok-wash); border-color: #bfe9d2; }

.icon-btn {
  display: none;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  place-items: center; cursor: pointer;
}

/* ----------------------------- Main ------------------------------ */
.main { padding: 28px 32px 64px; min-width: 0; width: 100%; max-width: 1320px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head h1 { margin-bottom: 4px; }
.page-head p { color: var(--text-soft); margin: 0; font-size: .92rem; }
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 0 14px; }
.section-head h2 { margin: 0; font-size: 1.12rem; }

/* ----------------------------- Stats ----------------------------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.stat__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.stat__label { font-size: .82rem; font-weight: 600; color: var(--text-soft); margin: 0; }
.stat__icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-wash); color: var(--accent-deep);
}
.stat__icon--blue   { background: var(--info-wash); color: var(--info); }
.stat__icon--red    { background: var(--bad-wash);  color: var(--bad); }
.stat__icon--amber  { background: var(--warn-wash); color: var(--warn); }
.stat__icon--violet { background: #f1edff; color: #6d4aff; }
.stat__value { font-family: var(--font-head); font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat__meta { font-size: .78rem; color: var(--text-faint); margin: 6px 0 0; }

.stat--hero {
  grid-column: span 2;
  color: #fff;
  border: 0;
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(255,255,255,.22), transparent 60%),
    linear-gradient(135deg, #00c063 0%, #00a655 60%, #008d49 100%);
  box-shadow: 0 18px 36px -18px rgba(0, 160, 82, .75);
}
.stat--hero .stat__label, .stat--hero .stat__meta { color: rgba(255,255,255,.85); }
.stat--hero .stat__value { font-size: 2.3rem; color: #fff; }
.stat--hero .stat__icon { background: rgba(255,255,255,.18); color: #fff; }

.progress { height: 6px; border-radius: 99px; background: #eef1f5; overflow: hidden; margin-top: 10px; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

/* ----------------------------- Panels ---------------------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.panel__head h2, .panel__head h3 { margin: 0; font-size: 1rem; }
.panel__head p { margin: 2px 0 0; font-size: .8rem; color: var(--text-faint); }
.panel__body { padding: 20px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }

/* Revenue bars (server-rendered, no JS) */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding-top: 10px; }
.chart__col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; min-width: 0; }
.chart__bar-wrap { flex: 1 1 auto; width: 100%; display: flex; align-items: flex-end; }
.chart__bar {
  width: 100%; min-height: 3px; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #33d98a, var(--accent));
  position: relative;
  transition: filter .15s ease;
}
.chart__bar.is-zero { background: #eef1f5; }
.chart__col:hover .chart__bar { filter: brightness(1.08); }
.chart__tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; font-size: .72rem; font-weight: 600;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.chart__col:hover .chart__tip { opacity: 1; }
.chart__label { font-size: .68rem; color: var(--text-faint); white-space: nowrap; }

.quick { display: grid; gap: 10px; }
.quick a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: #fff;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.quick a:hover { border-color: #b7e9cf; box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.quick a small { display: block; font-weight: 400; color: var(--text-faint); font-size: .78rem; }
.quick a .stat__icon { flex: 0 0 auto; }
.quick a .chev { margin-left: auto; color: var(--text-faint); }

/* ----------------------------- Tables ---------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.panel .table-wrap { border: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: none; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 720px; }
table.data th {
  text-align: left; font-weight: 600; font-size: .72rem; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--bg-sunken);
  white-space: nowrap;
}
table.data td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background-color .12s ease; }
table.data tbody tr:hover { background: #fafcfd; }
table.data .cell-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
table.data .text-right { text-align: right; }

.thumb {
  width: 38px; height: 38px; border-radius: 10px; object-fit: contain; flex: 0 0 auto;
  background: #fff; border: 1px solid var(--line); padding: 4px;
}
span.thumb { display: inline-block; background: var(--bg-sunken); }
.cell-brand { display: flex; align-items: center; gap: 11px; }
.cell-sub { display: block; font-size: .78rem; color: var(--text-faint); }

.empty { padding: 52px 20px; text-align: center; color: var(--text-soft); }
.empty h3 { margin-bottom: 6px; }
.empty p { margin-inline: auto; }
.empty__icon {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px;
  display: grid; place-items: center; background: var(--accent-wash); color: var(--accent-deep);
}

/* ----------------------------- Toolbar --------------------------- */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px;
  box-shadow: var(--shadow-xs);
}
.toolbar .input, .toolbar .select { width: auto; min-width: 180px; padding: 9px 12px; font-size: .88rem; }
.toolbar .select { padding-right: 34px; }
.toolbar form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; width: 100%; }
.toolbar .input[type="search"] { flex: 1 1 220px; }

/* ----------------------------- Copy field ------------------------ */
.copy-row { display: flex; gap: 6px; align-items: center; }
.copy-row input {
  flex: 1 1 auto; min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 10px; color: var(--text-soft);
}
.copy-btn.is-done { border-color: #9fdfbd; color: var(--ok); background: var(--ok-wash); }

/* ----------------------------- Login ----------------------------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: #fff; }
.login__art {
  position: relative; overflow: hidden;
  background:
    radial-gradient(520px 320px at 85% 10%, rgba(255,255,255,.25), transparent 60%),
    radial-gradient(600px 400px at 0% 100%, rgba(0,0,0,.18), transparent 60%),
    linear-gradient(145deg, #00c063 0%, #00a655 55%, #007f42 100%);
  color: #fff;
  padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.login__art h2 { color: #fff; font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.5rem); max-width: 16ch; margin-bottom: 14px; }
.login__art p { color: rgba(255,255,255,.85); max-width: 42ch; }
.login__brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; }
.login__brand .side__mark { background: rgba(255,255,255,.2); box-shadow: none; }
.login__mock {
  margin-top: 28px; max-width: 380px;
  background: rgba(255,255,255,.96); color: var(--text);
  border-radius: 18px; padding: 18px 20px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.35);
  transform: rotate(-2deg);
}
.login__mock-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .86rem; }
.login__mock-row:last-child { border-bottom: 0; }
.login__panel { display: grid; place-items: center; padding: 40px 24px; }
.login__card { width: 100%; max-width: 400px; }
.login__card h1 { margin-bottom: 6px; }
.login__card .muted { margin-bottom: 26px; }
.login__foot { margin-top: 24px; font-size: .78rem; color: var(--text-faint); text-align: center; }

/* ----------------------------- Cropper --------------------------- */
.cropper-zone { margin-top: 14px; }
.cropper-zone[hidden] { display: none; }
.cropper-canvas-wrap {
  max-height: 340px;
  background: repeating-conic-gradient(#f1f4f8 0% 25%, #ffffff 0% 50%) 50% / 18px 18px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  overflow: hidden; padding: 8px;
}
.cropper-canvas-wrap img { max-width: 100%; display: block; }
.cropper-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }

.logo-preview {
  width: 92px; height: 92px; border-radius: var(--r-md); object-fit: contain;
  background: #fff; border: 1px solid var(--line); padding: 7px;
}
.file-drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
  padding: 24px; text-align: center; color: var(--text-soft); cursor: pointer;
  background: var(--bg-sunken);
  transition: border-color .15s ease, background-color .15s ease;
}
.file-drop svg { color: var(--accent); }
.file-drop:hover, .file-drop.is-over { border-color: var(--accent); background: var(--accent-wash); color: var(--text); }
.file-drop input[type="file"] { display: none; }

/* ----------------------------- Link form / preview --------------- */
.form-section { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.form-section:last-of-type { border-bottom: 0; }
.form-section__title { display: flex; align-items: center; gap: 10px; font-size: .95rem; margin: 0 0 4px; }
.form-section__sub { font-size: .82rem; color: var(--text-faint); margin: 0 0 16px; }
.form-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 24px; background: var(--bg-sunken); border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.input-suffix { position: relative; }
.input-suffix .input { padding-right: 42px; }
.input-suffix span {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  font-size: .8rem; color: var(--text-faint); pointer-events: none;
}

.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1 1 auto; accent-color: var(--accent); }
.range-row .input-suffix { flex: 0 0 104px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip {
  font: inherit; font-size: .76rem; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text-soft);
}
.chip:hover { border-color: var(--accent); color: var(--accent-deep); }

.sticky-col { position: sticky; top: 86px; }

.preview {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}
.preview__chrome {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; background: #f1f4f8; border-bottom: 1px solid var(--line);
}
.preview__dots { display: flex; gap: 5px; }
.preview__dots i { width: 9px; height: 9px; border-radius: 50%; background: #d5dce5; display: block; }
.preview__tab {
  display: flex; align-items: center; gap: 7px; min-width: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 10px; font-size: .76rem; color: var(--text-soft);
}
.preview__tab img { width: 14px; height: 14px; flex: 0 0 auto; }
.preview__tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview__bar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--line);
  font-family: var(--font-head); font-weight: 700; font-size: .92rem;
}
.preview__bar .brandbar__note { font-family: var(--font-body); font-size: .68rem; padding: 3px 8px; }
.preview__body {
  padding: 26px 18px 22px; text-align: center;
  background: radial-gradient(300px 140px at 50% 0%, rgba(0,192,99,.12), transparent 70%), linear-gradient(180deg, #f3fcf7, #fff);
}
.preview__logo { display: flex; justify-content: center; align-items: center; margin-bottom: 14px; min-height: 20px; }
.preview__logo img { width: auto; height: auto; object-fit: contain; outline: 1px dashed rgba(0,192,99,.45); outline-offset: 3px; }
.preview__kicker {
  display: inline-block; font-size: .62rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent-deep); background: var(--accent-wash); padding: 3px 9px; border-radius: 999px; margin-bottom: 8px;
}
.preview__pkg { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; margin: 0 0 6px; max-width: none; }
.preview__amt { font-family: var(--font-head); font-weight: 800; font-size: 1.9rem; letter-spacing: -.03em; margin: 0; max-width: none; }
.preview__note { font-size: .74rem; color: var(--text-faint); margin: 10px 0 0; max-width: none; }

.favicon-box {
  width: 72px; height: 72px; border-radius: 16px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: repeating-conic-gradient(#f1f4f8 0% 25%, #ffffff 0% 50%) 50% / 12px 12px;
  border: 1px solid var(--line);
}
.favicon-box img { width: 48px; height: 48px; object-fit: contain; }

.info-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.info-list li { display: flex; gap: 10px; font-size: .86rem; color: var(--text-soft); }
.info-list li::before {
  content: ""; flex: 0 0 auto; width: 7px; height: 7px; margin-top: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash);
}

/* ----------------------------- Layout bits ----------------------- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-size: .84rem; color: var(--text-soft); text-decoration: none; background: #fff;
}
.pagination .is-current { background: var(--accent-wash); color: var(--accent-deep); border-color: #b7e9cf; font-weight: 600; }

details.detail { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 10px; background: var(--bg-sunken); }
details.detail summary { cursor: pointer; font-size: .8rem; color: var(--text-soft); }
details.detail pre {
  margin: 8px 0 0; white-space: pre-wrap; word-break: break-word;
  font-size: .76rem; color: var(--text-soft); font-family: var(--font-body);
}
.mt-8 { margin-top: 8px; }

/* ----------------------------- Responsive ------------------------ */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .sticky-col { position: static; }
  .login { grid-template-columns: 1fr; }
  .login__art { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .icon-btn { display: grid; }
  .topbar { padding: 10px 16px; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 40;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .side.is-open { transform: translateX(0); }
  .side-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 35; }
  .side-backdrop[hidden] { display: none; }
  .main { padding: 20px 16px 56px; }
  .stat--hero { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .topbar__crumb .faint, .topbar__crumb svg { display: none; }
  .chart { gap: 4px; }
  .chart__label { font-size: .6rem; }
  .form-section { padding: 18px 16px; }
  .form-foot { padding: 14px 16px; }
}

/* Numbered step bubble (form sections) */
.step {
  width: 24px; height: 24px; flex: 0 0 auto;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: .75rem; font-weight: 700;
  background: var(--accent-wash);
  color: var(--accent-deep);
  border: 1px solid rgba(0, 192, 99, .3);
}
