@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
  --brand: #1F7A3A;
  --brand-deep: #145528;
  --brand-mid: #2E9B4F;
  --brand-soft: #E6F4EB;
  --brand-glow: rgba(31, 122, 58, 0.18);
  --ink: #0F1A12;
  --ink-2: #2A3B2E;
  --muted: #5F7364;
  --faint: #8FA095;
  --line: #D7E3DB;
  --line-strong: #B8CDBF;
  --canvas: #EAF1EC;
  --surface: #FFFFFF;
  --surface-2: #F5FAF6;
  --danger: #C62828;
  --danger-soft: #FDECEA;
  --warning: #C77700;
  --warning-soft: #FFF4E0;
  --info: #1565C0;
  --info-soft: #E3F2FD;
  --success: #1B7A3D;
  --sidebar-w: 272px;
  --header-h: 68px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 26, 18, 0.04), 0 8px 24px rgba(15, 26, 18, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 26, 18, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(31, 122, 58, 0.07), transparent 50%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(31, 122, 58, 0.05), transparent 45%),
    var(--canvas);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button, input, select, textarea {
  font-family: inherit;
}

/* ─── Login ─── */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background:
    linear-gradient(135deg, rgba(15, 26, 18, 0.55), rgba(20, 85, 40, 0.45)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(160deg, #145528 0%, #1F7A3A 48%, #0F1A12 100%);
  transition: opacity 0.4s var(--ease);
}

.login-box {
  background: var(--surface);
  padding: 2.25rem 1.75rem 2rem;
  border-radius: 22px;
  text-align: center;
  width: min(420px, 100%);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.35);
  animation: loginIn 0.45s var(--ease);
}

@keyframes loginIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.1rem;
}

.brand-logo {
  display: block;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(15, 26, 18, 0.18);
}

.brand-logo-sm {
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.brand-logo-xs {
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 26, 18, 0.12);
  flex-shrink: 0;
}

.login-box h1 {
  color: var(--ink);
  font-size: 1.65rem;
  margin-bottom: 0.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.login-box > p {
  color: var(--muted);
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
}

.field-label {
  display: block;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 0.4rem;
}

.login-box input[type="password"],
.login-box input[type="tel"],
.login-box input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-size: 1.05rem;
  text-align: center;
  margin-bottom: 1rem;
  background: var(--surface-2);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-box input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px var(--brand-glow);
}

