/* ============================================================
   PC OEB — Owner panel stylesheet
   Shares the storefront design system
   ============================================================ */

:root {
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;

  --bg: #070a11;
  --bg-soft: #0b1019;
  --surface: #101724;
  --surface-2: #161f2f;
  --surface-3: #1d2839;
  --border: rgba(148, 178, 214, 0.14);
  --border-strong: rgba(148, 178, 214, 0.26);

  --text: #eef4ff;
  --text-soft: #c3cfe2;
  --muted: #93a3bc;

  --primary-1: #0284c7;
  --primary-2: #4f46e5;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --glow: rgba(56, 189, 248, 0.3);

  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(2, 6, 18, 0.4);
  --shadow-md: 0 12px 28px -18px rgba(2, 6, 18, 0.75);
  --shadow-lg: 0 32px 64px -32px rgba(2, 6, 18, 0.9);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme="light"] {
  --bg: #f6f8fc;
  --bg-soft: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f5fb;
  --surface-3: #e6edf7;
  --border: rgba(15, 32, 58, 0.1);
  --border-strong: rgba(15, 32, 58, 0.2);

  --text: #0b1524;
  --text-soft: #2c3d55;
  --muted: #5d6f88;

  --accent: #0369a1;
  --accent-soft: rgba(3, 105, 161, 0.09);
  --glow: rgba(3, 105, 161, 0.16);

  --success: #059669;
  --warning: #b45309;
  --danger: #dc2626;

  --shadow-sm: 0 1px 2px rgba(15, 32, 58, 0.06);
  --shadow-md: 0 12px 28px -18px rgba(15, 32, 58, 0.28);
  --shadow-lg: 0 32px 64px -36px rgba(15, 32, 58, 0.32);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.no-scroll { overflow: hidden; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); font-size: 0.88rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease),
              background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  color: #fff;
  box-shadow: 0 10px 22px -14px rgba(37, 99, 235, 0.9);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 14px 28px -14px rgba(37, 99, 235, 1); transform: translateY(-1px); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.btn-danger {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn-sm { padding: 7px 12px; font-size: 0.79rem; border-radius: 9px; }
.btn-lg { padding: 13px 22px; font-size: 0.95rem; }
.btn-block { width: 100%; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  transition: all 0.16s var(--ease);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.icon-sun { display: none; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* ---------- Login ---------- */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(50% 55% at 20% 15%, var(--glow), transparent 70%),
    radial-gradient(45% 50% at 82% 12%, rgba(139, 92, 246, 0.2), transparent 72%),
    var(--bg);
}

.login-card {
  width: min(410px, 100%);
  padding: 34px 30px 28px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand img { width: auto; height: 46px; object-fit: contain; }

.brand-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-name span { color: var(--accent); }

.login-card h1 { font-size: 1.45rem; margin-bottom: 6px; }
.login-sub { font-size: 0.86rem; color: var(--muted); margin-bottom: 22px; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
}
.password-toggle:hover { color: var(--accent); background: var(--accent-soft); }

.login-back {
  display: block;
  margin-top: 16px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}
.login-back:hover { color: var(--accent); }

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

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 252px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 16px;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.admin-logo { width: auto; height: 30px; object-fit: contain; }

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 11px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.16s var(--ease);
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.is-active {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.16), rgba(79, 70, 229, 0.16));
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.08);
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}

.admin-sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 0.84rem;
  color: var(--muted);
  transition: all 0.16s var(--ease);
}
.sidebar-link:hover { background: var(--surface); color: var(--text); }
.sidebar-link.danger:hover { color: var(--danger); background: rgba(248, 113, 113, 0.1); }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.admin-topbar h1 { font-size: 1.25rem; }
.topbar-sub { font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.owner-badge {
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 600;
}

.admin-page { padding: 28px 32px 56px; display: none; width: 100%; max-width: 1240px; }
.admin-page.is-active { display: block; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h2 { font-size: 1.35rem; }
.page-head .muted { margin-top: 3px; }

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.stat-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }

.stat-icon {
  width: 40px; height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 11px;
}
.icon-products { background: rgba(56, 189, 248, 0.13); color: var(--accent); }
.icon-orders { background: rgba(251, 191, 36, 0.13); color: var(--warning); }
.icon-stock { background: rgba(248, 113, 113, 0.13); color: var(--danger); }
.icon-sales { background: rgba(52, 211, 153, 0.13); color: var(--success); }

.stat-label {
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  white-space: nowrap;
}
.stat-note { font-size: 0.76rem; color: var(--muted); }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 1rem; }

.table-scroll { overflow-x: auto; }

