/* Skya Admin Panel — Pro CRM White Theme */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --admin-primary: #0f172a;
  --admin-accent: #2563eb;
  --admin-accent-hover: #1d4ed8;
  --admin-accent-soft: rgba(37, 99, 235, 0.08);
  --admin-accent-light: rgba(37, 99, 235, 0.04);
  --admin-accent-glow: rgba(37, 99, 235, 0.25);
  --admin-success: #059669;
  --admin-success-soft: rgba(5, 150, 105, 0.1);
  --admin-warning: #d97706;
  --admin-warning-soft: rgba(217, 119, 6, 0.1);
  --admin-danger: #dc2626;
  --admin-danger-soft: rgba(220, 38, 38, 0.1);
  --admin-info: #0891b2;
  --admin-bg: #ffffff;
  --admin-bg-muted: #f8fafc;
  --admin-card: #ffffff;
  --admin-card-hover: #f8fafc;
  --admin-sidebar-bg: #ffffff;
  --admin-sidebar-border: #e2e8f0;
  --admin-sidebar-hover: #f1f5f9;
  --admin-sidebar-active: #eff6ff;
  --admin-header-bg: #ffffff;
  --admin-header-border: #e2e8f0;
  --admin-border: #e2e8f0;
  --admin-border-light: #f1f5f9;
  --admin-muted: #64748b;
  --admin-text: #0f172a;
  --admin-text-secondary: #475569;
  --admin-radius: 8px;
  --admin-radius-lg: 12px;
  --admin-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --admin-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --admin-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --admin-shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.1);
  --admin-shadow-btn: 0 2px 8px rgba(37, 99, 235, 0.3);
  --admin-header-h: 60px;
  --admin-sidebar-w: 255px;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
}

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

html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--admin-text);
  line-height: 1.5;
  background: var(--admin-bg);
}

/* —— Login —— */
html.admin-html,
.admin-login-page {
  background: var(--admin-bg-muted);
  min-height: 100vh;
}

.admin-login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.admin-login-shell {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
}

.admin-login-brand img {
  height: auto;
  max-width: min(160px, 60vw);
}

.admin-login-card {
  width: 100%;
  padding: 2rem 2rem 1.75rem;
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-lg);
  box-shadow: var(--admin-shadow-lg);
}

.admin-login-card h1 {
  font-size: 1.3rem;
  margin: 0 0 0.2rem;
  font-weight: 700;
}

.admin-login-sub {
  margin: 0 0 1.35rem;
  font-size: 0.85rem;
  color: var(--admin-muted);
}

.admin-login-form { display: flex; flex-direction: column; gap: 0.1rem; }

.admin-field { display: block; margin-bottom: 0.85rem; }

.admin-field span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--admin-text);
}

.admin-field input,
.admin-form input,
.admin-form textarea,
.admin-form select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1.5px solid var(--admin-border);
  border-radius: var(--admin-radius);
  font: inherit;
  font-size: 0.9rem;
  background: #fff;
  color: var(--admin-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-field input:focus,
.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px var(--admin-accent-soft);
}

/* —— Admin shell —— */
.admin-body { background: var(--admin-bg-muted); min-height: 100vh; }

/* —— Header —— */
.admin-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--admin-header-h);
  padding: 0 1.25rem;
  background: var(--admin-header-bg);
  border-bottom: 1px solid var(--admin-header-border);
  box-shadow: var(--admin-shadow-sm);
}

.admin-menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.admin-menu-toggle:hover {
  border-color: var(--admin-accent);
  background: var(--admin-accent-soft);
}

.admin-menu-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  margin: 0 auto;
  background: var(--admin-text);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.15s ease;
}

