/* ============================================================
   Design system — Despachante Náutico Luís Paulo
   Paleta extraída da logomarca (navy + dourado). Mesmos tokens
   usados na versão desktop, agora em CSS de verdade — o que
   permite sombras, gradientes e transições muito mais ricos do
   que era possível desenhar à mão num Canvas do Tkinter.
   ============================================================ */

:root {
  --navy: #1F2956;
  --navy-dark: #12193B;
  --navy-darker: #0B0F27;
  --navy-light: #2E3B78;
  --navy-tint: #EEF0F9;

  --gold: #F6AD12;
  --gold-light: #FFC94D;
  --gold-dark: #C6870A;
  --gold-tint: #FFF4DF;

  --white: #FFFFFF;
  --off-white: #FBFBFD;
  --gray-bg: #EEF0F5;
  --surface: #FFFFFF;
  --surface-alt: #F5F6FA;
  --gray-text: #5B6072;
  --gray-text-soft: #8A8FA3;
  --gray-border: #E1E4EE;
  --gray-border-soft: #EDEFF6;

  --red-alert: #D64545;
  --red-tint: #FDEDEC;
  --green-ok: #1F9D6B;
  --green-tint: #E8F8F1;
  --yellow-warn: #C6870A;
  --yellow-tint: #FFF4DF;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --sp-xxs: 4px; --sp-xs: 8px; --sp-sm: 12px; --sp-md: 16px;
  --sp-lg: 24px; --sp-xl: 32px; --sp-xxl: 48px;

  --shadow-sm: 0 1px 2px rgba(11,15,39,.06), 0 2px 6px rgba(11,15,39,.05);
  --shadow-md: 0 2px 6px rgba(11,15,39,.06), 0 8px 24px rgba(11,15,39,.08);
  --shadow-lg: 0 8px 16px rgba(11,15,39,.08), 0 24px 48px rgba(11,15,39,.14);
  --shadow-gold: 0 6px 16px rgba(198,135,10,.28);

  --font: "Segoe UI", -apple-system, "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--gray-bg);
  color: var(--navy-dark);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; }

