/* Porto Hub — tema escuro único. Tokens da seção 12 da especificação. */

:root {
  --bg: #0A0A0A;
  --panel: #111111;
  --field: #0D0D0D;
  --border: #222222;
  --border-status: #330B10;

  --red: #FF2A42;
  --orange: #FF6B00;
  --brand-gradient: linear-gradient(90deg, #FF2A42, #FF6B00);

  --text-title: #FFFFFF;
  --text: #D1D5DB;
  --text-muted: #A1A1AA;

  --success: #4ADE80;
  --success-bg: #0B1A10;

  --crit-text: #FF8A96;
  --crit-bg: #16080A;
  --crit-border: rgba(255, 42, 66, 0.4);
  --warn-text: #FFA25C;
  --warn-bg: #1A0F06;
  --warn-border: rgba(255, 107, 0, 0.4);
  --info-text: #9CCAFF;
  --info-bg: #0A111A;
  --info-border: rgba(156, 202, 255, 0.3);

  --font-title: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius: 4px;
  --radius-chip: 2px;
  --sidebar-w: 220px;
  --target: 44px;
  --glow: 0 0 16px rgba(255, 107, 0, 0.4);
  --focus-field: inset 0 0 4px rgba(255, 42, 66, 0.3);
}

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

[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--text-title); font-family: var(--font-title); font-weight: 800; margin: 0; }
h1 { font-size: 32px; line-height: 1.15; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
a { color: var(--orange); }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--red); color: var(--bg); padding: 10px 14px; border-radius: var(--radius);
  font-family: var(--font-title); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 8px; }

.boot { color: var(--text-muted); padding: 48px; text-align: center; }

/* ---------------------------------------------------------------- rótulos */

.eyebrow {
  font-family: var(--font-title); font-weight: 700; font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted);
}
.eyebrow.accent { color: var(--orange); }
.eyebrow .common { font-size: 12px; text-transform: none; letter-spacing: 0; }
.eyebrow .sep { color: var(--text-muted); margin: 0 0.5em; }

.common {
  font-family: var(--font-body); font-weight: 400; font-size: 0.55em;
  color: var(--text-muted); letter-spacing: 0; text-transform: none; margin-left: 0.5em;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- layout */

.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 24px;
  padding: 24px 16px; border-right: 1px solid var(--border); background: var(--bg);
}

.brand {
  display: flex; align-items: center; gap: 10px; padding: 0 8px;
  font-family: var(--font-title); font-weight: 800; font-size: 15px; letter-spacing: 0.05em;
  color: var(--text-title); text-decoration: none; text-transform: uppercase;
}
.brand-mark { width: 28px; height: 28px; border-radius: var(--radius); background: var(--brand-gradient); flex: none; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; flex-direction: column; justify-content: center;
  min-height: var(--target); padding: 6px 12px; border-radius: var(--radius);
  border-left: 2px solid transparent; color: var(--text); text-decoration: none;
}
.nav a:hover { background: var(--panel); color: var(--text-title); }
.nav a[aria-current='page'] { background: #1A0A0D; border-left-color: var(--red); color: var(--text-title); font-weight: 600; }
.nav .nav-common { font-size: 11px; color: var(--text-muted); font-weight: 400; line-height: 1.2; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.profile-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--target);
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); cursor: pointer; text-align: left;
}
.profile-btn:hover { border-color: rgba(255, 42, 66, 0.3); }
.avatar {
  width: 28px; height: 28px; border-radius: var(--radius); flex: none;
  display: grid; place-items: center; background: #1A0A0D; color: var(--crit-text);
  font-family: var(--font-title); font-weight: 800; font-size: 12px;
}
.profile-btn .who { display: flex; flex-direction: column; min-width: 0; }
.profile-btn .who strong { color: var(--text-title); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-btn .who span { font-size: 12px; color: var(--text-muted); }

.menu-pop {
  display: flex; flex-direction: column; padding: 4px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel);
}
.menu-pop[hidden] { display: none; }
.menu-pop button {
  display: flex; align-items: center; gap: 8px; min-height: var(--target); padding: 0 10px;
  background: none; border: 0; border-radius: var(--radius); cursor: pointer; text-align: left; color: var(--text);
}
.menu-pop button:hover { background: #1A1A1A; color: var(--text-title); }

.main { min-width: 0; padding: 24px 32px 48px; }

.topbar { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 28px; }
.quick { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.quick input {
  width: 100%; height: 48px; padding: 0 16px; font-size: 15px;
  background: var(--field); border: 1px solid var(--red); border-radius: var(--radius); color: var(--text-title);
}
.quick input::placeholder { color: var(--text-muted); }
.quick input:disabled { border-color: var(--border); cursor: not-allowed; }
.quick-hint { font-size: 12px; color: var(--text-muted); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.page-head .titles { display: flex; flex-direction: column; gap: 6px; }

/* ---------------------------------------------------------------- painéis */

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }

.empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 32px; border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty p { color: var(--text-muted); }

/* ---------------------------------------------------------------- botões */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--target); padding: 0 18px; border-radius: var(--radius); cursor: pointer;
  font-family: var(--font-title); font-weight: 700; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  text-decoration: none; border: 1px solid transparent; transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--red); color: var(--bg); }