.login-box code {
  font-size: 0.78rem;
  background: var(--brand-soft);
  color: var(--brand-deep);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* ─── Layout ─── */
#app-content {
  display: none;
  min-height: 100vh;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background:
    linear-gradient(180deg, #0F1A12 0%, #145528 42%, #1A6B32 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  box-shadow: -8px 0 32px rgba(15, 26, 18, 0.18);
}

.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.sidebar-brand {
  position: relative;
  padding: 1.35rem 1.1rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.sidebar-brand h1 {
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.sidebar-brand span {
  display: block;
  font-size: 0.72rem;
  opacity: 0.72;
  margin-top: 0.12rem;
  font-weight: 500;
}

.topbar-logo { display: none; }

.sidebar-nav {
  position: relative;
  flex: 1;
  padding: 0.85rem 0.7rem 1rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.nav-group-label {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  opacity: 0.5;
  padding: 0.85rem 0.85rem 0.35rem;
  font-weight: 700;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.72rem 0.9rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: right;
  transition: background 0.2s var(--ease), color 0.2s, transform 0.15s;
  margin-bottom: 3px;
}

.nav-item i {
  width: 22px;
  text-align: center;
  font-size: 0.92rem;
  opacity: 0.9;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: inset 3px 0 0 #fff;
}

.nav-badge {
  margin-right: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #FF5252;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(255, 82, 82, 0.4);
}

.nav-badge.hidden { display: none; }

.main-area {
  flex: 1;
  margin-right: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.topbar {
  min-height: var(--header-h);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}

.topbar-start {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 200px;
}

.topbar-titles { min-width: 0; }

.topbar-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}

.topbar-sub {
  font-size: 0.8rem;
  color: var(--faint);
  font-weight: 500;
}

.topbar-badge {
  background: var(--brand-soft);
  color: var(--brand-deep);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid rgba(31, 122, 58, 0.15);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.topbar-btn-label { white-space: nowrap; }

.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.notif-enable-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid #ffe0b2;
  background: var(--warning-soft);
  color: #e65100;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.notif-enable-btn:hover { background: #ffecb3; }
.notif-enable-btn.hidden { display: none; }

.notif-enable-btn:disabled,
.btn-primary:disabled {
  opacity: 0.65;
  cursor: wait;
  pointer-events: none;
}

.pwa-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem 0.4rem 0.45rem;
  border-radius: 999px;
  border: 1px solid #a5d6a7;
  background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
  color: #2e7d32;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(61, 155, 79, 0.12);
}

.pwa-install-logo { border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.pwa-install-btn.hidden { display: none; }

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

main {
  padding: 1.35rem 1.5rem 2.5rem;
  flex: 1;
}

.tab-content { display: none; animation: fadeTab 0.28s var(--ease); }
.tab-content.active { display: block; }

@keyframes fadeTab {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ─── Panels ─── */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.panel-header i {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* ─── Forms ─── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.form-field { display: flex; flex-direction: column; gap: 0.4rem; }
.form-field.full { grid-column: 1 / -1; }

.form-field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-2);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.92rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.form-field textarea { min-height: 96px; resize: vertical; }

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px var(--brand-glow);
}

.file-field {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  background: var(--surface-2);
}

.file-field input[type="file"] {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.25rem 0;
}

.file-field-hint {
  font-size: 0.78rem;
  color: var(--faint);
  margin-top: 0.35rem;
  font-weight: 500;
}

.discount-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.discount-toolbar .form-field { flex: 1; min-width: 140px; }

/* ─── Buttons ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.35rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-mid), var(--brand-deep));
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(31, 122, 58, 0.28);
  transition: transform 0.15s var(--ease), box-shadow 0.15s, filter 0.15s;
}

.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(31, 122, 58, 0.34);
}

.btn-primary:active { transform: translateY(0); }

.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1rem;
  padding: 0.7rem 1.1rem;
  border: 1.5px solid #ffcdd2;
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-danger-outline:hover { background: #ffcdd2; }

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
  background: var(--brand-soft);
}

.btn-action.edit { color: var(--info); border-color: #bbdefb; background: var(--info-soft); }
.btn-action.accept { color: #fff; border-color: transparent; background: var(--brand); }
.btn-action.delete { color: var(--danger); border-color: #ffcdd2; background: var(--danger-soft); }
.btn-action.remove-discount { color: var(--warning); border-color: #ffe0b2; background: var(--warning-soft); }

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.btn-success {
  background: linear-gradient(135deg, #43a047, #2e7d32) !important;
}

.btn-success:hover { filter: brightness(1.05); }

/* ─── Cards grid ─── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.cards-grid.wide {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.card-3d {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.card-3d:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.card-3d > img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.cards-grid.wide .card-3d > img { display: none; }

.card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.35;
}

.card-price {
  font-size: 1rem;
  font-weight: 800;
  color: var(--brand-deep);
}

.card-price-old {
  font-size: 0.82rem;
  color: var(--faint);
  text-decoration: line-through;
}

.card-price-discount {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--danger);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.discount-select-card {
  cursor: pointer;
  position: relative;
}

.discount-select-card input[type="checkbox"] {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  z-index: 2;
}

/* ─── Orders ─── */
.order-card { gap: 0.65rem; }

.order-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.order-customer-name { font-size: 1.05rem; }

.order-meta {
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 500;
}

.order-meta i { color: var(--brand); margin-left: 0.25rem; }

.order-status {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}

.order-status.pending { background: #FFF8E1; color: #F57C00; border-color: #FFE0B2; }
.order-status.accepted { background: var(--info-soft); color: var(--info); border-color: #BBDEFB; }
.order-status.preparing { background: #F3E5F5; color: #7B1FA2; border-color: #E1BEE7; }
.order-status.on_the_way { background: var(--brand-soft); color: var(--brand-deep); border-color: #A5D6A7; }

.order-address-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
}

.order-address-empty { opacity: 0.75; }

.order-address-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink-2);
  margin-bottom: 0.45rem;
}

.order-address-code {
  font-family: ui-monospace, monospace;
  font-weight: 800;
  color: var(--brand-deep);
  margin-bottom: 0.25rem;
}

.order-address-summary,
.order-address-raw,
.order-address-missing {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.order-address-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

.order-address-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.order-address-label {
  font-size: 0.68rem;
  color: var(--faint);
  font-weight: 700;
}

.order-address-value {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink);
}

.order-items {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}

.order-item-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
}

.order-item-row img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.order-item-row strong { color: var(--brand-deep); }

.order-total {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
}

.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.order-scheduled { color: var(--warning) !important; font-weight: 700; }

/* ─── Empty / Loading ─── */
.empty-state,
.loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--faint);
}

.empty-state i,
.loading-state i {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  color: var(--brand);
  opacity: 0.55;
}

.empty-state p,
.loading-state p {
  font-size: 0.95rem;
  font-weight: 600;
}

/* ─── Sales ─── */
.sales-card {
  text-align: center;
  padding: 2rem 1.25rem !important;
  background:
    linear-gradient(160deg, rgba(31, 122, 58, 0.08), transparent 55%),
    var(--surface) !important;
}

.sales-card h3 {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.sales-card h2 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--brand-deep);
  letter-spacing: -0.03em;
}

.push-stats-card { text-align: right !important; }

.stats-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.stats-mini-grid > div {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
}

.stats-mini-grid strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--brand-deep);
  margin-bottom: 0.2rem;
}