/* ---------- Tables ---------- */
.data-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.data-table th {
  padding: 12px 18px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.align-right { text-align: right; }

.table-empty {
  padding: 40px 20px !important;
  text-align: center;
  color: var(--muted);
}

.product-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.product-thumb {
  width: 44px; height: 44px;
  flex-shrink: 0;
  object-fit: contain;
  padding: 4px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.product-cell strong {
  display: block;
  font-weight: 600;
  font-size: 0.87rem;
  line-height: 1.35;
  max-width: 30ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-cell small { font-size: 0.74rem; color: var(--muted); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill-neutral { background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border); }
.pill-success { background: rgba(52, 211, 153, 0.13); color: var(--success); }
.pill-warning { background: rgba(251, 191, 36, 0.13); color: var(--warning); }
.pill-danger { background: rgba(248, 113, 113, 0.13); color: var(--danger); }
.pill-info { background: rgba(56, 189, 248, 0.13); color: var(--accent); }

.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }

.status-select {
  appearance: none;
  padding: 6px 28px 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2393a3bc' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  font-size: 0.79rem;
  font-weight: 600;
  cursor: pointer;
}
.status-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap svg {
  position: absolute;
  top: 50%; left: 13px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 11px 14px 11px 38px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 0.87rem;
}
.toolbar select {
  appearance: none;
  padding: 11px 36px 11px 14px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%2393a3bc' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  font-size: 0.85rem;
  cursor: pointer;
}
.search-wrap input:focus,
.toolbar select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Messages ---------- */
.messages-list { display: grid; gap: 12px; }

.message-card {
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease);
}
.message-card:hover { border-color: var(--border-strong); }
.message-card.is-unread { border-left: 3px solid var(--accent); }

.message-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.message-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.message-who strong { font-size: 0.92rem; font-weight: 600; }
.message-who a { font-size: 0.8rem; color: var(--accent); word-break: break-all; }
.message-date { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.message-text {
  font-size: 0.88rem;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 14px;
}
.message-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Forms ---------- */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.field { margin-bottom: 15px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--text-soft);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  font-size: 0.88rem;
  color: var(--text);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; }
.field input[type="file"] { padding: 9px 11px; font-size: 0.82rem; cursor: pointer; }
.field input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.field input[type="file"]::file-selector-button:hover { border-color: var(--accent); color: var(--accent); }

.field.has-error input,
.field.has-error textarea,
.field.has-error select { border-color: var(--danger); }

.field-error { display: none; margin-top: 5px; font-size: 0.76rem; color: var(--danger); }
.field.has-error .field-error { display: block; }

.field-hint { font-size: 0.75rem; color: var(--muted); margin-top: 6px; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 0.85rem;
  cursor: pointer;
}
.check input { width: 16px; height: 16px; accent-color: var(--primary-1); cursor: pointer; }

.image-preview {
  margin-top: 10px;
  width: 130px;
  height: 130px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  overflow: hidden;
}
.image-preview img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }

