/* =========================================================
   JF Seguros — Plataforma de gestão
   Identidade visual alinhada com jfsegurosecreditos.pt
   ========================================================= */

/* ---------- Fontes (servidas localmente, sem pedidos a terceiros) ---------- */
@font-face { font-family: 'Figtree'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/figtree-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 500; font-style: normal; font-display: swap; src: url('../fonts/figtree-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/figtree-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/figtree-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/bricolage-grotesque-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/bricolage-grotesque-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 800; font-style: normal; font-display: swap; src: url('../fonts/bricolage-grotesque-latin-800-normal.woff2') format('woff2'); }

:root {
  /* Paleta do site do cliente */
  --blue: #2D7DD2;
  --blue-deep: #1B5FA8;
  --blue-dark: #0E2A47;
  --blue-soft: #EAF3FC;
  --blue-pale: #F4F9FE;
  --green: #6CBF3F;
  --green-ink: #3F7A1E;
  --green-soft: #EDF8E4;
  --orange: #F39C2C;
  --orange-ink: #9A5A0B;
  --orange-soft: #FEF3E2;
  --red: #C8372D;
  --red-ink: #9E2A22;
  --red-soft: #FDECEA;
  --white: #FFFFFF;
  --ink: #14375C;
  --ink-soft: #5B7693;
  --line: #DCE9F5;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 40px rgba(27, 95, 168, .12);
  --shadow-sm: 0 2px 10px rgba(27, 95, 168, .08);
  --sidebar-w: 248px;
  --topbar-h: 68px;
  --bottomnav-h: 66px;
  --font: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Figtree', 'Segoe UI', sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--ink); background: var(--blue-pale);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--blue-dark); margin: 0; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 12px; }
a { color: var(--blue); }
a:hover { color: var(--blue-deep); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(45, 125, 210, .45); 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; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 26px; height: 26px; }

/* ---------- Ecrãs de autenticação ---------- */
.auth-wrap {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(ellipse 55% 70% at 85% 15%, rgba(108, 191, 63, .12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 10% 90%, rgba(45, 125, 210, .14) 0%, transparent 60%),
    var(--blue-pale);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--white); border: 1px solid var(--line);
  border-radius: 24px; box-shadow: var(--shadow); padding: 32px 28px;
}
.auth-card .logo { width: 220px; max-width: 80%; margin: 0 auto 22px; }
.auth-card h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.auth-card .sub { text-align: center; color: var(--ink-soft); margin-bottom: 22px; font-size: 14px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 14px; }
.auth-secure { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 20px; color: var(--ink-soft); font-size: 12.5px; }
.auth-secure .icon { color: var(--green); }

/* ---------- Estrutura da aplicação ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--white);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 30;
}
.sidebar .brand { padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.sidebar .brand img { width: 170px; }
.nav { list-style: none; margin: 0; padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 999px;
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: 14.5px; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--blue-pale); color: var(--blue); }
.nav a.active { background: var(--blue-soft); color: var(--blue-deep); font-weight: 700; }
.nav a .badge-count { margin-left: auto; }
.nav .sep { height: 1px; background: var(--line); margin: 8px 10px; }
.sidebar .user { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none;
}
.sidebar .user .nome { font-weight: 600; font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .user .email { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: rgba(244, 249, 254, .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .titulo { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--blue-dark); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .mobile-brand { display: none; }
.content { padding: 26px 28px 40px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 4px 0 0; color: var(--ink-soft); }
.bottomnav { display: none; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid transparent; border-radius: 999px; padding: 10px 20px; min-height: 44px;
  font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .15s, box-shadow .2s, background .2s, color .2s, border-color .2s;
  background: var(--white); color: var(--blue); border-color: var(--line);
}
.btn:hover { border-color: var(--blue); background: var(--blue-pale); }
.btn:disabled, .btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; transform: none !important; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 6px 18px rgba(45, 125, 210, .32); }
.btn-primary:hover { background: var(--blue-deep); border-color: var(--blue-deep); color: #fff; transform: translateY(-1px); box-shadow: 0 10px 26px rgba(45, 125, 210, .42); }
.btn-outline { background: var(--white); color: var(--blue); border-color: var(--blue); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 6px 18px rgba(108, 191, 63, .32); }
.btn-green:hover { background: #5BAA31; border-color: #5BAA31; color: #fff; }
.btn-danger { background: var(--white); color: var(--red); border-color: #F3C4BF; }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--blue-soft); border-color: transparent; color: var(--blue-deep); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: none; background: transparent; color: var(--ink-soft); cursor: pointer; position: relative; flex: none;
  text-decoration: none;
}
.icon-btn:hover { background: var(--blue-soft); color: var(--blue-deep); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--blue-pale); }
.btn .spinner, .icon-btn .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Cartões ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 16.5px; }
.card-body { padding: 18px 22px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .kpi-label { font-size: 13px; color: var(--ink-soft); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .kpi-value { font-family: var(--font-display); font-size: 30px; font-weight: 800; color: var(--blue-dark); line-height: 1.1; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi .kpi-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }
.kpi .kpi-ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.kpi.verde .kpi-ico { background: var(--green-soft); color: var(--green-ink); }
.kpi.laranja .kpi-ico { background: var(--orange-soft); color: var(--orange-ink); }
.kpi.vermelho .kpi-ico { background: var(--red-soft); color: var(--red); }
.kpi::after { content: ''; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%; border: 16px solid rgba(45, 125, 210, .05); }
a.kpi { text-decoration: none; color: inherit; transition: transform .15s, box-shadow .2s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* ---------- Estados (badges) ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--blue-soft); color: var(--blue-deep); }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge.plain::before { display: none; }
.badge.em_dia, .badge.ativo, .badge.ativa, .badge.enviado { background: var(--green-soft); color: var(--green-ink); }
.badge.aviso, .badge.em_negociacao, .badge.prospeto, .badge.pendente { background: var(--orange-soft); color: var(--orange-ink); }
.badge.urgente, .badge.falhou { background: var(--red-soft); color: var(--red-ink); }
.badge.expirada { background: #F6CFCB; color: var(--red-ink); }
.badge.inativa, .badge.inativo, .badge.anulada, .badge.terminada, .badge.ignorado, .badge.a_enviar { background: #EEF2F6; color: #5B6B7D; }
.badge-count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--orange); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--blue-pale); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }

/* ---------- Formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 12.5px; color: var(--ink-soft); }
.field .erro { font-size: 12.5px; color: var(--red); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--white); color: var(--ink); font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(45, 125, 210, .15); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--red); }
.input:disabled { background: var(--blue-pale); color: var(--ink-soft); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 48px; }
.input-group .icon-btn { position: absolute; right: 4px; }
.input-search { position: relative; }
.input-search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
.input-search .input { padding-left: 42px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px 4px; margin: 4px 0 16px; background: var(--blue-pale); }
.fieldset legend { font-weight: 700; font-size: 13.5px; padding: 0 6px; color: var(--blue-dark); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.alert .icon { margin-top: 1px; }
.alert.info { background: var(--blue-soft); color: var(--blue-deep); }
.alert.erro { background: var(--red-soft); color: var(--red-ink); }
.alert.ok { background: var(--green-soft); color: var(--green-ink); }
.alert.aviso { background: var(--orange-soft); color: var(--orange-ink); }

/* ---------- Toolbar / filtros ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .input-search { flex: 1 1 280px; }
.toolbar .select { width: auto; min-width: 150px; flex: 0 1 200px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { border: 1.5px solid var(--line); background: var(--white); border-radius: 999px; padding: 7px 14px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--blue); border-color: var(--blue); }
.tab.active { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.tab .n { font-size: 12px; opacity: .8; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--blue-pale); white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--blue); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: var(--blue-pale); }
.table tbody tr:last-child td { border-bottom: none; }
.table .t-title { font-weight: 600; color: var(--blue-dark); }
.table .t-sub { font-size: 12.5px; color: var(--ink-soft); }
.table .acoes { white-space: nowrap; text-align: right; width: 1%; }
.cards-list { display: none; }

/* ---------- Listas ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 13px 22px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.list-item:last-child { border-bottom: none; }
a.list-item:hover { background: var(--blue-pale); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; color: var(--blue-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-sub { font-size: 13px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date-box { width: 50px; flex: none; text-align: center; border-radius: 12px; background: var(--blue-soft); color: var(--blue-deep); padding: 6px 0; line-height: 1.05; }
.date-box .d { font-family: var(--font-display); font-size: 19px; font-weight: 800; }
.date-box .m { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.date-box.urgente, .date-box.expirada { background: var(--red-soft); color: var(--red-ink); }
.date-box.aviso { background: var(--orange-soft); color: var(--orange-ink); }

.empty { text-align: center; padding: 42px 20px; color: var(--ink-soft); }
.empty .icon { width: 44px; height: 44px; color: #A9C3DC; margin: 0 auto 10px; }
.empty h3 { color: var(--blue-dark); margin-bottom: 6px; }

/* barras do painel */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row .bar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; margin-bottom: 5px; }
.bar-row .bar-top b { font-weight: 600; color: var(--blue-dark); }
.bar-track { height: 8px; background: var(--blue-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--blue-deep)); border-radius: 999px; }

/* detalhes */
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; margin: 0; }
.dl div { min-width: 0; }
.dl dt { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); font-weight: 700; margin-bottom: 2px; }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.dl .span-2 { grid-column: 1 / -1; }
.hero-card { background: linear-gradient(135deg, var(--blue-dark), var(--blue-deep)); color: #fff; border: none; }
.hero-card h1, .hero-card h2 { color: #fff; }
.hero-card .muted { color: rgba(255, 255, 255, .75); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 28px; }
.timeline li::before { content: ''; position: absolute; left: 7px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .tl-dot { position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--blue-soft); border: 3px solid var(--blue); }
.timeline .tl-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); }
.timeline .tl-body { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* lembretes no formulário */
/* duas linhas: [tipo | quantidade/data] e [canais ... remover] — funciona também em cartões estreitos */
.lembrete-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 40px; gap: 8px 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.lembrete-row > .select { grid-column: 1; }
.lembrete-row .valor-data { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 8px; }
.lembrete-row .valor-data .input { flex: 1 1 110px; min-width: 0; }
.lembrete-row .valor-data [data-k="data"] { flex: 1 1 160px; }
.lembrete-row .canais { grid-column: 1 / 3; display: flex; gap: 16px; flex-wrap: wrap; }
.lembrete-row:last-child { border-bottom: none; }
/* avisos predefinidos (Definições): uma linha em ecrã largo */
.pred-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto auto 40px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.pred-row:last-child { border-bottom: none; }
.pred-row .canais { display: flex; gap: 14px; }

/* ---------- Links rápidos ---------- */
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.link-tile {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: var(--radius);
  background: var(--white); border: 1px solid var(--line); text-decoration: none; color: var(--ink); min-height: 120px;
  box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .2s, border-color .2s; overflow: hidden;
}
.link-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--blue); color: var(--ink); }
.link-tile .lt-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--blue); font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.link-tile.verde .lt-ico { background: var(--green); }
.link-tile.laranja .lt-ico { background: var(--orange); }
.link-tile.escuro .lt-ico { background: var(--blue-dark); }
.link-tile .lt-title { font-weight: 700; color: var(--blue-dark); font-size: 15px; margin-top: 4px; }
.link-tile .lt-desc { font-size: 13px; color: var(--ink-soft); }
.link-tile .lt-host { font-size: 12px; color: var(--blue); margin-top: auto; display: flex; gap: 4px; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.link-tile .lt-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.link-tile:hover .lt-actions, .link-tile:focus-within .lt-actions { opacity: 1; }
.links-cat { margin: 22px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 700; }

/* ---------- Cofre ---------- */
.vault-lock { max-width: 420px; margin: 30px auto; text-align: center; padding: 34px 28px; }
.vault-lock .lock-ico { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--blue-dark), var(--blue-deep)); color: #fff; box-shadow: var(--shadow); }
.vault-lock .lock-ico .icon { width: 34px; height: 34px; }
.pin-input { text-align: center; font-size: 22px; letter-spacing: .35em; font-weight: 700; }
.vault-bar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: var(--radius); background: var(--blue-dark); color: #fff; margin-bottom: 16px; flex-wrap: wrap; }
.vault-bar .icon { color: var(--green); }
.vault-bar .btn { min-height: 36px; padding: 6px 14px; }
.vault-bar .timer { font-variant-numeric: tabular-nums; opacity: .85; font-size: 13.5px; }
.secret { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; letter-spacing: .04em; }
.pw-meter { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 4px; }
.pw-meter span { display: block; height: 100%; width: 0; background: var(--red); transition: width .2s, background .2s; }

