/* MosaDispatch — sistema de design (Bloco 3, reorganização UX/UI).
   Paleta derivada do logo: navy (texto/elementos fortes), slate (secundário),
   verde (SÓ acento de marca / "positivo" — nunca decorativo). */

@font-face {
    font-family: "Poppins";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/static/fonts/poppins-600.woff2") format("woff2");
}
@font-face {
    font-family: "Poppins";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/static/fonts/poppins-700.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url("/static/fonts/inter-var.woff2") format("woff2");
}

:root {
    /* identidade */
    --navy: #141A33;
    --navy-soft: #2A3357;
    --slate: #7B8595;
    --slate-light: #C3C9D2;
    --green: #1FA254;
    --green-bg: #E3F5EA;

    /* semântica de estado — nunca decorativa */
    --ok: #1FA254;
    --ok-bg: #E3F5EA;
    --amber: #B4790C;
    --amber-bg: #FBEFDA;
    --red: #C4341F;
    --red-bg: #FBE7E3;
    /* prazo "amanhã" (cartões, 2026-07-11) — distinto do amber (que é a
       condicionante horária, não o prazo) */
    --yellow: #8A6D00;
    --yellow-bg: #FBF3D2;
    /* passagem ao depósito / entrega suplementar dela nascida */
    --purple: #6E4A9E;
    --purple-bg: #EFE6F7;
    /* paragem na bomba (Bloco 4) — nunca confundir com passagem ao depósito */
    --teal: #1B7F82;
    --teal-bg: #E2F3F3;

    /* neutros */
    --bg: #F7F8F6;
    --card-bg: #FFFFFF;
    --border: #E4E6EA;
    --text: var(--navy);
    --text-secondary: var(--slate);

    /* tipografia */
    --font-display: "Poppins", "Segoe UI", sans-serif;
    --font-body: "Inter", "Segoe UI", sans-serif;

    /* paleta de camiões no mapa — dessaturada, não colide com o semântico */
    --truck-1: #4C6EF5;
    --truck-2: #AE6BC9;
    --truck-3: #3AA8A0;
    --truck-4: #C98A3A;
    --truck-5: #6C7FD8;
    --truck-6: #5C9E6B;

    --radius: 10px;
    --shadow: 0 1px 2px rgba(20, 26, 51, 0.06), 0 1px 6px rgba(20, 26, 51, 0.05);
    --grid: 8px;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
}

.icon {
    width: 1.1em;
    height: 1.1em;
    display: inline-block;
    vertical-align: -0.2em;
    stroke: currentColor;
    flex-shrink: 0;
}
.icon-lg { width: 1.6em; height: 1.6em; }
.icon-xl { width: 2.4em; height: 2.4em; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; color: var(--navy); margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }
.tabular-nums { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ===================== layout / navegação de topo ===================== */

.layout { display: flex; flex-direction: column; min-height: 100vh; }

.topnav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--navy);
    color: #fff;
    padding: 0 1.5rem;
    height: 56px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topnav .brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .5rem;
    white-space: nowrap;
}
.topnav .brand .icon { color: var(--green); width: 1.4em; height: 1.4em; }