.form-msg { font-size: 0.83rem; font-weight: 500; min-height: 0; margin-top: 8px; }
.form-msg:empty { display: none; }
.form-msg.is-success { color: var(--success); }
.form-msg.is-error { color: var(--danger); }

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  visibility: hidden;
  pointer-events: none;
}
.modal.is-open { visibility: visible; pointer-events: auto; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.modal.is-open .modal-backdrop { opacity: 1; }

.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(580px, 100%);
  max-height: 90vh;
  max-height: 90dvh;
  overflow: hidden;
  overscroll-behavior: contain;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px) scale(0.99);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.modal.is-open .modal-panel { opacity: 1; transform: translateY(0) scale(1); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-head h3 { font-size: 1.05rem; }

.modal-panel > form { display: flex; flex-direction: column; min-height: 0; }
.modal-body { padding: 20px 22px; overflow-y: auto; min-height: 0; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.order-details { display: grid; gap: 14px; }
.order-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.order-meta div { padding: 12px 14px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); }
.order-meta span { display: block; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.order-meta strong { font-size: 0.87rem; font-weight: 600; word-break: break-word; }

.order-items { display: grid; gap: 8px; }
.order-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}
.order-item-row span:last-child { font-weight: 600; white-space: nowrap; }
.order-total-row {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-weight: 700;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 2000;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  pointer-events: none;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Scrollbars ---------- */
.table-scroll::-webkit-scrollbar,
.modal-panel::-webkit-scrollbar { height: 8px; width: 6px; }
.table-scroll::-webkit-scrollbar-thumb,
.modal-panel::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1000px) {
  .admin-sidebar { width: 216px; }
  .admin-page { padding: 22px 22px 48px; }
  .admin-topbar { padding: 14px 22px; }
}

@media (max-width: 860px) {
  .admin-layout { flex-direction: column; }

  .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .admin-brand { padding: 0; margin: 0; border: 0; flex-shrink: 0; }
  .admin-brand .brand-name { display: none; }

  .admin-nav {
    flex-direction: row;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .admin-nav::-webkit-scrollbar { display: none; }

  .nav-item {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 0.82rem;
    white-space: nowrap;
  }
  .nav-item span:not(.nav-badge) { display: inline; }
  .nav-badge { margin-left: 4px; }

  .admin-sidebar-foot {
    flex-direction: row;
    padding: 0;
    border: 0;
    gap: 2px;
  }
  .sidebar-link { padding: 8px; font-size: 0.8rem; }
  .sidebar-link span { display: none; }

  .admin-topbar { top: 61px; padding: 12px 16px; }
  .admin-topbar h1 { font-size: 1.08rem; }
  .topbar-sub { display: none; }

  .admin-page { padding: 18px 16px 48px; }

  .col-featured { display: none; }
  .page-head { align-items: flex-start; }
  .page-head .btn { width: 100%; }
}

@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { flex-direction: column; gap: 10px; padding: 14px; }
  .stat-value { font-size: 1.28rem; }
  .stat-label { font-size: 0.66rem; }
  .stat-note { display: none; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .search-wrap { min-width: 0; }
  .toolbar select { width: 100%; }

  .col-cat, .col-date { display: none; }
  .data-table { min-width: 0; font-size: 0.82rem; }
  .data-table th, .data-table td { padding: 10px 12px; }
  .product-thumb { width: 38px; height: 38px; }
  .product-cell strong { max-width: 16ch; }

  .row-actions { flex-direction: column; align-items: stretch; }
  .row-actions .btn { width: 100%; }

  .modal { padding: 0; align-items: flex-end; }
  .modal-panel {
    width: 100%;
    max-height: 94vh;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
  }
  .modal-head { padding: 16px 18px; }
  .modal-body { padding: 16px 18px; }
  .modal-foot { padding: 12px 18px; }
  .modal-foot .btn { flex: 1; }

  .form-row { grid-template-columns: 1fr; gap: 0; }
  .order-meta { grid-template-columns: 1fr; }

  .login-card { padding: 26px 22px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   Phone layout — app bar + bottom tab bar, card-style tables
   ============================================================ */
.topbar-brand,
.mobile-action { display: none; }

@media (max-width: 860px) {
  .admin-layout { flex-direction: column; min-height: 100vh; min-height: 100dvh; }

  /* Navigation becomes a bottom tab bar */
  .admin-sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 0;
    border-top: 1px solid var(--border);
  }

  .admin-sidebar .admin-brand,
  .admin-sidebar-foot { display: none; }

  .admin-nav {
    flex-direction: row;
    gap: 2px;
    flex: 1;
    overflow: visible;
  }

  .nav-item {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 7px 2px;
    font-size: 0.64rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    border-radius: 11px;
  }
  .nav-item svg { width: 19px; height: 19px; }
  .nav-item.is-active { border-color: transparent; }

  .nav-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 22px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.58rem;
  }

  /* App bar */
  .topbar-brand { display: block; flex-shrink: 0; }
  .topbar-brand img { height: 26px; width: auto; }
  .mobile-action { display: inline-grid; }

  .admin-topbar {
    top: 0;
    z-index: 50;
    gap: 10px;
    padding: 10px 14px;
  }
  .topbar-title { flex: 1; min-width: 0; }
  .admin-topbar h1 { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-sub,
  .owner-badge { display: none; }
  .topbar-actions { gap: 7px; }
  .topbar-actions .icon-btn { width: 36px; height: 36px; border-radius: 10px; }

  .admin-page {
    padding: 16px 14px calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .col-featured { display: none; }
  .page-head { align-items: flex-start; }
  .page-head .btn { width: 100%; }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { flex-direction: column; gap: 8px; padding: 13px; }
  .stat-icon { width: 34px; height: 34px; border-radius: 10px; }
  .stat-value { font-size: 1.2rem; }
  .stat-label { font-size: 0.64rem; }
  .stat-note { display: none; }

  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .search-wrap { min-width: 0; }
  .toolbar select,
  .toolbar .btn { width: 100%; }

  /* Tables turn into stacked cards so nothing scrolls sideways */
  .table-scroll { overflow: visible; }
  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table tr,
  .data-table td { display: block; }
  .data-table { min-width: 0; font-size: 0.85rem; }
  .data-table thead { display: none; }
  .data-table tr { padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .data-table tbody tr:last-child { border-bottom: 0; }
  .data-table tbody tr:hover { background: transparent; }
  .data-table td { padding: 0; border: 0; }
  .data-table td.align-right { text-align: left; }
  .data-table td.col-cat,
  .data-table td.col-date,
  .data-table td.col-featured { display: none; }

  #productsTableBody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px 10px;
  }
  #productsTableBody td:nth-child(1) { grid-column: 1 / -1; }
  #productsTableBody td:nth-child(3) { font-weight: 700; }
  #productsTableBody td:nth-child(4) { justify-self: end; }
  #productsTableBody td:nth-child(6) { grid-column: 1 / -1; margin-top: 4px; }
  #productsTableBody .product-cell strong { max-width: none; white-space: normal; }
  #productsTableBody .row-actions { display: flex; flex-direction: row; width: 100%; gap: 8px; }
  #productsTableBody .row-actions .btn { flex: 1; }

  #ordersTableBody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4px 10px;
  }
  #ordersTableBody td:nth-child(1) { grid-area: 1 / 1; }
  #ordersTableBody td:nth-child(2) { grid-area: 2 / 1 / 3 / 3; }
  #ordersTableBody td:nth-child(3) { grid-area: 3 / 1; font-weight: 700; }
  #ordersTableBody td:nth-child(4) { grid-area: 1 / 2; justify-self: end; }
  #ordersTableBody td:nth-child(5) { display: none; }
  #ordersTableBody td:nth-child(6) { grid-area: 4 / 1 / 5 / 3; margin-top: 8px; }
  #ordersTableBody .row-actions { display: flex; flex-direction: row; align-items: center; width: 100%; gap: 8px; }
  #ordersTableBody .row-actions .status-select { flex: 1 1 auto; min-width: 0; }
  #ordersTableBody .row-actions .btn { flex: 0 0 auto; width: auto; }

  #recentOrdersWrap tr {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 2px 10px;
  }
  #recentOrdersWrap td:nth-child(1) { grid-area: 1 / 1; }
  #recentOrdersWrap td:nth-child(2) { grid-area: 2 / 1 / 3 / 3; }
  #recentOrdersWrap td:nth-child(3) { grid-area: 3 / 1; font-weight: 600; }
  #recentOrdersWrap td:nth-child(4) { grid-area: 1 / 2; justify-self: end; }
  #recentOrdersWrap td:nth-child(5) { display: none; }

  /* Modals become bottom sheets with a fixed action bar */
  .modal { padding: 0; align-items: flex-end; }
  .modal-panel {
    width: 100%;
    max-height: 94vh;
    max-height: 94dvh;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
  }
  .modal-head { padding: 14px 18px; }
  .modal-body { padding: 16px 18px; }
  .modal-foot { padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .modal-foot .btn { flex: 1; }

  .form-row { grid-template-columns: 1fr; gap: 0; }
  .order-meta { grid-template-columns: 1fr; }
  .image-preview { width: 110px; height: 110px; }
  .login-card { padding: 26px 20px 22px; }

  /* 16px inputs stop mobile browsers zooming into fields */
  .field input,
  .field textarea,
  .field select,
  .search-wrap input,
  .toolbar select,
  .status-select { font-size: 16px; }

  .message-card { padding: 16px; }
  .message-actions { gap: 8px; }
  .message-actions .btn { flex: 1; }
}

@media (max-width: 360px) {
  .stats-grid { grid-template-columns: 1fr; }
  .nav-item { font-size: 0.6rem; padding: 6px 1px; }
}

/* ============================================================
   PC OEB — Owner panel v2
   Dashboard, orders workflow, settings, search, mobile drawer
   ============================================================ */

/* ---------- Topbar extras ---------- */
.menu-btn { display: none; }

.global-search {
  position: relative;
  flex: 1;
  max-width: 380px;
  margin-left: auto;
}
.global-search > svg {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.global-search input {
  width: 100%;
  padding: 9px 74px 9px 36px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 0.84rem;
}
.global-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-kbd {
  position: absolute;
  top: 50%;
  right: 9px;
  transform: translateY(-50%);
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.66rem;
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 120;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  box-shadow: var(--shadow-lg);
}
.search-group { padding: 4px 0 6px; }
.search-group h4 {
  padding: 6px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  text-align: left;
}
.search-item:hover,
.search-item.is-active { background: var(--accent-soft); }
.search-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
}
.search-thumb {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.search-main { min-width: 0; flex: 1; }
.search-main strong { display: block; font-size: 0.84rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-main small { display: block; font-size: 0.73rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-empty { padding: 22px 12px; text-align: center; font-size: 0.84rem; color: var(--muted); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.user-chip:hover { border-color: var(--border-strong); }
.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.user-meta strong { font-size: 0.76rem; font-weight: 600; }
.user-meta small { font-size: 0.66rem; color: var(--muted); text-transform: capitalize; }

.notif-wrap { position: relative; }
.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
}
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  width: min(320px, calc(100vw - 24px));
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  box-shadow: var(--shadow-lg);
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; }
.notif-head strong { font-size: 0.84rem; }
.notif-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  text-align: left;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item strong { font-size: 0.8rem; }
.notif-item span { font-size: 0.73rem; color: var(--muted); }

/* ---------- Switches ---------- */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  margin-bottom: 10px;
}
.switch-row.is-disabled { opacity: 0.65; }
.switch-row span > strong { display: block; font-size: 0.86rem; font-weight: 600; }
.switch-row span > small { display: block; font-size: 0.75rem; color: var(--muted); }

.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 0.78rem; color: var(--muted); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch > span { position: relative; display: inline-block; width: 40px; height: 22px; border-radius: 999px; background: var(--surface-3); transition: background 0.18s var(--ease); }
.switch > span::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s var(--ease);
}
.switch input:checked + span { background: var(--primary-1); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch-sm > span { width: 34px; height: 19px; }
.switch-sm > span::after { width: 13px; height: 13px; }
.switch-sm input:checked + span::after { transform: translateX(15px); }

/* ---------- Dashboard ---------- */
.period-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.seg button { padding: 7px 12px; border-radius: 8px; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.seg button:hover { color: var(--text); }
.seg button.is-active { background: var(--accent-soft); color: var(--accent); }

.custom-range { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.custom-range label { font-size: 0.78rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.custom-range input { padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); }

.stats-dash { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); }
.stats-dash .stat-card { flex-direction: column; gap: 6px; }
.stats-dash .stat-value { font-size: 1.32rem; }
.stats-dash .stat-card.is-clickable { cursor: pointer; }
.stat-main { min-width: 0; }
.change { font-weight: 600; }
.change.up { color: var(--success); }
.change.down { color: var(--danger); }
.change.flat { color: var(--muted); }
.info-tip { cursor: help; color: var(--muted); }

.skeleton-card {
  height: 104px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 18px; }
.dash-chart-panel { min-width: 0; }
.chart-wrap { position: relative; padding: 12px 14px 6px; }
.chart-wrap canvas { display: block; width: 100%; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0.84rem; color: var(--muted); pointer-events: none; }
.chart-tip {
  position: absolute;
  top: 6px;
  z-index: 5;
  min-width: 118px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.chart-tip strong { display: block; font-size: 0.72rem; color: var(--muted); }
.chart-tip span { display: block; font-size: 0.86rem; font-weight: 700; }
.chart-tip small { font-size: 0.68rem; color: var(--muted); }

.mini-list { display: grid; gap: 2px; padding: 8px 12px 12px; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.mini-row:last-child { border-bottom: 0; }
.mini-row img { width: 34px; height: 34px; object-fit: contain; border-radius: 8px; background: var(--surface-2); padding: 3px; }
.mini-main { flex: 1; min-width: 0; }
.mini-main strong { display: block; font-size: 0.82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-main small { font-size: 0.72rem; color: var(--muted); }
.mini-value { font-size: 0.8rem; font-weight: 700; white-space: nowrap; }

.wilaya-row { padding: 7px 4px; border-bottom: 1px solid var(--border); }
.wilaya-row:last-child { border-bottom: 0; }
.wilaya-top { display: flex; justify-content: space-between; gap: 10px; font-size: 0.8rem; }
.wilaya-bar { height: 5px; margin: 5px 0 3px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.wilaya-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--primary-2)); }
.wilaya-row small { font-size: 0.7rem; color: var(--muted); }

.alerts-list { display: grid; gap: 2px; padding: 8px 12px 12px; }
.alert-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.alert-row:last-child { border-bottom: 0; }
.alert-row > div { flex: 1; min-width: 0; }
.alert-row strong { display: block; font-size: 0.82rem; font-weight: 600; }
.alert-row small { font-size: 0.72rem; color: var(--muted); }
.alert-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; }
.alert-dot.warn { background: var(--warning); }
.alert-dot.danger { background: var(--danger); }
.alert-dot.info { background: var(--accent); }

.clickable { cursor: pointer; }

/* ---------- Status badges ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.71rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status-new { background: rgba(56, 189, 248, 0.12); color: var(--accent); border-color: rgba(56, 189, 248, 0.25); }
.status-confirmed { background: rgba(129, 140, 248, 0.14); color: #a5b4fc; border-color: rgba(129, 140, 248, 0.25); }
.status-preparing { background: rgba(251, 191, 36, 0.13); color: var(--warning); border-color: rgba(251, 191, 36, 0.25); }
.status-shipping { background: rgba(244, 114, 182, 0.13); color: #f472b6; border-color: rgba(244, 114, 182, 0.25); }
.status-delivered { background: rgba(52, 211, 153, 0.13); color: var(--success); border-color: rgba(52, 211, 153, 0.25); }
.status-cancelled { background: rgba(248, 113, 113, 0.13); color: var(--danger); border-color: rgba(248, 113, 113, 0.25); }
.status-returned { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.28); }
[data-theme="light"] .status-confirmed { color: #4f46e5; }
[data-theme="light"] .status-shipping { color: #be185d; }
[data-theme="light"] .status-returned { color: #475569; }

select.status-new, select.status-confirmed, select.status-preparing,
select.status-shipping, select.status-delivered, select.status-cancelled,
select.status-returned { border-color: currentColor; }

.flag { font-size: 0.78rem; }
.flag.danger { color: var(--danger); }
.flag.vip { color: var(--warning); }
.customer-cell { display: flex; flex-direction: column; min-width: 0; }
.customer-cell strong { font-size: 0.86rem; font-weight: 600; }
.customer-cell small { font-size: 0.74rem; color: var(--muted); }

/* ---------- Orders ---------- */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.filters-panel {
  display: none;
  padding: 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}
.filters-panel.is-open { display: block; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.filter-grid-3 { grid-template-columns: repeat(3, 1fr); }
.filter-search { grid-column: span 2; }
.filter-actions { display: flex; justify-content: flex-end; gap: 8px; }

.order-flags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.order-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-status {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--muted);
}
.quick-status:hover { border-color: var(--border-strong); color: var(--text); }
.quick-status.is-active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.contact-row { display: flex; flex-wrap: wrap; gap: 8px; }

.order-totals { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.order-totals > div { display: flex; justify-content: space-between; font-size: 0.85rem; }
.order-totals .discount { color: var(--success); }
.order-totals .total { padding-top: 8px; border-top: 1px solid var(--border); font-weight: 700; font-size: 0.95rem; }
.order-meta .span-2 { grid-column: span 2; }

.order-section { margin-top: 6px; }
.order-section h4 { font-size: 0.88rem; margin-bottom: 10px; }
.order-section h4 .muted { font-weight: 400; font-size: 0.74rem; }
.timeline { list-style: none; padding: 0; display: grid; gap: 0; }
.timeline-item { position: relative; display: flex; gap: 12px; padding: 0 0 14px 2px; }
.timeline-item::before { content: ''; position: absolute; left: 7px; top: 14px; bottom: 0; width: 1px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 14px; height: 14px; flex-shrink: 0; margin-top: 3px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--bg-soft); }
.timeline-dot.status-new { background: var(--accent); }
.timeline-dot.status-confirmed { background: #818cf8; }
.timeline-dot.status-preparing { background: var(--warning); }
.timeline-dot.status-shipping { background: #f472b6; }
.timeline-dot.status-delivered { background: var(--success); }
.timeline-dot.status-cancelled { background: var(--danger); }
.timeline-dot.status-returned { background: #94a3b8; }
.timeline-item strong { display: block; font-size: 0.83rem; font-weight: 600; }
.timeline-item small { font-size: 0.73rem; color: var(--muted); }
.timeline-item p { font-size: 0.78rem; color: var(--text-soft); margin-top: 2px; }

.note-list { display: grid; gap: 8px; margin-bottom: 10px; }
.note-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.note-row > div { flex: 1; min-width: 0; }
.note-row p { font-size: 0.82rem; white-space: pre-wrap; word-break: break-word; }
.note-row small { font-size: 0.7rem; color: var(--muted); }
.note-row .icon-btn { width: 28px; height: 28px; flex-shrink: 0; }
.note-form { display: flex; gap: 8px; align-items: flex-start; }
.note-form textarea { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg-soft); font-size: 0.85rem; resize: vertical; }
.note-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Products ---------- */
.margin-box { padding: 11px 13px; border-radius: 10px; border: 1px dashed var(--border-strong); background: var(--bg-soft); font-size: 0.9rem; font-weight: 700; color: var(--muted); }
.margin-box.is-positive { color: var(--success); border-color: rgba(52, 211, 153, 0.4); }
.margin-box.is-negative { color: var(--danger); border-color: rgba(248, 113, 113, 0.4); }
.strike { text-decoration: line-through; font-size: 0.75rem; }
.col-check { width: 36px; }
.col-check input { width: 16px; height: 16px; accent-color: var(--primary-1); }
.icon-only { padding: 7px 9px; }

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
}
.bulk-bar strong { font-size: 0.82rem; }
.bulk-bar select, .bulk-bar input { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 0.8rem; }

.history-list { display: grid; gap: 2px; margin-top: 6px; }
.history-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.history-main { flex: 1; min-width: 0; }
.history-main strong { display: block; font-size: 0.83rem; font-weight: 600; }
.history-main small { font-size: 0.73rem; color: var(--muted); }
.history-qty { text-align: right; }
.history-qty span { display: block; font-weight: 700; font-size: 0.85rem; }
.qty-up { color: var(--success); }
.qty-down { color: var(--danger); }
.history-qty small { font-size: 0.7rem; color: var(--muted); }
.history-row time { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.qty-row { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.qty-row input { flex: 1; padding: 11px 13px; text-align: center; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg-soft); font-size: 1.1rem; font-weight: 700; }
.qty-row .btn { width: 48px; height: 46px; font-size: 1.2rem; }
.stock-current { font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; }
.stock-current strong { color: var(--text); font-size: 1rem; }

/* ---------- Customers ---------- */
.risk-note { padding: 10px 12px; border-radius: 10px; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.3); color: var(--warning); font-size: 0.8rem; }
.customer-detail { display: grid; gap: 14px; }
.customer-orders { display: grid; gap: 6px; }
.customer-order { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); text-align: left; }
.customer-order:hover { border-color: var(--border-strong); }
.customer-order > span:first-child { flex: 1; min-width: 0; font-size: 0.8rem; font-weight: 600; }
.customer-order small { display: block; font-size: 0.7rem; color: var(--muted); font-weight: 400; }
.customer-order > strong { font-size: 0.8rem; white-space: nowrap; }

/* ---------- Settings ---------- */
.settings-tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; scrollbar-width: none; }
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tabs button { flex-shrink: 0; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 0.79rem; font-weight: 600; color: var(--muted); }
.settings-tabs button:hover { color: var(--text); border-color: var(--border-strong); }
.settings-tabs button.is-active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.settings-body { display: grid; gap: 16px; padding-bottom: 70px; }
.settings-panel .panel-body { padding: 18px 20px; }
.settings-panel .field:last-child { margin-bottom: 0; }
.image-setting { display: flex; align-items: center; gap: 12px; }
.image-setting img { width: 64px; height: 46px; object-fit: contain; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); padding: 4px; }
.hours-list { display: grid; gap: 6px; }
.hour-row { display: grid; grid-template-columns: 96px 90px 1fr; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.hour-row:last-child { border-bottom: 0; }
.hour-row > strong { font-size: 0.82rem; }
.hour-times { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hour-times input { padding: 7px 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg-soft); font-size: 0.8rem; }
.hour-times span { font-size: 0.72rem; color: var(--muted); }
.wilaya-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.wilaya-toolbar input[type="search"] { flex: 1; min-width: 180px; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--bg-soft); font-size: 0.84rem; }
.wilaya-bulk { display: flex; gap: 8px; align-items: center; }
.wilaya-bulk input { width: 110px; padding: 9px 10px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--bg-soft); font-size: 0.84rem; }
.wilaya-table-wrap { max-height: 460px; overflow: auto; border-radius: 10px; border: 1px solid var(--border); }
.wilaya-table { width: 100%; min-width: 460px; border-collapse: collapse; font-size: 0.82rem; }
.wilaya-table th { position: sticky; top: 0; z-index: 1; padding: 9px 10px; text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.wilaya-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.wilaya-table td strong { display: block; font-size: 0.8rem; }
.wilaya-table td small { font-size: 0.72rem; color: var(--muted); }
.wilaya-table input[type="number"] { width: 86px; padding: 6px 8px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--bg-soft); font-size: 0.8rem; }
.wilaya-table .wilaya-check { width: 34px; padding-right: 0; }
.wilaya-table .wilaya-check input { width: 15px; height: 15px; accent-color: var(--primary-1); }
.slides-list { display: grid; gap: 14px; }
.slide-card { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-soft); }
.slide-preview img { width: 100%; height: 100px; object-fit: cover; border-radius: 9px; border: 1px solid var(--border); }
.slide-fields .field { margin-bottom: 8px; }
.slide-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.save-bar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 70;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  box-shadow: var(--shadow-lg);
  font-size: 0.82rem;
}

