body.admin-body {
  background: var(--cream);
  min-height: 100vh;
}

.admin-shell { display: none; }
.admin-shell.visible { display: block; }

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border: 1px solid var(--gold-line);
  padding: 40px 36px;
  text-align: center;
}
.login-box img { height: 70px; margin: 0 auto 20px; }
.login-box h1 { font-size: 1.4rem; }
.login-box .field { text-align: left; margin-top: 20px; }
.login-error { color: var(--danger); font-family: var(--sans); font-size: 0.85rem; margin-top: 14px; min-height: 1em; }

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--gold-line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 20;
}
.admin-topbar .brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 700; }
.admin-topbar .brand img { height: 32px; }
.admin-topbar .actions { display: flex; gap: 14px; align-items: center; font-family: var(--sans); font-size: 0.85rem; }

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 0 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--gold-line);
}
.admin-tab {
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  background: none;
  border-left: none; border-right: none; border-top: none;
}
.admin-tab.active { color: var(--ink); border-bottom-color: var(--gold); }

.admin-panel { padding: 32px 28px 80px; max-width: 1240px; margin: 0 auto; }
.admin-panel > section { display: none; }
.admin-panel > section.active { display: block; }

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.panel-head h2 { margin: 0; font-size: 1.5rem; }

.admin-table-wrap { overflow-x: auto; border: 1px solid var(--gold-line); background: var(--paper); }
table.admin-table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.88rem; min-width: 760px; }
table.admin-table th { text-align: left; padding: 12px 14px; background: var(--cream-2); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
table.admin-table td { padding: 10px 14px; border-top: 1px solid var(--gold-line); vertical-align: middle; }
table.admin-table img.thumb-sm { width: 44px; height: 44px; object-fit: cover; border: 1px solid var(--gold-line); background: var(--cream-2); }
table.admin-table .name-cell { font-family: var(--body); font-weight: 600; font-size: 1rem; }
table.admin-table .muted { color: var(--muted); font-size: 0.8rem; }

.icon-btn {
  border: 1px solid var(--gold-line);
  background: var(--paper);
  cursor: pointer;
  padding: 6px 10px;
  font-family: var(--sans);
  font-size: 0.75rem;
}
.icon-btn.active { background: var(--gold); border-color: var(--gold); color: #fff; }
.icon-btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

select.status-select, input.stock-input {
  font-family: var(--sans);
  font-size: 0.82rem;
  padding: 6px 8px;
  border: 1px solid var(--gold-line);
  background: var(--cream);
}
input.stock-input { width: 60px; }

/* modal */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(20, 18, 14, 0.6);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--paper);
  max-width: 640px;
  width: 100%;
  padding: 32px;
  border: 1px solid var(--gold-line);
}
.modal h3 { margin-bottom: 20px; }
.modal .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .modal .field-row { grid-template-columns: 1fr; } }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.modal-close { position: absolute; top: 14px; right: 18px; background:none; border:none; font-size: 1.4rem; cursor: pointer; color: var(--muted); }
.modal { position: relative; }

.image-uploader { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.image-uploader .thumb-wrap { position: relative; width: 70px; height: 70px; }
.image-uploader img { width: 70px; height: 70px; object-fit: cover; border: 1px solid var(--gold-line); }
.image-uploader .remove-img { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; background: var(--danger); color: #fff; border: none; cursor: pointer; font-size: 12px; line-height: 1; }
.image-uploader label.upload-tile {
  width: 70px; height: 70px; border: 1px dashed var(--gold-line);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-family: var(--sans); font-size: 0.7rem; color: var(--muted); text-align: center;
}

.settings-card {
  background: var(--paper);
  border: 1px solid var(--gold-line);
  padding: 26px 28px;
  max-width: 640px;
  margin-bottom: 22px;
}
.settings-card h3 { margin-bottom: 6px; }
.settings-card .hint { color: var(--muted); font-family: var(--sans); font-size: 0.85rem; margin-bottom: 16px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--cream-2); border: 1px solid var(--gold-line); transition: 0.2s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; transition: 0.2s; }
.switch input:checked + .slider { background: var(--gold); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.status-pill { font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; padding: 4px 9px; border: 1px solid var(--gold-line); }
.status-pill.on { background: var(--ink); color: var(--cream); border-color: var(--ink); }

.msg-list { display: flex; flex-direction: column; gap: 14px; }
.msg-card { background: var(--paper); border: 1px solid var(--gold-line); padding: 18px 20px; font-family: var(--sans); font-size: 0.9rem; }
.msg-card .top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.msg-card .top strong { font-family: var(--body); font-size: 1.05rem; }
.msg-card .meta { color: var(--muted); font-size: 0.8rem; }
.msg-card .product-tag { display: inline-block; margin-top: 6px; font-size: 0.75rem; color: var(--gold); }

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--ink); color: var(--cream);
  font-family: var(--sans); font-size: 0.85rem;
  padding: 12px 18px; z-index: 200;
  opacity: 0; transform: translateY(10px);
  transition: 0.25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
