body.admin { background: #f1f5f9; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 232px; background: #0f172a; color: #cbd5e1; display: flex; flex-direction: column; z-index: 30; transition: transform .2s; }
.sidebar .brand { font-weight: 800; font-size: 19px; color: #fff; padding: 22px 22px 18px; border-bottom: 1px solid #1e293b; }
.sidebar .brand small { display: block; font-size: 11px; color: #64748b; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.sidebar nav { padding: 12px; flex: 1; }
.sidebar nav a, .side-foot a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; margin-bottom: 2px; font-size: 14px; font-weight: 500; }
.sidebar nav a:hover, .side-foot a:hover { background: #1e293b; color: #fff; }
.sidebar nav a.active { background: #4f46e5; color: #fff; }
.nb { margin-left: auto; background: #f59e0b; color: #111; font-style: normal; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.side-foot { padding: 12px; border-top: 1px solid #1e293b; }
.main { margin-left: 232px; min-height: 100vh; }
.topnav { display: flex; align-items: center; gap: 14px; background: #fff; border-bottom: 1px solid var(--line); padding: 0 28px; height: 64px; position: sticky; top: 0; z-index: 10; }
.topnav h1 { font-size: 20px; margin: 0; flex: 1; }
.menu-btn { display: none; }
.view { padding: 24px 28px 60px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.stat .k { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.5px; }
.stat .s { font-size: 12px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.dash-grid > * { min-width: 0; }
.chart-box { position: relative; height: 280px; width: 100%; }

.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.bar input, .bar select { width: auto; min-width: 200px; }
.bar .grow { flex: 1; }
.tcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.tcard .table td, .tcard .table th { padding: 12px 16px; white-space: nowrap; }
.tcard .table tr:last-child td { border-bottom: 0; }
.tcard .table tbody tr:hover { background: #f8fafc; }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: #f3f4f6; }
.link { color: var(--brand); font-weight: 600; cursor: pointer; }
.actions { display: flex; gap: 6px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; cursor: pointer; }
.switch input { width: auto; }

.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal .x { background: none; border: 0; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }
.img-pick { display: flex; gap: 14px; align-items: center; }
.img-pick img { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.form-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .dash-grid { grid-template-columns: 1fr; }
  .view { padding: 16px; } .topnav { padding: 0 16px; }
  .bar input, .bar select { min-width: 0; flex: 1; }
}

.ship-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.ship-tabs a { padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.ship-tabs a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.ship-tabs em { font-style: normal; background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 7px; margin-left: 4px; }
.ship-tabs a.active em { background: rgba(255,255,255,.25); }
.track-list { list-style: none; padding: 0 0 0 16px; margin: 14px 0 0; border-left: 2px solid var(--line); }
.track-list li { position: relative; padding: 0 0 12px 10px; font-size: 14px; }
.track-list li::before { content: ''; position: absolute; left: -23px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; }
.track-list li:not(:first-child)::before { background: #cbd5e1; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }

.brand-pick { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.brand-prev { width: 180px; height: 64px; border: 1px dashed var(--line); border-radius: 10px; display: flex; align-items: center; justify-content: center; background: repeating-conic-gradient(#f1f5f9 0 25%, #fff 0 50%) 0 0 / 16px 16px; padding: 6px; text-align: center; }
.brand-prev.sq { width: 64px; }
.brand-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 6px; }
.theme-card { border: 2px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; background: #fff; transition: .15s; font-size: 14px; }
.theme-card:hover { border-color: #a5b4fc; }
.theme-card.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.theme-card.active b::after { content: ' ✓'; color: var(--brand); }
.theme-hero { height: 54px; border-radius: 8px; margin-bottom: 8px; position: relative; }
.theme-hero span { position: absolute; left: 10px; bottom: 10px; width: 46px; height: 12px; border-radius: 4px; }
.theme-sw { display: flex; gap: 4px; margin-bottom: 6px; }
.theme-sw i { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 46px; height: 40px; padding: 2px; flex: none; cursor: pointer; }

.banner-admin-grid { display: grid; gap: 14px; }
.banner-admin-grid.pl-card { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.banner-admin-grid.pl-topbar { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.bn-preview .slide, .bn-preview .offer-card { pointer-events: none; }

/* Page editor */
.pg-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.pg-tools select { width: auto; padding: 6px 8px; font-size: 13px; }
.pg-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pg-edit textarea { min-height: 420px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; resize: vertical; }
.pg-prev { border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px !important; max-height: 470px; overflow: auto; background: #fff; font-size: 14px !important; }
.pg-prev h2 { font-size: 17px; margin-top: 16px; }
@media (max-width: 760px) { .pg-edit { grid-template-columns: 1fr; } .pg-edit textarea { min-height: 260px; } }
