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

:root {
  --bg:   #F8F6F6;
  --sfc:  #ffffff;
  --brd:  #E8E4DD;
  --brd2: #D4CFC7;
  --txt:  #1A1714;
  --txt2: #A09990;
  --txt3: #6B6560;
  --acc:  #CC0000;
  --acc2: #AA0000;
  --info: #1D4ED8;
  --ok:   #15803D;
  --warn: #B45309;
  --r:    6px;
  --r2:   10px;
  --sh:   0 1px 4px rgba(0,0,0,.08);
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'Sora', sans-serif; font-size: 13px; color: var(--txt); background: var(--bg); }
button,input,select,textarea { font-family: inherit; font-size: 13px; }
a { text-decoration: none; color: inherit; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--brd2); border-radius: 8px; }

/* ── LAYOUT ── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ── */
.sidebar { width: 200px; flex-shrink: 0; background: var(--sfc); border-right: 1px solid var(--brd); display: flex; flex-direction: column; }
.sb-logo { padding: 12px 14px; border-bottom: 1px solid var(--brd); }
.sb-logo img { height: 34px; width: auto; }
.sb-logo-sub { font-size: 10px; color: var(--txt2); margin-top: 4px; font-weight: 600; letter-spacing:.04em; }
.sb-logo-sub span { color: var(--acc); }
nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-section { padding: 10px 14px 3px; font-size: 9px; font-weight: 700; letter-spacing: .08em; color: var(--txt2); text-transform: uppercase; }
.nav-item { display: flex; align-items: center; justify-content: space-between; padding: 7px 14px; font-size: 12px; font-weight: 500; color: var(--txt3); border-left: 2px solid transparent; cursor: pointer; transition: all .1s; gap: 8px; }
.nav-item .ni-icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; opacity: .7; }
.nav-item.active .ni-icon { opacity: 1; }
.nav-item:hover .ni-icon { opacity: 1; }
.nav-item .ni-label { flex: 1; }
.nav-item:hover { background: var(--bg); color: var(--txt); }
.nav-item.active { background: #FFF0F0; color: var(--acc); border-left-color: var(--acc); font-weight: 600; }
.nav-badge { background: var(--acc); color: #fff; border-radius: 10px; font-size: 10px; font-weight: 700; padding: 1px 6px; min-width: 18px; text-align: center; }

/* ── SIDEBAR USER ── */
.sb-user { padding: 10px 14px; border-top: 1px solid var(--brd); }
.sb-user-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sb-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--acc); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.sb-user-info { min-width: 0; }
.sb-user-name { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role { font-size: 10px; color: var(--txt2); }
.sb-user-btns { display: flex; flex-direction: column; gap: 4px; }
.btn-sb { width: 100%; padding: 5px 8px; font-size: 11px; font-weight: 600; border-radius: var(--r); cursor: pointer; transition: all .1s; text-align: center; border: 1px solid var(--brd); background: transparent; color: var(--txt3); display: flex; align-items: center; justify-content: center; gap: 5px; }
.btn-sb svg { width: 13px; height: 13px; flex-shrink: 0; }
.btn-sb:hover { background: var(--bg); color: var(--txt); border-color: var(--brd2); }
.btn-sb.pw { border-color: var(--brd); color: var(--txt3); }
.btn-sb.pw:hover { background: #FFF0F0; color: var(--acc); border-color: #FFD6D6; }
.btn-sb.logout { color: var(--txt3); }
.btn-sb.logout:hover { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }

/* ── MAIN ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; background: var(--sfc); border-bottom: 1px solid var(--brd); border-top: 3px solid var(--acc); flex-shrink: 0; box-shadow: var(--sh); }
.topbar h1 { font-size: 14px; font-weight: 700; letter-spacing: -.02em; }
.topbar-right { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--txt2); cursor: pointer; user-select: none; }
.topbar-right:hover { color: var(--txt); }
.content { flex: 1; overflow-y: auto; padding: 16px 20px; }

/* ── CARDS ── */
.grid4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin-bottom: 12px; }
.stat { background: var(--sfc); border: 1px solid var(--brd); border-radius: var(--r2); padding: 14px 16px; box-shadow: var(--sh); border-left: 3px solid #FFD6D6; }
.stat .lbl { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--txt2); margin-bottom: 4px; }
.stat .val { font-size: 26px; font-weight: 700; letter-spacing: -.03em; color: var(--txt); }
.stat .sub { font-size: 10px; color: var(--txt2); margin-top: 2px; }

/* ── CARD CONTAINER ── */
.card { background: var(--sfc); border: 1px solid var(--brd); border-radius: var(--r2); box-shadow: var(--sh); margin-bottom: 14px; overflow: hidden; }
.card-hdr { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--brd); }
.card-hdr h2 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--txt2); }
.card-hdr .actions { display: flex; gap: 6px; align-items: center; }

