/* public/css/main.css — JC Lipulane Shop */
:root {
  --primary: #0a2463;
  --primary-dark: #061a4d;
  --accent: #e63946;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f8fafc;
  --white: #ffffff;
  --shadow: 0 4px 20px rgba(10,36,99,.08);
  --shadow-hover: 0 8px 30px rgba(10,36,99,.15);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: all .25s ease;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

/* ===== TYPOGRAPHY ===== */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.3; color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== UTILITIES ===== */
.text-primary { color: var(--primary) !important; }
.text-accent { color: var(--accent) !important; }
.text-muted { color: var(--text-muted) !important; }
.bg-primary { background: var(--primary) !important; }
.bg-accent { background: var(--accent) !important; }
.fw-bold { font-weight: 700; }
.fs-sm { font-size: .875rem; }
.fs-xs { font-size: .75rem; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[disabled] { opacity: .65; cursor: not-allowed; transform: none; pointer-events: none; }
.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn-xs { padding: 3px 8px; font-size: .75rem; }
.btn-lg { padding: 14px 32px; font-size: 1.05rem; }

/* CORRECÇÃO CRITICA: .btn-primary usa !important para garantir cor branca
   independentemente do contexto (navbar, card, sidebar, etc.)
   O problema original: dentro do .navbar, a regra .navbar-links .btn-light
   podia contaminar outros botões via cascade quando o HTML era renderizado
   com classes ambíguas. Com !important no btn-primary isso é eliminado. */
.btn-primary {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
}
.btn-primary:hover {
  background: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
  color: #ffffff !important;
}
.btn-primary:focus {
  background: var(--primary) !important;
  color: #ffffff !important;
  outline: 3px solid rgba(10,36,99,.35);
  outline-offset: 2px;
}
/* Garantir que i/span dentro do btn-primary herdam a cor branca */
.btn-primary i, .btn-primary span { color: inherit !important; }

.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: #c62a35; color: #fff; border-color: #c62a35; }

.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

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

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #059669; color: #fff; }

.btn-light { background: #fff; color: var(--primary); border-color: var(--border); }
.btn-light:hover { background: var(--bg); color: var(--primary); }

.btn-secondary { background: #6b7280; color: #fff; border-color: #6b7280; }
.btn-secondary:hover { background: #4b5563; color: #fff; }

.btn-block { width: 100%; justify-content: center; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .9rem; color: var(--text); }
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-control, .form-select {
  display: block; width: 100%; padding: 11px 15px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: #fafbfc; font-size: .95rem; color: var(--text);
  transition: var(--transition);
  -webkit-appearance: none; appearance: none;
}
.form-control:focus, .form-select:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(10,36,99,.1); }
.form-control::placeholder { color: #9ca3af; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger); background-color: #fff5f5; }
.form-control.is-valid { border-color: var(--success); }
.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .82rem; color: var(--danger); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.email-status { font-size:.82rem; margin-top:4px; display:flex; align-items:center; gap:5px; }
.email-status.checking { color: var(--text-muted); }
.email-status.valid { color: var(--success); }
.email-status.invalid { color: var(--danger); }

/* ===== CARDS ===== */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 18px 24px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 1.05rem; color: var(--primary); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--primary); margin: 0; }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--bg); }

/* ===== ALERTS ===== */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; font-size: .92rem; animation: alertIn .25s ease; }
.alert i { margin-top: 2px; flex-shrink: 0; }
@keyframes alertIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--success); }
.alert-error, .alert-danger { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef9c3; color: #854d0e; border-left: 4px solid var(--warning); }
.alert-info { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--info); }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f3f4f6; color: #374151; }
.badge-primary { background: rgba(10,36,99,.1); color: var(--primary); }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.data-table, .table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .table thead th { background: var(--primary); color: #fff; padding: 12px 16px; text-align: left; font-weight: 600; white-space: nowrap; }
.data-table td, .table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td, .table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover, .table tbody tr:hover { background: rgba(10,36,99,.03); }
.data-table-empty { text-align: center; padding: 40px 16px; color: var(--text-muted); font-size: .95rem; }

/* ===== PAGE HEADER ===== */
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-subtitle { color: var(--text-muted); font-size: .9rem; margin: 4px 0 0; }

/* ===== STATS CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; transition: var(--transition); }
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.stat-icon { width: 52px; height: 52px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-icon.primary { background: rgba(10,36,99,.12); color: var(--primary); }
.stat-icon.success { background: rgba(16,185,129,.12); color: var(--success); }
.stat-icon.warning { background: rgba(245,158,11,.12); color: var(--warning); }
.stat-icon.danger { background: rgba(239,68,68,.12); color: var(--danger); }
.stat-info .value { font-size: 1.7rem; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-info .label { font-size: .82rem; color: var(--text-muted); margin-top: 4px; }

/* ===== PUBLIC NAVBAR ===== */
.navbar { background: var(--primary); padding: 0 32px; height: 68px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 20px rgba(0,0,0,.2); }
.navbar-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.navbar-brand img { height: 40px; }
.navbar-brand span { color: #fff; font-size: 1.2rem; font-weight: 800; letter-spacing: .5px; }
.navbar-links { display: flex; align-items: center; gap: 8px; }
/* Usar .nav-link para links de navegação — separado de .btn */
.navbar-links a.nav-link { color: rgba(255,255,255,.85); padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 500; font-size: .95rem; transition: var(--transition); text-decoration: none; }
.navbar-links a.nav-link:hover, .navbar-links a.nav-link.active { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.navbar-links .btn { margin-left: 8px; }
/* CORRECÇÃO: .btn-light na navbar tem estilo próprio sem afectar .btn-primary */
.navbar-links .btn-light {
  background: transparent !important;
  color: #fff !important;
  border-color: rgba(255,255,255,.6) !important;
}
.navbar-links .btn-light:hover {
  background: rgba(255,255,255,.15) !important;
  color: #fff !important;
  border-color: #fff !important;
}
.navbar-links .btn-accent {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}
.navbar-links .btn-accent:hover {
  background: #c62a35 !important;
  color: #fff !important;
}
.hamburger { display: none; background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; padding: 8px; }

/* ===== HERO ===== */
.hero { background: linear-gradient(135deg, var(--primary) 0%, #1a3a7a 50%, var(--primary-dark) 100%); color: #fff; padding: 80px 32px; text-align: center; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background: url('/images/hero-bg.jpg') center/cover no-repeat; opacity: .12; pointer-events: none; }
.hero-content { position: relative; max-width: 700px; margin: 0 auto; }
.hero h1 { font-size: clamp(2rem,5vw,3.2rem); font-weight: 800; margin-bottom: 20px; color: #fff; }
.hero p { font-size: 1.15rem; opacity: .9; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 40px; justify-content: center; margin-top: 50px; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat .num { font-size: 2rem; font-weight: 800; color: #fff; }
.hero-stat .lbl { font-size: .85rem; opacity: .8; }

/* ===== VEHICLE CARDS ===== */
.vehicles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 24px; }
.vehicle-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: var(--transition); }
.vehicle-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-4px); }
.vehicle-card-img { width: 100%; height: 200px; object-fit: cover; background: #f3f4f6; display: block; }
.vehicle-card-img-placeholder { width: 100%; height: 200px; background: linear-gradient(135deg,#e5e7eb,#f3f4f6); display: flex; align-items: center; justify-content: center; font-size: 3rem; color: #9ca3af; }
.vehicle-card-body { padding: 18px; }
.vehicle-card-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.vehicle-card-meta { font-size: .85rem; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.vehicle-card-price { font-size: 1.3rem; font-weight: 800; color: var(--primary); margin-bottom: 14px; }
.vehicle-card-price span { font-size: .8rem; color: var(--text-muted); font-weight: 400; }

/* ===== PROCESS TIMELINE ===== */
.timeline { position: relative; padding-left: 32px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 24px; }
.timeline-item::before { content: ''; position: absolute; left: -26px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--border); border: 2px solid var(--white); box-shadow: 0 0 0 2px var(--border); }
.timeline-item.completed::before { background: var(--success); border-color: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.timeline-item.active::before { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10,36,99,.2); }
.timeline-title { font-weight: 600; font-size: .95rem; }
.timeline-desc { font-size: .85rem; color: var(--text-muted); margin-top: 3px; }
.timeline-date { font-size: .78rem; color: var(--text-muted); }

/* ===== ADMIN SIDEBAR ===== */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--primary); color: #fff; flex-shrink: 0; position: fixed; top: 0; left: 0; height: 100vh; display: flex; flex-direction: column; z-index: 100; transition: transform .3s ease; overflow-y: auto; }
.sidebar-header { padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.sidebar-header h3 { font-size: 1.1rem; font-weight: 700; color: #fff; margin: 0; line-height: 1.2; }
.sidebar-header small { color: rgba(255,255,255,.6); font-size: .75rem; }
.sidebar-logo { height: 38px; width: 38px; border-radius: 8px; background: rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.sidebar-nav { flex: 1; padding: 16px 0; }
.sidebar-section { padding: 10px 20px 4px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,.45); margin-top: 12px; }
.sidebar-item { display: block; }
.sidebar-link { display: flex; align-items: center; gap: 12px; padding: 11px 20px; color: rgba(255,255,255,.8); font-size: .9rem; font-weight: 500; transition: var(--transition); text-decoration: none; }
.sidebar-link:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.sidebar-link.active { background: rgba(255,255,255,.15); color: #fff; border-left: 3px solid rgba(255,255,255,.6); }
.sidebar-link i { width: 18px; text-align: center; font-size: .95rem; }
.sidebar-link.sidebar-sub { padding: 9px 20px 9px 34px; font-size: .865rem; }
.sidebar-link.sidebar-sub i { font-size: .82rem; width: 15px; }
/* Accordion groups */
.sg { border-bottom: 1px solid rgba(255,255,255,.05); }
.sg-hdr { display:flex;align-items:center;gap:10px;width:100%;padding:11px 20px;background:none;border:none;color:rgba(255,255,255,.75);font-size:.88rem;font-weight:600;cursor:pointer;text-align:left;transition:background .15s; }
.sg-hdr:hover { background:rgba(255,255,255,.08);color:#fff; }
.sg-hdr span { flex:1;display:flex;align-items:center;gap:10px; }
.sg-arrow { font-size:.62rem;transition:transform .25s;margin-left:auto;flex-shrink:0;opacity:.55; }
.sg.open .sg-arrow { transform:rotate(90deg); }
.sg-body { max-height:0;overflow:hidden;transition:max-height .3s ease; }
.sg.open .sg-body { max-height:900px; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); flex-shrink: 0; }
.admin-content { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.admin-topbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 0 28px; height: 64px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 8px rgba(0,0,0,.06); }
.topbar-left { display: flex; align-items: center; }
.topbar-left h2 { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin: 0; }
.topbar-left .breadcrumb { display: flex; gap: 6px; font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.topbar-left .breadcrumb a { color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-badge { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--radius-sm); background: var(--bg); font-size: .88rem; font-weight: 600; cursor: pointer; transition: var(--transition); }
.user-badge:hover { background: var(--border); }
.admin-main { padding: 28px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 1.4rem; color: var(--primary); margin: 0; }
.page-header p { font-size: .9rem; color: var(--text-muted); margin: 4px 0 0; }
.section-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden; }
.section-card-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.section-card-header h3 { font-size: 1rem; font-weight: 700; color: var(--primary); margin: 0; }
.section-card-body { padding: 22px; }
.search-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.search-bar input { flex: 1; min-width: 200px; padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .9rem; }
.search-bar input:focus { outline: none; border-color: var(--primary); }
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.page-btn { padding: 7px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--white); color: var(--text); font-size: .88rem; cursor: pointer; transition: var(--transition); text-decoration: none; display: inline-block; }
.page-btn:hover, .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--white); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.3); max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-weight: 700; font-size: 1.1rem; color: var(--primary); }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ===== SPINNER ===== */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== FOOTER ===== */
.footer { background: var(--primary-dark); color: rgba(255,255,255,.8); padding: 50px 32px 24px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 36px; margin-bottom: 36px; }
.footer-brand h3 { color: #fff; font-size: 1.3rem; margin-bottom: 10px; }
.footer-brand p { font-size: .9rem; line-height: 1.7; }
.footer-col h4 { color: #fff; font-size: .95rem; margin-bottom: 14px; font-weight: 700; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { color: rgba(255,255,255,.7); font-size: .9rem; transition: var(--transition); }
.footer-col ul li a:hover { color: #fff; text-decoration: none; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: .85rem; }
.social-links { display: flex; gap: 10px; }
.social-link { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.8); transition: var(--transition); text-decoration: none; }
.social-link:hover { background: rgba(255,255,255,.25); color: #fff; }

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  /* Navbar público */
  .navbar { padding: 0 16px; }
  .navbar-links .nav-link { display: none; }
  .hamburger { display: block; }
  .navbar-links.open {
    flex-direction: column;
    position: fixed;
    top: 68px; left: 0; right: 0;
    background: var(--primary);
    padding: 16px;
    gap: 4px;
    box-shadow: 0 8px 20px rgba(0,0,0,.3);
    z-index: 999;
  }
  .navbar-links.open .nav-link { display: flex; width: 100%; }
  .navbar-links.open .btn { margin-left: 0; width: 100%; justify-content: center; }

  /* Admin sidebar: esconde por defeito no mobile */
  .sidebar {
    transform: translateX(-260px);
    z-index: 200;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }
  .admin-content { margin-left: 0; }
  .admin-topbar { padding: 0 12px; height: 56px; }
  .admin-topbar .topbar-left h2 { font-size: 1rem; }
  .admin-main { padding: 14px; }

  /* Grelhas */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hero { padding: 50px 16px; }
  .vehicles-grid { grid-template-columns: 1fr; }
  .footer { padding: 36px 16px 20px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-actions { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .data-table, .table { font-size: .80rem; }
  .data-table th, .data-table td,
  .table th, .table td { padding: 8px 10px; }
  .btn-lg { padding: 12px 24px; font-size: 1rem; }
  /* Ocultar colunas menos importantes em mobile */
  .hide-mobile { display: none !important; }
  .admin-topbar .topbar-right span { display: none; }
}

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99; }
.sidebar-overlay.active { display: block; }

/* ===== RESPONSIVIDADE MELHORADA ===== */

/* Tablet: 769px – 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: 220px; }
  .admin-content { margin-left: 220px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-main { padding: 16px; }
}

/* Mobile melhorado: ≤ 768px */
@media (max-width: 768px) {
  /* Touch targets mínimos (WCAG 2.5.5) */
  .btn, button, .nav-link, a.social-link { min-height: 44px; min-width: 44px; }
  .btn-xs { min-height: 32px; min-width: 32px; font-size: .78rem; }
  .btn-sm { min-height: 38px; }

  /* Footer: coluna única */
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-brand { text-align: center; }
  .footer-brand .social-links { justify-content: center; }

  /* Tabelas com scroll horizontal */
  .table-wrap, .card .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table, .table { min-width: 560px; }

  /* Cards empilhados */
  .card-grid-2,
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }

  /* Formulários: full width em mobile */
  .form-row { flex-direction: column !important; }
  .form-row > * { width: 100% !important; }

  /* Modal: ocupa toda a largura em mobile */
  .modal { max-width: 100% !important; margin: 0 !important; border-radius: 12px 12px 0 0 !important; position: fixed !important; bottom: 0 !important; left: 0 !important; right: 0 !important; top: auto !important; max-height: 90vh !important; }

  /* Hero section */
  .hero h1 { font-size: 1.8rem; }
  .hero p  { font-size: 1rem; }
  .hero-btns { flex-direction: column; gap: 10px; }
  .hero-btns .btn { width: 100%; justify-content: center; }

  /* Processo steps: empilhar em mobile */
  .process-steps { grid-template-columns: 1fr; }

  /* Admin topbar: esconder texto longo */
  .admin-topbar .topbar-left h2 { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Page header actions: full width */
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }

  /* Newsletter strip no footer */
  .footer form[action*="newsletter"] { flex-direction: column; align-items: stretch; }
  .footer form[action*="newsletter"] input { min-width: 100% !important; }
  .footer form[action*="newsletter"] .btn { width: 100%; }
}

/* Small phones: ≤ 480px */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .data-table, .table { font-size: .80rem; }
  .data-table th, .data-table td,
  .table th, .table td { padding: 8px 10px; }
  .btn-lg { padding: 12px 24px; font-size: 1rem; }
  .hide-mobile { display: none !important; }
  .admin-topbar .topbar-right span { display: none; }

  /* Cabeçalhos de página */
  .page-title { font-size: 1.2rem; }
  .page-subtitle { font-size: .82rem; }

  /* Badges e tags: quebrar texto */
  .badge { white-space: normal; text-align: center; }

  /* Botões de acção em linhas: envolver */
  td div[style*="display:flex"] { flex-wrap: wrap !important; gap: 3px !important; }
}

/* Landscape phone (curto/largo) */
@media (max-height: 500px) and (max-width: 900px) {
  .navbar { height: 54px; }
  .hero { padding: 30px 16px; min-height: auto; }
  .admin-content { margin-top: 54px; }
}

/* PWA Install Banner — responsivo */
#pwaInstallBanner {
  padding-bottom: env(safe-area-inset-bottom, 12px); /* iPhone notch */
}
@media (max-width: 480px) {
  #pwaInstallBanner { padding: 10px 12px; padding-bottom: env(safe-area-inset-bottom, 10px); }
  #pwaInstallBanner > div:first-child { min-width: 0; }
  #pwaInstallBanner .icon-emoji { display: none; }
}

/* Scroll suave globalmente */
html { scroll-behavior: smooth; }

/* Garantir que imagens não transbordam */
img { max-width: 100%; height: auto; }

/* Inputs e textareas: não ultrapassar contentor */
input, textarea, select { max-width: 100%; box-sizing: border-box; }

/* ===== PRINT ===== */
@media print {
  .navbar, .sidebar, .admin-topbar, .sidebar-footer, .btn, .footer, .hamburger,
  #pwaInstallBanner { display: none !important; }
  .admin-content { margin: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd; }
}