/* ─── Notifications history ─── */
.notifications-history {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.notification-history-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: var(--surface-2);
}

.notification-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.notification-history-title {
  font-weight: 800;
  color: var(--ink);
  font-size: 0.95rem;
}

.notification-history-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.notification-history-tag.broadcast { background: var(--info-soft); color: var(--info); }
.notification-history-tag.order { background: var(--brand-soft); color: var(--brand-deep); }
.notification-history-tag.user { background: var(--warning-soft); color: #e65100; }

.notification-history-body {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 0.45rem;
}

.notification-history-meta {
  color: var(--faint);
  font-size: 0.8rem;
}

/* ─── FCM / PWA leftovers ─── */
.fcm-status-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--line);
}

.fcm-status-banner.success { background: var(--brand-soft); color: var(--brand-deep); border-color: #A5D6A7; }
.fcm-status-banner.warning { background: var(--warning-soft); color: #e65100; border-color: #FFE0B2; }
.fcm-status-banner.muted { background: var(--surface); color: var(--muted); }

.fcm-status-banner code {
  background: rgba(0,0,0,0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.pwa-install-panel-btn {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid #a5d6a7;
  background: linear-gradient(135deg, #e8f5e9, #fff);
  color: #1b5e20;
  cursor: pointer;
  text-align: right;
  box-shadow: 0 4px 14px rgba(61, 155, 79, 0.1);
}

.pwa-install-panel-btn:hover { border-color: #66bb6a; }
.pwa-install-panel-logo { border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.pwa-install-panel-text { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.pwa-install-panel-text strong { font-size: 0.95rem; }
.pwa-install-panel-text small { font-size: 0.78rem; color: #558b2f; font-weight: 600; }
.pwa-install-panel-btn > .fa-download { color: #2e7d32; font-size: 1.1rem; }
.pwa-install-panel-btn.hidden { display: none; }

.pwa-install-modal {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}
.pwa-install-modal.hidden { display: none; }
.pwa-install-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 26, 18, 0.5);
  backdrop-filter: blur(4px);
}
.pwa-install-modal-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: 20px;
  padding: 1.5rem 1.25rem 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: loginIn 0.3s var(--ease);
}
.pwa-install-modal-logo {
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(61, 155, 79, 0.25);
  margin-bottom: 1rem;
}
.pwa-install-modal-card h2 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}
.pwa-install-modal-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 1rem;
}
.pwa-install-ios-steps {
  text-align: right;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.pwa-install-ios-steps.hidden { display: none; }
.pwa-install-step {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.88rem;
  background: var(--brand-soft);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  line-height: 1.45;
}
.pwa-install-step span { font-weight: 800; color: var(--brand-deep); flex-shrink: 0; }
.pwa-install-modal-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-mid), var(--brand-deep));
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: 0.5rem;
}
.pwa-install-modal-btn:disabled { opacity: 0.65; }
.pwa-install-modal-later {
  background: none;
  border: none;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  padding: 0.5rem;
}

.pwa-install-fab {
  position: fixed;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  left: 1.25rem;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1rem 0.65rem 0.65rem;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
}
.pwa-install-fab img { border-radius: 8px; }
.pwa-install-fab.hidden { display: none; }
.pwa-install-fab.is-loading { opacity: 0.7; pointer-events: none; }
.pwa-install-fab.is-loading span::after { content: '...'; }

.admin-toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  background: var(--ink);
  color: #fff;
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-width: min(420px, 92vw);
}
.admin-toast-new { border-right: 4px solid var(--brand-mid); }
.admin-toast-update { border-right: 4px solid var(--info); }
.admin-toast-title { font-weight: 800; margin-bottom: 0.2rem; }
.admin-toast-body { font-size: 0.88rem; opacity: 0.9; }

/* ─── Overlay mobile ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 26, 18, 0.45);
  backdrop-filter: blur(2px);
  z-index: 150;
}
.sidebar-overlay.visible { display: block; }

/* ─── Responsive ─── */
@media (max-width: 960px) {
  .sidebar {
    transform: translateX(110%);
    transition: transform 0.3s var(--ease);
  }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-right: 0; }
  .menu-toggle { display: inline-flex; }
  .topbar-logo { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .cards-grid.wide { grid-template-columns: 1fr; }
  main { padding: 1rem 0.9rem 2rem; }
  .topbar { padding: 0.65rem 0.9rem; }
  .topbar-btn-label { display: none; }
  .topbar-badge { display: none; }
}

@media (max-width: 520px) {
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
  .card-3d { padding: 0.65rem; }
  .panel { padding: 1rem; border-radius: 14px; }
  .login-box { padding: 1.75rem 1.25rem; }
  .order-address-grid { grid-template-columns: 1fr 1fr; }
}
