/* ════════════════════════════════════════════════════════════════════
   Sultrade Design System — tokens
   Escala de espaçamento: 8 / 16 / 24 / 32 / 48
   ════════════════════════════════════════════════════════════════════ */
:root {
  /* superfícies */
  --bg: #0E1117; --surface: #161B22; --surface2: #1C2128; --card-bg: #242B35; --hover: #2B3442;
  /* bordas */
  --border: #30363D; --border-hover: #4B5563;
  /* texto */
  --text: #F3F4F6; --text-2: #D1D5DB; --text-muted: #9CA3AF; --text-dim: #6B7280;
  /* azul institucional */
  --accent: #0F5FA8; --accent-hover: #1474D4; --accent-2: #4FA6FF;
  /* status */
  --st-op: #2563EB; --green: #22C55E; --green-light: #4ADE80; --st-aud: #F59E0B;
  --yellow-light: #FBBF24; --st-warn: #EAB308; --red: #EF4444; --red-light: #F87171; --st-info: #8B5CF6;
  /* forma */
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 4px 12px rgba(0,0,0,.35); --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; font-size: 14px; }
svg.lc { vertical-align: -2px; flex-shrink: 0; }
.ic { display: inline-flex; align-items: center; }

/* ── Login ─────────────────────────────────────────────────────────── */
#login-screen { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 48px 40px; width: 380px; box-shadow: var(--shadow-lg); }
.login-box .logo { text-align: center; margin-bottom: 24px; }
.login-box .logo img { display: block; margin: 0 auto; }
.login-box .logo p { color: var(--text-muted); font-size: .82rem; margin-top: 8px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .8rem; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: .9rem; outline: none; transition: border-color .15s, box-shadow .15s; font-family: inherit; }
.form-group input:hover, .form-group select:hover, .form-group textarea:hover { border-color: var(--border-hover); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent-hover); box-shadow: 0 0 0 3px rgba(20,116,212,.15); }