body.admin-sidebar-collapsed .admin-menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.admin-sidebar-collapsed .admin-menu-toggle span:nth-child(2) { opacity: 0; }
body.admin-sidebar-collapsed .admin-menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 1023px) {
  body.admin-sidebar-open .admin-menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  body.admin-sidebar-open .admin-menu-toggle span:nth-child(2) { opacity: 0; }
  body.admin-sidebar-open .admin-menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

.admin-header-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.admin-header-logo img {
  height: 32px;
  width: auto;
  max-width: min(130px, 28vw);
  object-fit: contain;
}

.admin-header-title { flex: 1; min-width: 0; }

.admin-header-title h1 {
  font-size: 1rem;
  margin: 0;
  font-weight: 600;
  color: var(--admin-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-header-actions {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.admin-header-actions .btn {
  background: var(--admin-bg-muted);
  border-color: var(--admin-border);
  color: var(--admin-text-secondary);
}

.admin-header-actions .btn:hover {
  background: var(--admin-accent-soft);
  border-color: var(--admin-accent);
  color: var(--admin-accent);
}

.admin-header-actions .btn.is-active {
  background: var(--admin-accent-soft);
  border-color: var(--admin-accent);
  color: var(--admin-accent);
}

/* —— Sidebar —— */
.admin-sidebar-overlay {
  position: fixed;
  top: var(--admin-header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 150;
  background: rgba(15, 23, 42, 0.3);
}

.admin-sidebar {
  position: fixed;
  top: var(--admin-header-h);
  left: 0;
  z-index: 200;
  width: var(--admin-sidebar-w);
  height: calc(100vh - var(--admin-header-h));
  display: flex;
  flex-direction: column;
  padding: 0.65rem 0.65rem 0.85rem;
  background: var(--admin-sidebar-bg);
  border-right: 1px solid var(--admin-sidebar-border);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-track { background: transparent; }
.admin-sidebar::-webkit-scrollbar-thumb { background: var(--admin-border); border-radius: 2px; }

.admin-sidebar-open .admin-sidebar { transform: translateX(0); }

@media (min-width: 1024px) {
  .admin-sidebar { transform: translateX(0); }
  body.admin-sidebar-collapsed .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar-overlay { display: none !important; }
}

.admin-user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.65rem;
  margin-bottom: 0.65rem;
  background: var(--admin-bg-muted);
  border: 1px solid var(--admin-border-light);
  border-radius: var(--admin-radius);
  text-decoration: none;
  color: var(--admin-text);
  transition: border-color 0.15s;
}

.admin-user-chip:hover { border-color: var(--admin-accent); }

.admin-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--admin-accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-user-chip strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--admin-text);
}

.admin-user-chip small {
  color: var(--admin-muted);
  font-size: 0.7rem;
}

.admin-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.admin-nav-label {
  margin: 0.85rem 0.5rem 0.3rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--admin-muted);
}

.admin-nav-label:first-child { margin-top: 0; }

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--admin-text-secondary);
  text-decoration: none;
  padding: 0.5rem 0.65rem;
  border-radius: var(--admin-radius);
  font-size: 0.84rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.admin-nav a:hover {
  background: var(--admin-sidebar-hover);
  color: var(--admin-primary);
}

.admin-nav a.is-active {
  background: var(--admin-sidebar-active);
  color: var(--admin-accent);
  font-weight: 600;
}

.admin-nav a svg,
.admin-nav a span {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.55;
  color: currentColor;
}

.admin-nav a:hover svg,
.admin-nav a:hover span { opacity: 0.8; }

.admin-nav a.is-active svg,
.admin-nav a.is-active span { opacity: 1; }

/* —— Image handling —— */
.admin-image-preview {
  max-width: min(180px, 100%);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--admin-border-light);
  background: var(--admin-bg-muted);
}

.admin-image-preview img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.admin-table-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--admin-bg-muted);
  border: 1px solid var(--admin-border-light);
  flex-shrink: 0;
}

.admin-table-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-favicon-preview {
  max-width: min(60px, 100%);
}

.admin-favicon-preview img {
  max-height: 42px;
  max-width: 42px;
  width: auto;
  height: auto;
  object-fit: contain;
}

@media (max-width: 480px) {
  .admin-image-preview { max-width: 100%; }
  .admin-image-preview img { height: 100px; }
}

/* 404 page */
.admin-404-box {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--admin-card);
  border: 1px solid var(--admin-border-light);
  border-radius: var(--admin-radius-lg);
  box-shadow: var(--admin-shadow-sm);
  max-width: 480px;
  margin: 2rem auto;
}

.admin-404-box h2 {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0 0 0.3rem;
  color: var(--admin-muted);
}

.admin-404-box p {
  font-size: 0.95rem;
  color: var(--admin-text-secondary);
  margin: 0 0 1.25rem;
}

/* —— Main content —— */
.admin-wrap {
  min-height: calc(100vh - var(--admin-header-h));
  margin-top: var(--admin-header-h);
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 1024px) {
  .admin-wrap { margin-left: var(--admin-sidebar-w); }
  body.admin-sidebar-collapsed .admin-wrap { margin-left: 0; }
}

.admin-main { padding: 1.5rem; }

@media (min-width: 768px) { .admin-main { padding: 1.75rem 2rem 2.5rem; } }

.admin-content {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--admin-radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.84rem;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn svg { width: 16px; height: 16px; }

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--admin-accent);
  color: #fff;
  border-color: var(--admin-accent);
  box-shadow: var(--admin-shadow-btn);
}

.btn-primary:hover {
  background: var(--admin-accent-hover);
  border-color: var(--admin-accent-hover);
}

.btn-outline {
  background: var(--admin-card);
  color: var(--admin-text-secondary);
  border-color: var(--admin-border);
}

.btn-outline:hover {
  border-color: var(--admin-accent);
  background: var(--admin-accent-soft);
  color: var(--admin-accent);
}

.btn-danger {
  background: var(--admin-danger);
  color: #fff;
  border-color: var(--admin-danger);
}

.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; }
.btn-block { width: 100%; margin-top: 0.25rem; }

