.admin-body { background: #f1f2f2; }
.admin-login { min-height: 100vh; place-items: center; padding: 24px; }
.admin-login:not([hidden]) { display: grid; }
.admin-login form { display: grid; width: min(420px, 100%); gap: 16px; border: 1px solid var(--line); background: white; padding: 30px; box-shadow: var(--shadow); }
.admin-login h1 { margin: 8px 0 0; font-size: 28px; }
.admin-login label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.admin-login input { min-height: 46px; border: 1px solid var(--line); padding: 0 12px; }
#adminLoginError { margin: 0; color: var(--red); font-size: 13px; }
.admin-shell { min-height: 100vh; grid-template-columns: 238px minmax(0,1fr); }
.admin-shell:not([hidden]) { display: grid; }
.admin-sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; background: #17191a; color: white; padding: 22px 16px; }
.admin-brand { margin: 0 8px 32px; }
.admin-brand .brand-mark { background: #f3f2ed; color: var(--ink); }
.admin-brand small { color: rgba(255,255,255,0.55); }
.admin-sidebar nav { display: grid; gap: 5px; }
.admin-sidebar button, .admin-sidebar a { display: flex; min-height: 44px; align-items: center; gap: 11px; border: 0; background: transparent; color: rgba(255,255,255,0.72); padding: 0 12px; text-align: left; font-weight: 700; }
.admin-sidebar button svg, .admin-sidebar a svg { width: 19px; }
.admin-sidebar nav button:hover, .admin-sidebar nav button.active { background: #2b2d2e; color: white; }
.sidebar-bottom { display: grid; gap: 4px; margin-top: auto; border-top: 1px solid rgba(255,255,255,0.12); padding-top: 14px; }
.admin-main { min-width: 0; padding: 0 28px 48px; }
.admin-topbar { display: flex; min-height: 90px; align-items: center; gap: 18px; border-bottom: 1px solid #d7dada; margin-bottom: 26px; }
.admin-topbar h1 { margin: 0; font-size: 26px; }
.admin-topbar .eyebrow { margin: 0; }
.admin-topbar > span { margin-left: auto; color: var(--muted); font-size: 13px; }
.admin-menu { display: none; }
.stat-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { display: grid; min-height: 126px; align-content: space-between; border: 1px solid #d7dada; background: white; padding: 18px; }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { font-size: 28px; }
.stat-card svg { width: 21px; color: var(--amber-dark); }
.admin-panel { border: 1px solid #d7dada; background: white; }
.panel-head, .toolbar { display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; }
.panel-head { border-bottom: 1px solid #e2e4e4; }
.panel-head h2 { margin: 0; font-size: 17px; }
.text-button { border: 0; background: transparent; color: var(--blue); font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid #e6e7e7; padding: 13px 16px; text-align: left; vertical-align: middle; font-size: 13px; }
th { background: #f8f9f9; color: var(--muted); font-size: 11px; text-transform: uppercase; white-space: nowrap; }
tbody tr:hover { background: #fafbfb; }
.wide-table { min-width: 900px; }
.segmented { display: flex; border: 1px solid #d7dada; background: white; }
.segmented button { min-height: 40px; border: 0; border-right: 1px solid #d7dada; background: white; padding: 0 14px; font-weight: 700; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--ink); color: white; }
.status-select { min-height: 34px; border: 1px solid #d7dada; background: white; padding: 0 8px; }
.product-cell { display: flex; min-width: 220px; align-items: center; gap: 10px; }
.product-cell img { width: 50px; height: 50px; object-fit: cover; }
.product-cell strong, .product-cell small { display: block; }
.product-cell small { color: var(--muted); }
.table-action { display: inline-grid; width: 34px; height: 34px; place-items: center; border: 1px solid #d7dada; background: white; }
.table-action svg { width: 16px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.integration-list { display: grid; }
.integration-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid #e6e7e7; padding: 15px 18px; }
.integration-row:last-child { border-bottom: 0; }
.integration-row strong, .integration-row small { display: block; }
.integration-row small { color: var(--muted); }
.integration-state { display: inline-flex; align-items: center; gap: 6px; color: var(--red); font-size: 12px; font-weight: 800; }
.integration-state.ready { color: var(--green); }
.integration-state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
#emailIntegration { padding: 18px; }
.config-note { display: flex; gap: 14px; padding: 18px; }
.config-note svg { flex: 0 0 auto; color: var(--green); }
.config-note p { margin: 4px 0 0; color: var(--muted); }
.password-panel { margin-top: 18px; }
.password-form { display: grid; grid-template-columns: minmax(180px,1fr) minmax(180px,1fr) auto; align-items: end; gap: 14px; padding: 18px; }
.password-form label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.password-form input { min-height: 44px; border: 1px solid #d7dada; padding: 0 11px; }
.product-dialog textarea { width: 100%; border: 1px solid var(--line); padding: 10px 12px; resize: vertical; }
.admin-form-grid { margin: 0; }
.toggle-row { grid-template-columns: auto 1fr; align-items: center; }
.toggle-row input { width: 18px; min-height: 18px; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: fixed; left: 0; z-index: 80; width: 238px; transform: translateX(-105%); transition: transform 180ms ease; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { padding-inline: 14px; }
  .admin-menu { display: inline-grid; }
  .admin-topbar > span { display: none; }
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .toolbar { align-items: stretch; flex-direction: column; }
  .password-form { grid-template-columns: 1fr; }
  .segmented { overflow-x: auto; }
  .segmented button { white-space: nowrap; }
}
@media (max-width: 460px) {
  .stat-grid { grid-template-columns: 1fr; }
}
