/* ============================================================
   IBP Livraria — Estilos principais
   Mobile-first, baseado no protótipo ibp_livraria_v2
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700&family=Barlow:wght@400;500;600&family=DM+Mono:wght@400;500&display=swap');

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

:root {
  --ibp-navy:          #1a3a6b;
  --ibp-navy-dark:     #122b52;
  --ibp-navy-light:    #1f4785;
  --ibp-teal:          #4caea8;
  --ibp-teal-dark:     #3a9490;
  --ibp-teal-bg:       rgba(76,174,168,0.15);
  --ibp-white:         #ffffff;
  --ibp-off:           #f0f4f8;
  --ibp-text:          rgba(255,255,255,0.90);
  --ibp-muted:         rgba(255,255,255,0.55);
  --ibp-border:        rgba(255,255,255,0.12);
  --ibp-green-bg:      rgba(76,174,100,0.20);
  --ibp-green:         #5dc46a;
  --ibp-amber-bg:      rgba(230,170,50,0.20);
  --ibp-amber:         #e6aa32;
  --ibp-red-bg:        rgba(220,70,70,0.20);
  --ibp-red:           #dc4646;
  --ibp-surface:       rgba(255,255,255,0.07);
  --ibp-surface2:      rgba(255,255,255,0.04);
  --ibp-muted-on-navy: rgba(255,255,255,0.45);
  --topbar-h:          64px;
  --bottomnav-h:       68px;
}

html, body {
  height: 100%;
  background: #0e2444;
  font-family: 'Barlow', sans-serif;
  color: var(--ibp-text);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ── Scan wrap (mobile: coluna única) ───────────────────── */
#scan-wrap { display: flex; flex-direction: column; gap: 10px; }
.scan-controls { display: flex; flex-direction: column; gap: 10px; }

/* ── App Shell ─────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--ibp-navy);
  position: relative;
}

/* ── Top bar ────────────────────────────────────────────── */
.topbar {
  flex-shrink: 0;
  height: var(--topbar-h);
  background: var(--ibp-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.08), 0 2px 12px rgba(0,0,0,0.1);
  border-bottom: 2px solid rgba(76,174,168,0.25);
  z-index: 10;
}

.topbar-brand { display: flex; align-items: center; gap: 11px; }
.brand-svg {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 2px solid var(--ibp-teal);
  box-shadow: 0 0 0 3px rgba(76,174,168,0.18), 0 2px 8px rgba(0,0,0,0.15);
}
.topbar-titles { display: flex; flex-direction: column; }
.topbar-main {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px; font-weight: 700;
  color: var(--ibp-navy);
  letter-spacing: 0.8px; text-transform: uppercase;
  line-height: 1.1;
}
.topbar-sub { font-size: 9px; color: #999; letter-spacing: 1.2px; text-transform: uppercase; margin-top: 1px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user {
  font-size: 11px; color: #555;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700;
  letter-spacing: 0.5px; max-width: 80px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.logout-btn {
  width: 34px; height: 34px;
  border-radius: 50%; border: 1.5px solid #e8e8e8;
  display: flex; align-items: center; justify-content: center;
  color: #888; text-decoration: none;
  background: #f7f7f7;
  transition: all 0.15s;
}
.logout-btn:hover { background: #eee; border-color: #ccc; color: #555; }

/* ── Main content ───────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Bottom nav ─────────────────────────────────────────── */
.bottom-nav {
  flex-shrink: 0;
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--ibp-navy-dark);
  border-top: 1px solid var(--ibp-border);
  display: flex;
  z-index: 10;
}

.nav-item {
  flex: 1;
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: var(--ibp-muted);
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.6px; text-transform: uppercase;
  font-family: 'Barlow Condensed', sans-serif;
  transition: color 0.18s;
  padding: 6px 2px 4px;
}
.nav-item svg { width: 20px; height: 20px; transition: transform 0.18s; }
.nav-item.active { color: var(--ibp-teal); }
.nav-item.active svg { transform: scale(1.1); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 32px; height: 2.5px;
  background: var(--ibp-teal);
  border-radius: 0 0 3px 3px;
}
.nav-item:active { opacity: 0.65; }

/* ── Screen padding ─────────────────────────────────────── */
.sp {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Typographic helpers ────────────────────────────────── */
.section-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--ibp-muted);
  padding: 0 0 2px;
}