.btn-logout {
  background: transparent;
  color: var(--admin-danger);
  border: 1.5px solid var(--admin-danger-soft);
}

.btn-logout:hover {
  background: var(--admin-danger);
  color: #fff;
  border-color: var(--admin-danger);
}

/* —— Dashboard —— */
.admin-dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-dash-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
}

.admin-dash-date {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--admin-muted);
}

.admin-dash-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 900px) { .stats { grid-template-columns: repeat(3, 1fr); gap: 1rem; } }

.stat-card {
  background: var(--admin-card);
  padding: 1.15rem 1.25rem;
  border-radius: var(--admin-radius-lg);
  border: 1px solid var(--admin-border-light);
  box-shadow: var(--admin-shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.stat-card:hover {
  border-color: var(--admin-accent);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
}

.stat-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--admin-radius);
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
}

.stat-card-icon svg { width: 18px; height: 18px; }

.stat-icon-blue { background: var(--admin-accent-soft); }
.stat-icon-green { background: var(--admin-success-soft); }
.stat-icon-amber { background: var(--admin-warning-soft); }
.stat-icon-cyan { background: rgba(8, 145, 178, 0.1); }
.stat-icon-purple { background: rgba(139, 92, 246, 0.1); }
.stat-card-icon-alert { background: var(--admin-danger-soft); }

.stat-card strong {
  display: block;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-card span {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--admin-muted);
  font-weight: 500;
}

.stat-unread-label {
  font-size: 0.55rem !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--admin-muted) !important;
  display: inline !important;
}

.stat-card-alert {
  border-color: var(--admin-accent) !important;
  background: var(--admin-accent-light);
}

/* —— Dashboard Grid —— */
.admin-dash-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 768px) {
  .admin-dash-grid { grid-template-columns: 1fr 1fr; }
  .admin-dash-card-wide { grid-column: 1 / -1; }
}

.admin-dash-card {
  background: var(--admin-card);
  padding: 1.25rem;
  border-radius: var(--admin-radius-lg);
  border: 1px solid var(--admin-border-light);
  box-shadow: var(--admin-shadow-sm);
}

.admin-dash-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--admin-border-light);
}

.admin-dash-inbox-list { display: flex; flex-direction: column; gap: 2px; }

.admin-dash-inbox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.7rem;
  border-radius: var(--admin-radius);
  text-decoration: none;
  transition: background 0.12s;
}

.admin-dash-inbox-item:hover { background: var(--admin-card-hover); }

.admin-dash-inbox-label {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--admin-text);
}

.admin-dash-inbox-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--admin-muted);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--admin-bg-muted);
}

.admin-dash-inbox-count.has-new {
  color: #fff;
  background: var(--admin-accent);
}

.admin-dash-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.admin-dash-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--admin-text-secondary);
  background: var(--admin-bg-muted);
  border-radius: var(--admin-radius);
  border: 1px solid var(--admin-border-light);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.admin-dash-action-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.admin-dash-action-btn:hover {
  background: var(--admin-accent-soft);
  border-color: var(--admin-accent);
  color: var(--admin-accent);
}

.admin-dash-action-outline {
  background: var(--admin-card);
  border-style: dashed;
}

.admin-dash-action-outline:hover { border-style: solid; }

.admin-dash-welcome-text {
  margin: 0;
  font-size: 0.88rem;
  color: var(--admin-muted);
  line-height: 1.6;
}

/* —— Tables —— */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: var(--admin-radius-lg);
  border: 1px solid var(--admin-border-light);
  box-shadow: var(--admin-shadow-sm);
  background: var(--admin-card);
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-table th,
.admin-table td {
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--admin-border-light);
  font-size: 0.84rem;
}

.admin-table th {
  background: var(--admin-bg-muted);
  font-weight: 600;
  color: var(--admin-text-secondary);
  white-space: nowrap;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-table tbody tr { transition: background 0.12s; }
.admin-table tbody tr:hover { background: var(--admin-card-hover); }
.admin-table tbody tr:last-child td { border-bottom: none; }

.admin-table-actions {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.admin-inline-form { display: inline; }

/* —— Utility —— */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* —— Modals —— */
.admin-modal[hidden] { display: none !important; }

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.admin-modal-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(85dvh, 660px);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: none;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.08);
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.admin-modal-panel-lg { width: min(720px, 100%); }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #eef0f2;
  flex-shrink: 0;
}

.admin-modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
}

.admin-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  flex-shrink: 0;
}

.admin-modal-close svg {
  width: 18px;
  height: 18px;
  display: block;
}

.admin-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: scale(1.05);
}

.admin-modal-close:active {
  transform: scale(0.95);
}

.admin-modal-close-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-modal-body { overflow-y: auto; padding: 1.25rem; }
.admin-modal-body:empty { display: none; }

.admin-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.85rem;
  border-top: 1px solid #eef0f2;
}

