/* Motobacs admin. Inherits the storefront palette from styles.css. */
.admin-body { background: var(--surface); }
.login-wrap { max-width: 460px; margin: 60px auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 34px 30px; text-align: center; }
.login-logo { width: 72px; height: 72px; margin: 0 auto 12px; object-fit: contain; }
.login-wrap h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.login-wrap p { color: var(--ink-faint); font-size: 14px; margin: 0 0 20px; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; margin-bottom: 12px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field label small { display: block; font-weight: 400; color: var(--ink-faint); font-size: 12px; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 6px; font: inherit; font-size: 16px; background: #fff; color: var(--ink); }
.field input[type="password"] { padding: 16px; font-size: 16px; letter-spacing: 0.06em; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); }
.field input[type="file"] { padding: 10px; }
.checkbox-field label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox-field input { width: auto; }
.form-error { color: #b00020; font-size: 13px; margin: 8px 0 0; }
.btn-admin { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background-color 0.25s, color 0.25s, border-color 0.25s; text-decoration: none; white-space: nowrap; }
.btn-admin:hover { border-color: var(--ink); }
.btn-admin.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-admin.primary:hover { background: var(--red); border-color: var(--red); }
.btn-admin.ghost { background: transparent; }
.btn-admin.danger { background: #fff; color: #b00020; border-color: #e6b3ba; }
.btn-admin.danger:hover { background: #b00020; color: #fff; border-color: #b00020; }
.btn-admin:disabled { opacity: 0.6; cursor: default; }

.admin-head { background: #fff; border-bottom: 1px solid var(--line); }
.admin-head-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 66px; flex-wrap: wrap; padding: 8px 0; }
.admin-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-nav { position: sticky; top: 0; z-index: 200; background: rgba(255,255,255,0.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.admin-nav .tabs { display: flex; gap: 4px; padding: 8px 0; flex-wrap: wrap; overflow: visible; }
.admin-nav a { text-decoration: none; font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 6px; color: var(--ink-soft); white-space: nowrap; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
.admin-nav a:hover, .admin-nav a.active { background: var(--ink); color: #fff; }
.admin-nav a.admin-nav-cta { background: var(--red); color: #fff; }
.admin-nav a.admin-nav-cta.active, .admin-nav a.admin-nav-cta:hover { background: var(--red-deep); }
.nav-count { background: var(--surface-2); color: var(--ink); border-radius: 10px; padding: 0 7px; font-size: 11px; min-height: 18px; display: inline-flex; align-items: center; }
.admin-nav a.active .nav-count { background: rgba(255,255,255,0.2); color: #fff; }
@media (max-width: 760px) { .admin-nav .tabs { width: 100%; flex-wrap: wrap; gap: 4px; } .admin-nav a { padding: 6px 11px; font-size: 13px; } }

.admin-main { padding: 20px 0 120px; display: grid; gap: 22px; }
.admin-main > * { min-width: 0; }
.dash { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; scroll-margin-top: 70px; min-width: 0; }
.dash-title { font-size: 22px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; }
.dash-title.dash-foldable::after { content: "›"; font-size: 22px; color: var(--ink-faint); transform: rotate(90deg); transition: transform 0.25s; margin-left: auto; }
.dash.collapsed .dash-title.dash-foldable::after { transform: rotate(0); }
.dash.collapsed > :not(:first-child) { display: none !important; }
.title-badge { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; background: var(--surface); color: var(--ink-faint); padding: 4px 9px; border-radius: 999px; }
.sub-title { font-size: 15px; font-weight: 700; margin: 18px 0 8px; }
.muted { color: var(--ink-faint); font-size: 13.5px; margin: 0 0 10px; }

.ig-quick { background: var(--red-soft); border: 2px solid rgba(200,16,46,0.25); border-left: 5px solid var(--red); border-radius: 10px; padding: 18px; }
.ig-pill { display: inline-block; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; margin-bottom: 8px; }
.ig-quick h3 { font-size: 20px; font-weight: 700; }
.ig-quick p { color: var(--ink-soft); font-size: 14px; margin: 6px 0 12px; }
.ig-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ig-row input { flex: 1 1 240px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 6px; font: inherit; font-size: 15px; }
.ig-status { font-size: 13px; color: var(--ink-soft); margin: 10px 0 0; min-height: 18px; }
.jiji-auto { font-size: 13px; color: var(--ink-soft); background: #fff; border: 1px solid rgba(200,16,46,0.2); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; }
.jiji-auto b { color: var(--ink); }
.ig-secondary { background: var(--surface); border-color: var(--line); border-left-color: var(--line-strong); margin-top: 12px; }
.ig-secondary h3 { font-size: 16px; }
.jiji-results { margin-top: 14px; }
.jiji-list { max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; scrollbar-width: thin; }
.jiji-row { display: grid; grid-template-columns: auto 88px 1fr; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); min-width: 0; }
.jiji-row:last-child { border-bottom: 0; }
.jiji-row img { width: 88px; height: 66px; object-fit: cover; border-radius: 6px; background: var(--surface); }
.jiji-row .row-actions { grid-column: 3; justify-content: flex-start; margin-top: 4px; }
@media (max-width: 640px) { .jiji-row { grid-template-columns: auto 70px 1fr; } .jiji-row img { width: 70px; height: 52px; } }
.me-row { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; }
.me-line { flex: 1 1 auto; height: 1px; background: var(--line); }
.me-pill { border: 0; background: var(--ink); color: #fff; font: inherit; font-weight: 600; font-size: 14px; padding: 10px 18px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--shadow); }
.me-plus { display: inline-block; transition: transform 0.25s; font-size: 18px; line-height: 1; }
.me-row.open .me-plus { transform: rotate(45deg); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.photo-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.photo-thumb { position: relative; width: 96px; height: 72px; border-radius: 6px; overflow: hidden; border: 2px solid var(--line); }
.photo-thumb.cover { border-color: var(--red); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(23,26,32,0.8); color: #fff; font-size: 13px; cursor: pointer; line-height: 1; }
.photo-thumb .make-cover { top: auto; bottom: 2px; left: 2px; right: auto; width: auto; border-radius: 4px; padding: 0 5px; font-size: 10px; height: 18px; }
.photo-thumb .cover-tag { position: absolute; bottom: 2px; left: 2px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; }
.admin-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; justify-content: flex-end; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border-radius: 10px; padding: 14px; }
.kpi b { display: block; font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.kpi b span { font-size: inherit; }
.kpi span { font-size: 12px; color: var(--ink-faint); }
.kpi small { display: block; font-size: 12px; color: var(--green); margin-top: 4px; }
.range-picker { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.range-picker label { font-size: 13px; color: var(--ink-faint); display: flex; align-items: center; gap: 6px; }
.range-picker input { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font: inherit; }
.range-result { font-size: 14px; font-weight: 600; flex: 1 1 100%; }
.recent-list { max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; scrollbar-width: thin; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); min-width: 0; }
.row:last-child { border-bottom: 0; }
.row img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.row-body { flex: 1 1 auto; min-width: 0; }
.row-name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.row-meta { font-size: 12.5px; color: var(--ink-faint); overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-actions .btn-admin { min-height: 32px; padding: 0 10px; font-size: 12.5px; }
.insight-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .insight-cols { grid-template-columns: 1fr; } }
.rank-list { margin: 0; padding-left: 20px; font-size: 14px; }
.rank-list li { padding: 4px 0; overflow-wrap: anywhere; }
.rank-list b { float: right; color: var(--ink-faint); font-weight: 500; margin-left: 8px; }
.search-gaps-pills { display: flex; flex-wrap: wrap; gap: 6px; max-height: 160px; overflow-y: auto; }
.search-gaps-pills span { background: #fff4e0; color: #8a4b00; border: 1px solid #f2d3a0; padding: 5px 11px; border-radius: 999px; font-size: 13px; }

.list-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.list-tools .search-wrap { flex: 1 1 240px; }
.list-tools .search-wrap input { padding-right: 70px; }
.match-count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--ink-faint); }
.list-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.select-all { font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.admin-list { max-height: 720px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; scrollbar-width: thin; background: var(--surface); }
.admin-card { display: grid; grid-template-columns: auto 110px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); min-width: 0; }
.admin-card.selected { box-shadow: inset 4px 0 0 var(--red); }
.admin-card img { width: 110px; height: 82px; object-fit: cover; border-radius: 6px; }
.admin-card-name { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.admin-card-price { font-family: var(--display); font-weight: 700; color: var(--red); font-size: 15px; }
.admin-card-meta { font-size: 12.5px; color: var(--ink-faint); overflow-wrap: anywhere; }
.status-chip { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--surface); color: var(--ink-soft); margin-right: 6px; }
.status-chip.available { background: rgba(0,146,69,0.12); color: var(--green); }
.status-chip.reserved { background: rgba(217,119,6,0.14); color: var(--amber); }
.status-chip.sold { background: var(--ink); color: #fff; }
.boost-tag { font-size: 11px; font-weight: 700; color: var(--red); margin-left: 6px; }
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi b { font-size: 20px; }
  .dash { padding: 16px; }
  .admin-card { grid-template-columns: auto 78px 1fr; }
  .admin-card img { width: 78px; height: 60px; }
  .admin-card .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .row-actions .btn-admin { padding: 0 8px; font-size: 11.5px; min-height: 30px; }
  .admin-list { max-height: 560px; }
}
.bulk-bar { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 300; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; box-shadow: 0 10px 30px rgba(0,0,0,0.25); }
.bulk-bar[hidden] { display: none; }
.bulk-bar .btn-admin.ghost { color: #fff; border-color: rgba(255,255,255,0.35); }
.bulk-bar .btn-admin.ghost:hover { border-color: #fff; }
.bulk-bar span { font-weight: 600; margin-right: auto; }

.modal-card.small { width: min(440px, 100%); }
.confirm-msg { font-size: 16px; margin: 6px 0 12px; }
@media (max-width: 600px) {
  .modal { padding: 0; align-items: stretch; }
  .modal-card { border-radius: 0; height: 100svh; height: 100dvh; max-height: 100dvh; width: 100%; }
  .modal-card .admin-actions { position: sticky; bottom: 0; background: #fff; padding: 12px 0 4px; margin-top: 20px; }
}
#suspendedBanner a { color: #fff; }

/* Staff (assistant) role: sells and manages stock, never sees money or reports. CSS-driven so re-renders cannot undo it. */
body.role-assistant #salesDash, body.role-assistant #owedDash, body.role-assistant #expensesDash, body.role-assistant #insightsDash, body.role-assistant #broadcastDash,
body.role-assistant a[href="#salesDash"], body.role-assistant a[href="#owedDash"], body.role-assistant a[href="#expensesDash"], body.role-assistant a[href="#insightsDash"], body.role-assistant a[href="#broadcastDash"],
body.role-assistant .inv-kpi-money, body.role-assistant .client-money, body.role-assistant .owed-amount, body.role-assistant #costInput, body.role-assistant #changePasswordBtn, body.role-assistant #staffAccessBtn, body.role-assistant #bulkPriceCut, body.role-assistant #bulkPriceRestore { display: none !important; }
body.role-assistant #costField { display: none !important; }
.admin-card-price s { font-weight: 500; color: var(--ink-faint); margin-right: 4px; }