/* ── Botões ────────────────────────────────────────────────────────── */
.btn { padding: 9px 16px; border: none; border-radius: var(--radius-sm); cursor: pointer; font-size: .85rem; font-weight: 600; transition: all .15s ease; font-family: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--card-bg); color: var(--text-2); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--hover); border-color: var(--border-hover); color: var(--text); }
.btn-danger { background: rgba(239,68,68,.14); color: var(--red); border: 1px solid rgba(239,68,68,.35); }
.btn-danger:hover { background: rgba(239,68,68,.24); }
.btn-sm { padding: 5px 10px; font-size: .78rem; }
.btn-block { width: 100%; }
.btn-trash { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; background: rgba(239,68,68,.12); color: var(--red-light); border: 1px solid rgba(239,68,68,.3); border-radius: var(--radius-sm); cursor: pointer; transition: all .15s; flex-shrink: 0; font-family: inherit; }
.btn-trash:hover { background: rgba(239,68,68,.25); border-color: rgba(239,68,68,.55); }
.btn-toggle { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.btn-toggle.active { background: rgba(239,68,68,.14); color: var(--red-light); border-color: rgba(239,68,68,.45); }
.error-msg { color: var(--red-light); font-size: .85rem; margin-top: 8px; }

/* ── Topbar ────────────────────────────────────────────────────────── */
#app { display: none; flex-direction: column; height: 100vh; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.topbar .brand { display: flex; align-items: center; margin-right: 16px; }
.topbar .brand span { color: var(--text-muted); font-weight: 400; font-size: .8rem; margin-left: 6px; }
.nav-btn { padding: 8px 14px; border: none; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; font-size: .83rem; font-weight: 500; transition: all .15s; display: inline-flex; align-items: center; gap: 7px; font-family: inherit; }
.nav-btn:hover { background: var(--surface2); color: var(--text-2); }
.nav-btn.active { background: var(--hover); color: var(--text); }
.nav-btn.active svg { color: var(--accent-2); }
.user-badge { font-size: .8rem; color: var(--text-muted); display: flex; align-items: center; gap: 8px; margin-left: auto; }
.user-badge .role-tag { padding: 2px 9px; border-radius: 99px; font-size: .68rem; font-weight: 600; background: var(--card-bg); color: var(--accent-2); letter-spacing: .3px; }

/* ── Dropdowns de navegação ────────────────────────────────────────── */
.dd-menu { position: absolute; top: calc(100% + 6px); left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 9999; min-width: 230px; padding: 6px; }
.dd-item { display: flex; align-items: center; gap: 13px; width: 100%; padding: 9px 12px; background: none; border: none; color: var(--text-2); text-align: left; cursor: pointer; font-size: .84rem; font-weight: 500; border-radius: var(--radius-sm); transition: background .15s, color .15s; font-family: inherit; }
.dd-item:hover { background: var(--hover); color: var(--text); }
.dd-item svg { color: var(--text-muted); }
.dd-item:hover svg { color: var(--accent-2); }
.dd-sub { position: relative; }
.dd-sub-menu { position: absolute; top: 0; left: calc(100% + 2px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 10000; min-width: 200px; padding: 6px; }
.dd-caret { margin-left: auto; color: var(--text-dim); }

/* ── Notificações ──────────────────────────────────────────────────── */
.notif-wrap { position: relative; display: inline-flex; align-items: center; }
.notif-bell { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 7px 8px; border-radius: var(--radius-sm); transition: color .15s, background .15s; position: relative; display: inline-flex; align-items: center; }
.notif-bell:hover { color: var(--text); background: var(--surface2); }
.notif-badge { position: absolute; top: 0; right: 0; background: var(--red); color: #fff; border-radius: 50%; width: 16px; height: 16px; font-size: .6rem; font-weight: 700; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.notif-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 370px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 9999; max-height: 480px; overflow-y: auto; }
.notif-sec-title { padding: 9px 14px; font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; background: var(--surface2); border-bottom: 1px solid var(--border); position: sticky; top: 0; }
.notif-item { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.notif-item:last-child { border-bottom: none; }
.notif-ship { flex: 1; min-width: 0; }
.notif-ship-name { font-weight: 600; font-size: .83rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-ship-detail { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.notif-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.btn-confirm { background: rgba(34,197,94,.14); color: var(--green-light); border: 1px solid rgba(34,197,94,.3); font-size: .7rem; padding: 3px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; font-family: inherit; }
.btn-confirm:hover { background: rgba(34,197,94,.25); }
.notif-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: .85rem; }

/* ── Kanban ────────────────────────────────────────────────────────── */
#kanban-view { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.kanban-toolbar { padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.search-box { position: relative; display: inline-flex; align-items: center; }
.search-box svg { position: absolute; left: 11px; color: var(--text-dim); pointer-events: none; }
.search-box input { padding: 9px 12px 9px 34px !important; width: 260px !important; }
.kanban-toolbar input { padding: 8px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: .83rem; width: 200px; outline: none; transition: border-color .15s; font-family: inherit; }
.kanban-toolbar input:hover { border-color: var(--border-hover); }
.kanban-toolbar input:focus { border-color: var(--accent-hover); }
.filter-select { padding: 8px 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); font-size: .8rem; outline: none; max-width: 160px; transition: border-color .15s; font-family: inherit; cursor: pointer; }
.filter-select:hover { border-color: var(--border-hover); }
.kanban-board { flex: 1; display: flex; gap: 12px; padding: 16px; overflow-x: auto; overflow-y: hidden; align-items: flex-start; min-height: 0; }
.kanban-board::-webkit-scrollbar { height: 8px; } .kanban-board::-webkit-scrollbar-track { background: var(--bg); } .kanban-board::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.kanban-col { flex-shrink: 0; width: 248px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: 100%; min-height: 0; overflow: hidden; }
.col-header { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.col-title { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-2); }
.col-count { background: var(--card-bg); border-radius: 99px; padding: 2px 8px; font-size: .7rem; color: var(--text-muted); font-weight: 600; }
.col-cards { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
.col-cards::-webkit-scrollbar { width: 3px; } .col-cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* barra superior colorida por coluna */
.col-aguardando .col-header { border-top: 3px solid var(--text-dim); }
.col-operacao .col-header { border-top: 3px solid var(--st-op); }
.col-sailing .col-header { border-top: 3px solid var(--st-info); }
.col-revlider .col-header { border-top: 3px solid #10B981; }
.col-revauditor .col-header { border-top: 3px solid var(--st-aud); }
.col-faturamento .col-header { border-top: 3px solid var(--st-warn); }
.col-revgestor .col-header { border-top: 3px solid var(--red); }
.col-fatenvio .col-header { border-top: 3px solid #34D399; }
.col-enviado .col-header { border-top: 3px solid var(--green); }
.col-cancelado .col-header { border-top: 3px solid var(--text-dim); }
.col-cancelado .col-title { color: var(--text-muted); }
.col-locked { opacity: .6; }
.col-locked .col-header { filter: grayscale(.5); }
.col-locked .ship-card { cursor: default !important; pointer-events: none; }

/* ── Cards de navio ────────────────────────────────────────────────── */
.ship-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: all .15s ease; }
.ship-card:hover { background: var(--hover); border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow); }
.ship-card.urgent, .ship-card.warning, .ship-card.ok { border-left: 1px solid var(--border); }
.ship-card.cancelado-card { opacity: .55; }
.card-vessel { font-weight: 600; font-size: .88rem; color: var(--text); line-height: 1.3; }
.card-os { font-size: .72rem; color: var(--accent-2); margin: 2px 0 10px; font-weight: 600; }
.card-port { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.card-port svg { color: var(--text-muted); }
.card-dates { display: flex; gap: 10px; flex-wrap: wrap; font-size: .7rem; color: var(--text-muted); margin-bottom: 8px; align-items: center; }
.card-dates b { color: var(--text-2); font-weight: 600; }
.card-dates svg { color: var(--text-dim); }
.card-pic { display: flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--text-muted); margin-bottom: 4px; }
.card-meta { display: flex; flex-direction: column; gap: 2px; }
.card-meta-row { display: flex; gap: 6px; font-size: .72rem; color: var(--text-muted); align-items: center; }
.card-meta-row .label { min-width: 28px; color: var(--text-dim); }
.card-meta-row .value { color: var(--text-2); }
.card-confirm-btn { display: block; width: 100%; margin-top: 8px; padding: 5px 0; background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.4); border-radius: var(--radius-sm); color: var(--green-light); font-size: .72rem; font-weight: 600; cursor: pointer; text-align: center; transition: background .15s; font-family: inherit; }
.card-confirm-btn:hover { background: rgba(34,197,94,.25); }
.card-client { font-size: .7rem; color: var(--text-dim); margin-top: 6px; display: inline-flex; align-items: center; gap: 5px; }
.card-deadline { font-size: .68rem; margin-top: 8px; padding: 3px 8px; border-radius: 6px; display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.card-deadline.red { background: rgba(239,68,68,.14); color: var(--red-light); }
.card-deadline.yellow { background: rgba(234,179,8,.14); color: var(--yellow-light); }
.card-deadline.green { background: rgba(34,197,94,.13); color: var(--green-light); }
.custom-step-pending { font-size: .68rem; margin-top: 6px; padding: 3px 8px; border-radius: 6px; background: rgba(239,68,68,.12); color: var(--red-light); display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }
.cancel-reason-box { margin-top: 10px; padding: 10px 12px; background: rgba(107,114,128,.1); border: 1px solid var(--border-hover); border-radius: var(--radius-sm); font-size: .82rem; color: var(--text-muted); }
.cancel-reason-box strong { color: var(--red-light); }
.kanban-col.drag-over { background: rgba(20,116,212,.07); border-color: var(--accent-hover); }
.ship-card.dragging { opacity: .4; }

/* ── Modais ────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(4,7,12,.7); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: 700px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal-lg { width: 860px; } .modal-sm { width: 460px; }
.modal-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-header h2 { font-size: 1rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; padding: 5px 8px; border-radius: var(--radius-sm); transition: all .15s; font-family: inherit; }
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; overflow-x: visible; }
.modal-body .cb-list { z-index: 2100; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.section-title { font-size: .78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.stage-select { padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface2); color: var(--text); font-size: .9rem; width: 100%; font-family: inherit; }
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-item { display: flex; gap: 10px; font-size: .8rem; align-items: flex-start; }
.history-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); margin-top: 4px; flex-shrink: 0; }
.history-date { color: var(--text-muted); white-space: nowrap; }
.checklist-item { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.checklist-item:last-child { border-bottom: none; }
.checklist-item input[type=checkbox] { accent-color: var(--accent-hover); width: 15px; height: 15px; }
.checklist-item label { font-size: .85rem; flex: 1; cursor: pointer; }
.checklist-item label.checked { text-decoration: line-through; color: var(--text-muted); }
.step-stage-tag { font-size: .7rem; padding: 2px 7px; border-radius: 6px; background: var(--surface); color: var(--text-muted); }
.custom-step-item { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }

/* ── Admin ─────────────────────────────────────────────────────────── */
#admin-view { flex: 1; overflow-y: auto; padding: 32px; display: none; background: var(--bg); }
.admin-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 8px; color: var(--text); letter-spacing: -.3px; }
.admin-subtitle { font-size: .82rem; color: var(--text-muted); margin-bottom: 24px; }
.admin-group-label { font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); margin: 24px 0 10px; padding-left: 2px; }
.admin-grid { display: grid; gap: 12px; }
.admin-grid-2 { grid-template-columns: 1fr 1fr; }
.admin-grid-3 { grid-template-columns: repeat(3, 1fr); }
.admin-grid-4 { grid-template-columns: repeat(4, 1fr); }
.admin-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.admin-section:hover { border-color: var(--border-hover); box-shadow: var(--shadow); }
.admin-section-header { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; transition: background .15s; }
.admin-section-header:hover { background: rgba(255,255,255,.02); }
.admin-section-header h3 { font-size: .88rem; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.admin-sec-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.admin-sec-icon.blue { background: rgba(37,99,235,.15); color: var(--accent-2); }
.admin-sec-icon.green { background: rgba(34,197,94,.13); color: var(--green-light); }
.admin-sec-icon.yellow { background: rgba(245,158,11,.14); color: var(--st-aud); }
.admin-sec-icon.purple { background: rgba(139,92,246,.15); color: #A78BFA; }
.admin-sec-icon.red { background: rgba(239,68,68,.13); color: var(--red-light); }
.admin-sec-icon.cyan { background: rgba(6,182,212,.14); color: #22D3EE; }
.admin-chev { font-size: .7rem; color: var(--text-dim); transition: transform .15s; }
.admin-chev.open { transform: rotate(90deg); }
.admin-section-header .admin-count { font-size: .7rem; background: var(--surface2); color: var(--text-muted); border-radius: 99px; padding: 1px 9px; font-weight: 500; }
.admin-list-item { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.admin-list-item:last-child { border-bottom: none; }
.admin-item-info h4 { font-size: .88rem; font-weight: 600; }
.admin-item-info p { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.admin-item-actions { display: flex; gap: 6px; }
.role-badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .68rem; font-weight: 600; margin: 1px; }
.role-operador { background: rgba(37,99,235,.18); color: var(--accent-2); }
.role-lider { background: rgba(34,197,94,.14); color: var(--green-light); }
.role-auditor { background: rgba(245,158,11,.15); color: var(--st-aud); }
.role-gestor { background: rgba(239,68,68,.13); color: #FB923C; }
.role-financeiro { background: rgba(139,92,246,.16); color: #A78BFA; }

/* ── Log ───────────────────────────────────────────────────────────── */
#log-view { flex: 1; overflow: hidden; display: none; flex-direction: column; min-height: 0; }
.log-toolbar { padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.log-toolbar input { padding: 8px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: .82rem; width: 240px; outline: none; font-family: inherit; transition: border-color .15s; }
.log-toolbar input:focus { border-color: var(--accent-hover); }
.log-table-wrap { flex: 1; overflow-y: auto; min-height: 0; }
.log-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.log-table th { text-align: left; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; position: sticky; top: 0; z-index: 1; }
.log-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.log-table tr:hover td { background: var(--surface2); }
.log-ship { color: var(--accent-2); font-weight: 600; cursor: pointer; }
.log-ship:hover { text-decoration: underline; }
.log-user { color: var(--green-light); }
.log-date { color: var(--text-muted); white-space: nowrap; font-size: .78rem; }
.log-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .7rem; font-weight: 600; white-space: nowrap; }
.badge-criar { background: rgba(34,197,94,.13); color: var(--green-light); }
.badge-mover { background: rgba(37,99,235,.15); color: var(--accent-2); }
.badge-editar { background: rgba(234,179,8,.13); color: var(--yellow-light); }
.badge-data { background: rgba(139,92,246,.15); color: #A78BFA; }
.badge-etapa { background: rgba(245,158,11,.14); color: #FB923C; }
.badge-excluir { background: rgba(239,68,68,.13); color: var(--red-light); }
.badge-validar { background: rgba(34,197,94,.13); color: var(--green-light); }
.badge-rejeitar { background: rgba(239,68,68,.11); color: var(--red-light); }
.badge-lancar { background: rgba(139,92,246,.14); color: #818CF8; }

/* ── Stats bar (kanban) ────────────────────────────────────────────── */
.stats-bar { display: flex; gap: 8px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; flex-shrink: 0; }
.stat-chip { background: var(--surface2); border: 1px solid var(--border); border-radius: 99px; padding: 4px 12px; font-size: .76rem; display: flex; align-items: center; gap: 6px; cursor: pointer; transition: all .15s; }
.stat-chip:hover { border-color: var(--border-hover); background: var(--hover); }
.stat-chip .n { font-weight: 700; } .stat-chip .l { color: var(--text-muted); }
.stat-urgent .n { color: var(--red-light); } .stat-warning .n { color: var(--yellow-light); }

/* ── Scrollbars / toast ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-track { background: var(--bg); } ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; font-size: .85rem; box-shadow: var(--shadow-lg); animation: slideIn .15s ease; max-width: 340px; }
.toast.success { border-left: 3px solid var(--green); border-radius: 0 10px 10px 0; }
.toast.error { border-left: 3px solid var(--red); border-radius: 0 10px 10px 0; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Stats / Faturamento views ─────────────────────────────────────── */
#sv-view { flex: 1; overflow-y: auto; padding: 24px; display: none; flex-direction: column; gap: 16px; }
#fat-view { flex: 1; overflow-y: auto; padding: 24px; display: none; flex-direction: column; gap: 16px; }
.fat-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.fat-table th { background: var(--surface2); color: var(--text-muted); font-weight: 600; padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.fat-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.fat-table tr:hover td { background: var(--surface2); }
.fat-table input[type=date], .fat-table select, .fat-table textarea { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 5px 8px; font-size: .8rem; width: 100%; font-family: inherit; }
.fat-table textarea { resize: none; height: 36px; }
.fat-summary { display: flex; flex-wrap: wrap; gap: 12px; }
.fat-summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; min-width: 160px; }
.fat-summary-card .fat-name { font-size: .78rem; color: var(--text-muted); margin-bottom: 4px; }
.fat-summary-card .fat-count { font-size: 1.6rem; font-weight: 700; color: var(--accent-2); }
.fat-badge-ok { background: rgba(34,197,94,.13); color: var(--green-light); border-radius: 6px; padding: 2px 8px; font-size: .74rem; font-weight: 600; }
.fat-badge-pend { background: rgba(234,179,8,.13); color: var(--yellow-light); border-radius: 6px; padding: 2px 8px; font-size: .74rem; font-weight: 600; }
.fat-badge-late { background: rgba(239,68,68,.13); color: var(--red-light); border-radius: 6px; padding: 2px 8px; font-size: .74rem; font-weight: 600; }
.sv-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sv-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.sv-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.sv-kpi .kpi-n { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.sv-kpi .kpi-l { font-size: .74rem; color: var(--text-muted); margin-top: 4px; }
.sv-kpi.kred .kpi-n { color: var(--red-light); }
.sv-kpi.kyellow .kpi-n { color: var(--yellow-light); }
.sv-kpi.kgreen .kpi-n { color: var(--green-light); }
.sv-kpi.kblue .kpi-n { color: var(--accent-2); }
.sv-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sv-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.sv-card-title { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.sv-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sv-bar-label { font-size: .73rem; color: var(--text-muted); width: 170px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-bar-track { flex: 1; background: var(--surface2); border-radius: 3px; height: 8px; overflow: hidden; }
.sv-bar-fill { height: 100%; background: var(--accent-hover); border-radius: 3px; transition: width .4s ease; min-width: 2px; }
.sv-bar-fill.bgreen { background: var(--green); }
.sv-bar-fill.byellow { background: var(--st-warn); }
.sv-bar-fill.bred { background: var(--red); }
.sv-bar-val { font-size: .75rem; font-weight: 600; min-width: 32px; text-align: right; color: var(--text); }
.sv-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.sv-table th { text-align: left; padding: 7px 10px; color: var(--text-muted); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.sv-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sv-table tr:last-child td { border-bottom: none; }
.sv-table tr:hover td { background: var(--surface2); }
.sv-badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .7rem; font-weight: 600; white-space: nowrap; }
.sv-badge.bred { background: rgba(239,68,68,.14); color: var(--red-light); }
.sv-badge.byellow { background: rgba(234,179,8,.14); color: var(--yellow-light); }
.sv-badge.bgreen { background: rgba(34,197,94,.13); color: var(--green-light); }
.sv-badge.bmuted { background: var(--surface2); color: var(--text-muted); }
.sv-empty { text-align: center; color: var(--text-muted); padding: 32px; font-size: .83rem; }
.sv-section-label { font-size: .7rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* ── Lista ─────────────────────────────────────────────────────────── */
#list-view { flex: 1; overflow: hidden; display: none; flex-direction: column; min-height: 0; }
.list-toolbar { padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex-shrink: 0; }
.list-toolbar input { padding: 8px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: .82rem; width: 220px; outline: none; font-family: inherit; transition: border-color .15s; }
.list-toolbar input:focus { border-color: var(--accent-hover); }
.list-wrap { flex: 1; overflow-y: auto; min-height: 0; }
.list-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.list-table th { text-align: left; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; position: sticky; top: 0; z-index: 1; cursor: pointer; white-space: nowrap; user-select: none; }
.list-table th:hover { color: var(--text); }
.list-table th .sort-arrow { margin-left: 4px; opacity: .5; }
.list-table th.sorted .sort-arrow { opacity: 1; color: var(--accent-2); }
.list-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.list-table tr:hover td { background: var(--surface2); cursor: pointer; }
.list-stage-badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .7rem; font-weight: 600; background: var(--card-bg); color: var(--text-muted); white-space: nowrap; }

/* ── Calendário ────────────────────────────────────────────────────── */
#cal-view { flex: 1; overflow: hidden; display: none; flex-direction: column; min-height: 0; background: var(--bg); }
.cal-toolbar { padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-month-label { font-weight: 600; font-size: .95rem; min-width: 160px; text-align: center; }
.cal-grid { flex: 1; display: grid; grid-template-columns: repeat(7,1fr); grid-template-rows: auto; gap: 1px; background: var(--border); overflow-y: auto; min-height: 0; }
.cal-dow { background: var(--surface); padding: 7px 8px; font-size: .7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.cal-cell { background: var(--surface); padding: 6px 8px; min-height: 100px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden; }
.cal-cell::-webkit-scrollbar { width: 3px; } .cal-cell::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.cal-cell.other-month { background: var(--bg); opacity: .45; }
.cal-cell.today { outline: 1px solid var(--accent-hover); outline-offset: -1px; }
.cal-day-num { font-size: .75rem; font-weight: 600; color: var(--text-muted); margin-bottom: 2px; flex-shrink: 0; }
.cal-chip { font-size: .68rem; padding: 2px 6px; border-radius: 4px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .15s; flex-shrink: 0; }
.cal-chip:hover { opacity: .8; }
.cal-chip.eta { background: rgba(37,99,235,.16); color: var(--accent-2); border-left: 2px solid var(--st-op); border-radius: 0 4px 4px 0; }
.cal-chip.etb { background: rgba(34,197,94,.13); color: var(--green-light); border-left: 2px solid var(--green); border-radius: 0 4px 4px 0; }
.cal-chip.ets { background: rgba(234,179,8,.13); color: var(--yellow-light); border-left: 2px solid var(--st-warn); border-radius: 0 4px 4px 0; }
.cal-filter-btn { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface2); color: var(--text-muted); font-size: .75rem; font-weight: 600; cursor: pointer; transition: all .15s; display: flex; align-items: center; gap: 5px; font-family: inherit; }
.cal-filter-btn:hover { border-color: var(--border-hover); color: var(--text); }
.cal-filter-btn.active-eta { background: rgba(37,99,235,.16); color: var(--accent-2); border-color: var(--st-op); }
.cal-filter-btn.active-etb { background: rgba(34,197,94,.13); color: var(--green-light); border-color: var(--green); }
.cal-filter-btn.active-ets { background: rgba(234,179,8,.13); color: var(--yellow-light); border-color: var(--st-warn); }
.cal-filter-btn.active-scope { background: rgba(139,92,246,.16); color: #a78bfa; border-color: rgba(139,92,246,.45); }

/* ── Comentários ───────────────────────────────────────────────────── */
#sm-comments-section { margin-top: 4px; }
.comment-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { font-size: .72rem; color: var(--text-muted); margin-bottom: 3px; }
.comment-meta strong { color: var(--text); }
.comment-text { font-size: .83rem; word-break: break-word; white-space: pre-wrap; }
.comment-del { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: .8rem; padding: 2px 4px; border-radius: 4px; opacity: 0; transition: opacity .15s; flex-shrink: 0; align-self: flex-start; }
.comment-item:hover .comment-del { opacity: 1; }
.comment-del:hover { color: var(--red-light); }
.comment-input-row { display: flex; gap: 8px; margin-top: 10px; }
.comment-input-row textarea { flex: 1; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: .83rem; padding: 8px 10px; resize: none; height: 60px; outline: none; font-family: inherit; transition: border-color .15s; }
.comment-input-row textarea:focus { border-color: var(--accent-hover); }

/* ── Atalhos / 2FA / Combobox ──────────────────────────────────────── */
.kbd-hint { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 16px; font-size: .78rem; color: var(--text-muted); z-index: 9000; box-shadow: var(--shadow); animation: slideIn .15s ease; pointer-events: none; }
#totp-qr-wrap canvas, #totp-qr-wrap img { border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.cb-wrap { position: relative; }
.cb-list { position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 900; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 220px; overflow-y: auto; display: none; }
.cb-item { padding: 8px 12px; cursor: pointer; font-size: .85rem; color: var(--text); transition: background .15s; }
.cb-item:hover, .cb-item:focus { background: var(--hover); outline: none; }
.cb-item mark { background: rgba(79,166,255,.25); color: var(--text); border-radius: 2px; }
.cb-new-item { color: var(--accent-2); border-top: 1px solid var(--border); }

/* ── Faturas / Invoices ────────────────────────────────────────────── */
#inv-view { flex: 1; overflow-y: auto; padding: 24px; display: none; flex-direction: column; gap: 16px; min-height: 0; }
.inv-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: visible; position: relative; }
.inv-section-header { padding: 11px 16px; background: var(--surface2); font-size: .82rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 8px; border-radius: var(--radius) var(--radius) 0 0; }
.inv-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.inv-table th { background: var(--surface2); padding: 8px 10px; text-align: left; font-size: .7rem; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.inv-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.inv-table tr:last-child td { border-bottom: none; }
.inv-status-pendente  { background: rgba(234,179,8,.13);  color: var(--yellow-light); font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.inv-status-validado  { background: rgba(34,197,94,.13);  color: var(--green-light); font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.inv-status-rejeitado { background: rgba(239,68,68,.13);  color: var(--red-light); font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.inv-status-lancado   { background: rgba(139,92,246,.14); color: #818CF8; font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.inv-link { color: var(--accent-2); text-decoration: none; font-size: .75rem; }
.inv-link:hover { text-decoration: underline; }
.inv-badge { background: var(--red); color: #fff; font-size: .65rem; font-weight: 700; border-radius: 99px; padding: 1px 6px; margin-left: 4px; vertical-align: middle; }
.inv-new-form { padding: 12px 16px; background: rgba(20,116,212,.04); border-top: 1px solid var(--border); display: none; flex-direction: column; gap: 8px; }
.inv-new-form.open { display: flex; }

/* ── Financeiro dropdown ───────────────────────────────────────────── */
#btn-financeiro.active { background: var(--hover); color: var(--text); }

/* ── Contas a Pagar ────────────────────────────────────────────────── */
#cp-view { flex: 1; overflow-y: hidden; padding: 24px; display: none; flex-direction: column; gap: 16px; min-height: 0; }
.cp-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.cp-table th { background: var(--surface2); padding: 9px 10px; text-align: left; font-size: .7rem; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.cp-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cp-table tr:hover td { background: var(--surface2); }
.cp-badge-fatura { background: rgba(139,92,246,.14); color: #818CF8; font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.cp-badge-admin { background: rgba(234,179,8,.13); color: var(--yellow-light); font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.cp-badge-aprovado { background: rgba(34,197,94,.13); color: var(--green-light); font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.cp-badge-pendente { background: rgba(107,114,128,.14); color: var(--text-muted); font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.cp-badge-rejeitado { background: rgba(239,68,68,.13); color: var(--red-light); font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.cp-badge-validado { background: rgba(139,92,246,.14); color: #818CF8; font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.cp-badge-lancado { background: rgba(34,197,94,.13); color: var(--green-light); font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.cp-badge-invalido { background: rgba(239,68,68,.13); color: var(--red-light); font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.cp-badge-pago { background: rgba(34,197,94,.17); color: #34D399; font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.cp-emp-btn { font-size: .78rem; padding: 6px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); cursor: pointer; display: flex; align-items: center; gap: 6px; white-space: nowrap; font-family: inherit; transition: border-color .15s; }
.cp-emp-btn:hover { border-color: var(--border-hover); }
.cp-emp-drop { position: absolute; top: calc(100% + 4px); left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 500; min-width: 200px; max-height: 260px; overflow-y: auto; padding: 6px 0; }
.cp-emp-drop label { display: flex; align-items: center; gap: 8px; padding: 7px 14px; cursor: pointer; font-size: .82rem; color: var(--text); }
.cp-emp-drop label:hover { background: var(--hover); }
.cp-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cp-section-header { padding: 12px 16px; background: var(--surface2); font-size: .88rem; font-weight: 600; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.cp-totals { display: flex; flex-wrap: wrap; gap: 12px; }
.cp-total-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 150px; }
.cp-total-card .cp-t-label { font-size: .72rem; color: var(--text-muted); margin-bottom: 4px; }
.cp-total-card .cp-t-val { font-size: 1.3rem; font-weight: 700; }

/* ── Módulo OS ─────────────────────────────────────────────────────── */
#os-view { flex: 1; overflow-y: hidden; padding: 24px; display: none; flex-direction: column; gap: 16px; min-height: 0; }
.os-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.os-toolbar input, .os-toolbar select { padding: 8px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: .82rem; font-family: inherit; outline: none; transition: border-color .15s; }
.os-toolbar input:focus, .os-toolbar select:focus { border-color: var(--accent-hover); }
.os-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.os-table-wrap { overflow: auto; flex: 1; min-height: 0; }
.os-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.os-table th { background: var(--surface2); padding: 9px 10px; text-align: left; font-size: .7rem; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.os-table td { padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; }
.os-table tr:hover td { background: rgba(255,255,255,.03); cursor: pointer; }
.os-badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .7rem; font-weight: 600; }
.os-badge-aberta { background: rgba(37,99,235,.16); color: var(--accent-2); }
.os-badge-encerrada { background: rgba(234,179,8,.13); color: var(--yellow-light); }
.os-badge-faturada { background: rgba(34,197,94,.13); color: var(--green-light); }
.os-modal-overlay { position: fixed; inset: 0; background: rgba(4,7,12,.7); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.os-modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: min(720px,96vw); max-height: 92vh; overflow-y: auto; padding: 32px; position: relative; box-shadow: var(--shadow-lg); }
#os-detail-modal > .os-modal { width: min(1100px,97vw); max-height: 96vh; padding: 32px 36px; }
.os-modal-lg { width: min(1100px,97vw); }
.os-modal h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 18px; color: var(--text); }
.os-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.os-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.os-field label { font-size: .74rem; color: var(--text-muted); font-weight: 600; display: block; margin-bottom: 4px; }
.os-field input, .os-field select, .os-field textarea { width: 100%; padding: 8px 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: .85rem; box-sizing: border-box; font-family: inherit; outline: none; transition: border-color .15s; }
.os-field input:focus, .os-field select:focus, .os-field textarea:focus { border-color: var(--accent-hover); }
.os-detail-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.os-tab { padding: 8px 16px; font-size: .83rem; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; background: none; border-top: none; border-left: none; border-right: none; font-family: inherit; transition: color .15s; }
.os-tab:hover { color: var(--text-2); }
.os-tab.active { color: var(--accent-2); border-bottom-color: var(--accent-2); }
.os-item-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px; display: flex; gap: 12px; align-items: flex-start; }
.os-item-tipo { font-size: .66rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; border: 1px solid var(--border); }
.tipo-proprio { background: rgba(79,166,255,.10); color: var(--accent-2); border-color: rgba(79,166,255,.22); }
.tipo-terceiro { background: var(--card-bg); color: var(--text-muted); }
.tipo-despesa { background: rgba(239,68,68,.09); color: var(--red-light); border-color: rgba(239,68,68,.22); }
.os-summary-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.os-kpi { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; flex: 1; min-width: 130px; }
.os-kpi-label { font-size: .7rem; color: var(--text-muted); }
.os-kpi-val { font-size: 1.05rem; font-weight: 700; margin-top: 2px; }

/* ── Responsividade (tablet / celular) ─────────────────────────────────
   O sistema foi desenhado para desktop. Estas regras evitam que a
   interface quebre em telas menores: barra de topo rolável, formulários
   e grids em 1 coluna, modais ocupando a tela quase toda. */
@media (max-width: 900px) {
  .topbar { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; gap: 2px; padding: 0 10px; }
  .topbar::-webkit-scrollbar { height: 0; }
  .topbar .brand { margin-right: 8px; }
  .topbar .brand img { height: 28px !important; }
  .nav-btn { padding: 8px 10px; font-size: .8rem; white-space: nowrap; }
  .user-badge { white-space: nowrap; }
  .os-grid-3, .form-row-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .form-row, .form-row-3, .os-grid-2, .os-grid-3 { grid-template-columns: 1fr; }
  .modal-overlay, .os-modal-overlay { padding: 8px; align-items: flex-start; }
  .modal, .modal-lg, .modal-sm, .os-modal { width: 100%; max-width: 100%; }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .kanban-toolbar { padding: 8px 10px; }
  .kanban-toolbar input { width: 100%; }
  .kanban-board { padding: 10px; gap: 10px; }
  .user-badge .role-tag { display: none; }
  .dd-menu { min-width: 200px; max-width: calc(100vw - 20px); }
}