.topnav .areas { display: flex; gap: .25rem; flex: 1; }
.topnav .areas a {
    display: flex;
    align-items: center;
    gap: .4rem;
    color: var(--slate-light);
    text-decoration: none;
    padding: 0 .9rem;
    height: 56px;
    font-weight: 600;
    font-size: .92rem;
    border-bottom: 3px solid transparent;
}
.topnav .areas a:hover { color: #fff; }
.topnav .areas a.active { color: #fff; border-bottom-color: var(--green); }

.topnav .topnav-right { display: flex; align-items: center; gap: 1rem; }
.lang-switch a { color: var(--slate-light); margin-right: 0.35rem; text-decoration: none; font-size: .85rem; font-weight: 600; }
.lang-switch a.active { color: #fff; }
.topnav .link-button { background: none; border: none; color: var(--slate-light); cursor: pointer; font-size: .85rem; display: flex; align-items: center; gap: .3rem; }
.topnav .link-button:hover { color: #fff; }

.content { flex: 1; padding: 1.5rem 1.75rem 3rem; max-width: 1500px; width: 100%; margin: 0 auto; }

/* réglages: submenu lateral próprio, só nesta área */
.reglages-layout { display: flex; gap: 1.75rem; align-items: flex-start; }
.reglages-submenu { width: 210px; flex-shrink: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem; box-shadow: var(--shadow); }
.reglages-submenu .grupo-titulo { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); font-weight: 600; padding: .75rem .75rem .35rem; }
.reglages-submenu a { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .88rem; font-weight: 500; }
.reglages-submenu a:hover { background: var(--bg); }
.reglages-submenu a.active { background: var(--green-bg); color: var(--green); font-weight: 600; }
.reglages-content { flex: 1; min-width: 0; }

/* ===================== cartões / grelhas ===================== */

.card-form, .card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.card-form { max-width: 520px; }

/* 2026-07-15 (zona "à placer" vazia — afinação UX): sem itens, a faixa
   fica visualmente inerte (fundo neutro, sombra ausente, texto discreto)
   — nunca a mesma aparência "viva" de quando há algo à espera. */
.zona-a-placer-inerte { background: var(--bg); box-shadow: none; }
.zona-a-placer-inerte #zona-a-placer-toggle { cursor: default; }
#zona-a-placer-label-vazia { font-size: .82rem; }

.card-form label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: .88rem; }

.card-form input[type=text], .card-form input[type=email], .card-form input[type=password],
.card-form input[type=number], .card-form input[type=date], .card-form input[type=time],
.card-form select, .card-form textarea {
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.92rem;
    font-weight: normal;
    font-family: var(--font-body);
    background: #fff;
    color: var(--text);
}
.card-form input:focus, .card-form select:focus, .card-form textarea:focus { outline: 2px solid var(--green); outline-offset: -1px; }

.checkbox-label { flex-direction: row !important; align-items: center; gap: 0.5rem !important; }
.param-desc { font-weight: normal; color: var(--text-secondary); font-size: .85rem; }

button, .card-form button, .btn {
    background: var(--navy);
    color: #fff;
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: 7px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-family: var(--font-body);
    text-decoration: none;
}
button:hover, .btn:hover { background: var(--navy-soft); }
button:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--green); }
.btn-primary:hover { background: #188a46; }
.btn-secondary { background: #fff; color: var(--navy); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
/* "Ajuster manuellement" (Planification, 2026-07-11): cor a dizer que o
   painel de ferramentas está aberto — nunca um estado de "arrastar
   permitido/proibido", o drag-and-drop dos cartões está sempre activo. */
.btn-secondary.btn-activo { background: var(--green); color: #fff; border-color: var(--green); }
.btn-secondary.btn-activo:hover { background: #188a46; }
.btn-cancelar, .btn-ghost { background: none; color: var(--text-secondary); }
.btn-cancelar:hover, .btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--red); }
/* separadores tipo "carteira-tab" nunca tinham estado activo visível —
   bug reportado 2026-07-10 (dois onglets pareciam iguais sempre). */
.carteira-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.carteira-tab.active:hover { background: var(--navy-soft); }
.btn-danger:hover { background: #a52a18; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }

.link-button { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 0.4rem 0; font-size: 0.88rem; }

.inline-group { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: 0.5rem; margin: 0.5rem 0; }

.data-table { width: 100%; border-collapse: collapse; background: var(--card-bg); margin-bottom: 1.5rem; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th { text-align: left; padding: 0.6rem 0.9rem; background: var(--bg); color: var(--text-secondary); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.data-table td { text-align: left; padding: 0.6rem 0.9rem; border-top: 1px solid var(--border); font-size: .9rem; }
.row-actions { display: flex; gap: 0.75rem; }
.row-actions a, .row-actions .link-button { color: var(--navy); text-decoration: none; background: none; border: none; cursor: pointer; padding: 0; font-size: 0.88rem; font-weight: 600; }

.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.alert-error { background: var(--red-bg); color: var(--red); }
.alert-success { background: var(--ok-bg); color: var(--ok); }
.alert-warning { background: var(--amber-bg); color: var(--amber); }
.alert.discreet { background: transparent; border: 1px dashed var(--border); color: var(--text-secondary); padding: .5rem .75rem; font-size: .82rem; }
.alert.discreet .btn-sm { padding: .25rem .6rem; }
.erro-rede-inline { background: var(--amber-bg); color: var(--amber); padding: .4rem .65rem; border-radius: var(--radius); font-size: .82rem; display: flex; align-items: center; gap: .4rem; margin-top: .4rem; }
.erro-rede-inline .link-button { color: var(--amber); font-weight: 600; text-decoration: underline; }

.status-grid { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.status-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1.25rem; display: flex; flex-direction: column; gap: 0.3rem; min-width: 140px; }
.status-card strong { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-secondary); font-weight: 600; }
.status-card span { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; color: var(--navy); }

.badge { padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.78rem; width: fit-content; font-weight: 600; display: inline-flex; align-items: center; gap: .3rem; }
.badge-ok, .badge-green { background: var(--ok-bg); color: var(--ok); }
.badge-down, .badge-red { background: var(--red-bg); color: var(--red); }
/* 2026-07-16 ("cor do badge = folga real"): "en retard" — planeada DEPOIS
   da própria échéance, só possível por forçagem humana — precisa de se
   distinguir claramente do vermelho "normal" (prazo é hoje). */
.badge-red-dark { background: var(--red); color: #fff; }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-neutral { background: var(--bg); color: var(--text-secondary); }

.current-file { font-weight: normal; color: var(--text-secondary); font-size: 0.85rem; }

/* ===================== autenticação ===================== */

.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--navy); }
.auth-box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 2.5rem; width: 340px; }
.auth-box h1 { margin: 0 0 0.25rem; font-size: 1.4rem; display: flex; align-items: center; gap: .5rem; }
.auth-box h1 .icon { color: var(--green); }
.auth-box h2 { margin: 0 0 1.5rem; font-size: 1rem; color: var(--text-secondary); font-weight: 500; }
.auth-box form { display: flex; flex-direction: column; gap: 1rem; }
.auth-box label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 600; font-size: .88rem; }
.auth-box input { padding: 0.6rem; border: 1px solid var(--border); border-radius: 6px; font-size: 1rem; }
.auth-box .lang-switch { margin-top: 1.5rem; text-align: center; }
.auth-box .lang-switch a { color: var(--text-secondary); margin: 0 0.4rem; text-decoration: none; }
.auth-box .lang-switch a.active { color: var(--green); font-weight: 700; }

/* ===================== /dispatch: linhas dinâmicas de entrega ===================== */

.entrega-linha { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; margin-bottom: 0.6rem; background: #fff; }
.linha-principal { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.linha-principal input[type=text] { padding: 0.45rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; }
.linha-nome, .linha-notas { flex: 1; min-width: 120px; }
.linha-localidade { font-size: 0.82rem; color: var(--text-secondary); min-width: 90px; }
.linha-localidade.ok { color: var(--ok); }
.linha-localidade.erro { color: var(--red); }
.linha-contraintes-toggle { flex-direction: row !important; align-items: center; gap: 0.3rem !important; font-size: 0.88rem; white-space: nowrap; }
.linha-morada-wrap { position: relative; }
.linha-sugestoes {
    position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--border);
    border-radius: 6px; box-shadow: var(--shadow); z-index: 20; max-height: 220px; overflow-y: auto;
}
.sugestao-item { padding: 0.5rem 0.75rem; cursor: pointer; font-size: 0.88rem; }
.sugestao-item:hover { background: var(--bg); }
.linha-contraintes-painel { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 0.5rem; }
.linha-contraintes-painel .inline-group { flex-wrap: wrap; gap: 0.75rem; }
.linha-contraintes-painel label { font-weight: normal; font-size: 0.88rem; }
.icones-contraintes .icon { width: 1em; height: 1em; color: var(--text-secondary); }

/* ===================== LIVE ===================== */

.day-strip {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    flex-wrap: wrap;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 1.25rem;
}
.day-strip .sep { color: var(--slate-light); font-weight: 400; }
.day-strip .n { color: var(--navy); }
.day-strip .alertas { color: var(--red); }

.notif-bell-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-left: auto;
    border: none;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
}
.notif-bell-btn:hover { background: var(--border); }
.notif-bell-btn .icon { width: 20px; height: 20px; }

.live-layout { display: grid; grid-template-columns: 1fr 320px; gap: 1.25rem; align-items: start; }
@media (max-width: 1300px) { .live-layout { grid-template-columns: 1fr; } }

.live-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.live-side { display: flex; flex-direction: column; gap: .75rem; min-width: 0; }

.torre-cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.25rem; }
@media (max-width: 900px) { .torre-cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .torre-cards-grid { grid-template-columns: 1fr; } }

