/* ========================================================
   LUXURY URBAN — Design System
   ======================================================== */

:root {
  --bg-base:        #050505;
  --bg-surface:     #111111;
  --bg-elevated:    #1a1a1a;
  --bg-hover:       #222222;
  --bg-active:      rgba(212, 175, 55, 0.12);
  --border-subtle:  rgba(255, 255, 255, 0.08);
  --border-default: rgba(212, 175, 55, 0.22);
  --text-primary:   #f5f5f5;
  --text-secondary: #a3a3a3;
  --text-tertiary:  #737373;
  --accent:         #d4af37;
  --accent-hover:   #e8c547;
  --accent-deep:    #9a7b2c;
  --accent-gradient: linear-gradient(135deg, #f9e498 0%, #d4af37 48%, #7a5c2d 100%);
  --accent-glow:    rgba(212, 175, 55, 0.35);
  --success:        #22c55e;
  --danger:         #ef4444;
  --warning:        #f59e0b;
  --info:           #60a5fa;
  --radius-card:    16px;
  --radius-btn:     8px;
  --sidebar-w:      256px;
  --topbar-h:       64px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
  background-color: #000;
}
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(212, 175, 55, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(212, 175, 55, 0.04) 0%, transparent 50%);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }

/* ── Shell ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0a0a0a 0%, #111 100%);
  border-right: 1px solid rgba(212, 175, 55, 0.12);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: transform .25s ease, width .25s ease;
  overflow: hidden;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}

.sidebar-brand {
  padding: 0 16px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(212, 175, 55, 0.25));
}
.brand-logo--full { width: auto; height: 48px; max-width: 180px; }

.brand-text {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border-subtle);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item:hover .nav-icon { color: var(--text-primary); }
.nav-item.active {
  background: var(--bg-active);
  color: var(--accent);
  font-weight: 500;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-item.active .nav-icon { color: var(--accent); }

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: color .15s;
}
.nav-icon svg { display: block; width: 20px; height: 20px; }
.nav-label { font-size: 14px; }

/* Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 49;
}
.sidebar-overlay.show { display: block; }

/* ── Main Area ── */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 30;
  flex-shrink: 0;
}

.topbar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.topbar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.topbar-toggle svg { display: block; }