.admin-modal-actions .btn {
  min-height: 38px;
  border-radius: 10px;
  font-size: 0.875rem;
}

html.admin-modal-open,
body.admin-modal-open { overflow: hidden; touch-action: none; }

/* —— Inbox detail modal —— */
.admin-inbox-modal .admin-modal-panel {
  max-height: min(80dvh, 600px);
}

.admin-inbox-detail-date {
  font-size: 0.85rem;
  margin-bottom: 1rem;
  color: #64748b;
}

.admin-inbox-detail-list {
  display: grid;
  gap: 0.75rem;
}

.admin-inbox-detail-list dt {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.15rem;
}

.admin-inbox-detail-list dd {
  margin: 0;
  font-size: 0.9rem;
  color: #0f172a;
  line-height: 1.5;
  word-break: break-word;
}

.admin-inbox-detail-list dd a {
  color: #2563eb;
  text-decoration: none;
}

.admin-inbox-detail-list dd a:hover {
  text-decoration: underline;
}

/* —— Forms —— */
.admin-form {
  background: var(--admin-card);
  padding: 1.5rem;
  border-radius: var(--admin-radius-lg);
  max-width: 720px;
  border: 1px solid var(--admin-border-light);
  box-shadow: var(--admin-shadow-sm);
}

.admin-form-modal { max-width: none; padding: 0; background: transparent; border: none; box-shadow: none; }
.admin-form-card { border: none; box-shadow: none; padding: 0; background: transparent; }

@media (min-width: 1024px) { .admin-form { padding: 1.75rem 2rem; } }

.admin-form label {
  display: block;
  margin-bottom: 0.9rem;
  font-weight: 600;
  font-size: 0.84rem;
}

.admin-form textarea { min-height: 100px; resize: vertical; }

/* —— Flash —— */
.admin-flash {
  padding: 0.65rem 0.9rem;
  border-radius: var(--admin-radius);
  margin-bottom: 0.85rem;
  font-size: 0.84rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.admin-flash-success {
  background: var(--admin-success-soft);
  color: #065f46;
  border-color: #a7f3d0;
}

.admin-flash-info {
  background: var(--admin-accent-soft);
  color: #1e40af;
  border-color: #bfdbfe;
}

.admin-flash-error {
  background: var(--admin-danger-soft);
  color: #991b1b;
  border-color: #fecaca;
}

/* —— Utilities —— */
.muted { color: var(--admin-muted); font-size: 0.875rem; }
.unread { font-weight: 700; }

/* —— Tabs —— */
.admin-page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.15rem;
}

.admin-page-tab {
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--admin-muted);
  background: var(--admin-card);
  border: 1px solid var(--admin-border-light);
  border-radius: var(--admin-radius);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.admin-page-tab:hover {
  color: var(--admin-text);
  border-color: var(--admin-border);
}

.admin-page-tab.is-active {
  color: var(--admin-accent);
  background: var(--admin-accent-soft);
  border-color: var(--admin-accent);
}

.admin-toolbar { margin-bottom: 1.15rem; }

.admin-content a:not(.btn) { color: var(--admin-accent); font-weight: 500; }
.admin-content a:not(.btn):hover { color: var(--admin-accent-hover); }

/* —— Toggle switch —— */
.admin-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  background: var(--admin-bg-muted);
  border: 1px solid var(--admin-border-light);
  border-radius: var(--admin-radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  user-select: none;
  transition: border-color 0.15s;
}

.admin-toggle-label:hover { border-color: var(--admin-accent); }

.admin-toggle-label input[type="checkbox"] {
  position: relative;
  width: 42px;
  height: 22px;
  appearance: none;
  -webkit-appearance: none;
  background: #cbd5e1;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.admin-toggle-label input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.admin-toggle-label input[type="checkbox"]:checked { background: var(--admin-accent); }
.admin-toggle-label input[type="checkbox"]:checked::before { transform: translateX(20px); }

/* —— Settings —— */
.admin-settings-form { max-width: 800px; }

.admin-settings-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--admin-border-light);
}

.admin-settings-section:last-of-type { border-bottom: none; }

.admin-settings-heading {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
}

.admin-settings-desc {
  margin: 0 0 0.85rem;
  font-size: 0.84rem;
  color: var(--admin-muted);
}

/* —— SMTP fields —— */
.admin-smtp-fields { margin-top: 0.85rem; padding-top: 0.85rem; border-top: 1px solid var(--admin-border-light); }

.admin-smtp-fields select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--admin-border);
  border-radius: var(--admin-radius);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  background: #fff;
}

.admin-smtp-fields .admin-field-hint {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.76rem;
  color: var(--admin-muted);
}

/* —— OTP —— */
.admin-otp-input {
  font-size: 1.65rem !important;
  letter-spacing: 0.3em;
  text-align: center;
  font-weight: 700;
  padding: 0.55rem 0.5rem !important;
}

.admin-otp-back { text-align: center; margin-top: 1rem; }

