/* ── Reset & Base ─────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Login ────────────────────────────────────────────────── */

.admin-login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #3E5636, #5B7C4F);
}

.login-container { width: 100%; max-width: 400px; padding: 1rem; }

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.login-card h1 { text-align: center; color: #5B7C4F; margin-bottom: 0.25rem; font-size: 1.5rem; }
.login-card h2 { text-align: center; color: #666; font-size: 1rem; margin-bottom: 1.5rem; font-weight: 400; }

.login-card input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.login-card .form-message { color: #c00; text-align: center; margin-top: 0.5rem; }

/* ── Admin Layout ─────────────────────────────────────────── */

.admin-body { min-height: 100vh; }

.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  background: #1a2e15;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
  color: #C8A96E;
  font-weight: 700;
  font-size: 1rem;
}
.sidebar-logo:hover { text-decoration: none; }

.sidebar-nav { flex: 1; padding: 0.5rem 0; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  min-height: 40px;
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.sidebar-link:hover { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }
.sidebar-link.active { background: rgba(255,255,255,0.15); color: #C8A96E; }

.sidebar-icon { display: flex; align-items: center; flex-shrink: 0; }
.sidebar-icon svg { display: block; }

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
}

.sidebar-lang { margin-bottom: 0.5rem; }
.sidebar-lang select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.sidebar-lang select:hover { background: rgba(255,255,255,0.12); }

.sidebar-user { display: flex; align-items: center; gap: 0.6rem; color: #999; margin-bottom: 0.25rem; }
.sidebar-user svg { flex-shrink: 0; }

.logout-btn { color: #f87171 !important; }

.admin-content {
  flex: 1;
  margin-left: 220px;
  padding: 1.5rem;
  min-height: 100vh;
}

/* ── Page Components ──────────────────────────────────────── */

.admin-page { max-width: 1100px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.page-header h1 { font-size: 1.5rem; }
.page-header h1 small { color: #999; font-weight: 400; font-size: 0.85rem; }

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.data-table thead { background: #f9f9f9; }
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

.data-table th { font-weight: 600; font-size: 0.85rem; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }

.unread-row { background: #fef3c7; }

/* Section card */
.section-card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.section-card summary {
  cursor: pointer;
  font-size: 1rem;
  padding: 0.5rem 0;
}

/* Forms */
label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="tel"],
input[type="url"], textarea, select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}

textarea { resize: vertical; }

hr {
  border: none;
  border-top: 1px solid rgba(0,0,0,0.1);
  margin: 1.25rem 0;
}

input[type="checkbox"] { width: auto; margin-right: 0.5rem; }
input[type="color"] { width: 60px; height: 36px; padding: 2px; cursor: pointer; }

.code-textarea { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.85rem; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  min-height: 40px;
  min-width: 40px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  background: #fff;
  color: #333;
  transition: all 0.15s;
  font-family: inherit;
  user-select: none;
  -webkit-user-select: none;
}
.btn:hover { background: #f5f5f5; text-decoration: none; }

.btn-primary { background: #5B7C4F; color: #fff; border-color: #5B7C4F; }
.btn-primary:hover { background: #3E5636; }

.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }

.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; min-height: 40px; min-width: 40px; }
.btn-block { width: 100%; }

.badge {
  background: #5B7C4F;
  color: #fff;
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Calendar layout */
.calendar-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .calendar-layout { grid-template-columns: 1fr; }
}

/* Colors grid */
.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
@media (max-width: 1100px) { .color-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .color-grid { grid-template-columns: 1fr; } }
.color-field input[type="text"] { width: 100%; min-width: 0; }

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-lg { max-width: 800px; }

.modal-content h2 { margin-bottom: 1rem; }

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* Widget type grid */
.widget-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}

.widget-type-btn {
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.widget-type-btn:hover { background: #f0fdf4; border-color: #5B7C4F; }

/* Widget cards */
.widget-card {
  background: #fff;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border-left: 3px solid #5B7C4F;
  max-width: 100%;
  overflow: hidden;
}

.widget-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.widget-handle { cursor: grab; color: #999; font-size: 1.2rem; }
.widget-type-badge { color: #999; font-size: 0.8rem; background: #f5f5f5; padding: 0.15rem 0.5rem; border-radius: 4px; }
.widget-actions { margin-left: auto; display: flex; gap: 0.25rem; }

.widget-editor { padding: 0 1rem 1rem; }
.widget-editor-actions { margin-top: 0.5rem; }

/* Media grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.media-item {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #eee;
  background: #fff;
}

.media-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  cursor: pointer;
}

.media-info {
  padding: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.media-info small { color: #999; font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 80px; }

/* Nav link rows */
.nav-link-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
  transition: opacity 0.2s;
}
.nav-link-row input { flex: 1; }
.nav-link-row.drag-over, .footer-link-row.drag-over { border: 2px dashed var(--color-primary, #5B7C4F); border-radius: 6px; }
.drag-handle {
  cursor: grab;
  color: #a8a29e;
  display: flex;
  align-items: center;
  padding: 0.25rem;
  flex-shrink: 0;
}
.drag-handle:active { cursor: grabbing; }
.drag-handle svg { stroke-linecap: round; }

/* Status badges */
.status-active { color: #16a34a; font-weight: 500; }
.status-inactive { color: #999; }

/* Empty state */
.empty-state { text-align: center; padding: 3rem; color: #999; }

/* Tabs */
.admin-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #e5e5e5;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  min-height: 40px;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: #78716c;
  transition: all 0.15s;
  font-family: inherit;
  user-select: none;
  -webkit-user-select: none;
}
.admin-tab:hover { color: #44403c; }
.admin-tab.active { border-bottom-color: #15803d; color: #166534; }
.admin-tab svg { display: block; }

.admin-tabs-mobile {
  display: none;
  width: 100%;
  margin-bottom: 1.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  background: #fff;
  color: #166534;
  font-family: inherit;
  cursor: pointer;
}

@media (max-width: 600px) {
  .admin-tabs { display: none; }
  .admin-tabs-mobile { display: block; }
}

/* Multi-row (phones, emails, links) */
.multi-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

/* Form grid (2 columns) */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Button link style */
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  background: none;
  border: none;
  color: #5B7C4F;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.25rem 0;
  font-family: inherit;
  font-weight: 500;
  margin-top: 0.25rem;
  user-select: none;
  -webkit-user-select: none;
}
.btn-link:hover { color: #3E5636; text-decoration: underline; }
.btn-link svg { display: block; }

/* Icon-only button */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  min-height: 40px;
  min-width: 40px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: #666;
  transition: all 0.15s;
  user-select: none;
  -webkit-user-select: none;
}
.btn-icon:hover { background: #f5f5f5; }
.btn-danger-icon { color: #dc2626; border-color: #fecaca; }
.btn-danger-icon:hover { background: #fef2f2; }

/* Broadcast email row */
.broadcast-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #fafaf9;
  border-radius: 6px;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

/* Checkbox row */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.checkbox-row label { margin: 0; }

/* Color field */
.color-field { margin-bottom: 0.5rem; }
.color-row { display: flex; align-items: center; gap: 0.5rem; }
.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid #ddd;
  flex-shrink: 0;
}

/* Badge (monospace for slugs) */
.badge { font-family: 'SF Mono', 'Fira Code', monospace; }

/* Text helpers */
.text-help { color: #999; font-size: 0.8rem; margin-top: 0.15rem; }
.text-muted { color: #999; }

/* Buttons with icons */
.btn { display: inline-flex; align-items: center; gap: 0.35rem; }
.btn svg { display: block; flex-shrink: 0; }

/* ── Page Builder ─────────────────────────────────────────── */

/* Add widget slot */
.add-widget-slot {
  display: flex;
  justify-content: center;
  padding: 0.35rem 0;
}

.btn-add-widget {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px dashed #d6d3d1;
  border-radius: 50%;
  background: none;
  color: #a8a29e;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-add-widget:hover {
  border-color: #5B7C4F;
  color: #5B7C4F;
  background: #f0fdf4;
}

/* Widget reorder buttons */
.widget-reorder {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.btn-reorder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 18px;
  border: none;
  background: none;
  color: #999;
  cursor: pointer;
  padding: 0;
  border-radius: 3px;
}
.btn-reorder:hover:not(:disabled) { background: #f5f5f5; color: #333; }
.btn-reorder:disabled { opacity: 0.3; cursor: default; }

/* Widget type icon in card header */
.widget-type-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Editor image preview */
.editor-img-preview {
  display: block;
  max-width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e5e5e5;
  margin-bottom: 0.4rem;
}

/* Widget thumbnail */
.widget-thumb {
  width: 40px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e5e5e5;
  flex-shrink: 0;
}

/* Widget preview text */
.widget-preview {
  color: #999;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

/* Widget picker groups */
.widget-picker-groups { }

.picker-group {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.picker-group-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: none;
  background: #fafaf9;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: #44403c;
  font-family: inherit;
  text-align: left;
}
.picker-group-toggle:hover { background: #f5f5f4; }
.picker-group-toggle .chevron { transition: transform 0.15s; flex-shrink: 0; }

.picker-group-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  padding: 0.75rem;
}

.picker-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 0.5rem;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  color: #57534e;
  transition: all 0.15s;
  font-family: inherit;
}
.picker-type-btn:hover { background: #f0fdf4; border-color: #5B7C4F; color: #3E5636; }

.picker-icon {
  width: 48px;
  height: 32px;
  display: block;
}

/* Element cards (inside widget editors) */
.element-card {
  background: #fafaf9;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 0.6rem;
  margin-bottom: 0.35rem;
}

.element-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.element-type-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #78716c;
  background: #e7e5e4;
  border-radius: 3px;
  flex-shrink: 0;
}

.element-type-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #78716c;
  text-transform: capitalize;
}

/* Add element dropdown */
.add-element-dropdown {
  margin-top: 0.25rem;
}

/* ── Spacing box model ─────────────────────────────────────── */
.spacing-box {
  max-width: 360px;
  margin: 0 auto;
  user-select: none;
}

.spacing-margin {
  position: relative;
  background: #fef3c7;
  border: 1px dashed #d97706;
  border-radius: 6px;
  padding: 28px 36px;
}

.spacing-padding {
  position: relative;
  background: #dbeafe;
  border: 1px dashed #3b82f6;
  border-radius: 4px;
  padding: 28px 36px;
}

.spacing-content {
  background: #d1fae5;
  border: 1px dashed #10b981;
  border-radius: 3px;
  height: 28px;
}

.spacing-label {
  position: absolute;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  pointer-events: none;
}

.spacing-label-margin {
  top: 3px;
  left: 6px;
  color: #92400e;
}

.spacing-label-padding {
  top: 3px;
  left: 6px;
  color: #1e40af;
}

.spacing-side {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spacing-margin > .spacing-top { top: 2px; left: 50%; transform: translateX(-50%); }
.spacing-margin > .spacing-bottom { bottom: 2px; left: 50%; transform: translateX(-50%); }
.spacing-margin > .spacing-left { left: 2px; top: 50%; transform: translateY(-50%); }
.spacing-margin > .spacing-right { right: 2px; top: 50%; transform: translateY(-50%); }

.spacing-padding > .spacing-top { top: 2px; left: 50%; transform: translateX(-50%); }
.spacing-padding > .spacing-bottom { bottom: 2px; left: 50%; transform: translateX(-50%); }
.spacing-padding > .spacing-left { left: 2px; top: 50%; transform: translateY(-50%); }
.spacing-padding > .spacing-right { right: 2px; top: 50%; transform: translateY(-50%); }

.spacing-input {
  width: 40px !important;
  padding: 1px 2px !important;
  border: 1px solid transparent !important;
  border-radius: 3px;
  background: transparent;
  text-align: center;
  font-size: 0.75rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: #333;
  -moz-appearance: textfield;
}
.spacing-input::-webkit-inner-spin-button,
.spacing-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.spacing-input:hover { border-color: rgba(0,0,0,0.2) !important; background: rgba(255,255,255,0.6); }
.spacing-input:focus { border-color: #3b82f6 !important; background: #fff; outline: none; }

/* Editor columns/cards grid — mirrors the actual layout */
.editor-columns-row {
  display: grid;
  gap: 0.5rem;
}
.editor-columns-1 { grid-template-columns: 1fr; }
.editor-columns-2 { grid-template-columns: 1fr 1fr; }
.editor-columns-3 { grid-template-columns: 1fr 1fr 1fr; }

.editor-column-card {
  padding: 0.75rem;
  min-width: 0;
}

@media (max-width: 900px) {
  .editor-columns-3 { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .editor-columns-2 { grid-template-columns: 1fr; }
}

/* Template variable pills */
.tpl-var-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  margin: 0.2rem;
  font-size: 0.75rem;
  font-family: monospace;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.tpl-var-pill:hover {
  background: #166534;
  color: #fff;
  border-color: #166534;
}
.tpl-var-block {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.tpl-var-block:hover {
  background: #92400e;
  color: #fff;
  border-color: #92400e;
}

/* ── Mobile top bar ─────────────────────────────────────────── */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: #1a2e15;
  color: #fff;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  z-index: 1001;
}

.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 6px;
}
.mobile-menu-btn:hover { background: rgba(255,255,255,0.1); }

.mobile-topbar-logo {
  color: #C8A96E;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}
.mobile-topbar-logo:hover { text-decoration: none; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
}

/* ── Responsive ─────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 900px) {
  .admin-sidebar { width: 200px; }
  .admin-content { margin-left: 200px; padding: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .editor-columns-3 { grid-template-columns: 1fr; }
}

/* Mobile */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; }
  .mobile-topbar { display: flex; }
  .sidebar-overlay { display: block; pointer-events: none; opacity: 0; transition: opacity 0.2s; }

  .admin-sidebar {
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1000;
  }

  .sidebar-open .admin-sidebar { transform: translateX(0); }
  .sidebar-open .sidebar-overlay { pointer-events: auto; opacity: 1; }

  .admin-content {
    margin-left: 0;
    padding: 1rem;
    padding-top: calc(52px + 1rem);
  }

  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header h1 { font-size: 1.25rem; }

  .admin-page { max-width: 100%; }

  /* Tables: card layout on mobile */
  .data-table { box-shadow: none; background: transparent; }
  .data-table thead { display: none; }
  .data-table tbody { display: block; }
  .data-table tbody tr {
    display: block;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  }
  .data-table tbody tr.msg-detail {
    border-radius: 0 0 8px 8px;
    margin-top: -0.75rem;
    border-top: none;
  }
  .data-table tbody tr.msg-detail td {
    display: block;
    width: 100%;
  }
  .data-table tbody tr.msg-detail td::before { display: none; }
  .data-table tbody td {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.35rem 0;
    border-bottom: none;
    font-size: 0.875rem;
    white-space: normal;
    word-break: break-word;
  }
  .data-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.7rem;
    color: #78716c;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    margin-right: 1rem;
  }
  .data-table tbody td[data-label=""]::before,
  .data-table tbody td:not([data-label])::before { display: none; }
  .data-table tbody td[data-label=""] {
    display: block;
    padding: 0.25rem 0;
  }
  .data-table tbody td.card-actions {
    border-top: 1px solid #f0f0f0;
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    justify-content: flex-start;
  }
  .data-table tbody td.card-actions::before { display: none; }

  /* Tabs: hidden on mobile, replaced by .admin-tabs-mobile select */

  /* Form grid: single column */
  .form-grid { grid-template-columns: 1fr; }

  /* Modals: full width */
  .modal-content { width: 95%; max-height: 90vh; }

  /* Editor columns: stack */
  .editor-columns-2, .editor-columns-3 { grid-template-columns: 1fr; }

  /* Media grid: 2 columns */
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

  /* Nav link rows: card-group on mobile */
  .nav-link-row {
    flex-direction: column;
    align-items: stretch;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
  }
  .nav-link-row input { width: 100%; }
  .nav-link-row .btn-danger { align-self: flex-end; margin-top: 0.25rem; }

  /* Unread messages: color-coded card border on mobile */
  .data-table tbody tr.unread-row { border-left: 4px solid #f97316; }
  .data-table tbody tr:not(.unread-row):not(.msg-detail) { border-left: 4px solid transparent; }

  /* Email templates: button wraps below title on mobile */
  .tpl-header-row { flex-wrap: wrap; }

  /* Widget cards: stack on mobile */
  .widget-card-header {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
  }
  .widget-card-header .widget-handle,
  .widget-card-header .widget-type-icon { display: none; }
  .widget-card-header .widget-preview {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .widget-card-header .widget-actions {
    width: 100%;
    justify-content: flex-end;
    border-top: 1px solid #f0f0f0;
    padding-top: 0.4rem;
  }

  /* Section card: less padding */
  .section-card { padding: 1rem; }

  /* Color grid — handled by dedicated breakpoints above */

  /* Spacing box */
  .spacing-box { max-width: 100%; }
}

/* Small phones */
@media (max-width: 480px) {
  .admin-content { padding: 0.75rem; padding-top: calc(52px + 0.75rem); }
  .media-grid { grid-template-columns: 1fr 1fr; }
  .widget-type-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .picker-group-items { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
