/* =====================================================================
   KIT DE DESIGN — extraído do mailrede (valores idênticos ao original)
   Estilo: "papel + tinta". Fundo creme, tinta quase preta, bordas de
   1,5px, cantos 100% retos, sombras sólidas "empilhadas" (sem desfoque),
   verde como única cor de destaque. Fontes: Inter + Inter Tight.
   ===================================================================== */

/* ---------- Fontes (arquivos em ./fonts) ---------- */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter Tight"; font-weight: 700; font-display: swap; src: url("fonts/inter-tight-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter Tight"; font-weight: 800; font-display: swap; src: url("fonts/inter-tight-latin-800-normal.woff2") format("woff2"); }

/* ---------- Cores e tokens ---------- */
:root {
  --paper:   #f3f2ee;  /* fundo da página (creme acinzentado) */
  --surface: #fbfaf7;  /* fundo de caixas, cartões, campos, lista */
  --ink:     #0e0e0e;  /* texto, bordas e sombras */
  --ink-soft:#55534e;  /* texto secundário, datas, dicas */
  --rule:    #d6d3cb;  /* divisórias internas (linhas de lista/tabela) */
  --green:   #5ed37a;  /* destaque principal: ativo, ação principal, sucesso */
  --yellow:  #f2c53d;  /* destaque secundário: contadores, avisos leves */
  --danger:  #d93a3f;  /* excluir, erro, sair (no hover) */
  --on-ink:  #f3f2ee;  /* texto sobre fundo preto */

  --font-body:    "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Inter Tight", "Inter", sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --border: 1.5px solid var(--ink);
  --border-soft: 1.5px solid var(--rule);
  --shadow-4: 1px 1px 0 var(--ink), 2px 2px 0 var(--ink), 3px 3px 0 var(--ink), 4px 4px 0 var(--ink);
  --shadow-6: 1px 1px 0 var(--ink), 2px 2px 0 var(--ink), 3px 3px 0 var(--ink), 4px 4px 0 var(--ink), 5px 5px 0 var(--ink), 6px 6px 0 var(--ink);
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: light;
}
/* Tema escuro automático (segue o sistema) */
@media (prefers-color-scheme: dark) {
  :root { --paper:#121211; --surface:#1a1a18; --ink:#f3f2ee; --ink-soft:#a7a49c; --rule:#34332f;
          --green:#6be08a; --yellow:#f5cd4f; --danger:#ff6b6f; --on-ink:#121211; color-scheme: dark; }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 640px) { .wrap { padding: 0 32px; } }
.muted { color: var(--ink-soft); }
.box { border: var(--border); background: var(--surface); }
.raised { box-shadow: var(--shadow-6); }      /* cartão principal */
.raised-sm { box-shadow: var(--shadow-4); }   /* cartão secundário */

/* ---------- Títulos ---------- */
.h-hero { font: 800 clamp(2.75rem, 8vw, 5.5rem)/.98 var(--font-display); letter-spacing: -0.045em; margin: 0; }
.h-page { font: 800 clamp(2rem, 5vw, 3rem)/1 var(--font-display); letter-spacing: -0.045em; margin: 12px 0 6px; }
.h-section { font: 800 24px/1.1 var(--font-display); letter-spacing: -0.03em; margin: 0 0 6px; }
.h-card { font: 700 20px/1.2 var(--font-display); letter-spacing: -0.02em; margin: 0; }

/* ---------- Topo ---------- */
header.top { position: sticky; top: 0; z-index: 30; background: color-mix(in oklab, var(--paper) 90%, transparent); backdrop-filter: blur(8px); border-bottom: var(--border); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font: 800 19px var(--font-display); letter-spacing: -0.03em; user-select: none; }
.brand .mark { display: grid; place-items: center; width: 32px; height: 32px; background: var(--green); color: #0e0e0e; border: 1.5px solid #0e0e0e; font: 800 16px var(--font-display); }
.nav { display: flex; align-items: center; gap: 8px; }
.nav a { display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border: var(--border); background: var(--surface); color: var(--ink); font: 600 14px var(--font-body); text-decoration: none; transition: transform .15s, box-shadow .15s, background-color .15s; }
.nav a:hover { transform: translate(-1px,-1px); box-shadow: 1px 1px 0 var(--ink), 2px 2px 0 var(--ink), 3px 3px 0 var(--ink); }
.nav a.active { background: var(--green); color: #0e0e0e; border-color: #0e0e0e; }
.nav a.out:hover { color: var(--danger); border-color: var(--danger); box-shadow: none; transform: none; }
@media (max-width: 560px) { .nav { gap: 6px; } .nav a { height: 34px; padding: 0 10px; font-size: 13px; } }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border: var(--border); border-radius: 0; background: var(--ink); color: var(--on-ink); font: 600 14px var(--font-body); text-decoration: none; white-space: nowrap; cursor: pointer; transition: transform .16s, box-shadow .16s, background-color .16s; }
.btn:hover { transform: translate(-1px,-1px); box-shadow: 1px 1px 0 var(--ink), 2px 2px 0 var(--ink), 3px 3px 0 var(--ink), 4px 4px 0 var(--ink), 5px 5px 0 var(--ink); }
.btn:active { transform: translate(4px,4px); box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.btn.accent { background: var(--green); color: #0e0e0e; }           /* ação principal */
.btn.ghost  { background: var(--surface); color: var(--ink); }      /* ação secundária */
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; } /* confirmar exclusão */
.btn.danger-ghost { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn.small { height: 36px; padding: 0 14px; font-size: 13px; }
.btn.lg { height: 51px; }
.btn .arrow { transition: transform .18s; }
.btn:hover .arrow { transform: translateX(3px); }
.icon-btn { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border: var(--border); background: var(--surface); color: var(--ink); cursor: pointer; transition: color .15s, border-color .15s; }
.icon-btn:hover { color: var(--danger); border-color: var(--danger); }
.link { background: none; border: 0; padding: 0; color: var(--ink); font: 500 14px var(--font-body); cursor: pointer; text-decoration: underline 1.5px; text-underline-offset: 4px; }
.link:hover { text-decoration-color: var(--green); text-decoration-thickness: 3px; }

/* ---------- Etiquetas ---------- */
.tag  { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border: var(--border); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: var(--border); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.tag.green, .pill.green   { background: var(--green);  color: #0e0e0e; border-color: #0e0e0e; }
.tag.yellow, .pill.yellow { background: var(--yellow); color: #0e0e0e; border-color: #0e0e0e; }
.pill.red   { background: var(--danger); color: #fff; border-color: var(--danger); }
.pill.muted { color: var(--ink-soft); border-color: var(--rule); }
.status { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border: var(--border); font-size: 12px; font-weight: 600; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); }
.status.on { background: var(--green); color: #0e0e0e; border-color: #0e0e0e; }
.status.on i { background: #0e0e0e; animation: blink 1.4s infinite; }
.count { min-width: 20px; height: 20px; padding: 0 5px; display: inline-grid; place-items: center; background: var(--yellow); color: #0e0e0e; border: 1.5px solid #0e0e0e; font-size: 11px; font-weight: 700; }

/* ---------- Campos ---------- */
.input-group { display: flex; min-width: 0; border: var(--border); background: var(--paper); }
.input-group input { flex: 1; min-width: 0; height: 48px; padding: 0 14px; border: 0; background: transparent; color: var(--ink); font: 400 15px var(--font-body); outline: none; }
.input-group .suffix { display: flex; align-items: center; padding: 0 14px 0 4px; color: var(--ink-soft); font: 400 15px var(--font-body); white-space: nowrap; }
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.form input, .form select, .form textarea { height: 48px; padding: 0 14px; border: var(--border); border-radius: 0; background: var(--paper); color: var(--ink); font: 400 15px var(--font-body); outline: none; }
.form textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { background: var(--surface); }
.form .hint { font-size: 12px; font-weight: 400; color: var(--ink-soft); }
.form .error { min-height: 20px; color: var(--danger); font-size: 14px; }
select.compact { height: 36px; padding: 0 8px; border: var(--border); background: var(--surface); color: var(--ink); font: 500 14px var(--font-body); }

/* ---------- Abas ---------- */
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-bottom: var(--border); }
.tabs button { height: 54px; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1.5px; background: transparent; color: var(--ink-soft); font: 600 14px var(--font-body); cursor: pointer; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--green); }

/* ---------- Blocos (chips) com remover ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; height: 36px; border: var(--border); background: var(--surface); font: 500 14px var(--font-body); cursor: pointer; user-select: none; }
.chip .name { padding: 0 10px 0 12px; }
.chip .x { display: grid; place-items: center; width: 30px; height: 100%; border: 0; border-left: var(--border); background: transparent; color: var(--ink-soft); font-size: 16px; cursor: pointer; }
.chip .x:hover { color: var(--danger); }
.chip:hover { background: color-mix(in oklab, var(--surface) 85%, var(--ink)); }
.chip.active { background: var(--green); color: #0e0e0e; border-color: #0e0e0e; }
.chip.active .x { color: #0e0e0e; border-color: #0e0e0e; }
.chip.dragging { box-shadow: 4px 4px 0 var(--ink); transform: translate(-2px,-2px); position: relative; z-index: 1; }

/* ---------- Painel e lista (padrão "lista à esquerda, detalhe à direita") ---------- */
.split { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; padding-top: 24px; padding-bottom: 64px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.panel { display: flex; flex-direction: column; min-height: 520px; border: var(--border); background: var(--surface); }
.panel.raised { box-shadow: var(--shadow-6); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: var(--border); }
.panel-head.lg { padding: 18px 20px; align-items: flex-start; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 20px; border-bottom: var(--border); background: var(--paper); }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 20px; border-bottom: var(--border-soft); background: var(--paper); font-size: 13px; color: var(--ink-soft); }
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.list li { display: grid; grid-template-columns: 40px 1fr; gap: 14px; padding: 16px; border-bottom: var(--border-soft); cursor: pointer; }
.list li:hover { background: color-mix(in oklab, var(--surface) 80%, var(--ink)); }
.list li.unread { background: color-mix(in oklab, var(--green) 30%, var(--surface)); box-shadow: inset 5px 0 0 var(--green); } /* novo / não visto */
.list li.unread:hover { background: color-mix(in oklab, var(--green) 38%, var(--surface)); }
.list li.unread .row-title, .list li.unread .row-from { font-weight: 800; }
.list li.sel, .list li.sel:hover { background: var(--surface); box-shadow: none; } /* aberto: sem destaque */
.list li.new { animation: slidein .28s var(--ease) both; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border: var(--border); background: var(--paper); font: 700 16px var(--font-display); text-transform: uppercase; }
.list li.unread .avatar { background: var(--green); color: #0e0e0e; border-color: #0e0e0e; }
.row-main { min-width: 0; }
.row-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-soft); }
.row-from { font-weight: 700; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title { font-weight: 600; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 56px 20px; text-align: center; color: var(--ink-soft); }
.empty .pulse { width: 14px; height: 14px; margin: 0 auto 16px; background: var(--green); border: var(--border); animation: pop 1.6s infinite; }

/* ---------- Números (estatísticas) ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stats > div { padding: 20px; border: var(--border); background: var(--surface); margin: 0 -1.5px -1.5px 0; }
.stats b { display: block; font: 800 34px/1.1 var(--font-display); letter-spacing: -0.04em; }
.stats span { font-size: 13px; color: var(--ink-soft); }

/* ---------- Tabela ---------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: var(--border); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 12px 20px; border-bottom: var(--border-soft); color: var(--ink-soft); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.table td { padding: 12px 20px; border-bottom: var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .mono { font-family: var(--font-mono); font-weight: 700; letter-spacing: .04em; }
.table .actions { text-align: right; white-space: nowrap; }

/* ---------- Barra de progresso ---------- */
.bar { height: 10px; border: var(--border); background: var(--paper); }
.bar > div { height: 100%; background: var(--green); transition: width 1s linear; }

/* ---------- Modal de confirmação ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(14,14,14,.45); animation: fade .15s both; }
.modal { width: 100%; max-width: 420px; padding: 24px; border: var(--border); background: var(--surface); box-shadow: var(--shadow-6); }
.modal h3 { margin: 0 0 8px; font: 700 20px var(--font-display); letter-spacing: -0.02em; }
.modal p { margin: 0 0 22px; color: var(--ink-soft); font-size: 15px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Aviso flutuante (toast) ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50; padding: 10px 16px; background: var(--green); color: #0e0e0e; border: 1.5px solid #0e0e0e; font-weight: 600; font-size: 14px; box-shadow: 1px 1px 0 #0e0e0e, 2px 2px 0 #0e0e0e, 3px 3px 0 #0e0e0e, 4px 4px 0 #0e0e0e; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* ---------- Tela de login ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 28px; }
.auth-brand .brand { font-size: 26px; }
.auth-brand .brand .mark { width: 38px; height: 38px; font-size: 19px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card .form { padding: 28px; }
.auth-card .btn { height: 50px; margin-top: 4px; }

/* ---------- Rodapé ---------- */
footer { border-top: var(--border); color: var(--ink-soft); font-size: 13px; padding: 24px 0; }

/* ---------- Animações ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.85); } 60% { opacity: 1; transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes slidein { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { *, ::before, ::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