.admin-otp-back a {
  color: var(--admin-muted);
  font-size: 0.84rem;
  text-decoration: none;
}

.admin-otp-back a:hover { color: var(--admin-accent); }

/* —— Upload fields —— */
.admin-image-field,
.admin-file-field {
  margin-bottom: 0.85rem;
  padding: 0.85rem;
  background: var(--admin-bg-muted);
  border: 1.5px dashed var(--admin-border);
  border-radius: var(--admin-radius);
}

.admin-field-label {
  display: block;
  font-weight: 600;
  font-size: 0.84rem;
  margin-bottom: 0.45rem;
}

.admin-file-upload input[type="file"] {
  width: 100%;
  padding: 0.4rem;
  font-size: 0.8rem;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  background: #fff;
  cursor: pointer;
}

.admin-file-upload input[type="file"]::file-selector-button {
  margin-right: 0.55rem;
  padding: 0.3rem 0.65rem;
  border: none;
  border-radius: 6px;
  background: var(--admin-accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.76rem;
  cursor: pointer;
}

.admin-field-hint {
  font-size: 0.75rem;
  color: var(--admin-muted);
  margin: 0;
}

.admin-file-current { font-size: 0.78rem; margin: 0 0 0.45rem; }
.admin-file-current a { color: var(--admin-accent); word-break: break-all; }

.admin-table-thumb-cell { width: 48px; padding-right: 0.2rem !important; }

/* —— Inbox —— */
.admin-inbox-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.admin-inbox-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.admin-inbox-meta { font-size: 0.82rem; margin: 0.1rem 0 0; }
.admin-inbox-unread-count { color: var(--admin-danger); }

.admin-inbox-empty {
  padding: 2.5rem;
  text-align: center;
  background: var(--admin-card);
  border: 1.5px dashed var(--admin-border);
  border-radius: var(--admin-radius-lg);
  color: var(--admin-muted);
  font-size: 0.88rem;
}

.admin-inbox-row-unread { background: var(--admin-accent-light); }
.admin-inbox-row-unread td:first-child { box-shadow: inset 3px 0 0 var(--admin-accent); }

.admin-inbox-date {
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--admin-muted);
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
}

.admin-badge-new { background: var(--admin-accent-soft); color: var(--admin-accent); }
.admin-badge-read { background: var(--admin-bg-muted); color: var(--admin-muted); }
.admin-badge-pending { background: var(--admin-warning-soft); color: var(--admin-warning); }

.admin-status-select {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  background: var(--admin-bg);
  color: var(--admin-primary);
  cursor: pointer;
  max-width: 110px;
}

.admin-form-type {
  font-weight: 600;
  font-size: 0.78rem;
}

.admin-inbox-detail-list {
  margin: 0;
  display: grid;
  gap: 0.6rem 1rem;
}

.admin-inbox-detail-list dt {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--admin-muted);
  margin: 0;
}

.admin-inbox-detail-list dd {
  margin: 0.05rem 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-inbox-detail-date { margin: 0 0 0.65rem; font-size: 0.8rem; color: var(--admin-muted); }

/* —— Profile —— */
.admin-profile-wrap {
  max-width: 800px;
}

.admin-profile-hero {
  position: relative;
  margin-bottom: 1.5rem;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #eef0f2;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.admin-profile-hero-bg {
  height: 100px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #7c3aed 100%);
}

.admin-profile-hero-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0 1.5rem 1.25rem;
  margin-top: -32px;
}

.admin-profile-avatar-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  padding: 4px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  flex-shrink: 0;
}

.admin-profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-weight: 800;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-profile-hero-text h1 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.1rem;
  color: #0f172a;
}

.admin-profile-hero-text p {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  color: #64748b;
}

.admin-profile-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  background: #2563eb;
  border-radius: 100px;
}

.admin-profile-grid {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 768px) {
  .admin-profile-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

.admin-profile-card {
  background: #fff;
  border: 1px solid #eef0f2;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  padding: 1.25rem 1.5rem;
  transition: box-shadow 0.2s;
}

.admin-profile-card-full {
  grid-column: 1 / -1;
}

.admin-profile-card-head {
  margin-bottom: 1rem;
}

.admin-profile-card-head h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.1rem;
  color: #0f172a;
}

.admin-profile-card-head p {
  margin: 0;
  font-size: 0.82rem;
  color: #64748b;
}

.admin-profile-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.admin-profile-form-row {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 640px) {
  .admin-profile-form-row { grid-template-columns: 1fr 1fr 1fr; }
}

.admin-profile-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.admin-profile-input-wrap input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font: inherit;
  font-size: 0.88rem;
  background: #fff;
  color: #0f172a;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.admin-profile-input-wrap input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.admin-profile-btn {
  align-self: flex-start;
  margin-top: 0.25rem;
  border-radius: 10px;
  min-height: 40px;
  padding: 0 1.25rem;
  font-size: 0.875rem;
}