/* ---------- Users / activity / backup ---------- */
.log-action { padding: 2px 7px; border-radius: 6px; background: var(--surface-2); font-size: 0.74rem; }
.log-details { font-size: 0.78rem; color: var(--muted); word-break: break-word; max-width: 420px; }
.backup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.backup-grid .panel-body { padding: 18px 20px; display: grid; gap: 10px; align-content: start; }
.backup-status { font-size: 0.82rem; color: var(--muted); }
.backup-status.is-warning { color: var(--warning); }
.danger-note { font-size: 0.8rem; color: var(--danger); padding: 10px 12px; border-radius: 9px; background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.25); }
.export-links { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- More sheet ---------- */
.more-list { display: grid; gap: 4px; }
.more-item { display: flex; flex-direction: column; padding: 12px 10px; border-radius: 10px; text-align: left; }
.more-item:hover { background: var(--surface-2); }
.more-item span { font-size: 0.9rem; font-weight: 600; }
.more-item small { font-size: 0.74rem; color: var(--muted); }
.more-item.danger span { color: var(--danger); }

/* ---------- Mobile tab bar + drawer ---------- */
.mobile-tabbar { display: none; }
.drawer-overlay { display: none; }

@media (max-width: 860px) {
  .menu-btn { display: inline-grid; }
  .user-chip .user-meta { display: none; }
  .user-chip { padding: 4px; }
  .global-search { display: none; }
  .global-search.is-open {
    display: block;
    position: fixed;
    top: 62px;
    left: 12px;
    right: 12px;
    max-width: none;
    z-index: 55;
    margin: 0;
  }
  .global-search.is-open input { background: var(--bg-soft); box-shadow: var(--shadow-lg); }
  .search-kbd { display: none; }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    bottom: 0;
    z-index: 90;
    width: 272px;
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 20px 16px;
    background: var(--bg-soft);
    border-top: 0;
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    overflow-y: auto;
  }
  .admin-sidebar.is-open { transform: none; }
  .admin-sidebar .admin-brand { display: flex; padding: 0 8px 18px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
  .admin-sidebar .admin-brand .brand-name { display: inline; }
  .admin-sidebar .admin-nav { flex-direction: column; gap: 3px; overflow: visible; }
  .admin-sidebar .nav-item {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 11px;
    padding: 11px 13px;
    font-size: 0.9rem;
    text-align: left;
    white-space: normal;
  }
  .admin-sidebar .nav-item svg { width: 18px; height: 18px; }
  .admin-sidebar .nav-badge { position: static; margin-left: auto; }
  .admin-sidebar-foot { display: flex; flex-direction: column; padding-top: 12px; border-top: 1px solid var(--border); }
  .admin-sidebar-foot .sidebar-link { padding: 9px 13px; }
  .admin-sidebar-foot .sidebar-link span { display: inline; }

  .drawer-overlay { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(4, 8, 16, 0.6); backdrop-filter: blur(2px); }

  .admin-topbar { top: 0; padding: 9px 12px; gap: 8px; }
  .admin-page { padding: 16px 14px calc(96px + env(safe-area-inset-bottom, 0px)); }

  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--bg) 95%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
  }
  .mobile-tabbar button {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 7px 2px;
    border-radius: 11px;
    font-size: 0.63rem;
    font-weight: 600;
    color: var(--muted);
  }
  .mobile-tabbar button.is-active { color: var(--accent); background: var(--accent-soft); }
  .mobile-tabbar .nav-badge { position: absolute; top: 2px; right: calc(50% - 20px); min-width: 16px; height: 16px; padding: 0 4px; font-size: 0.58rem; }

  .save-bar { bottom: calc(78px + env(safe-area-inset-bottom, 0px)); width: calc(100% - 28px); justify-content: space-between; border-radius: 14px; }

  .dash-grid { grid-template-columns: 1fr; }
  .period-bar { width: 100%; }
  .seg { width: 100%; overflow-x: auto; }
  .seg button { flex: 1; white-space: nowrap; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-search { grid-column: span 2; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }

  .slide-card { grid-template-columns: 1fr; }
  .slide-preview img { height: 140px; }
  .hour-row { grid-template-columns: 1fr; gap: 6px; }
  .hour-times { gap: 4px; }
  .hour-times input { flex: 1; min-width: 92px; }
}

