/* ============================================================
   ZAD Speciality Coffee — Admin Dashboard Styles
   Matches the customer-site design language:
   warm browns, gold accents, cream backgrounds, rounded cards.
   ============================================================ */

/* ── Variables ── */
:root {
  --brown-900: #2c1a10;
  --brown-800: #4a2c1d;
  --brown-700: #5b2e1c;
  --brown-600: #6b3a24;
  --brown-muted: #8a7a6b;
  --gold: #b78a5e;
  --gold-dark: #a3764c;
  --gold-light: #d4a76a;
  --cream: #faf5ec;
  --cream-2: #f4ede3;
  --cream-line: #e7ddd0;
  --tab-line: #e4d7c5;
  --tab-bg: #f8f2e9;
  --coffee: #b78a5e;
  --muted: #8a7a6b;
  --green: #4a7c59;
  --green-bg: #e8f5e9;
  --red: #a94442;
  --red-bg: #fdecea;
  --amber: #b8860b;
  --amber-bg: #fff8e1;
  --shadow-sm: 0 1px 3px rgba(44, 26, 16, 0.06);
  --shadow-md: 0 4px 12px rgba(44, 26, 16, 0.08);
  --shadow-lg: 0 8px 30px rgba(44, 26, 16, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --sidebar-w: 260px;
  --topbar-h: 60px;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }

/* The `hidden` attribute must always win over component display rules —
   .login-overlay, .admin-shell and .modal-backdrop all declare their own
   `display`, which otherwise overrides the browser's default `[hidden]`
   rule and leaves the element visible even after JS sets `.hidden = true`. */
[hidden] {
  display: none !important;
}

.admin-body {
  margin: 0;
  font-family: "Poppins", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--brown-900);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: "Playfair Display", ui-serif, Georgia, serif;
  color: var(--brown-800);
}

p { margin: 0; }

a { text-decoration: none; color: inherit; }

img { display: block; max-width: 100%; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  background: var(--gold);
  color: #fff;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn:hover { background: var(--gold-dark); box-shadow: var(--shadow-md); }
.btn:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--cream-2);
  color: var(--brown-800);
  border: 1px solid var(--cream-line);
}
.btn-secondary:hover { background: #ebe3d7; }

.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover { background: #8b3635; }

.btn-small {
  padding: 6px 14px;
  font-size: 12px;
}

/* ── Form Controls ── */
.control {
  display: block;
  width: 100%;
  border: 1px solid var(--cream-line);
  border-radius: var(--radius-xs);
  background: #fff;
  padding: 10px 14px;
  font-size: 13px;
  font-family: inherit;
  color: var(--brown-900);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.control:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(183, 138, 94, 0.15);
}

.control::placeholder { color: #bba999; }

textarea.control {
  min-height: 70px;
  resize: vertical;
}

select.control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a7a6b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brown-700);
}
.field label span { color: var(--red); }

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-stack { display: flex; flex-direction: column; }

/* ── Toggle Switch ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}
.toggle-row b { font-size: 13px; color: var(--brown-800); }
.toggle-row small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: none;
  background: var(--cream-line);
  cursor: pointer;
  transition: background 0.25s;
  flex-shrink: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.25s;
}
.switch.active { background: var(--gold); }
.switch.active::after { transform: translateX(18px); }

/* ── Badges ── */
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--cream-2);
  color: var(--brown-muted);
  border: 1px solid var(--cream-line);
}
.badge.green { background: var(--green-bg); color: var(--green); border-color: #c8e6c9; }
.badge.red   { background: var(--red-bg);   color: var(--red);   border-color: #f5c6cb; }
.badge.amber { background: var(--amber-bg); color: var(--amber); border-color: #ffe082; }

/* ── Action Buttons (icon) ── */
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--cream-line);
  border-radius: var(--radius-xs);
  background: #fff;
  color: var(--brown-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.action-button:hover { background: var(--cream-2); color: var(--brown-800); }
.action-button.delete:hover { background: var(--red-bg); color: var(--red); border-color: #f5c6cb; }
.action-button.star.active { color: var(--amber); background: var(--amber-bg); border-color: #ffe082; }
.action-button:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

.action-buttons { display: flex; gap: 6px; }

/* ── Toast Notifications ── */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: var(--brown-800);
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.9s forwards;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-8px); }
}

/* ── Loading / Skeleton ── */
.loading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  padding: 24px 0;
}

.skeleton {
  height: 180px;
  border-radius: var(--radius);
  background: linear-gradient(110deg, var(--cream-2) 30%, #f9f1e6 50%, var(--cream-2) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brown-900);
  background-image:
    radial-gradient(ellipse at 30% 20%, rgba(183, 138, 94, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(183, 138, 94, 0.08) 0%, transparent 60%);
}

.login-card {
  width: min(400px, 92vw);
  background: #fff;
  border-radius: 20px;
  padding: 40px 32px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.login-brand {
  margin-bottom: 28px;
}
.login-brand .brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  font-size: 26px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(183, 138, 94, 0.3);
}
.login-brand h1 {
  font-size: 22px;
  color: var(--brown-800);
}
.login-brand p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.login-form {
  text-align: left;
}
.login-form .field { margin-bottom: 16px; }
.login-form .btn { width: 100%; margin-top: 8px; padding: 12px; font-size: 14px; }

.login-error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #f5c6cb;
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 16px;
  text-align: center;
}

.demo-box {
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: var(--radius-xs);
  background: var(--cream);
  border: 1px solid var(--cream-line);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* ============================================================
   ADMIN SHELL (sidebar + main)
   ============================================================ */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--cream-line);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--cream-line);
  cursor: pointer;
}
.brand .brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(183, 138, 94, 0.25);
}
.brand span {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--brown-800);
  line-height: 1.2;
}
.brand small {
  display: block;
  font-family: "Poppins", sans-serif;
  font-weight: 400;
  font-size: 11px;
  color: var(--muted);
}

