@font-face { font-family: "Tw Cen MT"; src: url(TCM_____.TTF); font-weight: 400; }
@font-face { font-family: "Tw Cen MT"; src: url(TCB_____.TTF); font-weight: 700; }
@font-face { font-family: "Tw Cen MT Condensed"; src: url(TCCB____.TTF); font-weight: 700; }
:root {
  --preto: #1A1A1A; --vermelho: #CC1F1F; --verm-escuro: #8B0000; --branco: #F2F2F2;
  --fundo: #F5F5F4; --card: #fff; --linha: #E4E4E2; --texto: #1A1A1A; --muted: #6B6B6B;
  --font: "Tw Cen MT", "Century Gothic", system-ui, sans-serif;
  --font-t: "Tw Cen MT Condensed", "Tw Cen MT", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--texto); background: var(--fundo); display: grid; grid-template-columns: 220px 1fr; font-size: 16px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }

/* lateral */
.side { background: var(--preto); color: var(--branco); padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-t); font-size: 26px; letter-spacing: .04em; padding: 0 8px; }
.brand img { height: 30px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { text-decoration: none; padding: 10px 12px; border-radius: 4px; color: #c9c9c9; display: flex; justify-content: space-between; align-items: center; }
.side nav a:hover { background: #262626; color: var(--branco); }
.side nav a.on { background: #2b2b2b; color: var(--branco); box-shadow: inset 3px 0 var(--vermelho); }
.side nav b { background: var(--vermelho); color: #fff; font-size: 12px; border-radius: 10px; padding: 1px 7px; }
.side nav b:empty { display: none; }
.me { margin-top: auto; font-size: 12px; color: #8a8a8a; padding: 0 8px; word-break: break-all; }
.menu { display: none; }

main { padding: 28px 32px 60px; min-width: 0; outline: none; }
.head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.head h1 { font-family: var(--font-t); font-size: 34px; margin: 0; flex: 1; letter-spacing: .01em; }
.head .crumb { font-size: 13px; color: var(--muted); text-decoration: none; display: block; margin-bottom: 4px; }
.btn { background: var(--vermelho); color: #fff; border: 0; padding: 9px 16px; border-radius: 4px; cursor: pointer; font-weight: 700; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.btn:hover { background: var(--verm-escuro); }
.btn.ghost { background: transparent; color: var(--texto); border: 1px solid var(--linha); }
.btn.ghost:hover { border-color: var(--texto); }
.btn.danger { background: transparent; color: var(--vermelho); border: 1px solid #f0c9c9; }
.btn.small { padding: 5px 10px; font-size: 14px; }
.search { padding: 9px 12px; border: 1px solid var(--linha); border-radius: 4px; background: #fff; min-width: 240px; }

/* resumo */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.kpi { background: var(--card); border: 1px solid var(--linha); border-radius: 6px; padding: 14px 16px; }
.kpi b { display: block; font-family: var(--font-t); font-size: 28px; }
.kpi small { color: var(--muted); }
.kpi.alert b { color: var(--vermelho); }

/* kanban */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: #ECECEA; border-radius: 6px; padding: 10px; min-height: 140px; }
.col h3 { margin: 2px 4px 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; display: flex; justify-content: space-between; color: #444; }
.col h3 span { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.col.ganho h3 { color: #1d7a3a; } .col.perdido h3 { color: var(--muted); }
.col.drop { outline: 2px dashed var(--vermelho); outline-offset: -2px; }
.deal { background: var(--card); border: 1px solid var(--linha); border-radius: 5px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; text-decoration: none; display: block; }
.deal:hover { border-color: #bdbdbd; }
.deal.dragging { opacity: .4; }
.deal.before { box-shadow: 0 -3px 0 var(--vermelho); }
.deal b { display: block; font-size: 15px; line-height: 1.25; }
.deal small { color: var(--muted); display: block; margin-top: 4px; }
.deal .amt { font-family: var(--mono); font-size: 12px; margin-top: 6px; }

/* tabelas */
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--linha); border-radius: 6px; overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--linha); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 400; background: #FAFAF9; }
tr.link { cursor: pointer; }
tr.link:hover td { background: #FBF6F6; }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #EEE; white-space: nowrap; }
.chip.quente, .chip.lead { background: #FBE3E3; color: var(--verm-escuro); }
.chip.morno { background: #FFF1D6; color: #7a4d00; }
.chip.cliente, .chip.ganho { background: #DFF3E4; color: #1d6b34; }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--linha); border-radius: 6px; }

/* detalhe */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--linha); border-radius: 6px; padding: 18px; margin-bottom: 18px; }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; font-weight: 400; display: flex; justify-content: space-between; align-items: center; }
dl.info { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0; }
dl.info dt { color: var(--muted); font-size: 14px; }
dl.info dd { margin: 0; word-break: break-word; white-space: pre-wrap; }
.rel a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--linha); text-decoration: none; }
.rel a:last-child { border-bottom: 0; }
.rel a:hover b { color: var(--vermelho); }

/* notas */
.composer textarea { width: 100%; min-height: 80px; padding: 10px 12px; border: 1px solid var(--linha); border-radius: 4px; resize: vertical; }
.composer .row { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.composer input[type=file] { font-size: 13px; flex: 1; min-width: 0; }
.note { border-left: 3px solid var(--linha); padding: 4px 0 4px 14px; margin: 18px 0; }
.note .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.note .meta button { margin-left: auto; }
.note p { white-space: pre-wrap; margin: 6px 0; word-break: break-word; }
.files { display: flex; flex-wrap: wrap; gap: 6px; }
.files a { font-size: 13px; padding: 4px 10px; border: 1px solid var(--linha); border-radius: 4px; text-decoration: none; background: #FAFAF9; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.linkbtn:hover { color: var(--vermelho); }

/* tarefas */
.task { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--linha); }
.task:last-child { border-bottom: 0; }
.task input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--vermelho); }
.task div { flex: 1; min-width: 0; }
.task small { color: var(--muted); display: block; }
.task small a { color: var(--muted); }
.task.done span { text-decoration: line-through; color: var(--muted); }
.task .late { color: var(--vermelho); }
.group h2 { margin-top: 0; }

/* modal */
dialog { border: 0; border-radius: 8px; padding: 0; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(26,26,26,.55); }
dialog form { padding: 22px 24px; }
dialog h2 { font-family: var(--font-t); font-size: 26px; margin: 0 0 16px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.fields label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.fields label.wide { grid-column: 1 / -1; }
.fields input, .fields select, .fields textarea { padding: 9px 10px; border: 1px solid var(--linha); border-radius: 4px; background: #fff; color: var(--texto); font-size: 15px; }
.fields textarea { min-height: 90px; resize: vertical; }
.fields input:focus, .fields select:focus, .fields textarea:focus, .search:focus, .composer textarea:focus { outline: 2px solid var(--vermelho); outline-offset: -1px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.err { color: var(--vermelho); font-size: 14px; margin: 12px 0 0; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--preto); color: #fff; padding: 10px 18px; border-radius: 4px; transition: transform .25s; z-index: 50; }
.toast.on { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--vermelho); }

@media (max-width: 1100px) { .detail { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  body { grid-template-columns: 1fr; }
  .side { position: sticky; height: auto; flex-direction: row; align-items: center; padding: 10px 14px; z-index: 10; flex-wrap: wrap; gap: 0; }
  .menu { display: block; margin-left: auto; background: none; border: 0; width: 44px; height: 44px; padding: 13px 10px; cursor: pointer; }
  .menu i { display: block; height: 2px; background: #fff; margin-bottom: 6px; }
  .side nav { display: none; width: 100%; padding: 8px 0; }
  .side.open nav { display: flex; }
  .me { display: none; }
  main { padding: 18px 14px 60px; }
  .search { min-width: 0; width: 100%; }
  .fields { grid-template-columns: 1fr; }
  table thead { display: none; }
  table tr { display: block; border-bottom: 1px solid var(--linha); padding: 8px 0; }
  table td { display: block; border: 0; padding: 3px 14px; }
  dl.info { grid-template-columns: 1fr; gap: 2px; }
  dl.info dd { margin-bottom: 8px; }
}