@media (max-width: 640px) {
  .stats-dash { grid-template-columns: 1fr 1fr; }
  .stats-dash .stat-card { flex-direction: column; }
  .stats-dash .stat-value { font-size: 1.12rem; }

  /* Products -> cards */
  #productsTableBody tr {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    align-items: start;
    gap: 6px 10px;
    padding: 13px 14px;
  }
  #productsTableBody td { display: block; padding: 0; border: 0; }
  #productsTableBody td:nth-child(1) { grid-area: 1 / 1 / 2 / 2; padding-top: 3px; }
  #productsTableBody td:nth-child(2) { grid-area: 1 / 2 / 2 / 3; }
  #productsTableBody td:nth-child(3) { display: none; }
  #productsTableBody td:nth-child(4) { grid-area: 1 / 3 / 2 / 4; text-align: right; }
  #productsTableBody td:nth-child(5) { display: none; }
  #productsTableBody td:nth-child(6) { grid-area: 2 / 2 / 3 / 3; }
  #productsTableBody td:nth-child(7) { grid-area: 2 / 3 / 3 / 4; justify-self: end; }
  #productsTableBody td:nth-child(8) { grid-area: 3 / 1 / 4 / 4; margin-top: 6px; }
  #productsTableBody .product-cell strong { max-width: none; white-space: normal; }
  #productsTableBody .row-actions { display: flex; flex-wrap: wrap; width: 100%; gap: 6px; }
  #productsTableBody .row-actions .btn { flex: 1 1 auto; width: auto; padding: 8px 10px; font-size: 0.76rem; }

  /* Orders -> cards */
  #ordersTableBody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 6px 10px;
    padding: 14px;
  }
  #ordersTableBody td { display: block; padding: 0; border: 0; }
  #ordersTableBody td:nth-child(1) { grid-area: 1 / 1 / 2 / 2; }
  #ordersTableBody td:nth-child(2) { grid-area: 2 / 1 / 3 / 2; }
  #ordersTableBody td:nth-child(3) { grid-area: 3 / 1 / 4 / 2; }
  #ordersTableBody td:nth-child(4) { grid-area: 1 / 2 / 2 / 3; justify-self: end; }
  #ordersTableBody td:nth-child(5) { display: none; }
  #ordersTableBody td:nth-child(6) { grid-area: 4 / 1 / 5 / 3; margin-top: 6px; }
  #ordersTableBody .status-select { max-width: 170px; font-size: 0.8rem; }
  #ordersTableBody .row-actions { display: flex; flex-wrap: wrap; width: 100%; gap: 6px; }
  #ordersTableBody .row-actions .btn { flex: 1 1 auto; width: auto; padding: 8px 10px; font-size: 0.76rem; }

  /* Customers -> cards */
  #customersTableBody tr { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; padding: 13px 14px; }
  #customersTableBody td { display: block; padding: 0; border: 0; }
  #customersTableBody td:nth-child(1) { grid-area: 1 / 1 / 2 / 3; }
  #customersTableBody td:nth-child(2) { grid-area: 2 / 1; font-size: 0.78rem; color: var(--muted); }
  #customersTableBody td:nth-child(3) { grid-area: 3 / 1; font-size: 0.76rem; color: var(--muted); }
  #customersTableBody td:nth-child(4),
  #customersTableBody td:nth-child(5) { display: none; }
  #customersTableBody td:nth-child(6) { grid-area: 2 / 2; text-align: right; font-weight: 700; }
  #customersTableBody td:nth-child(7) { display: none; }
  #customersTableBody td:nth-child(8) { grid-area: 4 / 1 / 5 / 3; margin-top: 6px; }
  #customersTableBody .btn { width: 100%; }

  /* Coupons -> cards */
  #couponsTableBody tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 13px 14px; }
  #couponsTableBody td { display: block; padding: 0; border: 0; }
  #couponsTableBody td:nth-child(1) { grid-area: 1 / 1; }
  #couponsTableBody td:nth-child(2) { grid-area: 1 / 2; text-align: right; font-weight: 700; }
  #couponsTableBody td:nth-child(3) { grid-area: 2 / 1; font-size: 0.76rem; color: var(--muted); }
  #couponsTableBody td:nth-child(4) { grid-area: 3 / 1 / 4 / 3; font-size: 0.76rem; }
  #couponsTableBody td:nth-child(5) { grid-area: 2 / 2; text-align: right; font-size: 0.76rem; }
  #couponsTableBody td:nth-child(6) { display: none; }
  #couponsTableBody td:nth-child(7) { grid-area: 4 / 1; }
  #couponsTableBody td:nth-child(8) { grid-area: 5 / 1 / 6 / 3; margin-top: 6px; }
  #couponsTableBody .row-actions { display: flex; gap: 6px; }
  #couponsTableBody .row-actions .btn { flex: 1; }

  /* Users -> cards */
  #usersTableBody tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 13px 14px; }
  #usersTableBody td { display: block; padding: 0; border: 0; }
  #usersTableBody td:nth-child(1) { grid-area: 1 / 1; }
  #usersTableBody td:nth-child(2) { grid-area: 1 / 2; text-align: right; }
  #usersTableBody td:nth-child(3) { grid-area: 2 / 1; }
  #usersTableBody td:nth-child(4) { display: none; }
  #usersTableBody td:nth-child(5) { grid-area: 3 / 1 / 4 / 3; margin-top: 6px; }
  #usersTableBody .row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
  #usersTableBody .row-actions .btn { flex: 1; }

  /* Activity -> cards */
  #activityTableBody tr { display: grid; gap: 3px; padding: 12px 14px; }
  #activityTableBody td { display: block; padding: 0; border: 0; }
  #activityTableBody td:nth-child(1) { font-size: 0.72rem; color: var(--muted); }
  #activityTableBody td:nth-child(3) { justify-self: start; }
  #activityTableBody .log-details { max-width: none; }

  .filter-grid, .filter-grid-3 { grid-template-columns: 1fr; }
  .filter-search { grid-column: span 1; }
  .order-meta .span-2 { grid-column: span 1; }
  .order-quick { display: grid; grid-template-columns: 1fr 1fr; }
  .contact-row .btn { flex: 1; }
  .note-form { flex-direction: column; }
  .note-form .btn { width: 100%; }
  .history-row { flex-wrap: wrap; }
  .history-row time { width: 100%; }
  .save-bar { font-size: 0.76rem; }
  .backup-grid { grid-template-columns: 1fr; }
  .seg button { padding: 7px 8px; font-size: 0.72rem; }
  .settings-tabs button { padding: 7px 12px; font-size: 0.75rem; }
  .wilaya-bulk { width: 100%; }
  .wilaya-bulk input { flex: 1; width: auto; }
}