/* Sidebar nav */
.side-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.side-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--brown-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.side-nav button span:first-child { font-size: 16px; opacity: 0.7; }
.side-nav button:hover { background: var(--cream); color: var(--brown-800); }
.side-nav button.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  box-shadow: 0 2px 8px rgba(183, 138, 94, 0.25);
}
.side-nav button.active span:first-child { opacity: 1; }

/* Sidebar bottom */
.side-bottom {
  padding: 12px 10px 16px;
  border-top: 1px solid var(--cream-line);
}

.side-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.side-link:hover { background: var(--cream); color: var(--brown-800); }

.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--cream);
}
.admin-user b { font-size: 13px; color: var(--brown-800); }
.admin-user small { display: block; font-size: 11px; color: var(--muted); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Main Area ── */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top bar */
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--cream-line);
}

.menu-toggle {
  display: none;
  border: none;
  background: none;
  font-size: 20px;
  color: var(--brown-800);
  cursor: pointer;
  padding: 4px;
}

.topbar-title {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--brown-800);
}

.topbar-spacer { flex: 1; }

.online {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-bg);
  padding: 4px 10px;
  border-radius: 999px;
}

/* Content area */
.admin-content {
  flex: 1;
  padding: 28px 28px 40px;
}

/* ============================================================
   PAGE HEADERS
   ============================================================ */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: 28px;
  font-weight: 900;
  color: var(--brown-800);
}
.page-head p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

/* ============================================================
   OVERVIEW — Stats
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--cream-line);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--cream);
  font-size: 18px;
}

.stat-number {
  font-family: "Playfair Display", serif;
  font-size: 32px;
  font-weight: 900;
  color: var(--brown-800);
  line-height: 1;
}

.stat-label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* ============================================================
   OVERVIEW — Dashboard Grid (panels)
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel {
  background: #fff;
  border: 1px solid var(--cream-line);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--cream-line);
}
.panel-head h2 { font-size: 16px; font-weight: 700; }
.panel-head button {
  border: none;
  background: none;
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.panel-head button:hover { color: var(--gold-dark); }

/* Recent items list */
.recent-list { padding: 4px 0; }

.recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  transition: background 0.15s;
}
.recent-row:hover { background: var(--cream); }
.recent-row img {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  object-fit: cover;
  flex-shrink: 0;
}
.recent-row > div:nth-child(2) { flex: 1; min-width: 0; }
.recent-row h4 {
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--brown-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-row p { font-size: 11px; color: var(--muted); }
.recent-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--brown-800);
}

/* Section summary */
.section-summary { padding: 4px 0; }

.summary-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  transition: background 0.15s;
}
.summary-row:hover { background: var(--cream); }
.summary-row .emoji {
  font-size: 22px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream-2);
  border-radius: 10px;
  flex-shrink: 0;
}
.summary-row > div:nth-child(2) { flex: 1; }
.summary-row h4 {
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--brown-800);
}
.summary-row p { font-size: 11px; color: var(--muted); }

/* ============================================================
   MENU ITEMS PAGE
   ============================================================ */
.admin-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-box .control {
  padding-inline-start: 38px;
}

.admin-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.admin-item-card {
  background: #fff;
  border: 1px solid var(--cream-line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.admin-item-card:hover { box-shadow: var(--shadow-md); }

.admin-item-image {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--cream-2);
  overflow: hidden;
}
.admin-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-flags {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.admin-item-info {
  padding: 16px;
}

.admin-item-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.admin-item-title h3 {
  font-family: "Poppins", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--brown-800);
}
.admin-item-title .price {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-dark);
  white-space: nowrap;
}

.section-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 6px;
}

.description {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--cream-line);
}

.stock-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

/* ============================================================
   SECTIONS (Categories) PAGE
   ============================================================ */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.section-admin-card {
  background: #fff;
  border: 1px solid var(--cream-line);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow 0.2s;
}
.section-admin-card:hover { box-shadow: var(--shadow-md); }

.section-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.section-card-head .emoji {
  font-size: 24px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream-2);
  border-radius: 12px;
  flex-shrink: 0;
}
.section-card-head > div:nth-child(2) { flex: 1; }
.section-card-head h3 {
  font-family: "Poppins", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--brown-800);
}

.order-buttons { display: flex; gap: 4px; }

.section-description {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}

.section-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--cream-line);
}
.section-card-footer > div { display: flex; align-items: center; gap: 6px; }

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-card {
  background: #fff;
  border: 1px solid var(--cream-line);
  border-radius: var(--radius);
  overflow: hidden;
}

.settings-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-bottom: 1px solid var(--cream-line);
}
.settings-head h2 { font-size: 17px; font-weight: 700; }
.settings-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }

.settings-form {
  padding: 20px;
}
.settings-form .btn { margin-top: 8px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}
.empty-state > div { max-width: 320px; }
.empty-icon {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}
.empty-state p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(44, 26, 16, 0.45);
  backdrop-filter: blur(4px);
  padding: 24px;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  width: min(480px, 100%);
  max-height: 90vh;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in 0.25s ease;
}

.modal.wide { width: min(720px, 100%); }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--cream-line);
}
.modal-head h2 { font-size: 20px; font-weight: 900; }
.modal-head p { font-size: 12px; color: var(--muted); margin-top: 4px; }

.modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--cream-line);
  border-radius: 50%;
  background: var(--cream);
  color: var(--brown-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--cream-2); color: var(--brown-800); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--cream-line);
  background: var(--cream);
}

/* ── Item form grid (inside modal) ── */
.item-form-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
}

/* Upload box */
.upload-box {
  display: block;
  border: 2px dashed var(--cream-line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
}
.upload-box:hover { border-color: var(--gold); }

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
}
.upload-placeholder b { font-size: 13px; color: var(--brown-700); }
.upload-placeholder small { font-size: 11px; }

.upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-box img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.image-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  }

  .admin-main {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .admin-content {
    padding: 20px 16px 32px;
  }

  .page-head h1 {
    font-size: 22px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-items-grid,
  .sections-grid {
    grid-template-columns: 1fr;
  }

  .item-form-grid {
    grid-template-columns: 1fr;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    border-radius: 16px;
  }

  .modal.wide {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .admin-toolbar {
    flex-direction: column;
  }

  .search-box {
    min-width: 100%;
  }
}