.btn-primary:hover { background: var(--orange); box-shadow: var(--glow); }
.btn-secondary { background: var(--panel); border-color: rgba(255, 42, 66, 0.3); color: var(--text-title); }
.btn-secondary:hover { border-color: var(--red); }
.btn-ghost { background: transparent; color: var(--text); text-transform: none; font-family: var(--font-body); font-weight: 500; font-size: 14px; letter-spacing: 0; }
.btn-ghost:hover { color: var(--text-title); background: var(--panel); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: var(--target); height: var(--target);
  background: transparent; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; color: var(--text);
}
.icon-btn:hover { background: var(--panel); color: var(--text-title); }

.icon { width: 18px; height: 18px; flex: none; }

/* ---------------------------------------------------------------- formulários */

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-family: var(--font-title); font-weight: 700; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.field .hint { font-size: 12px; color: var(--text-muted); }
.input {
  width: 100%; min-height: var(--target); padding: 10px 12px;
  background: var(--field); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-title);
}
.input:focus, .quick input:focus { outline: none; border-color: var(--red); box-shadow: var(--focus-field); }
.input:focus-visible, .quick input:focus-visible { outline: none; }
.form-error {
  padding: 10px 12px; border: 1px solid var(--crit-border); border-radius: var(--radius);
  background: var(--crit-bg); color: var(--crit-text);
}
.form-error:empty { display: none; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------------------------------------------------------------- chips */

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: var(--radius-chip);
  font-family: var(--font-title); font-weight: 700; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid var(--border);
}
.chip-critico { color: var(--crit-text); background: var(--crit-bg); border-color: var(--crit-border); }
.chip-atencao { color: var(--warn-text); background: var(--warn-bg); border-color: var(--warn-border); }
.chip-info { color: var(--info-text); background: var(--info-bg); border-color: var(--info-border); }
.chip-success { color: var(--success); background: var(--success-bg); border-color: rgba(74, 222, 128, 0.4); }

/* ---------------------------------------------------------------- telas de acesso */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 24px; }
.auth-card .panel { padding: 28px; }
.auth-card .lead { color: var(--text-muted); margin-top: 6px; }
.auth-card .rule { height: 2px; background: var(--brand-gradient); border-radius: 1px; }

/* ---------------------------------------------------------------- modal */

dialog.modal {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.7); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 0 24px; }
.modal-body { padding: 16px 24px 24px; }

/* ---------------------------------------------------------------- toasts */

.toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  display: flex; flex-direction: column; gap: 8px; width: min(400px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--orange);
  border-radius: var(--radius); color: var(--text-title); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--success); }
.toast .msg { flex: 1; min-width: 0; }
.toast .msg small { display: block; color: var(--text-muted); }

/* ---------------------------------------------------------------- celular */

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center;
    gap: 8px; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand span:not(.brand-mark) { display: none; }
  .nav { flex-direction: row; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; }
  .nav a { flex: none; border-left: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 6px 10px; }
  .nav a[aria-current='page'] { border-bottom-color: var(--red); background: transparent; }
  .nav .nav-common { display: none; }
  .sidebar-foot { margin-top: 0; position: relative; }
  .profile-btn { width: var(--target); padding: 0; justify-content: center; border: 0; background: none; }
  .profile-btn .who { display: none; }
  .menu-pop { position: absolute; right: 0; top: calc(100% + 4px); width: 200px; z-index: 20; }
  .main { padding: 16px 16px 48px; }
  h1 { font-size: 26px; }
  .quick-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ================================================================ Fase 2 */