@media (max-width: 380px) {
  .stats-dash { grid-template-columns: 1fr; }
  #ordersTableBody td:nth-child(4) { justify-self: stretch; grid-area: 3 / 2 / 4 / 3; }
  #ordersTableBody .status-select { max-width: none; width: 100%; }
  #ordersTableBody td:nth-child(3) { grid-area: 4 / 1 / 5 / 3; }
  #ordersTableBody td:nth-child(6) { grid-area: 5 / 1 / 6 / 3; }
}

/* 44px minimum touch targets on phones */
@media (max-width: 640px) {
  .btn,
  .btn-sm,
  .status-select,
  .settings-tabs button,
  .seg button,
  .more-item,
  .search-item,
  .quick-status {
    min-height: 44px;
  }
  .btn-sm { padding-top: 10px; padding-bottom: 10px; }
  .icon-only { min-width: 44px; }
  .hour-times input,
  .wilaya-table input[type="number"],
  .field input,
  .field textarea,
  .field select { min-height: 44px; }
}

/* ---------- Print ---------- */
.print-area { display: none; }

@media print {
  body { background: #fff !important; color: #111 !important; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; }
  .invoice { width: 100%; padding: 12mm; color: #111; background: #fff; font-family: 'Inter', Arial, sans-serif; }
  .invoice-head { display: flex; justify-content: space-between; gap: 24px; border-bottom: 2px solid #111; padding-bottom: 14px; }
  .invoice-brand { display: flex; gap: 12px; align-items: center; }
  .invoice-brand img { width: 64px; height: auto; object-fit: contain; }
  .invoice-brand h1 { font-size: 20pt; margin: 0; }
  .invoice-brand p { font-size: 8.5pt; color: #444; max-width: 60mm; margin: 2px 0 0; }
  .invoice-title { text-align: right; }
  .invoice-title h2 { font-size: 13pt; margin: 0 0 4px; letter-spacing: 0.04em; }
  .invoice-title p { font-size: 9pt; margin: 1px 0; }
  .invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 16px 0; }
  .invoice-parties h3 { font-size: 8pt; text-transform: uppercase; letter-spacing: 0.08em; color: #666; margin: 0 0 4px; }
  .invoice-parties p { font-size: 9.5pt; margin: 1px 0; }
  .invoice-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
  .invoice-table th { font-size: 8pt; text-transform: uppercase; letter-spacing: 0.05em; text-align: left; border-bottom: 1px solid #111; padding: 7px 6px; }
  .invoice-table td { font-size: 9.5pt; border-bottom: 1px solid #ddd; padding: 7px 6px; }
  .invoice-table th:nth-child(3), .invoice-table td:nth-child(3) { text-align: center; }
  .invoice-table th:nth-child(4), .invoice-table td:nth-child(4),
  .invoice-table th:nth-child(5), .invoice-table td:nth-child(5) { text-align: right; }
  .invoice-totals { margin-left: auto; width: 70mm; margin-top: 12px; }
  .invoice-totals > div { display: flex; justify-content: space-between; font-size: 9.5pt; padding: 3px 0; }
  .invoice-grand { border-top: 2px solid #111; margin-top: 4px; padding-top: 6px !important; font-weight: 700; font-size: 12pt !important; }
  .invoice-foot { display: flex; justify-content: space-between; gap: 30px; margin-top: 26mm; }
  .signature { flex: 1; border-top: 1px solid #999; padding-top: 6px; font-size: 8.5pt; color: #666; }
  .invoice-thanks { margin-top: 10mm; text-align: center; font-size: 9pt; color: #555; }
}