.admin-profile-info-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-profile-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.admin-profile-info-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.admin-profile-info-label {
  font-size: 0.82rem;
  color: #64748b;
}

.admin-profile-info-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
}

.admin-profile-card-cta {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.8rem;
  color: #16a34a;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.admin-profile-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  display: inline-block;
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .admin-profile-hero-bg { height: 72px; }
  .admin-profile-hero-inner { padding: 0 1rem 1rem; margin-top: -28px; gap: 1rem; }
  .admin-profile-avatar-ring { width: 60px; height: 60px; padding: 3px; }
  .admin-profile-avatar { font-size: 1.2rem; }
  .admin-profile-hero-text h1 { font-size: 1.05rem; }
  .admin-profile-card { padding: 1rem 1.15rem; }
  .admin-profile-form-row { grid-template-columns: 1fr; }
  .admin-profile-btn { width: 100%; justify-content: center; }
}

/* —— Responsive —— */
@media (max-width: 1023px) {
  .admin-header-title h1 { font-size: 0.88rem; }
}

@media (max-width: 767px) {
  :root { --admin-header-h: 56px; }

  .admin-header { padding: 0 0.75rem; }
  .admin-header-logo img { max-width: 85px; height: 26px; }
  .admin-main { padding: 1rem; }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .stat-card strong { font-size: 1.3rem; }
  .stat-card { padding: 0.9rem 1rem; }

  .admin-table th, .admin-table td { padding: 0.5rem 0.6rem; font-size: 0.78rem; }

  .admin-table-actions { flex-direction: column; align-items: stretch; gap: 0.25rem; }
  .admin-table-actions .btn,
  .admin-table-actions form,
  .admin-table-actions .admin-inline-form { width: 100%; }
  .admin-table-actions .btn { justify-content: center; min-height: 36px; }
  .admin-table-actions .admin-inline-form .btn { margin: 0; }

  .admin-modal { padding: 0; align-items: flex-end; }
  .admin-modal-panel,
  .admin-modal-panel-lg {
    width: 100%;
    max-width: 100%;
    max-height: min(92dvh, 100%);
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }
  .admin-modal-panel::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #d1d5db;
    z-index: 2;
  }
  .admin-modal-header { padding: 0.7rem 1.15rem 0.7rem 1.15rem; }
  .admin-modal-body { padding: 1rem 1.15rem 1.25rem; }
  .admin-modal-actions { flex-direction: column; }
  .admin-modal-actions .btn { width: 100%; justify-content: center; }
  .admin-modal-panel { display: flex; flex-direction: column; }
  .admin-modal-body { flex: 1; min-height: 0; }
  .admin-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0,0,0,0.05);
  }
  .admin-modal-close svg { width: 16px; height: 16px; }
  /* Better modal form field sizing on mobile */
  .admin-form-modal label { margin-bottom: 0.65rem; }

  .admin-form { padding: 1.15rem; }
  .admin-settings-form,
  .admin-form { max-width: 100%; }
  .admin-settings-form .btn-primary,
  .admin-form > .btn-primary:last-child { width: 100%; }

  .admin-inbox-head { flex-direction: column; align-items: stretch; gap: 0.55rem; }
  .admin-toolbar { flex-direction: column; align-items: stretch; gap: 0.45rem; }
  .admin-toolbar .btn { width: 100%; justify-content: center; }

  .admin-dash-header { flex-direction: column; }
  .admin-dash-actions { width: 100%; }
  .admin-dash-actions .btn { flex: 1; }

  .admin-dash-actions-grid { grid-template-columns: 1fr 1fr; }
  .admin-table-thumb { width: 34px; height: 34px; }
  .admin-page-tabs { gap: 0.25rem; }
  .admin-page-tab { font-size: 0.76rem; padding: 0.3rem 0.55rem; }
}

@media (max-width: 480px) {
  .admin-modal { padding: 0; }
  .admin-modal-panel,
  .admin-modal-panel-lg {
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }
  .admin-modal-panel::before { display: none; }
  .admin-modal-header { padding: 0.65rem 1rem; }
  .admin-modal-body { padding: 0.85rem 1rem 1.15rem; }
  .admin-modal-close { width: 30px; height: 30px; }
  .admin-modal-close svg { width: 14px; height: 14px; }

  .stats { grid-template-columns: 1fr 1fr; gap: 0.45rem; }
  .stat-card { padding: 0.65rem 0.75rem; }
  .stat-card strong { font-size: 1.1rem; }
  .stat-card span { font-size: 0.7rem; }
  .stat-card-icon { width: 28px; height: 28px; margin-bottom: 0.4rem; }
  .stat-card-icon svg { width: 16px; height: 16px; }
  .admin-dash-actions { flex-direction: column; }
  .admin-dash-actions .btn { width: 100%; }
  .admin-header-actions .btn { font-size: 0; gap: 0; }
  .admin-header-actions .btn svg { width: 18px; height: 18px; }
  .admin-header-actions .btn:first-child { font-size: 0.72rem; gap: 0.25rem; }
  .admin-header-actions .btn:first-child svg { width: 14px; height: 14px; }
  .admin-dash-actions-grid { grid-template-columns: 1fr; }
  .admin-dash-card-title { font-size: 0.82rem; }
  .admin-settings-field { margin-bottom: 0.65rem; }
  .admin-toggle-label { padding: 0.55rem 0.7rem; font-size: 0.82rem; }
  .admin-smtp-fields label { margin-bottom: 0.55rem; }
  .admin-settings-section { margin-bottom: 1.25rem; padding-bottom: 1rem; }
  .admin-login-shell { width: 100%; }
  .admin-login-card { padding: 1.5rem 1.25rem 1.25rem; }
  .admin-login-card h1 { font-size: 1.1rem; }
  .admin-sidebar { width: 280px; }
}