/* ---------- Layout raiz ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy-dark) 0%, var(--navy-darker) 100%);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo img { height: 32px; flex-shrink: 0; }
.sidebar-logo .name { color: var(--white); font-weight: 700; font-size: 11.5px; line-height: 1.3; letter-spacing: .01em; white-space: nowrap; }
.sidebar-logo .name small { display: block; color: var(--gold-light); font-size: 9.5px; font-weight: 600; letter-spacing: .04em; }

.nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #B9BEDA;
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.nav a svg, .nav a .ic { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.06); color: var(--white); transform: translateX(2px); }
.nav a.active {
  background: linear-gradient(90deg, rgba(246,173,18,.16), rgba(246,173,18,.03));
  color: var(--white);
  font-weight: 700;
}
.nav a.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: var(--gold); border-radius: 0 3px 3px 0;
}
.sidebar-help {
  margin: 12px; padding: 14px;
  background: rgba(255,255,255,.05);
  border-radius: var(--radius-md);
  color: #C7CBE3; font-size: 12px;
}
.sidebar-help strong { display: block; color: var(--white); font-size: 13px; margin-bottom: 2px; }

/* ---------- Header ---------- */
.topbar {
  height: 66px; flex-shrink: 0;
  background: var(--navy-dark);
  border-bottom: 3px solid var(--gold);
  display: flex; align-items: center; gap: 20px;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .search {
  flex: 1; max-width: 460px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 9px 16px;
  display: flex; align-items: center; gap: 10px;
  color: #C7CBE3;
  transition: background .15s ease, border-color .15s ease;
}
.topbar .search:focus-within { background: rgba(255,255,255,.13); border-color: rgba(246,173,18,.4); }
.topbar .search input { background: transparent; border: none; outline: none; color: var(--white); font-size: 13.5px; flex: 1; }
.topbar .search input::placeholder { color: #9BA0C0; }
.topbar .search kbd { font-size: 10px; color: #9BA0C0; background: rgba(255,255,255,.06); padding: 2px 6px; border-radius: 5px; }
.topbar .spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 10px; color: var(--white); font-size: 13px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(145deg, var(--gold-light), var(--gold-dark));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--navy-darker); font-size: 13px;
  box-shadow: var(--shadow-gold);
}
.topbar-user small { display: block; color: #B9BEDA; font-size: 10.5px; }

.content { flex: 1; min-width: 0; }
.page { padding: 28px 32px 60px; max-width: 1400px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 20px 22px;
}
.card + .card { margin-top: var(--sp-md); }
.card-title { font-size: 15px; font-weight: 700; color: var(--navy); margin: 0 0 4px; }
.card-hint { font-size: 12px; color: var(--gray-text-soft); margin: 0 0 14px; }

/* ---------- Banner ---------- */
.banner {
  background: linear-gradient(120deg, var(--navy-dark) 0%, var(--navy) 55%, var(--navy-light) 130%);
  border-radius: var(--radius-lg);
  padding: 34px 36px;
  color: var(--white);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin-bottom: 22px;
}
.banner::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(600px 260px at 88% -10%, rgba(255,255,255,.10), transparent 60%);
}
.banner .eyebrow { color: var(--gold-light); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.banner h1 { font-size: 30px; margin: 6px 0 6px; font-weight: 800; letter-spacing: -.01em; }
.banner p { margin: 0; opacity: .85; font-style: italic; font-size: 14px; }
.banner .place { position: absolute; top: 34px; right: 36px; font-size: 12px; opacity: .75; }

/* ---------- KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--sp-md); margin-bottom: var(--sp-md); }
.kpi {
  background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-badge {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(11,15,39,.10);
}
.kpi-value { font-size: 26px; font-weight: 800; color: var(--navy-dark); }
.kpi-label { font-size: 12.5px; color: var(--gray-text); }
.kpi-trend { font-size: 11px; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.kpi-trend.up { color: var(--green-ok); }
.kpi-trend.flat { color: var(--gray-text-soft); }

/* ---------- Grid de duas colunas ---------- */
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--sp-md); align-items: start; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Ações rápidas ---------- */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-action {
  display: flex; align-items: center; gap: 12px;
  background: var(--navy-tint);
  border-radius: var(--radius-md);
  padding: 14px 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  cursor: pointer; border: none; width: 100%; text-align: left;
}
.quick-action.gold { background: var(--gold-tint); }
.quick-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.quick-action .ic-badge {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.65);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.quick-action span { font-size: 12.5px; font-weight: 700; color: var(--navy-dark); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border-radius: 11px;
  font-size: 13.5px; font-weight: 700;
  border: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-gold { background: linear-gradient(160deg, var(--gold-light), var(--gold)); color: var(--navy-darker); box-shadow: var(--shadow-gold); }
.btn-gold:hover { filter: brightness(1.05); box-shadow: 0 8px 22px rgba(198,135,10,.36); }
.btn-navy { background: linear-gradient(160deg, var(--navy-light), var(--navy-dark)); color: var(--white); box-shadow: 0 6px 16px rgba(18,25,59,.28); }
.btn-navy:hover { filter: brightness(1.1); }
.btn-ghost { background: var(--surface-alt); color: var(--navy-dark); box-shadow: none; border: 1px solid var(--gray-border); }
.btn-ghost:hover { background: var(--gray-border-soft); }
.btn-danger { background: linear-gradient(160deg, #E4685F, var(--red-alert)); color: var(--white); box-shadow: 0 6px 16px rgba(214,69,69,.3); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: none !important; transform: none !important; }

/* ---------- Formulários ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--gray-text); margin-bottom: 5px; }
.field input[type=text], .field input[type=password], .field input[type=email],
.field input[type=date], .field input[type=number], .field select, .field textarea {
  width: 100%; padding: 9px 12px; font-size: 13.5px;
  border: 1px solid var(--gray-border); border-radius: 9px;
  background: var(--white); color: var(--navy-dark);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(246,173,18,.16);
}
.field .hint { font-size: 11px; color: var(--gray-text-soft); margin-top: 4px; }
.field-row { display: grid; gap: 14px; }
.field-row.cols-2 { grid-template-columns: 1fr 1fr; }
.field-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.field-row.cols-4 { grid-template-columns: repeat(4, 1fr); }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--navy-dark); margin-bottom: 10px; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--gold-dark); }

fieldset.section { border: none; padding: 0; margin: 0 0 26px; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.section-title .bar { width: 4px; height: 16px; background: var(--gold); border-radius: 2px; }
.section-hint { font-size: 12px; color: var(--gray-text-soft); margin: 0 0 14px 12px; }

/* ---------- Tabelas ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th {
  text-align: left; background: var(--navy-dark); color: var(--white);
  padding: 10px 14px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
}
table.data thead th:first-child { border-radius: 8px 0 0 8px; }
table.data thead th:last-child { border-radius: 0 8px 8px 0; }
table.data tbody tr { transition: background .12s ease; }
table.data tbody tr:hover { background: var(--surface-alt); }
table.data tbody tr.selected { background: var(--gold-tint); }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--gray-border-soft); color: var(--navy-dark); }
table.data tbody tr:last-child td { border-bottom: none; }

.badge { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-green { background: var(--green-tint); color: var(--green-ok); }
.badge-red { background: var(--red-tint); color: var(--red-alert); }
.badge-gold { background: var(--gold-tint); color: var(--gold-dark); }
.badge-gray { background: var(--surface-alt); color: var(--gray-text-soft); }

/* ---------- Cartões de entidade (listas que antes eram tabela) ---------- */
.card-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.card-grid > * { flex: 1 1 300px; }
.entity-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--gray-border); border-radius: 14px;
  padding: 16px; position: relative; overflow: hidden;
}
.entity-card-avatar {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; background: var(--gold-tint); color: var(--gold-dark);
}
.entity-card-body { flex: 1; min-width: 0; }
.entity-card-title { font-weight: 700; font-size: 14.5px; color: var(--navy-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-card-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--gray-text-soft); margin-top: 3px; }
.entity-card-meta span + span::before { content: "·"; margin-right: 10px; color: var(--gray-border); }
.entity-card-action { flex-shrink: 0; }

.alert-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--gray-border); border-radius: 14px;
  padding: 14px 16px;
}
.alert-card-dia {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0;
  background: var(--surface-alt);
}
.alert-card-dia-num { font-size: 17px; font-weight: 800; line-height: 1; }
.alert-card-dia-mes { font-size: 10px; font-weight: 700; opacity: .7; }
.alert-card-body { flex: 1; min-width: 0; }
.alert-card-title { font-weight: 700; font-size: 14px; color: var(--navy-dark); }
.alert-card-meta { font-size: 12px; color: var(--gray-text-soft); margin-top: 2px; }
.alert-card-urgente .alert-card-dia { background: var(--red-tint); color: var(--red-alert); }