.topbar-search {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 14px;
}
.topbar-search input {
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
}
.topbar-search input::placeholder { color: var(--text-tertiary); }
.topbar-search svg { width: 16px; height: 16px; color: var(--text-tertiary); flex-shrink: 0; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.topbar-header-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-link {
  color: var(--text-secondary);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.topbar-link:hover { background: var(--bg-hover); color: var(--text-primary); }

.user-chip {
  background: var(--bg-elevated);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 10px;
  padding: 8px 14px;
  text-align: right;
  white-space: nowrap;
}
.user-chip small {
  display: block;
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Page Content ── */
.page-content {
  padding: 24px;
  flex: 1;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
  background: linear-gradient(90deg, #f5f5f5 0%, #d4af37 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.breadcrumb { color: var(--text-secondary); font-size: 12px; margin-bottom: 4px; }

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}
.card-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.form-card { max-width: 860px; }

/* ── Stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stats-grid--secondary {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 24px;
}
.stat-card { display: flex; flex-direction: column; gap: 8px; }
.stat-label { color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat-value {
  font-size: 26px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Grids ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Spacing ── */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 12px; }
.mb-0 { margin-bottom: 0 !important; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  height: 36px;
  border-radius: var(--radius-btn);
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  font-family: inherit;
  white-space: nowrap;
  line-height: 1;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-primary {
  background: var(--accent-gradient);
  color: #0a0a0a;
  font-weight: 600;
  border: 1px solid rgba(212, 175, 55, 0.4);
  box-shadow: 0 2px 12px rgba(212, 175, 55, 0.2);
}
.btn-primary:hover {
  filter: brightness(1.08);
  color: #000;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn-icon svg { width: 16px; height: 16px; }

/* ── Inputs ── */
.input, select.input, textarea.input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-btn);
  color: var(--text-primary);
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  appearance: auto;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}
textarea.input { resize: vertical; min-height: 80px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { color: var(--text-secondary); font-size: 12px; font-weight: 500; }
.form-check label { display: flex; align-items: center; gap: 8px; color: var(--text-primary); }
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.filter-bar .input { max-width: 260px; }
.filter-select { max-width: 280px; }
.input-group { display: flex; gap: 8px; }
.input-group select { max-width: 80px; }
.field-with-btn { display: flex; gap: 8px; align-items: stretch; }
.field-with-btn .input,
.field-with-btn select { flex: 1; min-width: 0; }
.field-with-btn .btn-add { width: 44px; height: 44px; padding: 0; flex-shrink: 0; border-radius: 10px; }
.modal-backdrop.modal-stacked { z-index: 210; }
.error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.text-muted { color: var(--text-secondary); font-size: 12px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; min-width: 500px; }
.table th {
  text-align: left;
  padding: 11px 16px;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  white-space: nowrap;
}
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  font-size: 14px;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-elevated); }

/* ── Table toolbar / filters ── */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.table-toolbar h2 { font-size: 18px; font-weight: 600; margin: 0; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.table-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filters-left  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters-right { display: flex; align-items: center; gap: 10px; }
.table-checkbox { width: 16px; height: 16px; cursor: pointer; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-success { background: rgba(34,197,94,.15);  color: #4ade80; border: 1px solid rgba(34,197,94,.35); }
.badge-danger  { background: rgba(239,68,68,.15);  color: #f87171; border: 1px solid rgba(239,68,68,.35); }
.badge-warning { background: rgba(245,158,11,.15); color: #fbbf24; border: 1px solid rgba(245,158,11,.35); }
.badge-info    { background: rgba(96,165,250,.15); color: #93c5fd; border: 1px solid rgba(96,165,250,.35); }
.badge-neutral { background: rgba(163,163,163,.12); color: #d4d4d4; border: 1px solid rgba(163,163,163,.25); }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius-btn); margin-bottom: 16px; border: 1px solid transparent; font-size: 14px; }
.alert-success { background: rgba(34,197,94,.12);  color: #4ade80; border-color: rgba(34,197,94,.35); }
.alert-error   { background: rgba(239,68,68,.12);  color: #f87171; border-color: rgba(239,68,68,.35); }
.alert-warning { background: rgba(245,158,11,.12); color: #fbbf24; border-color: rgba(245,158,11,.35); }

/* ── Toast ── */
.toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 260px;
  max-width: 360px;
  background: #111827;
  color: #fff;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 12px 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toastIn .18s ease;
}
.toast__title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.toast__msg { font-size: 13px; opacity: .95; }
.toast__close {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toast__close:hover { background: rgba(255,255,255,.14); }
.toast--warn { background: #111827; }
.toast--danger { background: #7F1D1D; border-color: rgba(255,255,255,.16); }
.toast--success { background: #14532D; border-color: rgba(255,255,255,.16); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Auth ── */
.auth-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #000;
  background-image:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(212, 175, 55, 0.12) 0%, transparent 55%),
    linear-gradient(180deg, #000 0%, #0a0a0a 100%);
}
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(17, 17, 17, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.auth-logo__img {
  width: min(260px, 100%);
  height: auto;
  filter: drop-shadow(0 4px 20px rgba(212, 175, 55, 0.2));
}
.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 28px;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.auth-form .field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.auth-form .field input {
  display: block;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  outline: none;
  box-sizing: border-box;
}
.auth-form .field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}
.auth-form .btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  margin-top: 4px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: #0a0a0a;
  background: var(--accent-gradient);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.25);
  transition: filter .15s, box-shadow .15s;
}
.auth-form .btn-submit:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 28px rgba(212, 175, 55, 0.35);
}
.auth-alert {
  padding: 12px 14px;
  margin-bottom: 20px;
  border-radius: 10px;
  font-size: 14px;
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* ── Login loading ── */
.auth-loading {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.auth-loading.hidden { display: none; }
.auth-loading__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 38%, rgba(212, 175, 55, 0.22) 0%, transparent 42%),
    radial-gradient(circle at 20% 80%, rgba(212, 175, 55, 0.06) 0%, transparent 35%),
    linear-gradient(165deg, #000 0%, #0d0d0d 45%, #050505 100%);
}
.auth-loading__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
}
.auth-loading__logo {
  width: min(300px, 78vw);
  height: auto;
  filter: drop-shadow(0 8px 32px rgba(212, 175, 55, 0.25));
  animation: splashLogoIn .6s cubic-bezier(.22, 1, .36, 1) both;
}
.auth-loading__text {
  margin-top: 28px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  animation: splashLogoIn .5s ease .25s both;
}
.auth-form .btn-submit:disabled {
  opacity: 0.7;
  cursor: wait;
}

/* ── Barra de progresso (login) ── */
.luxury-progress {
  width: min(280px, 78vw);
  margin-top: 28px;
  animation: splashLogoIn .5s ease .35s both;
}
.luxury-progress__track {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.18);
}
.luxury-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.4);
  transition: width .1s ease-out;
}
.luxury-progress__label {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--accent);
}

/* ── Detail view ── */
.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; align-items: baseline; }
.detail-list dt { color: var(--text-secondary); font-size: 13px; }
.detail-list dd { font-size: 14px; }
.photo-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photo-grid img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-subtle); }

/* ── PDV ── */
.pdv-layout { display: grid; grid-template-columns: 300px 1fr 1.15fr; gap: 20px; align-items: start; }
.pdv-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pdv-panel { display: flex; flex-direction: column; gap: 12px; }
.pdv-list {
  max-height: 460px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-elevated);
}
.pdv-list-empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}
.pdv-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.pdv-list-item:last-child { border-bottom: none; }
.pdv-list-item--customer { cursor: pointer; transition: background .15s; width: 100%; border: none; background: transparent; text-align: left; font: inherit; color: inherit; }
.pdv-list-item--customer:hover { background: var(--bg-hover); }
.pdv-list-item--customer.selected {
  background: var(--bg-active);
  box-shadow: inset 3px 0 0 var(--accent);
}
.pdv-list-item__info { min-width: 0; flex: 1; }
.pdv-list-item__title {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pdv-list-item__meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.pdv-list-item__price {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
.pdv-list-item--product .btn { flex-shrink: 0; }
.pdv-list-item--no-stock { opacity: .92; }
.btn-out-of-stock {
  opacity: .75;
  cursor: pointer;
}
.search-results {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 8px;
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.search-results.show { display: block; }
.search-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border-subtle); font-size: 14px; }
.search-item:hover { background: var(--bg-hover); }
.search-item:last-child { border-bottom: none; }
.selected-chip { margin-top: 8px; padding: 8px 12px; background: rgba(212, 175, 55, 0.1); border: 1px solid rgba(212, 175, 55, 0.25); border-radius: 8px; color: var(--accent); font-size: 13px; }
.hidden { display: none !important; }
.pdv-summary { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-subtle); }
.totals { margin: 16px 0; }
.totals div { display: flex; justify-content: space-between; padding: 6px 0; color: var(--text-secondary); font-size: 14px; }
.totals .total-line { color: var(--text-primary); font-size: 17px; font-weight: 700; border-top: 1px solid var(--border-subtle); padding-top: 12px; margin-top: 8px; }
.actions-cell { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Misc ── */
.divider { border: none; border-top: 1px solid var(--border-subtle); margin: 16px 0; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }

.user-chip span { display: block; font-weight: 500; font-size: 13px; }

/* ================================================================
   SPLASH SCREEN
   ================================================================ */

html.splash-skip #appSplash { display: none !important; }

.app-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  transition: opacity .5s ease, visibility .5s ease;
}
.app-splash.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.app-splash__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 38%, rgba(212, 175, 55, 0.22) 0%, transparent 42%),
    radial-gradient(circle at 20% 80%, rgba(212, 175, 55, 0.06) 0%, transparent 35%),
    linear-gradient(165deg, #000 0%, #0d0d0d 45%, #050505 100%);
}
.app-splash__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
}
.app-splash__logo {
  width: min(320px, 82vw);
  height: auto;
  filter: drop-shadow(0 8px 32px rgba(212, 175, 55, 0.25));
  animation: splashLogoIn .85s cubic-bezier(.22, 1, .36, 1) both;
}
.app-splash__bar {
  width: 140px;
  height: 2px;
  margin-top: 32px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  animation: splashLogoIn .5s ease .5s both;
}
.app-splash__bar::after {
  content: '';
  display: block;
  height: 100%;
  width: 45%;
  background: var(--accent-gradient);
  border-radius: 2px;
  animation: splashLoad 1.1s ease-in-out infinite;
}