html.admin-sidebar-open,
body.admin-sidebar-open { overflow: hidden; touch-action: none; }

.admin-table-scroll-hint {
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.admin-table-scroll-hint::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 24px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--admin-bg-muted));
}

/* ————————————————
   Product Builder
   ———————————————— */
.admin-modal-panel-xl { max-width: 860px !important; }
.pb-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.pb-field { margin-bottom: 0.75rem; }
.pb-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.3rem;
}
.pb-field input,
.pb-field textarea,
.pb-field select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.pb-field input:focus,
.pb-field textarea:focus,
.pb-field select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}
.pb-field-check { display: flex; gap: 1rem; align-items: center; padding-top: 0.2rem; }
.pb-field-check label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; cursor: pointer; }
.pb-field-check input[type=checkbox] { width: auto; }
.pb-field-note { font-weight: 400; color: #94a3b8; font-size: 0.72rem; }
.pb-divider {
  position: relative;
  text-align: center;
  margin: 1.5rem 0 1rem;
}
.pb-divider::before {
  content: '';
  position: absolute;
  inset: 50% 0 0;
  border-top: 1px solid #e2e8f0;
}
.pb-divider span {
  position: relative;
  z-index: 1;
  background: #fff;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}
#pb-container { margin-bottom: 1rem; }
.pb-add-wrap { position: relative; margin-bottom: 0.75rem; }
.pb-add-section-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s;
}
.pb-add-section-btn:hover { background: #f1f5f9; border-color: #94a3b8; color: #1a2744; }
.pb-add-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  min-width: 240px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15,23,42,0.1);
  padding: 0.4rem;
  display: none;
  margin-top: 4px;
}
.pb-add-menu.is-open { display: block; }
.pb-add-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 8px;
  background: none;
  font-size: 0.82rem;
  font-weight: 500;
  color: #1a2744;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s;
}
.pb-add-option:hover { background: #f1f5f9; }
.pb-add-option.is-active { color: #94a3b8; }
.pb-add-option-icon { flex-shrink: 0; width: 20px; color: #64748b; }
.pb-add-check { margin-left: auto; color: #2563eb; font-size: 0.75rem; }

/* Cards */
.pb-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.pb-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.pb-card-header:hover { background: #f8fafc; }
.pb-card-icon { flex-shrink: 0; width: 18px; color: #64748b; }
.pb-card-label { flex: 1; font-size: 0.85rem; font-weight: 600; color: #1a2744; }
.pb-card-toggle {
  width: 10px; height: 10px;
  border-right: 2px solid #cbd5e1;
  border-bottom: 2px solid #cbd5e1;
  transform: rotate(-45deg);
  transition: transform 0.2s;
  margin-right: 0.3rem;
}
.pb-card.is-open .pb-card-toggle { transform: rotate(45deg); margin-top: -3px; }
.pb-card-remove {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 6px;
  background: none; color: #94a3b8;
  cursor: pointer; font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.pb-card-remove:hover { background: #fee2e2; color: #dc2626; }
.pb-card-body { display: none; padding: 0.75rem 1rem 1rem; border-top: 1px solid #f1f5f9; }
.pb-card.is-open .pb-card-body { display: block; }

/* Item rows */
.pb-items-wrap { }
.pb-items-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; }
.pb-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: #f8fafc;
  border-radius: 8px;
  transition: background 0.15s;
}
.pb-item-row:hover { background: #f1f5f9; }
.pb-item-with-preset {
  flex: 1;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.pb-item-with-preset select,
.pb-item-with-preset input {
  padding: 0.45rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: inherit;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.pb-item-with-preset select:focus,
.pb-item-with-preset input:focus { border-color: #2563eb; }
.pb-item-with-preset select { max-width: 180px; }
.pb-item-with-preset input[type=text] { flex: 1; min-width: 100px; }
.pb-item-actions {
  display: flex;
  gap: 0.15rem;
  flex-shrink: 0;
}
.pb-item-actions button {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 6px;
  background: none; color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pb-item-actions button:hover { background: #e2e8f0; color: #475569; }
.pb-item-remove:hover { background: #fee2e2 !important; color: #dc2626 !important; }
.pb-add-item-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.75rem;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: none;
  font-size: 0.78rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s, color 0.2s;
}
.pb-add-item-btn:hover { border-color: #2563eb; color: #2563eb; }

/* Spec row */
.pb-spec-inner { flex: 1; display: flex; gap: 0.4rem; align-items: center; }
.pb-spec-inner select { max-width: 160px; }

/* Finish swatch */
.pb-finish-swatch {
  display: inline-block;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.pb-finish-hex { max-width: 80px !important; font-family: monospace !important; }

/* Table sections badge */
.pb-table-sections { font-size: 0.7rem; color: #94a3b8; letter-spacing: 0.15em; }

/* Hint */
.pb-hint { font-size: 0.8rem; color: #94a3b8; margin: 0.5rem 0; }

/* ————————————————
   Product Form Redesign
   ———————————————— */

/* Form sections */
.pf-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 1rem;
  overflow: hidden;
}

.pf-section-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1a2744;
  user-select: none;
}

.pf-section-head svg {
  flex-shrink: 0;
  color: #64748b;
}

.pf-section-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.pf-section-body {
  padding: 0.85rem 1rem 1rem;
}

/* Collapsible section */
.pf-section-collapse .pf-section-head {
  cursor: pointer;
  transition: background 0.15s;
}

.pf-section-collapse .pf-section-head:hover {
  background: #f1f5f9;
}

.pf-section-collapse .pf-section-head svg:first-child {
  transition: transform 0.2s;
}

.pf-section-collapse.is-collapsed .pf-section-head svg:first-child {
  transform: rotate(-90deg);
}

.pf-section-collapse.is-collapsed .pf-section-body {
  display: none;
}

/* Grid layout */
.pf-grid {
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.pf-grid-2 {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .pf-grid-2 { grid-template-columns: 1fr 1fr; }
}

/* Form fields inside pf */
.pf-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.35rem;
}

.pf-field input,
.pf-field textarea,
.pf-field select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.pf-field input:focus,
.pf-field textarea:focus,
.pf-field select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

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

.pf-field select {
  cursor: pointer;
}

.pf-required {
  color: #dc2626;
}

.pf-input-mono {
  font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
  font-size: 0.8rem !important;
}

.pf-hint {
  font-size: 0.8rem;
  color: #94a3b8;
  margin: 0 0 0.65rem;
  line-height: 1.5;
}

/* Input group (slug + refresh button) */
.pf-input-group {
  display: flex;
  gap: 0.35rem;
}

.pf-input-group input {
  flex: 1;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.pf-input-group-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-height: 38px;
  border: 1.5px solid #e2e8f0;
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.pf-input-group-btn:hover {
  background: #e2e8f0;
  color: #1a2744;
}

/* Toggle switch (replaces checkbox) */
.pf-field-check {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 0.2rem;
}

.pf-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
}

.pf-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.pf-toggle-track {
  position: relative;
  width: 40px;
  height: 22px;
  background: #cbd5e1;
  border-radius: 11px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.pf-toggle-track::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.pf-toggle input:checked + .pf-toggle-track {
  background: #2563eb;
}

.pf-toggle input:checked + .pf-toggle-track::before {
  transform: translateX(18px);
}

.pf-toggle-label {
  font-size: 0.84rem;
  font-weight: 500;
  color: #475569;
}

/* ── Image Field Redesign ── */
.pif-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.35rem;
  padding: 0 1rem;
  padding-top: 0.5rem;
}

.pif-wrap {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  align-items: flex-start;
}

.pif-preview {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pif-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pif-preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 500;
}

.pif-clear {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,0.9);
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  opacity: 0;
}

.pif-preview:hover .pif-clear {
  opacity: 1;
}

.pif-clear:hover {
  background: #fee2e2;
  color: #dc2626;
}

.pif-fields {
  flex: 1;
  min-width: 0;
}

.pif-upload {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pif-upload input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.pif-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: #2563eb;
  color: #fff;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.pif-upload-label:hover {
  background: #1d4ed8;
}

.pif-upload-label svg {
  width: 16px;
  height: 16px;
}

.pif-upload-name {
  font-size: 0.78rem;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pif-or {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.5rem 0;
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

.pif-or::before,
.pif-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.pif-url input {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.pif-url input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

.pif-hint {
  margin: 0.45rem 0 0;
  font-size: 0.74rem;
  color: #94a3b8;
}

/* Modal header actions */
.admin-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.admin-modal-header-actions .btn {
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
}

.admin-modal-header-actions .btn svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 640px) {
  .pif-wrap { flex-direction: column; align-items: stretch; }
  .pif-preview { width: 100%; height: 180px; }
  .pif-upload-name { display: none; }
}