/* ---------- Kanban de Processos ---------- */
.kanban { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 10px; }
.kanban-col { flex: 1 1 260px; min-width: 260px; background: var(--surface-alt); border-radius: 16px; padding: 10px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 10px; font-weight: 800; font-size: 13px; margin-bottom: 8px; }
.kanban-count { background: rgba(255,255,255,.5); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.kanban-col.azul .kanban-col-head, .kanban-col-head.kanban-azul { background: var(--navy-tint); color: var(--navy); }
.kanban-col-head.kanban-vermelho { background: var(--red-tint); color: var(--red-alert); }
.kanban-col-head.kanban-dourado { background: var(--gold-tint); color: var(--gold-dark); }
.kanban-col-head.kanban-verde { background: var(--green-tint); color: var(--green-ok); }
.kanban-col-body { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.kanban-card {
  background: var(--surface); border-radius: 14px; padding: 12px 14px;
  border-left: 4px solid var(--gray-border); box-shadow: 0 1px 2px rgba(20,25,43,.04);
  display: flex; flex-direction: column; gap: 6px;
}
.kanban-card.pag-pago { border-left-color: var(--green-ok); }
.kanban-card.pag-aguardando { border-left-color: var(--gold-dark); }
.kanban-card.pag-pendente { border-left-color: var(--red-alert); }
.kanban-card-title { font-weight: 700; font-size: 13.5px; color: var(--navy-dark); }
.kanban-card-cliente { font-size: 12.5px; color: var(--gray-text); }
.kanban-card-meta { display: flex; gap: 10px; font-size: 11px; color: var(--gray-text-soft); }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.kanban-card-valor { font-weight: 800; font-size: 12.5px; color: var(--navy-dark); }

/* ---------- Lista de transações (Financeiro) ---------- */
.txn-list { display: flex; flex-direction: column; }
.txn-row { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--gray-border-soft); }
.txn-row:last-child { border-bottom: none; }
.txn-icon { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; }
.txn-icon-in { background: var(--green-tint); color: var(--green-ok); }
.txn-icon-out { background: var(--red-tint); color: var(--red-alert); }
.txn-info { flex: 1; min-width: 0; }
.txn-desc { font-weight: 700; font-size: 13.5px; color: var(--navy-dark); }
.txn-meta { font-size: 12px; color: var(--gray-text-soft); margin-top: 2px; }
.txn-nf { flex-shrink: 0; }
.txn-nf input { width: 84px; padding: 5px 8px; font-size: 11.5px; border: 1px solid var(--gray-border); border-radius: 7px; }
.txn-valor { font-weight: 800; font-size: 14.5px; flex-shrink: 0; min-width: 110px; text-align: right; }
.txn-valor-in { color: var(--green-ok); }
.txn-valor-out { color: var(--red-alert); }
.txn-acoes { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- Alertas/avisos ---------- */
.notice { border-radius: var(--radius-md); padding: 14px 16px; font-size: 13px; margin-bottom: 16px; }
.notice-green { background: var(--green-tint); color: #146848; }
.notice-red { background: var(--red-tint); color: #A3312E; }
.notice-gold { background: var(--gold-tint); color: #8A5F07; }
.notice-big {
  display: flex; align-items: center; gap: 12px;
  font-size: 15px; font-weight: 700; padding: 18px 22px;
  border-width: 2px; border-style: solid;
  animation: notice-pop .35s cubic-bezier(.2,.9,.3,1.2);
}
.notice-big.notice-green { border-color: rgba(31,157,107,.35); }
.notice-big.notice-red { border-color: rgba(214,69,69,.35); }
.notice-big.notice-gold { border-color: rgba(198,135,10,.35); }
.notice-icon {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff;
}
.notice-big.notice-green .notice-icon { background: #1F9D6B; }
.notice-big.notice-red .notice-icon { background: #D64545; }
.notice-big.notice-gold .notice-icon { background: #C6870A; }
@keyframes notice-pop {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 700px at 20% 0%, var(--navy-light) 0%, var(--navy-dark) 55%, var(--navy-darker) 100%);
}
.login-card {
  background: var(--white); border-radius: 22px; box-shadow: var(--shadow-lg);
  padding: 44px 40px; width: 380px; text-align: center;
}
.login-card img { height: 56px; margin-bottom: 14px; }
.login-card h1 { font-size: 19px; margin: 0 0 4px; color: var(--navy-dark); }
.login-card p.sub { font-size: 12.5px; color: var(--gray-text-soft); margin: 0 0 24px; }
.login-card .field { text-align: left; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--gray-text-soft); font-size: 13px; }

/* ---------- Utilitários ---------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.text-soft { color: var(--gray-text-soft); }
.text-sm { font-size: 12.5px; }