.truck-filter { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .25rem; }
.truck-chip {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    padding: .35rem .85rem;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
.truck-chip .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.truck-chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.truck-chip.all.active { background: var(--green); border-color: var(--green); }

#torre-map, #plano-map, #map {
    border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border);
    /* Leaflet posiciona os seus painéis/controlos internos com z-index até
    1000 (leaflet.css) — sem um contexto de empilhamento próprio aqui, essas
    camadas escapavam do mapa e ficavam por cima do .topnav (z-index: 100)
    ao fazer scroll. */
    position: relative; z-index: 1;
}

.truck-card { border-left: none !important; position: relative; padding: 1rem 1.1rem; cursor: pointer; transition: box-shadow .15s; }
.truck-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; border-radius: var(--radius) 0 0 var(--radius); background: var(--truck-color, var(--slate)); }
.truck-card.dimmed { opacity: .35; }
.truck-card:hover { box-shadow: 0 2px 10px rgba(20,26,51,.1); }
.truck-card .tc-head { display: flex; justify-content: space-between; align-items: center; }
.truck-card .tc-plate { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.truck-card .tc-delta { font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; margin: .25rem 0; }
.truck-card .tc-progress { background: var(--border); border-radius: 4px; height: 6px; overflow: hidden; margin: .4rem 0; }
.truck-card .tc-progress > div { height: 100%; background: var(--truck-color, var(--green)); }
.truck-card .tc-row { display: flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--text-secondary); margin: .2rem 0; }
.truck-card .tc-row strong { color: var(--text); font-weight: 600; }