/* ── TABLE ── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 8px 12px; text-align: left; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--txt2); border-bottom: 1px solid var(--brd); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid var(--brd); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }
.td-bold { font-weight: 600; }
.td-muted { color: var(--txt3); font-size: 11px; }

/* ── BADGES ── */
.badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 600; border: 1px solid; }
.badge-green  { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.badge-red    { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }
.badge-yellow { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-blue   { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-gray   { background: #f9fafb; color: #6b7280; border-color: #e5e7eb; }
.badge-del    { background: #eff6ff; color: #1D4ED8; border-color: #BFDBFE; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.badge-uso    { background: #fef2f2; color: #dc2626; border-color: #fca5a5; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; animation: pulse-badge 2s infinite; }
@keyframes pulse-badge { 0%,100% { opacity:1; } 50% { opacity:.65; } }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border: 1px solid var(--brd); border-radius: var(--r); background: var(--sfc); color: var(--txt3); cursor: pointer; font-size: 12px; font-weight: 600; transition: all .1s; box-shadow: var(--sh); }
.btn:hover { background: var(--bg); color: var(--txt); border-color: var(--brd2); }
.btn.primary { background: var(--acc); color: #fff; border-color: var(--acc); }
.btn.primary:hover { background: var(--acc2); border-color: var(--acc2); }
.btn.success { background: #15803d; color: #fff; border-color: #15803d; }
.btn.danger  { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn.sm { padding: 4px 8px; font-size: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── FORMS ── */
.fg { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.fg label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--txt2); }
.fg input, .fg select, .fg textarea { padding: 8px 10px; border: 1px solid var(--brd); border-radius: var(--r); background: var(--sfc); color: var(--txt); transition: border-color .15s; }
.fg input:focus, .fg select:focus, .fg textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 2px rgba(204,0,0,.1); }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.frow3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ── MODAL ── */
.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(2px); }
.modal { background: var(--sfc); border-radius: var(--r2); width: 520px; max-width: 95vw; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.lg { width: 700px; }
.modal-hdr { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--brd); flex-shrink: 0; }
.modal-hdr h2 { font-size: 14px; font-weight: 700; }
.modal-hdr .btn-x { background: none; border: none; cursor: pointer; font-size: 16px; color: var(--txt2); padding: 2px 6px; border-radius: 4px; }
.modal-hdr .btn-x:hover { background: var(--bg); color: var(--txt); }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--brd); flex-shrink: 0; }

/* ── TOOLTIP custom ── */
.has-tip { position: relative; }
.has-tip .tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: #1A1714; color: #fff; font-size: 11px; white-space: nowrap; padding: 5px 9px; border-radius: 5px; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 100; line-height: 1.5; }
.has-tip .tip::after { content:''; position:absolute; top:100%; left:50%; transform:translateX(-50%); border:4px solid transparent; border-top-color:#1A1714; }
.has-tip:hover .tip { opacity: 1; }

/* ── TIMELINE ── */
.tl-wrap { overflow-x: auto; padding: 6px 12px 12px; }
.tl-header { display: flex; margin-left: 90px; margin-bottom: 4px; }
.tl-hour-lbl { flex: 1; font-size: 9px; color: var(--txt2); font-weight: 600; text-align: left; padding-left: 2px; }
.tl-row { display: flex; align-items: center; height: 26px; margin-bottom: 3px; cursor: pointer; }
.tl-row:hover .tl-lbl { color: var(--acc); }
.tl-lbl { width: 90px; font-size: 10px; font-weight: 600; color: var(--txt3); flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 6px; transition: color .1s; }
.tl-track { flex: 1; height: 20px; background: var(--bg); border-radius: 3px; position: relative; border: 1px solid var(--brd); min-width: 500px; }
.tl-seg { position: absolute; height: 100%; border-radius: 3px; display: flex; align-items: center; padding: 0 5px; font-size: 10px; font-weight: 600; color: #fff; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: filter .1s; z-index: 1; }
.tl-seg:hover { filter: brightness(.88); z-index: 2; }
/* Linha "Agora" */
.tl-now { position: absolute; top: -3px; bottom: 0; width: 2px; background: var(--acc); z-index: 3; border-radius: 2px; animation: pulse-now 2s ease-in-out infinite; }
.tl-now::before { content: 'Agora'; position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 8px; font-weight: 700; color: var(--acc); white-space: nowrap; letter-spacing: .04em; }
.tl-now::after { content: ''; position: absolute; top: 3px; left: -3px; width: 8px; height: 8px; background: var(--acc); border-radius: 50%; }
@keyframes pulse-now { 0%,100%{opacity:1} 50%{opacity:.6} }
.tl-grid-lines { position: absolute; inset: 0; display: flex; pointer-events: none; }
.tl-grid-line { flex: 1; border-left: 1px solid var(--brd); }
/* Zona clicável vazia da timeline */
.tl-track-click { position: absolute; inset: 0; cursor: crosshair; z-index: 0; }

/* ── FILTROS ── */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--brd); }
.filters input, .filters select { padding: 5px 8px; border: 1px solid var(--brd); border-radius: var(--r); font-size: 12px; color: var(--txt); background: var(--sfc); }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--acc); }
.filters label { font-size: 11px; color: var(--txt2); font-weight: 600; }

/* ── EMPTY STATE ── */
.empty { text-align: center; padding: 50px 20px; color: var(--txt2); }
.empty-icon { font-size: 36px; margin-bottom: 10px; opacity: .5; }
.empty h3 { font-size: 14px; font-weight: 600; color: var(--txt); margin-bottom: 5px; }
.empty p { font-size: 12px; margin-bottom: 14px; }

/* ── ALERTS ── */
.alert { padding: 10px 12px; border-radius: var(--r); font-size: 12px; margin-bottom: 12px; border: 1px solid; }
.alert-red    { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }
.alert-green  { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.alert-yellow { background: #fffbeb; color: #b45309; border-color: #fde68a; }

/* ── LOADING ── */
.loading { display: flex; align-items: center; justify-content: center; padding: 60px 20px; color: var(--txt2); gap: 8px; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--brd); border-top-color: var(--acc); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TABS ── */
.tabs { display: flex; border-bottom: 1px solid var(--brd); padding: 0 14px; }
.tab { padding: 8px 14px; font-size: 12px; font-weight: 600; color: var(--txt2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .1s; }
.tab:hover { color: var(--txt); }
.tab.active { color: var(--acc); border-bottom-color: var(--acc); }

/* ── INSPECAO ── */
.insp-ok   { color: #15803d; font-weight: 600; font-size: 11px; }
.insp-warn { color: #b45309; font-weight: 600; font-size: 11px; }
.insp-over { color: #dc2626; font-weight: 600; font-size: 11px; }

/* ── TOAST ── */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: var(--r2); font-size: 12px; font-weight: 600; box-shadow: 0 4px 20px rgba(0,0,0,.15); animation: toast-in .2s ease; min-width: 240px; }
@keyframes toast-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
.toast.ok     { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.toast.err    { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.toast.warn   { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.toast-icon   { flex-shrink: 0; display: flex; align-items: center; }
.toast-icon svg { width: 14px; height: 14px; }

/* ── SPOTLIGHT (pesquisa global) ── */
.spotlight-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.4); backdrop-filter: blur(3px); z-index: 2000; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.spotlight { background: var(--sfc); border-radius: 12px; width: 540px; max-width: 95vw; box-shadow: 0 24px 64px rgba(0,0,0,.25); overflow: hidden; }
.spotlight-input { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--brd); gap: 10px; }
.spotlight-input input { flex: 1; border: none; outline: none; font-size: 15px; font-weight: 500; background: transparent; color: var(--txt); }
.spotlight-input .sp-esc { font-size: 10px; color: var(--txt2); background: var(--bg); border: 1px solid var(--brd); border-radius: 4px; padding: 2px 6px; cursor: pointer; white-space: nowrap; }
.spotlight-results { max-height: 360px; overflow-y: auto; padding: 6px; }
.sp-result { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r); cursor: pointer; transition: background .08s; }
.sp-result:hover, .sp-result.active { background: var(--bg); }
.sp-result-icon { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.sp-result-body { min-width: 0; }
.sp-result-title { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-result-sub { font-size: 11px; color: var(--txt2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-section { padding: 6px 10px 3px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--txt2); }
.sp-empty { text-align: center; padding: 24px; color: var(--txt2); font-size: 13px; }
.sp-hint { padding: 8px 16px; font-size: 10px; color: var(--txt2); border-top: 1px solid var(--brd); display: flex; gap: 12px; }

/* ── CONFLICT ALERT ── */
.conflict-alert { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--r); padding: 9px 12px; font-size: 11px; color: #b45309; margin-top: -6px; margin-bottom: 10px; display: none; }
.conflict-alert.show { display: block; }

/* ── DETAIL SLIDE ── */
.detail-panel { position: fixed; top: 0; right: -420px; width: 420px; height: 100vh; background: var(--sfc); border-left: 1px solid var(--brd); box-shadow: -4px 0 24px rgba(0,0,0,.1); z-index: 500; transition: right .2s ease; display: flex; flex-direction: column; }
.detail-panel.open { right: 0; }
.detail-hdr { padding: 14px 18px; border-bottom: 1px solid var(--brd); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.detail-hdr h2 { font-size: 14px; font-weight: 700; }
.detail-body { padding: 18px; overflow-y: auto; flex: 1; }
.detail-field { margin-bottom: 14px; }
.detail-field label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--txt2); display: block; margin-bottom: 3px; }
.detail-field .val { font-size: 13px; font-weight: 500; }
.detail-foot { padding: 12px 18px; border-top: 1px solid var(--brd); display: flex; gap: 8px; flex-shrink: 0; }
.detail-overlay { position: fixed; inset: 0; z-index: 499; }

/* ── CSV export flash ── */
@keyframes flash { 0%,100%{opacity:1} 50%{opacity:.5} }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .grid4 { grid-template-columns: repeat(2,1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .sidebar { width: 160px; }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — TABLET & MOBILE
   ══════════════════════════════════════════════════════════ */

/* ── Tablet (até 1024px) ─────────────────────────────────── */
@media (max-width: 1024px) {
  .grid4 { grid-template-columns: repeat(2,1fr); }
  .sidebar { width: 52px; overflow: visible; position: relative; z-index: 100; }
  .sidebar.expanded { width: 200px; box-shadow: 4px 0 20px rgba(0,0,0,.12); }
  .sb-logo { padding: 10px; justify-content: center; }
  .sb-logo img { display: none; }
  .sb-logo-icon { display: flex !important; width: 32px; height: 32px; background: var(--acc); border-radius: 8px; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 13px; }
  .sidebar.expanded .sb-logo img { display: block; }
  .sidebar.expanded .sb-logo-icon { display: none !important; }
  .nav-section { display: none; }
  .sidebar.expanded .nav-section { display: block; }
  .nav-item { padding: 10px; justify-content: center; font-size: 0; border-left: none; border-radius: 8px; margin: 2px 4px; gap: 0; }
  .nav-item .ni-icon { flex-shrink: 0; }
  .nav-item .ni-label { display: none; }
  .sidebar.expanded .nav-item { font-size: 12px; padding: 8px 14px; justify-content: flex-start; border-radius: 0; margin: 0; border-left: 2px solid transparent; gap: 8px; }
  .sidebar.expanded .nav-item .ni-icon { display: flex; }
  .sidebar.expanded .nav-item .ni-label { display: inline; }
  .nav-badge { font-size: 8px; padding: 0px 4px; min-width: 14px; }
  .sb-user { padding: 8px; }
  .sb-user-row, .sb-user-btns { display: none; }
  .sidebar.expanded .sb-user-row, .sidebar.expanded .sb-user-btns { display: flex; }
  .sb-user-mini { display: flex !important; width: 32px; height: 32px; border-radius: 50%; background: var(--acc); color: #fff; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; cursor: pointer; }
  .sidebar.expanded .sb-user-mini { display: none !important; }
  .topbar { padding: 0 14px; }
  .content { padding: 12px 14px; }
  .detail-panel { width: 100%; max-width: 380px; }
}

/* ── Mobile (até 640px) ─────────────────────────────────── */
@media (max-width: 640px) {
  .app { flex-direction: column; }
  .sidebar { display: none; }
  .main { flex: 1; padding-bottom: 60px; }
  .topbar { height: 44px; padding: 0 14px; border-top: none; border-bottom: 2px solid var(--acc); }
  .topbar h1 { font-size: 14px; }
  .topbar-right { display: none; }
  .content { padding: 12px; }
  .grid4 { grid-template-columns: repeat(2,1fr); gap: 8px; }
  .grid2 { grid-template-columns: 1fr; gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat .val { font-size: 20px; }
  .stat .sub { font-size: 10px; }

  /* Tabelas — scroll horizontal em mobile para tabelas que não têm versão card */
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Touch targets maiores */
  .btn { padding: 9px 14px; min-height: 40px; }
  .btn.sm { padding: 8px 12px; min-height: 36px; font-size: 12px; }
  .fg input, .fg select { padding: 10px 12px; min-height: 44px; font-size: 15px; }
  .fg label { font-size: 11px; }

  /* Modal fullscreen */
  .modal-wrap { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .modal-hdr { padding: 16px 18px 12px; }
  .modal-hdr::before { content: ''; display: block; width: 36px; height: 4px; background: var(--brd2); border-radius: 2px; margin: 0 auto 12px; }
  .modal-body { padding: 0 18px 18px; }
  .frow { grid-template-columns: 1fr; }
  .frow3 { grid-template-columns: 1fr; }

  /* Spotlight fullscreen */
  .spotlight-wrap { align-items: flex-start; padding: 0; }
  .spotlight { width: 100%; max-width: 100%; border-radius: 0 0 16px 16px; }

  /* Painel detalhe fullscreen */
  .detail-panel { width: 100%; max-width: 100%; }
  .detail-overlay { display: none; }

  /* Timeline scroll horizontal */
  .tl-wrap { padding: 6px 8px 10px; }
  .tl-row { min-width: 0; }

  /* Topbar mobile com hamburger e pesquisa */
  .mob-topbar-left { display: flex !important; align-items: center; gap: 10px; }
  .mob-topbar-right { display: flex !important; align-items: center; gap: 8px; }
  .mob-menu-btn, .mob-search-btn { background: none; border: none; cursor: pointer; color: var(--txt3); font-size: 18px; padding: 6px; border-radius: 6px; display: flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px; }
  .mob-menu-btn:hover, .mob-search-btn:hover { background: var(--bg); color: var(--txt); }

  /* Cards compactos no mobile */
  .card-hdr { padding: 8px 12px; flex-wrap: wrap; gap: 6px; }
  .card-hdr h2 { font-size: 10px; }
  .card { margin-bottom: 10px; }

  /* Filtros em coluna no mobile */
  .filters { flex-direction: column; align-items: stretch; padding: 8px 12px; gap: 6px; }
  .filters label { display: none; }
  .filters input, .filters select { width: 100%; padding: 9px 10px; min-height: 40px; }

  /* Actions em linha completa no mobile */
  .card-hdr .actions { width: 100%; justify-content: space-between; }

  /* Grid stats 2 colunas sempre */
  .grid4 { grid-template-columns: 1fr 1fr; }
  /* Tabs scrolláveis */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .tab { display: inline-block; }
}

/* ── Bottom Navigation Bar (mobile only) ─────────────────── */
.bottom-nav { display: none; }
@media (max-width: 640px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: var(--sfc);
    border-top: 1px solid var(--brd);
    box-shadow: 0 -2px 12px rgba(0,0,0,.08);
    z-index: 200;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    color: var(--txt2);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .03em;
    padding: 6px 4px;
    border-radius: 8px;
    position: relative;
    transition: all .1s;
    -webkit-tap-highlight-color: transparent;
  }
  .bn-item.active { color: var(--acc); }
  .bn-item:active { background: var(--bg); }
  .bn-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.bn-icon svg { width: 22px; height: 22px; }
  .bn-badge { position: absolute; top: 4px; right: calc(50% - 16px); background: var(--acc); color: #fff; border-radius: 8px; font-size: 9px; font-weight: 700; padding: 0 4px; min-width: 14px; text-align: center; }
}

/* ── Drawer mobile (menu "Mais") ─────────────────────────── */
.mob-drawer { position: fixed; inset: 0; z-index: 300; display: none; }
.mob-drawer.open { display: block; }
.mob-drawer-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.mob-drawer-panel { position: absolute; bottom: 0; left: 0; right: 0; background: var(--sfc); border-radius: 20px 20px 0 0; padding: 16px 0 calc(16px + env(safe-area-inset-bottom, 0px)); max-height: 80vh; overflow-y: auto; }
.mob-drawer-handle { width: 36px; height: 4px; background: var(--brd2); border-radius: 2px; margin: 0 auto 16px; }
.mob-drawer-item { display: flex; align-items: center; gap: 14px; padding: 14px 20px; font-size: 15px; font-weight: 500; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mob-drawer-item:active { background: var(--bg); }
.mob-drawer-item .mdi { width: 28px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mob-drawer-item .mdi svg { width: 20px; height: 20px; }
.mob-drawer-sep { height: 1px; background: var(--brd); margin: 8px 0; }
.mob-drawer-user { padding: 14px 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--brd); margin-bottom: 8px; }
.mob-drawer-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--acc); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }

/* ── Pull to refresh ─────────────────────────────────────── */
.ptr-indicator { display: none; align-items: center; justify-content: center; gap: 8px; padding: 12px; font-size: 12px; color: var(--txt2); }
.ptr-spinner { width: 16px; height: 16px; border: 2px solid var(--brd); border-top-color: var(--acc); border-radius: 50%; animation: spin .6s linear infinite; }
@media (max-width: 640px) {
  .ptr-indicator { display: flex; }
}

/* ── Skeleton loading ────────────────────────────────────── */
.skel { background: linear-gradient(90deg, var(--bg) 25%, var(--brd) 50%, var(--bg) 75%); background-size: 200% 100%; animation: skel-anim 1.4s ease infinite; border-radius: var(--r); }
@keyframes skel-anim { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.skel-line { height: 12px; margin-bottom: 8px; }
.skel-line.w60 { width: 60%; }
.skel-line.w80 { width: 80%; }
.skel-line.w40 { width: 40%; }
.skel-stat { height: 70px; border-radius: var(--r2); }

/* ── Offline banner ──────────────────────────────────────── */
.offline-banner { display: none; position: fixed; top: 0; left: 0; right: 0; background: #b45309; color: #fff; text-align: center; font-size: 12px; font-weight: 600; padding: 8px; z-index: 9999; }
.offline-banner.show { display: block; }

/* ── Swipe to action ─────────────────────────────────────── */
.swipe-row { position: relative; overflow: hidden; }
.swipe-actions { position: absolute; top: 0; bottom: 0; display: flex; pointer-events: none; }
.swipe-act-left { left: 0; background: #15803d; color: #fff; align-items: center; padding: 0 20px; font-size: 12px; font-weight: 700; }
.swipe-act-right { right: 0; background: #dc2626; color: #fff; align-items: center; padding: 0 20px; font-size: 12px; font-weight: 700; }
.swipe-content { position: relative; background: var(--sfc); transition: transform .15s; }

/* ── PWA install prompt ──────────────────────────────────── */
.pwa-prompt { position: fixed; bottom: 70px; left: 12px; right: 12px; background: var(--sfc); border: 1px solid var(--brd); border-radius: 12px; padding: 14px 16px; box-shadow: 0 8px 24px rgba(0,0,0,.15); z-index: 150; display: none; }
.pwa-prompt.show { display: flex; gap: 12px; align-items: center; }
.pwa-prompt-text { flex: 1; font-size: 12px; line-height: 1.5; }
.pwa-prompt-text strong { display: block; margin-bottom: 2px; }