/* ── Book price ─────────────────────────────────────────── */
.book-price {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--ibp-teal);
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.stock-item-price {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--ibp-teal);
  margin-top: 2px;
}

/* ── Movimentacao search results ────────────────────────── */
.mov-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ibp-border);
  cursor: pointer;
  transition: opacity 0.15s;
}
.mov-search-item:last-child { border-bottom: none; }
.mov-search-item:active { opacity: 0.7; }

/* ── Edit icon button (estoque) ─────────────────────────── */
.edit-icon-btn {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border: none; background: transparent;
  color: var(--ibp-muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s;
  padding: 0;
}
.edit-icon-btn:active,
.edit-icon-btn:hover { color: var(--ibp-teal); background: var(--ibp-teal-bg); }

/* ── Book cover images ──────────────────────────────────── */
.book-cover {
  width: 56px;
  height: auto;
  border-radius: 4px;
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

.book-thumb {
  width: 30px;
  height: auto;
  border-radius: 3px;
  flex-shrink: 0;
  object-fit: cover;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--ibp-surface);
  border: 1px solid var(--ibp-border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

/* ── Buttons ─────────────────────────────────────────────── */
.big-action-btn {
  width: 100%; padding: 17px;
  border-radius: 12px; border: none;
  background: var(--ibp-teal); color: var(--ibp-white);
  font-size: 14px; font-weight: 700;
  font-family: 'Barlow Condensed', sans-serif;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  letter-spacing: 1.5px; text-transform: uppercase;
  text-decoration: none;
  transition: opacity 0.15s;
}
.big-action-btn:active { opacity: 0.82; }

.secondary-btn {
  width: 100%; padding: 13px;
  border-radius: 10px;
  border: 1px solid var(--ibp-border);
  background: transparent; color: var(--ibp-text);
  font-size: 12px; font-weight: 700;
  font-family: 'Barlow Condensed', sans-serif;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  letter-spacing: 1px; text-transform: uppercase;
  text-decoration: none;
  transition: background 0.15s;
}
.secondary-btn:active { background: var(--ibp-surface); }

.go-btn {
  padding: 12px 16px;
  border-radius: 10px; border: none;
  background: var(--ibp-teal); color: var(--ibp-white);
  font-size: 12px; font-weight: 700;
  font-family: 'Barlow Condensed', sans-serif;
  cursor: pointer; white-space: nowrap;
  letter-spacing: 1px; text-transform: uppercase;
}

.confirm-btn {
  width: 100%; padding: 15px;
  border-radius: 11px; border: none;
  background: var(--ibp-teal); color: var(--ibp-white);
  font-size: 13px; font-weight: 700;
  font-family: 'Barlow Condensed', sans-serif;
  cursor: pointer; letter-spacing: 1.5px; text-transform: uppercase;
  transition: opacity 0.15s;
}
.confirm-btn:active { opacity: 0.85; }

.action-btn-entrada {
  padding: 13px;
  border-radius: 10px;
  border: 1px solid rgba(93,196,106,0.30);
  background: var(--ibp-green-bg); color: var(--ibp-green);
  font-size: 12px; font-weight: 700;
  font-family: 'Barlow Condensed', sans-serif;
  cursor: pointer; letter-spacing: 1px; text-transform: uppercase;
  transition: opacity 0.15s;
}
.action-btn-entrada:active { opacity: 0.75; }

.action-btn-saida {
  padding: 13px;
  border-radius: 10px;
  border: 1px solid rgba(220,70,70,0.30);
  background: var(--ibp-red-bg); color: var(--ibp-red);
  font-size: 12px; font-weight: 700;
  font-family: 'Barlow Condensed', sans-serif;
  cursor: pointer; letter-spacing: 1px; text-transform: uppercase;
  transition: opacity 0.15s;
}
.action-btn-saida:active { opacity: 0.75; }

/* ── Stats ──────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.stat-card {
  background: var(--ibp-navy-dark);
  border-radius: 12px; padding: 14px;
  border: 1px solid var(--ibp-border);
}
.stat-label {
  font-size: 10px; color: var(--ibp-muted);
  margin-bottom: 4px; letter-spacing: 1px; text-transform: uppercase;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 600;
}
.stat-value {
  font-size: 26px; font-weight: 700;
  color: var(--ibp-white);
  font-family: 'Barlow Condensed', sans-serif;
  line-height: 1;
}
.stat-sub { font-size: 10px; color: var(--ibp-muted); margin-top: 4px; }

/* ── History list ───────────────────────────────────────── */
.history-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--ibp-border);
}
.history-item:last-child { border-bottom: none; }

.badge {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.badge-in  { background: var(--ibp-green-bg); }
.badge-out { background: var(--ibp-red-bg); }

.history-info { flex: 1; min-width: 0; }
.history-title {
  font-size: 13px; font-weight: 600; color: var(--ibp-white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-sub { font-size: 10px; color: var(--ibp-muted); margin-top: 2px; font-family: 'DM Mono', monospace; }

.history-qty { font-size: 14px; font-weight: 700; font-family: 'Barlow Condensed', sans-serif; }
.qty-in  { color: var(--ibp-green); }
.qty-out { color: var(--ibp-red); }

/* ── Scanner ─────────────────────────────────────────────── */
.scan-area {
  background: var(--ibp-navy-dark);
  border-radius: 12px;
  height: 200px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  border: 1px solid var(--ibp-border);
}

#scanner-container video {
  position: absolute !important;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 0 !important;
}
#scanner-container canvas.drawingBuffer {
  display: none !important;
}

#scan-placeholder {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: absolute; inset: 0;
  pointer-events: none;
}

.scan-corner {
  position: absolute; width: 26px; height: 26px;
  border-color: var(--ibp-teal); border-style: solid; border-width: 0;
  z-index: 2;
}
.scan-corner.tl { top: 14px; left: 14px; border-top-width: 2.5px; border-left-width: 2.5px; border-radius: 4px 0 0 0; }
.scan-corner.tr { top: 14px; right: 14px; border-top-width: 2.5px; border-right-width: 2.5px; border-radius: 0 4px 0 0; }
.scan-corner.bl { bottom: 14px; left: 14px; border-bottom-width: 2.5px; border-left-width: 2.5px; border-radius: 0 0 0 4px; }
.scan-corner.br { bottom: 14px; right: 14px; border-bottom-width: 2.5px; border-right-width: 2.5px; border-radius: 0 0 4px 0; }

.scan-line {
  width: 90%; height: 1.5px;
  background: var(--ibp-teal);
  position: absolute; opacity: 0;
  z-index: 3;
  animation: scanMove 2.2s ease-in-out infinite;
}
@keyframes scanMove {
  0%   { top: 20px; opacity: 0; }
  10%  { opacity: 0.85; }
  90%  { opacity: 0.85; }
  100% { top: 175px; opacity: 0; }
}
.scan-line.paused { animation-play-state: paused; opacity: 0; }

.scan-text {
  color: var(--ibp-muted); font-size: 11px; margin-top: 10px;
  letter-spacing: 1px;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 600; text-transform: uppercase;
}

.scan-msg {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  background: var(--ibp-amber-bg);
  color: var(--ibp-amber);
  border: 1px solid rgba(230,170,50,0.3);
}
.scan-msg.error { background: var(--ibp-red-bg); color: var(--ibp-red); border-color: rgba(220,70,70,0.3); }
.scan-msg.success { background: var(--ibp-green-bg); color: var(--ibp-green); border-color: rgba(93,196,106,0.3); }

/* ── Form inputs ─────────────────────────────────────────── */
.search-input {
  width: 100%; padding: 12px 15px;
  border-radius: 10px;
  border: 1px solid var(--ibp-border);
  background: var(--ibp-navy-dark);
  font-size: 14px; font-family: 'Barlow', sans-serif;
  color: var(--ibp-white); outline: none;
  -webkit-appearance: none;
}
.search-input::placeholder { color: var(--ibp-muted); }
.search-input:focus { border-color: var(--ibp-teal); }
input[type="date"].search-input { color-scheme: dark; }

.manual-input-row { display: flex; gap: 8px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 10px; color: var(--ibp-muted);
  letter-spacing: 1px;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; text-transform: uppercase;
}
.field-error { font-size: 11px; color: var(--ibp-red); }

/* ── Book result card ────────────────────────────────────── */
.book-result-card {
  background: var(--ibp-navy-dark);
  border: 1px solid var(--ibp-teal);
  border-radius: 14px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}

.book-title-lg {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 19px; font-weight: 700; color: var(--ibp-white); letter-spacing: 0.5px;
}
.book-author { font-size: 13px; color: var(--ibp-muted); }
.book-isbn { font-size: 10px; color: var(--ibp-muted); font-family: 'DM Mono', monospace; margin-top: 2px; }

.stock-indicator {
  display: flex; align-items: center; gap: 10px;
  background: var(--ibp-surface2);
  padding: 10px 14px; border-radius: 9px;
  border: 1px solid var(--ibp-border);
}
.stock-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-ok       { background: var(--ibp-green); }
.dot-baixo    { background: var(--ibp-amber); }
.dot-critico  { background: var(--ibp-red); }

.stock-qty {
  font-size: 24px; font-weight: 700; color: var(--ibp-white);
  font-family: 'Barlow Condensed', sans-serif; line-height: 1;
}
.stock-label { font-size: 11px; color: var(--ibp-muted); }

.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Qty stepper ─────────────────────────────────────────── */
.mode-label {
  font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  text-align: center; padding: 4px 0;
  font-family: 'Barlow Condensed', sans-serif;
}
.mode-entrada { color: var(--ibp-green); }
.mode-saida   { color: var(--ibp-red); }

.qty-stepper { display: flex; align-items: center; gap: 20px; justify-content: center; padding: 8px 0; }
.step-btn {
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--ibp-border);
  background: var(--ibp-navy-dark);
  font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ibp-white); font-family: 'Barlow', sans-serif;
  transition: border-color 0.15s;
}
.step-btn:active { border-color: var(--ibp-teal); }
.step-qty {
  font-size: 36px; font-weight: 700; min-width: 44px; text-align: center;
  color: var(--ibp-white); font-family: 'Barlow Condensed', sans-serif;
}