/* Détail de la tournée (cartão expansível, Live) */
.detalhe-toggle-btn { display: inline-flex; align-items: center; gap: .3rem; }
.detalhe-chevron { transition: transform .15s ease; width: 14px; height: 14px; }
.detalhe-chevron-aberto { transform: rotate(90deg); }
.detalhe-badge-count { font-size: .68rem; padding: .1rem .45rem; }
.detalhe-tournee-lista { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--border); max-height: 320px; overflow-y: auto; }
.detalhe-tournee-ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.detalhe-item { font-size: .82rem; }
.detalhe-item-linha { display: flex; align-items: center; gap: .4rem; }
.detalhe-item-texto { flex: 1; color: var(--text); }
.detalhe-item-hora { color: var(--text-secondary); font-weight: 600; }
.detalhe-previsto { color: var(--text-secondary); font-weight: 400; white-space: nowrap; }
.detalhe-estado-icon.detalhe-estado-feito { color: var(--green); width: 16px; height: 16px; flex-shrink: 0; }
.detalhe-estado-icon.detalhe-estado-actual { color: var(--truck-color, var(--slate)); width: 16px; height: 16px; flex-shrink: 0; }
.detalhe-estado-circulo { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; }
.detalhe-tipo-icon { width: 14px; height: 14px; color: var(--text-secondary); flex-shrink: 0; }
.detalhe-item-alterada { border-left: 3px solid var(--amber); padding-left: .4rem; margin-left: -.4rem; }
.detalhe-alteracao { margin-top: .2rem; margin-left: 1.6rem; display: flex; align-items: center; gap: .35rem; color: var(--text-secondary); }
.detalhe-item-removida .detalhe-item-texto { text-decoration: line-through; color: var(--text-secondary); }
.detalhe-decalada-badge { font-size: .78rem; color: var(--text-secondary); white-space: nowrap; }
.detalhe-item-removida { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 4rem 2rem; text-align: center; background: var(--card-bg); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-state .icon { color: var(--slate-light); width: 3rem; height: 3rem; }
.empty-state h2 { margin: 0; }
.empty-state p { color: var(--text-secondary); margin: 0; max-width: 420px; }

.notif-panel-toggle { position: relative; }
.notif-count { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; border-radius: 999px; font-size: .68rem; min-width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }
.notif-nao-lida { font-weight: 600; }
#notificacoes-lista { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.notif-linha { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.notif-linha:last-child { border-bottom: none; }
.notif-linha-texto { flex: 1; min-width: 0; }
.notif-linha-acoes { display: flex; gap: .3rem; flex-shrink: 0; }
.notif-linha-acoes .icon { width: 16px; height: 16px; }

/* ===================== PLANIFICATION ===================== */

.plan-day-strip { display: flex; align-items: center; gap: .4rem; margin-bottom: 1.25rem; overflow-x: auto; padding-bottom: .25rem; }
.plan-day-strip .nav-btn { background: none; border: 1px solid var(--border); color: var(--text-secondary); border-radius: 8px; width: 34px; height: 34px; padding: 0; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.plan-day-strip .nav-btn:hover { background: var(--bg); }
.plan-day-chip {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding: .5rem .8rem;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--navy);
    cursor: pointer;
    min-width: 76px;
    text-align: center;
}
.plan-day-chip:hover { background: var(--bg); }
.plan-day-chip.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.plan-day-chip .pd-date { font-weight: 600; font-size: .85rem; }
.plan-day-chip .pd-status { font-size: .68rem; text-transform: uppercase; letter-spacing: .02em; color: var(--text-secondary); }
.plan-day-chip.active .pd-status { color: var(--slate-light); }
.plan-day-chip .pd-icon { width: .8rem; height: .8rem; }
.plan-day-chip .pd-fill-outer { width: 100%; height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; margin-top: .1rem; }
.plan-day-chip.active .pd-fill-outer { background: rgba(255,255,255,.25); }
.plan-day-chip .pd-fill-inner { display: block; height: 100%; border-radius: 2px; }
.plan-day-chip.plan-day-fechado { background: var(--bg); color: var(--text-secondary); cursor: not-allowed; opacity: .6; }
.plan-day-chip.plan-day-fechado:hover { background: var(--bg); }

.status-pill { padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.status-pill.sem-plano { background: var(--bg); color: var(--text-secondary); }
.status-pill.brouillon { background: var(--amber-bg); color: var(--amber); }
.status-pill.validado { background: var(--ok-bg); color: var(--ok); }
.status-pill.em-curso { background: #E1E9FB; color: #2547A8; }
.status-pill.terminado { background: var(--bg); color: var(--text-secondary); }

.truck-departure-row { display: flex; align-items: center; gap: .6rem; padding: .5rem .25rem; border-bottom: 1px solid var(--border); }
.truck-departure-row:last-child { border-bottom: none; }
.truck-departure-row.indisponivel { opacity: .5; }
.truck-departure-row .td-nome { flex: 1; font-weight: 600; font-size: .88rem; }
.truck-departure-row input[type=time] { padding: .4rem .5rem; border: 1px solid var(--border); border-radius: 6px; }

.progress-bar-wrap { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .6rem; align-items: center; }
.progress-bar-outer { width: 100%; max-width: 420px; background: var(--border); border-radius: 6px; height: 10px; overflow: hidden; }
.progress-bar-inner { height: 100%; background: var(--green); transition: width .3s; }

.stop-list { display: flex; flex-direction: column; gap: .4rem; margin-top: .5rem; }
.stop-item {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .5rem .6rem;
    font-size: .85rem;
    cursor: grab;
}
.stop-linha1 { display: flex; align-items: center; gap: .5rem; }
/* Ronda "cartões legíveis" (2026-07-16): arrivée · sur place · départ,
   esquerda→direita, larguras iguais — a mesma anatomia em entregas,
   pausas, bombas e passages au dépôt. */
.stop-linha2 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .4rem; }
.stop-col {
    display: flex; flex-direction: column; gap: .1rem; min-width: 0;
    padding: .3rem .4rem; border-radius: 6px; background: var(--bg-secondary, #f4f4f6);
}
.stop-col-label {
    display: flex; align-items: center; gap: .2rem;
    font-size: .62rem; color: var(--text-secondary); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.stop-col-label .icon { flex-shrink: 0; width: .8rem; height: .8rem; }
.stop-col span.tabular-nums { font-family: var(--font-display); font-weight: 600; font-size: .85rem; }
.stop-pausa-card {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    background: var(--bg-secondary, #f4f4f6);
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: .5rem .6rem;
    font-size: .8rem;
    color: var(--text-secondary);
}
.stop-pausa-card .stop-cp { font-style: italic; }
.stop-pausa-card .icon { flex-shrink: 0; }
/* linha de viagem entre cartões — nunca ".stop-item" (não é arrastável,
   não tem id; ver comentário em planificacao.js::viagemLinhaHtml). */
.viagem-entre-paragens {
    display: flex; align-items: center; justify-content: center; gap: .3rem;
    font-size: .74rem; color: var(--text-secondary); padding: .1rem 0;
}
.viagem-entre-paragens .icon { flex-shrink: 0; opacity: .7; }
.viagem-deposito { font-style: italic; }
/* P2 do diagnóstico (docs/diagnostico_pausa.md) — nunca uma viagem
   negativa em silêncio: cor semântica de erro, nunca decorativa. */
.viagem-incoerente { color: var(--red); font-weight: 600; font-style: normal; }
.viagem-incoerente .icon { opacity: 1; }
.aviso-incoerencia-horaria { margin-bottom: .5rem; font-size: .82rem; padding: .5rem .75rem; }
.stop-item.dragging { opacity: .4; }
.stop-item.drag-over { border-color: var(--navy); border-style: dashed; }
.stop-item .drag-handle { color: var(--slate-light); flex-shrink: 0; }
.stop-item .stop-order { font-weight: 600; color: var(--text-secondary); width: 1.4rem; flex-shrink: 0; }
.stop-item .stop-cp { font-weight: 600; }
.stop-item .stop-cp-bloco { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.stop-item .stop-morada { font-size: .72rem; font-weight: 400; color: var(--text-secondary); white-space: normal; word-break: break-word; }
.stop-item .stop-cp-bloco .badge { width: 100%; box-sizing: border-box; margin-top: .2rem; justify-content: center; }
.stop-item.violacao { border-color: var(--red); background: var(--red-bg); }
.stop-item-depot { background: var(--purple-bg); border-style: dashed; border-color: var(--purple); }
.stop-item-depot .stop-cp { font-style: italic; color: var(--purple); font-weight: 600; }
.stop-item.risco { border-color: var(--amber); background: var(--amber-bg); }
/* Historique: passagem ao depósito (pedido do utilizador 2026-07-13) */
.stop-item-passage-depot { background: var(--amber-bg); border-style: dashed; border-color: var(--amber); }
.stop-item-passage-depot .icon { color: var(--amber); flex-shrink: 0; }
.stop-item-passage-depot .stop-cp { font-style: italic; color: var(--amber); font-weight: 600; }
/* Bloco 4 (2026-07-13): paragem na bomba aceite pelo motorista — visível
   em Planification/Historique, nunca só um FuelLog invisível. */
.stop-item-fuel { background: var(--teal-bg); border-style: dashed; border-color: var(--teal); }
.stop-item-fuel .icon { color: var(--teal); flex-shrink: 0; }
.stop-item-fuel .stop-cp { font-style: italic; color: var(--teal); font-weight: 600; }
.stop-item .stop-warn { color: var(--red); flex-shrink: 0; }
.stop-apagar-btn {
    display: flex; align-items: center; justify-content: center;
    width: 1.5rem; height: 1.5rem; flex-shrink: 0; padding: 0;
    border: none; background: transparent; border-radius: 6px;
    color: var(--slate-light); cursor: pointer;
}
.stop-apagar-btn:hover { background: var(--red-bg); color: var(--red); }
.stop-apagar-btn .icon { width: 1rem; height: 1rem; }

.truck-column { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; min-width: 0; }
.truck-column.drop-target { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-bg); }
.tc-resumo { display: flex; flex-direction: column; gap: .3rem; font-size: 1rem; font-weight: 600; margin-bottom: .6rem; padding-bottom: .6rem; border-bottom: 1px dashed var(--border); color: var(--text); }
/* 4 segmentos (partida/regresso/trajecto/km) — distinguidos por ícone mono,
   nunca por cor (cor fica só para significado semântico: ok/aviso/erro). */
.tc-resumo .tc-seg { font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: .3rem; }
.tc-resumo .tc-seg .icon { color: var(--text-secondary); }
.truck-columns-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }

/* marcador próprio do depósito no mapa — distinto das paragens */
.depot-marker-icon {
    background: var(--navy); color: #fff; border-radius: 50%;
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 2px #fff, var(--shadow);
}
.depot-marker-icon .icon { width: 16px; height: 16px; }

/* ===================== HISTORIQUE ===================== */

.hist-list { display: flex; flex-direction: column; gap: .5rem; }
.hist-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .85rem 1.1rem;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
}
.hist-row:hover { border-color: var(--slate); }
.hist-row .hr-date { font-family: var(--font-display); font-weight: 600; width: 130px; flex-shrink: 0; }
.hist-row .hr-stat { color: var(--text-secondary); font-size: .85rem; }
.hist-row .hr-stat strong { color: var(--text); }

/* ===================== modais ===================== */
/* .modal/.modal-box existiam em várias páginas desde a Fase 3 mas nunca
   tinham CSS próprio (só o display:none/flex do JS) — ficavam sem overlay
   nem caixa centrada. Corrigido ao construir os popups da Carteira. */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(20, 26, 51, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}
.modal-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(20, 26, 51, .25);
    padding: 1.5rem 1.75rem;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-box h2 { margin-top: 0; }
.modal-box textarea, .modal-box input[type=text], .modal-box input[type=date], .modal-box input[type=time] {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.92rem;
    font-family: var(--font-body);
    margin-top: .3rem;
}
.modal-box label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .25rem; }

/* ===================== overlay de carregamento (Parte 1, §6) ===================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(247, 248, 246, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
:root[data-theme="dark"] .loading-overlay { background: rgba(18, 21, 31, .92); }
.loading-box { display: flex; flex-direction: column; align-items: center; gap: 1rem; width: 100%; max-width: 320px; }

/* 2026-07-16: cena temática (camião parado de portas abertas + empilhador
   a entrar com uma caixa) — traço macio e arredondado (pedido do gestor:
   "mais doce e redondo, não tão quadrado e duro"), só cores da identidade
   (navy/verde/slate), zero preenchimento decorativo. */
.loading-scene { width: 100%; height: 82px; overflow: visible; }
.scene-ground { stroke: var(--slate-light); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1 8; }
.scene-truck-outline, .scene-forklift-outline {
    fill: none;
    stroke: var(--navy);
    stroke-width: 3.4;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.scene-truck-door { fill: var(--slate); }
.scene-wheel { fill: var(--navy); }
.scene-forklift-counterweight { fill: var(--navy); }
.scene-bottle-body { fill: var(--green); }
.scene-bottle-neck { fill: var(--navy); }
.scene-bottle-highlight { stroke: var(--green-bg); stroke-width: 1.6; stroke-linecap: round; }

@keyframes scene-forklift-move {
    0%   { transform: translateX(340px); }
    38%  { transform: translateX(104px); }
    58%  { transform: translateX(104px); }
    100% { transform: translateX(340px); }
}
@keyframes scene-cargo-fade {
    0%   { opacity: 0; }
    4%   { opacity: 1; }
    40%  { opacity: 1; }
    48%  { opacity: 0; }
    100% { opacity: 0; }
}
.scene-forklift {
    animation: scene-forklift-move 2.5s ease-in-out infinite;
    transform-box: view-box;
}
.scene-cargo {
    animation: scene-cargo-fade 2.5s ease-in-out infinite;
    transform-box: view-box;
}
@media (prefers-reduced-motion: reduce) {
    .scene-forklift { animation: none; transform: translateX(104px); }
    .scene-cargo { animation: none; opacity: 1; }
}
.loading-texto { font-size: .88rem; color: var(--text-secondary); text-align: center; }

/* ===================== responsivo / diverso ===================== */

.scroll-x { overflow-x: auto; }
.mt-0 { margin-top: 0; }