.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.block { display: block; }
.text-critico { color: var(--crit-text); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }
textarea.input { resize: vertical; min-height: 80px; font: inherit; }
.input-inline { width: auto; min-height: 36px; padding: 4px 8px; }
.form-actions.split { justify-content: space-between; align-items: center; }
.btn-ghost.danger { color: var(--crit-text); }
.btn-ghost.danger:hover { background: var(--crit-bg); }
.subtle-block { padding: 12px; border: 1px dashed var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--red); flex: none; }
.check span { display: flex; flex-direction: column; gap: 2px; }
.check strong { color: var(--text-title); font-weight: 600; }
.check small { color: var(--text-muted); font-size: 12px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .input { width: auto; min-width: 180px; }
.btn.toggle[aria-pressed="true"] { background: #1A0A0D; border-color: var(--red); color: var(--text-title); }

/* ---------------------------------------------------------------- Cais */

.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px;
  overflow-x: auto; padding-bottom: 8px; align-items: start;
}
.col {
  display: flex; flex-direction: column; min-height: 420px;
  background: var(--field); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
}
.col-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.col-head .eyebrow { color: var(--text-title); }
.col-count { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.col-count.over { color: var(--orange); font-weight: 600; }
.col-list { display: flex; flex-direction: column; gap: 8px; min-height: 48px; flex: 1; border-radius: var(--radius); transition: background 0.1s; }
.col-list.over { background: rgba(255, 107, 0, 0.05); }
.col-empty { color: var(--text-muted); font-size: 12px; padding: 8px 2px; }
.col-add { margin-top: 8px; }
.add-btn { min-height: 36px; padding: 0 6px; font-size: 13px; color: var(--text-muted); }
.drop-placeholder { height: 4px; border-radius: 2px; background: var(--brand-gradient); }
.board-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

.card {
  position: relative; background: #151515; border: 1px solid var(--border); border-left: 3px solid #3A3A3A;
  border-radius: var(--radius); padding: 10px 10px 10px 12px; display: flex; flex-direction: column; gap: 6px;
  cursor: grab;
}
.card:hover { border-color: #2E2E2E; }
.card.prio-0 { border-left-color: #2A2A2A; }
.card.prio-2 { border-left-color: var(--orange); }
.card.prio-3 { border-left-color: var(--red); }
.card.dragging { opacity: 0.4; }
.card-top { display: flex; align-items: flex-start; gap: 4px; }
.card-title {
  flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 2px 0; cursor: pointer;
  color: var(--text-title); font-weight: 600; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere;
}
.card-title:hover { text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.3); }
.card-menu-btn { width: 32px; height: 32px; margin: -4px -4px 0 0; color: var(--text-muted); flex: none; }
.card-menu { position: absolute; right: 6px; top: 34px; z-index: 5; min-width: 170px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.card-project { font-size: 12px; color: var(--text-muted); }
.card-foot { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.card-assignee { margin-left: auto; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.card-time { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.due-muted, .due-plain { color: var(--text-muted); }
.due-overdue { color: var(--crit-text); font-weight: 600; }
.due-today { color: var(--warn-text); font-weight: 600; }
.due-soon { color: var(--text); }

/* ---------------------------------------------------------------- Frota */

.fleet { display: flex; flex-direction: column; gap: 28px; }
.fleet-group { display: flex; flex-direction: column; gap: 10px; }
.fleet-list { display: flex; flex-direction: column; gap: 8px; }
.fleet-row {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.6fr) minmax(0, 1.3fr) 200px minmax(0, 0.9fr);
  gap: 16px; align-items: center; padding: 14px 16px; text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.fleet-row:hover { border-color: rgba(255, 42, 66, 0.3); }
.fleet-row h3 { font-size: 15px; }
.fleet-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.fleet-chips .chip { white-space: nowrap; }
.fleet-progress { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 900px) {
  .fleet-row { grid-template-columns: 1fr 1fr; }
  .fleet-main { grid-column: 1 / -1; }
}

.progress { position: relative; height: 8px; background: #1C1C1C; border-radius: 2px; }
.progress-fill { height: 100%; border-radius: 2px; background: var(--brand-gradient); }
.progress-mark { position: absolute; top: -4px; width: 2px; height: 16px; background: #FFFFFF; transform: translateX(-1px); }
.progress-labels { display: flex; justify-content: space-between; margin-bottom: 8px; }

/* ---------------------------------------------------------------- Navio */

.crumbs { font-size: 13px; color: var(--text-muted); }
.crumbs a { color: var(--text); text-decoration: none; }
.crumbs a:hover { color: var(--text-title); text-decoration: underline; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-family: var(--font-title); font-weight: 800; font-size: 22px; color: var(--text-title); }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 12px 0; }
.mini-stats .stat { padding: 12px; background: var(--field); }
.mini-stats .stat-value { font-size: 18px; }
.panel { margin-bottom: 16px; }
.panel > h2 { margin-bottom: 12px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel h2 .common { font-size: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-bottom: 16px; }
.two-col .panel { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .mini-stats { grid-template-columns: 1fr 1fr; } }
.task-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.task-group { display: flex; flex-direction: column; gap: 8px; }
.inline-add .input { max-width: 520px; }
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.activity li p:first-child { color: var(--text-title); }

/* ---------------------------------------------------------------- Clientes */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; background: var(--panel); }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th { font-family: var(--font-title); font-weight: 700; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); background: var(--field); }
.table tbody th { font-weight: 400; }
.table tbody th strong { color: var(--text-title); font-weight: 600; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; width: 1%; }

@media (max-width: 820px) {
  .board { grid-auto-columns: minmax(78vw, 1fr); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .filters .input { min-width: 0; flex: 1; }
}

/* ================================================================ Fase 3 — Ampulheta */

.timer-slot { flex: none; min-width: 0; }
.timer-slot:empty { display: none; }
.timer-bar {
  display: flex; align-items: center; gap: 12px; height: 48px; margin-top: 22px; padding: 0 6px 0 14px;
  background: var(--panel); border: 1px solid var(--crit-border); border-radius: var(--radius); max-width: 420px;
}
.timer-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--red); box-shadow: 0 0 8px rgba(255, 42, 66, 0.8); animation: pulse 1.6s ease-in-out infinite; flex: none; }
@keyframes pulse { 50% { opacity: 0.35; } }
.timer-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.timer-info strong { color: var(--text-title); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.timer-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.timer-clock { font-family: var(--font-title); font-weight: 800; font-size: 18px; color: var(--text-title); font-variant-numeric: tabular-nums; }
.timer-stop { min-height: 36px; padding: 0 12px; }

.timer-btn { color: var(--text-muted); width: 32px; height: 32px; }
.card-foot .timer-btn { margin: -6px -6px -6px 0; }
.timer-btn:hover { color: var(--text-title); }
.timer-btn.running { color: var(--red); background: var(--crit-bg); border-color: var(--crit-border); }
.btn.timer-btn { width: auto; height: auto; color: var(--text-title); }
.btn.timer-btn.running { color: var(--crit-text); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab {
  min-height: var(--target); padding: 0 16px; background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  font-family: var(--font-title); font-weight: 700; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap;
}
.tab:hover { color: var(--text-title); }
.tab[aria-selected="true"] { color: var(--text-title); border-bottom-color: var(--red); }
.tab-panel:focus-visible { outline-offset: 6px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
.toolbar.end { justify-content: flex-end; }
.week-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.week-nav .btn-secondary { min-width: var(--target); padding: 0 12px; }
.week-label { color: var(--text-title); padding: 0 8px; }
.align-end { align-self: flex-end; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 560px) { .grid-3 { grid-template-columns: 1fr; } }
.report-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; margin-bottom: 12px; }

.week-table th, .week-table td { padding: 8px 10px; }
.week-table .today { background: rgba(255, 107, 0, 0.06); }
.week-table thead .today { color: var(--warn-text); }
.week-table tfoot th, .week-table tfoot td { border-top: 1px solid var(--border); background: var(--field); }
.strong { font-weight: 600; color: var(--text-title); }
.total { color: var(--orange); }
.cell-btn {
  min-width: 56px; min-height: 36px; padding: 0 8px; background: transparent; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--text-title); cursor: pointer; font-variant-numeric: tabular-nums;
}
.cell-btn:hover { border-color: var(--border); background: #1A1A1A; }
.cell-btn.active, .cell-btn[aria-pressed="true"] { border-color: var(--red); background: var(--crit-bg); }
.week-detail { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.warn-note { padding: 10px 12px; border: 1px solid var(--warn-border); background: var(--warn-bg); color: var(--warn-text); border-radius: var(--radius); margin-bottom: 16px; }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-gap { display: flex; gap: 6px; align-items: center; }
.entry-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; max-height: 180px; overflow: auto; }
.entry-list li { display: flex; gap: 12px; align-items: center; }
.entry-list li strong { margin-left: auto; color: var(--text-title); font-variant-numeric: tabular-nums; }

@media (max-width: 820px) {
  .topbar { flex-direction: column; gap: 8px; }
  .timer-slot { width: 100%; }
  .timer-bar { margin-top: 0; max-width: none; }
}

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ================================================================ Fase 4 — Ponte de Comando */

.btn-sm { min-height: 40px; padding: 0 14px; }
.btn-ghost.btn-sm { padding: 0 10px; font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.link-btn:hover { text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.3); }

.stats-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .stats-4 { grid-template-columns: repeat(2, 1fr); } }
.stat-sub { font-family: var(--font-title); font-size: 14px; font-weight: 700; color: var(--text-muted); }
.stat-warn { border-color: var(--warn-border); }
.stat-warn .stat-value { color: var(--warn-text); }

.ponte-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 24px; align-items: start; margin-top: 8px; }
@media (max-width: 980px) { .ponte-grid { grid-template-columns: minmax(0, 1fr); } }
.block-title { margin-bottom: 14px; }
.block-title .common { font-size: 12px; }

.rota-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rota-card {
  display: flex; gap: 14px; padding: 18px 18px 18px 16px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.rota-card.first { position: relative; border-color: rgba(255, 107, 0, 0.35); box-shadow: 0 0 24px rgba(255, 107, 0, 0.12); }
.rota-card.first::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--brand-gradient); border-radius: var(--radius) var(--radius) 0 0; }
.rota-num { font-family: var(--font-title); font-weight: 800; font-size: 20px; color: var(--orange); line-height: 1.2; min-width: 16px; }
.rota-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rota-body h3 { font-size: 15px; font-family: var(--font-body); font-weight: 600; overflow-wrap: anywhere; }
.rota-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }

.alert-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.alert-card {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 14px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.alert-card.level-critico { border-color: var(--border-status); }
.alert-main { display: flex; gap: 12px; align-items: flex-start; min-width: 0; flex: 1 1 260px; }
.alert-main .chip { flex: none; margin-top: 1px; }
.chip .dot { width: 6px; height: 6px; border-radius: 1px; background: currentColor; }
.alert-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.alert-text h3 { font-family: var(--font-body); font-weight: 600; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.alert-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.snooze { position: relative; }
.snooze-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 6; min-width: 140px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.empty.calm { border-style: solid; border-color: rgba(74, 222, 128, 0.25); }
.empty.calm p { color: var(--success); }

/* Concluir viagem */
fieldset.choice { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
fieldset.choice legend { padding: 0 6px; color: var(--text-title); font-weight: 600; }
.check input[type="radio"] { width: 20px; height: 20px; accent-color: var(--red); }

/* Alternância de forma de cobrança */
.field-label { font-family: var(--font-title); font-weight: 700; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; width: fit-content; }
.seg-btn { min-height: var(--target); padding: 0 18px; background: var(--field); border: 0; color: var(--text); cursor: pointer; font-weight: 500; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn[aria-pressed="true"] { background: #1A0A0D; color: var(--text-title); box-shadow: inset 0 -2px 0 var(--red); }
.seg-btn:focus-visible { outline-offset: -2px; }

/* Deploys */
.deploys .deploy-kind { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.deploys .deploy-kind h3 { font-size: 14px; }
.deploy-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.deploy-row { display: flex; gap: 12px; align-items: flex-start; }
.deploy-row .chip { flex: none; min-width: 92px; justify-content: center; }
.deploy-text { flex: 1; min-width: 0; }
.deploy-text p:first-child { color: var(--text-title); overflow-wrap: anywhere; }

/* Equipe e Configurações */
.row-muted > * { opacity: 0.55; }
.setting-row { display: grid; grid-template-columns: minmax(0, 1fr) 280px 90px; gap: 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.setting-row label { color: var(--text-title); }
.setting-input { display: flex; align-items: center; gap: 8px; }
.input-num { width: 90px; text-align: right; }
@media (max-width: 640px) { .setting-row { grid-template-columns: 1fr; gap: 6px; } }
.integration { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.disabled-block { opacity: 0.6; }

.data-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin: 12px 0; }
.data-row .field { flex: 1; min-width: 220px; }
.data-row .muted { flex: 1; min-width: 220px; }

/* Captura rápida com listas */
.quick-row { display: flex; gap: 8px; align-items: stretch; }
.quick-row > input[type="text"] { flex: 1; min-width: 0; }
.quick-row .quick-select, .quick-row .quick-date { height: 48px; min-height: 48px; width: auto; background: var(--field); }
.quick-row .quick-select { max-width: 240px; }
.quick-row .quick-prio { max-width: 120px; }
.quick-row .quick-btn { height: 48px; }
@media (max-width: 1100px) {
  .quick-row { flex-wrap: wrap; }
  .quick-row > input[type="text"] { flex-basis: 100%; }
  .quick-row .quick-select { flex: 1; max-width: none; }
}

.quick-row > * { min-width: 0; }
@media (max-width: 820px) {
  .quick-row .quick-select, .quick-row .quick-date { flex: 1 1 40%; }
  .quick-row .quick-btn { flex: 1 1 100%; }
}

@media (max-width: 820px) {
  .topbar { align-items: stretch; }
  .quick { width: 100%; }
}