/* ---------- Modal ---------- */
dialog.modal { border: none; padding: 0; border-radius: 22px; width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 30px 80px rgba(14, 42, 71, .35); color: var(--ink); }
dialog.modal.sm { width: min(460px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(14, 42, 71, .45); backdrop-filter: blur(2px); }
.modal-inner { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; font-size: 18px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--blue-pale); flex-wrap: wrap; }

/* ---------- Painel de notificações ---------- */
.notif-panel { position: fixed; top: calc(var(--topbar-h) - 6px); right: 18px; width: min(400px, calc(100vw - 24px)); max-height: 70vh; overflow: hidden; display: flex; flex-direction: column; z-index: 40; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.notif-panel .np-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.notif-panel .np-list { overflow-y: auto; }
.notif-item { display: block; padding: 12px 18px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.notif-item:hover { background: var(--blue-pale); }
.notif-item.nova { background: #F7FBFF; box-shadow: inset 3px 0 0 var(--orange); }
.notif-item .ni-t { font-weight: 700; color: var(--blue-dark); font-size: 14px; }
.notif-item .ni-b { font-size: 13px; color: var(--ink); }
.notif-item .ni-d { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 32px); }
.toast { display: flex; gap: 10px; align-items: center; background: var(--blue-dark); color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow); font-size: 14px; font-weight: 500; animation: toastIn .25s ease; max-width: 420px; }
.toast.erro { background: var(--red-ink); }
.toast.ok .icon { color: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.loading { display: grid; place-items: center; padding: 60px 0; color: var(--ink-soft); }
.loading .spinner { width: 28px; height: 28px; border: 3px solid var(--blue-soft); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
.offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 200; background: var(--orange); color: #fff; text-align: center; font-size: 13px; font-weight: 600; padding: 4px; }

/* sheet "Mais" (telemóvel) */
.sheet { position: fixed; inset: auto 0 0 0; z-index: 60; background: var(--white); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(14, 42, 71, .25); padding: 10px 14px calc(16px + env(safe-area-inset-bottom)); }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(14, 42, 71, .4); z-index: 55; }
.sheet .grab { width: 44px; height: 5px; border-radius: 999px; background: var(--line); margin: 4px auto 12px; }
.sheet a, .sheet button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 12px; border: none; background: none; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; border-radius: 14px; cursor: pointer; }
.sheet a:hover, .sheet button:hover { background: var(--blue-pale); }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 12px 0 16px; height: 60px; }
  .topbar .mobile-brand { display: block; width: 34px; height: 34px; }
  .topbar .titulo { font-size: 17px; }
  .notif-panel { top: 56px; right: 12px; }
  .content { padding: 18px 16px 28px; }
  h1 { font-size: 22px; }
  .page-head { margin-bottom: 16px; }
  .page-head .btn { flex: 1; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px 16px; }
  .kpi .kpi-value { font-size: 24px; }
  .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .toolbar .select { flex: 1 1 140px; }
  .table-wrap.responsive { display: none; }
  .cards-list { display: block; }
  .pred-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; }
  .pred-row .canais { grid-column: 1 / 3; }
  .pred-row > span:empty { display: none; }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--white);
    border-top: 1px solid var(--line); height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 20px rgba(27, 95, 168, .08);
  }
  .bottomnav a, .bottomnav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    text-decoration: none; color: var(--ink-soft); font-size: 11px; font-weight: 600; border: none; background: none; cursor: pointer;
  }
  .bottomnav a.active { color: var(--blue); }
  .bottomnav a.active .icon { stroke-width: 2.4; }
  .toasts { bottom: calc(var(--bottomnav-h) + 14px); right: 12px; left: 12px; }
  .toast { max-width: none; }
  dialog.modal { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  .modal-inner { max-height: 100dvh; height: 100%; }
  .modal-body { flex: 1; }
  .link-tile .lt-actions { opacity: 1; }
}

/* cartões em vez de tabelas (telemóvel) */
.m-card { display: block; padding: 14px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.m-card:last-child { border-bottom: none; }
.m-card .mc-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.m-card .mc-title { font-weight: 700; color: var(--blue-dark); }
.m-card .mc-sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.m-card .mc-foot { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-top: 8px; font-size: 13px; }

@media print {
  .sidebar, .topbar, .bottomnav, .toolbar, .page-head .btn, .acoes { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Complementos ---------- */
.link-tile .stretched { display: flex; flex-direction: column; gap: 6px; flex: 1; text-decoration: none; color: inherit; }
.link-tile .stretched:focus-visible { outline: none; }
.link-tile:has(.stretched:focus-visible) { outline: 3px solid rgba(45, 125, 210, .45); outline-offset: 2px; }
.list-item .kpi-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); flex: none; }
.list-item > .icon { color: var(--blue); }
code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; background: var(--blue-pale); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: 13px; }
.hero-card .btn { box-shadow: none; }
.hero-card .avatar { width: 52px; height: 52px; font-size: 18px; background: rgba(255,255,255,.16); }
.tab .icon { width: 16px; height: 16px; }
a.tab { text-decoration: none; }
.vault-lock h2 { margin-bottom: 6px; }