@keyframes splashLogoIn {
  from { opacity: 0; transform: scale(.92) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes splashLoad {
  0%   { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}

/* ================================================================
   MODAL
   ================================================================ */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--bg-surface);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 520px;
  animation: modalIn .2s ease;
  position: relative;
  margin: auto;
}
.modal-lg { max-width: 720px; }
.modal-sm { max-width: 380px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-title { font-size: 17px; font-weight: 600; }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-close svg { display: block; width: 18px; height: 18px; }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  max-height: calc(100vh - 140px);
}

.modal-footer {
  padding: 0 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
  margin-top: 4px;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

canvas { max-width: 100%; height: auto !important; }

/* ---- Tablet e mobile (≤ 1024px) — menu drawer ---- */
@media (max-width: 1024px) {
  .stats-grid,
  .stats-grid--secondary { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .pdv-layout { grid-template-columns: 1fr; }
  .pdv-col.pdv-main { order: -1; }

  .sidebar {
    width: min(var(--sidebar-w), 88vw);
    transform: translateX(-105%);
    padding-top: env(safe-area-inset-top, 0);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .brand-text,
  .sidebar .nav-label { display: block; }
  .sidebar-brand { justify-content: flex-start; padding: 0 16px; }
  .sidebar-nav { padding: 12px 8px; }
  .sidebar-footer { padding: 12px 8px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0)); }
  .nav-item {
    padding: 12px;
    justify-content: flex-start;
    border-radius: 10px;
    min-height: 44px;
  }
  .nav-icon { width: 20px; height: 20px; }
  .nav-icon svg { width: 20px; height: 20px; }

  .main-area { margin-left: 0; }

  .topbar {
    padding: 0 16px;
    padding-top: env(safe-area-inset-top, 0);
    gap: 10px;
    flex-wrap: wrap;
    min-height: var(--topbar-h);
    height: auto;
  }
  .topbar-toggle { display: flex !important; }
  .topbar-search { max-width: none; flex: 1 1 180px; min-width: 0; }
  .topbar-actions {
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
  }
}

/* ---- Mobile (≤ 768px) ---- */
@media (max-width: 768px) {
  .topbar-search input,
  .input,
  select.input,
  textarea.input {
    font-size: 16px;
  }

  .user-chip span { display: none; }
  .user-chip { padding: 6px 10px; flex-shrink: 0; }

  .page-content {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
  }
  .page-header { flex-direction: column; gap: 12px; align-items: stretch; }
  .page-header .header-actions { width: 100%; justify-content: stretch; }
  .page-title { font-size: 18px; -webkit-text-fill-color: #f5f5f5; color: #f5f5f5; }

  .card { padding: 16px; border-radius: 12px; }

  .table-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .table-toolbar .btn { align-self: flex-start; }
  .toolbar-actions { width: 100%; justify-content: flex-end; }
  .table-filters { flex-direction: column; align-items: stretch; gap: 8px; }
  .filters-left,
  .filters-right { width: 100%; }
  .filters-left .input,
  .filters-left select,
  .filter-select { max-width: 100% !important; width: 100%; }
  .filters-right .btn { width: 100%; }

  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .input,
  .filter-bar select { max-width: 100%; width: 100%; }
  .filter-bar .btn { width: 100%; }

  .stats-grid,
  .stats-grid--secondary { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-value { font-size: 20px; word-break: break-word; }

  .table th,
  .table td { padding: 10px 12px; font-size: 13px; }
  .table { min-width: 520px; }
  .table-wrap {
    margin: 0 -4px;
    padding: 0 4px 4px;
    -webkit-overflow-scrolling: touch;
  }

  .detail-list { grid-template-columns: 1fr; gap: 2px 0; }
  .detail-list dt {
    color: var(--text-tertiary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 10px;
  }
  .detail-list dt:first-child { margin-top: 0; }
  .detail-list dd { font-size: 14px; }

  .form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .form-actions .btn { width: 100%; min-height: 44px; }

  .input-group { flex-wrap: wrap; }
  .input-group select { max-width: none; flex: 0 0 72px; }
  .input-group .input { flex: 1; min-width: 0; }

  .field-with-btn { flex-wrap: wrap; }
  .field-with-btn .btn-add { width: 100%; height: 44px; }

  .actions-cell { gap: 6px; }
  .actions-cell .btn { flex: 1 1 auto; justify-content: center; min-width: 0; }
  .actions-cell form { display: flex !important; flex: 1 1 100%; }
  .actions-cell form .btn { width: 100%; }

  .pdv-list { max-height: min(300px, 42vh); }
  .pdv-list-item { padding: 12px; gap: 8px; }
  .pdv-list-item--product { flex-wrap: wrap; }
  .pdv-list-item--product .btn { margin-left: auto; }

  .pdv-summary .btn-block { min-height: 48px; font-size: 15px; }

  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal-backdrop.open { align-items: flex-end; }
  .modal {
    max-width: none;
    width: 100%;
    margin: 0;
    border-radius: 16px 16px 0 0;
    max-height: min(92dvh, 92vh);
    display: flex;
    flex-direction: column;
    animation: modalSlideUp .22s ease;
  }
  .modal-lg,
  .modal-sm { max-width: none; }
  .modal-header { padding: 16px 16px 0; flex-shrink: 0; }
  .modal-body {
    padding: 16px;
    max-height: none;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-footer {
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0));
    flex-shrink: 0;
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-footer .btn { width: 100%; min-height: 44px; }

  .toast-host {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0));
  }
  .toast {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .auth-card { padding: 28px 20px; }
  .auth-wrap { padding: 16px; }
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Notifications dropdown ---- */
.notif-wrap { position: relative; }
.notif-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.notif-btn:hover { color: var(--gold); border-color: var(--gold-dim); }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--gold);
  color: #111;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(320px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
}
.notif-dropdown__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.notif-empty { padding: 16px 14px; margin: 0; color: var(--text-muted); font-size: 13px; }
.notif-item {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-hover); }
.notif-item--unread { border-left: 3px solid var(--gold); }
.notif-item__title { display: block; font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.notif-item__msg { display: block; font-size: 12px; color: var(--text-muted); }
.notif-item__time { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ---- Permissions page ---- */
.perm-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.perm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.perm-item label { cursor: pointer; flex: 1; }

/* ---- Small mobile (≤ 480px) ---- */
@media (max-width: 480px) {
  .stats-grid,
  .stats-grid--secondary { grid-template-columns: 1fr; }

  .topbar {
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top, 0));
  }
  .topbar-search { display: none; }
  .topbar-actions {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
  .topbar-actions > .btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 8px;
    font-size: 12px;
    height: 36px;
  }
  .topbar-header-btns {
    flex: 1 1 auto;
    width: 100%;
    justify-content: stretch;
  }
  .topbar-header-btns .btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 8px;
    font-size: 12px;
    height: 36px;
  }

  .page-content { padding: 12px; }

  .pdv-list-item--product .btn {
    width: 100%;
    margin-top: 4px;
    margin-left: 0;
    min-height: 40px;
  }

  .btn-sm { min-height: 36px; }

  .auth-card { padding: 24px 16px; }
}