/* ── Divider ─────────────────────────────────────────────── */
.divider-label {
  display: flex; align-items: center; gap: 8px;
  color: var(--ibp-muted); font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 600;
}
.divider-label::before, .divider-label::after {
  content: ''; flex: 1; height: 1px; background: var(--ibp-border);
}

/* ── Success overlay ─────────────────────────────────────── */
.success-overlay {
  position: fixed; inset: 0;
  background: rgba(18,43,82,0.97);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; z-index: 100;
}
.success-check {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--ibp-green-bg);
  border: 2px solid var(--ibp-green);
  display: flex; align-items: center; justify-content: center;
}
.success-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px; font-weight: 700; color: var(--ibp-white);
  margin-top: 4px; letter-spacing: 1px; text-transform: uppercase;
}
.success-sub { font-size: 13px; color: var(--ibp-muted); }

/* ── Stock list ──────────────────────────────────────────── */
.stock-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ibp-border);
}
.stock-list-item:last-child { border-bottom: none; }

.stock-pill {
  font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
  flex-shrink: 0; font-family: 'DM Mono', monospace;
}
.pill-ok      { background: var(--ibp-green-bg); color: var(--ibp-green); }
.pill-baixo   { background: var(--ibp-amber-bg); color: var(--ibp-amber); }
.pill-critico { background: var(--ibp-red-bg);   color: var(--ibp-red); }

.stock-item-title { font-size: 13px; font-weight: 600; color: var(--ibp-white); }
.stock-item-sub   { font-size: 11px; color: var(--ibp-muted); margin-top: 1px; }

/* ── Report ──────────────────────────────────────────────── */
.report-header {
  background: var(--ibp-navy-dark);
  border-radius: 12px; padding: 16px;
  border: 1px solid var(--ibp-border);
}
.report-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px; font-weight: 700; color: var(--ibp-white);
  letter-spacing: 1.5px; text-transform: uppercase;
}
.report-date { font-size: 10px; color: var(--ibp-muted); font-family: 'DM Mono', monospace; margin-top: 4px; }

.report-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rstat {
  background: var(--ibp-navy-dark); border-radius: 10px;
  padding: 12px; border: 1px solid var(--ibp-border); text-align: center;
}
.rstat-val { font-size: 24px; font-weight: 700; font-family: 'Barlow Condensed', sans-serif; color: var(--ibp-white); }
.rstat-lbl { font-size: 10px; color: var(--ibp-muted); margin-top: 2px; letter-spacing: 0.5px; font-family: 'Barlow Condensed', sans-serif; text-transform: uppercase; }

.rtable { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.rtable th {
  color: var(--ibp-muted); font-weight: 700;
  padding: 6px 8px; text-align: left;
  border-bottom: 1px solid var(--ibp-border);
  font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase;
  font-family: 'Barlow Condensed', sans-serif;
}
.rtable td { padding: 10px 8px; border-bottom: 1px solid var(--ibp-border); color: var(--ibp-white); vertical-align: middle; }
.rtable tr:last-child td { border-bottom: none; }

.rbar-wrap { height: 4px; background: var(--ibp-surface); border-radius: 2px; overflow: hidden; margin-top: 5px; }
.rbar { height: 100%; border-radius: 2px; }

.filter-row { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  padding: 6px 12px; border-radius: 20px;
  border: 1px solid var(--ibp-border);
  background: transparent; color: var(--ibp-muted);
  font-size: 10px; font-family: 'Barlow Condensed', sans-serif; font-weight: 700;
  cursor: pointer; letter-spacing: 1px; text-transform: uppercase;
  transition: all 0.15s; white-space: nowrap;
}
.filter-chip.active {
  background: var(--ibp-teal-bg); color: var(--ibp-teal); border-color: var(--ibp-teal);
}

.periodo-form { display: flex; flex-direction: column; gap: 8px; }

/* ── Cadastro ────────────────────────────────────────────── */
.alert-success {
  background: var(--ibp-green-bg); color: var(--ibp-green);
  border: 1px solid rgba(93,196,106,0.3);
  border-radius: 10px; padding: 12px 14px;
  font-size: 13px;
}

/* ── Login ───────────────────────────────────────────────── */
.login-body {
  background: #0a1e3d;
  background-image: radial-gradient(ellipse at 50% 0%, rgba(76,174,168,0.12) 0%, transparent 65%);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.login-shell {
  width: 100%; max-width: 360px;
  background: var(--ibp-navy);
  border-radius: 24px;
  padding: 36px 28px 32px;
  border: 1px solid var(--ibp-border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(76,174,168,0.08);
}
.login-logo {
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
  margin-bottom: 32px;
}
.login-logo-img {
  width: 96px; height: 96px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 3px solid var(--ibp-teal);
  box-shadow: 0 0 0 6px rgba(76,174,168,0.14), 0 8px 32px rgba(0,0,0,0.45);
}
.login-brand-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 24px; font-weight: 700;
  color: var(--ibp-white); letter-spacing: 2.5px; text-transform: uppercase;
  line-height: 1;
}
.login-brand-sub {
  font-size: 10px; color: var(--ibp-muted);
  letter-spacing: 1.8px; text-transform: uppercase;
  margin-top: -6px;
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-erro {
  background: var(--ibp-red-bg); color: var(--ibp-red);
  border: 1px solid rgba(220,70,70,0.3);
  border-radius: 8px; padding: 10px 14px;
  font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVO — Tablet / Notebook / Desktop  (≥ 768 px)
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 768px) {

  html, body { height: 100%; overflow: hidden; }

  /* Shell: grid com topbar + sidebar + conteúdo */
  .app-shell {
    max-width: 100%;
    height: 100vh;
    display: grid;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-columns: 200px 1fr;
    grid-template-areas:
      "topbar  topbar"
      "sidenav content";
    border-radius: 0;
    box-shadow: none;
  }

  /* Topbar: largura total */
  .topbar {
    grid-area: topbar;
    padding: 0 28px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.1);
  }
  .topbar-user { font-size: 12px; }

  /* Sidebar */
  .bottom-nav {
    grid-area: sidenav;
    flex-direction: column;
    align-items: stretch;     /* itens ocupam largura total */
    justify-content: flex-start; /* agrupados no topo */
    height: 100%;
    width: 200px;
    border-top: none;
    border-right: 1px solid var(--ibp-border);
    padding: 12px 0 20px;
    gap: 2px;                 /* pequeno gap entre itens */
    overflow-y: auto;
  }

  /* Nav item: linha horizontal, tamanho natural (sem flex:1) */
  .nav-item {
    flex: none;               /* ← FIX PRINCIPAL: não esticar */
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    padding: 11px 18px;
    font-size: 11px;
    border-radius: 0 10px 10px 0;
    width: calc(100% - 8px);
    letter-spacing: 0.5px;
    margin-right: 8px;
  }
  .nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
  .nav-item span { font-size: 11px; }
  .nav-item.active {
    background: var(--ibp-teal-bg);
    color: var(--ibp-teal);
    border-right: 3px solid var(--ibp-teal);
    margin-right: 0;
    width: 100%;
  }
  .nav-item.active::before { display: none; }
  .nav-item:hover:not(.active) {
    background: var(--ibp-surface);
    color: var(--ibp-text);
  }

  /* Área de conteúdo */
  .main-content {
    grid-area: content;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--ibp-navy);
  }

  /* Conteúdo com padding generoso, largura limitada para legibilidade */
  .sp {
    padding: 28px 36px;
    max-width: 900px;
    gap: 16px;
  }

  /* Stats */
  .stats-row { gap: 16px; }
  .stat-card { padding: 18px 20px; }
  .stat-value { font-size: 34px; }

  /* Scan: grid 2 colunas no desktop (câmera | controles) */
  #scan-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
  }
  .scan-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .scan-area { height: 280px; }
  #btn-iniciar-scan, #btn-parar-scan { width: 100%; }

  /* Tabela */
  .rtable { font-size: 13px; }
  .rtable th { padding: 8px 10px; }
  .rtable td { padding: 12px 10px; }

  /* Relatório: 4 stats em linha */
  .report-stats { grid-template-columns: repeat(4, 1fr); }

  /* Filtros */
  .filter-chip { font-size: 11px; padding: 7px 14px; }

  /* Lista estoque */
  .stock-item-title { font-size: 14px; }
  .stock-item-sub   { font-size: 12px; }
  .stock-pill       { font-size: 12px; padding: 5px 12px; }

  /* Cadastro: form com largura controlada */
  #form-cadastro { max-width: 600px; }

  /* Histórico */
  .history-item  { padding: 13px 0; }
  .history-title { font-size: 14px; }
  .history-sub   { font-size: 11px; }

  /* Overlay de sucesso sobre área de conteúdo */
  .success-overlay { left: 200px; }
}

/* ── Tela grande (≥ 1200px) ─────────────────────────────── */
@media (min-width: 1200px) {
  .app-shell { grid-template-columns: 220px 1fr; }
  .bottom-nav { width: 220px; }
  .sp { max-width: 1000px; padding: 32px 48px; }
  .success-overlay { left: 220px; }
}
