:root{
--bg: #14161B;
--surface: #1D2129;
--surface-2: #262B34;
--border: #333944;
--ink: #ECEAE2;
--ink-muted: #9AA0AC;
--accent: #FF6A12;
--accent-contrast: #1A0D00;
--accent-soft: #3A2008;
--muted-soft: #232830;
--info: #4FA6E8;
--info-soft: #12283A;
--good: #5DB026;
--good-soft: #16260A;
--warn: #FF9F45;
--warn-soft: #3A2410;
--bad: #FF5C5C;
--bad-soft: #3A1414;
--shadow: 0 1px 2px rgba(0,0,0,0.5), 0 16px 32px -16px rgba(0,0,0,0.8);
--glow: 0 0 0 1px rgba(255,106,18,0.4), 0 0 22px -4px rgba(255,106,18,0.35);
}

*{ box-sizing: border-box; }
html, body{ margin:0; padding:0; height:100%; }
body{
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background:
radial-gradient(ellipse 900px 500px at 12% -10%, rgba(255,106,18,0.08), transparent 60%),
radial-gradient(ellipse 700px 420px at 100% 110%, rgba(93,176,38,0.06), transparent 60%),
linear-gradient(rgba(8,9,11,0.86), rgba(8,9,11,0.92)),
var(--bg);
color: var(--ink);
min-height: 100vh;
}
[hidden]{ display:none !important; }
button, input, select, textarea{ font-family: inherit; }
a{ color: var(--accent); }

/* ---------- Login (gate) ---------- */
.gate{
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background:
radial-gradient(ellipse 800px 500px at 15% -10%, rgba(255,106,18,0.14), transparent 60%),
radial-gradient(ellipse 700px 480px at 100% 110%, rgba(93,176,38,0.12), transparent 60%),
linear-gradient(180deg, #14161B, #0D0E11);
padding: 20px;
}
.gate-card{
width: 100%;
max-width: 380px;
background: rgba(29,33,41,0.92);
border: 1px solid var(--border);
border-radius: 16px;
padding: 32px 28px;
box-shadow: var(--shadow);
backdrop-filter: blur(6px);
}
.gate-logo{
display: block;
max-width: 220px;
width: 100%;
height: auto;
margin: 0 auto 18px;
}
.gate-title{
font-size: 22px;
font-weight: 700;
letter-spacing: 0.02em;
color: var(--accent);
margin: 0 0 4px;
text-align: center;
}
.gate-sub{
color: var(--ink-muted);
font-size: 13px;
text-align: center;
margin: 0 0 24px;
}
.field{ margin-bottom: 14px; }
.field label{ display:block; font-size:12px; color: var(--ink-muted); margin-bottom:6px; }
.field input, .field select, .field textarea{
width: 100%;
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--ink);
padding: 10px 12px;
font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus{
outline: none;
border-color: var(--accent);
box-shadow: var(--glow);
}
.btn{
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
border-radius: 8px;
border: 1px solid var(--border);
background: var(--surface-2);
color: var(--ink);
padding: 10px 16px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
}
.btn:hover{ border-color: var(--accent); }
.btn-primary{
background: var(--accent);
color: var(--accent-contrast);
border-color: var(--accent);
width: 100%;
}
.btn-primary:hover{ filter: brightness(1.06); }
.btn-danger{ border-color: var(--bad); color: var(--bad); background: transparent; }
.btn-small{ padding: 6px 10px; font-size: 12px; }
.gate-error{
color: var(--bad);
font-size: 13px;
text-align: center;
margin-top: 10px;
min-height: 18px;
}

/* ---------- App shell ---------- */
.app-shell{ display:flex; min-height:100vh; }
.sidebar{
width: 220px;
flex-shrink: 0;
background: var(--surface);
border-right: 1px solid var(--border);
padding: 20px 14px;
display:flex; flex-direction:column; gap:4px;
}
.brand{
display: flex;
align-items: center;
gap: 8px;
color: var(--accent);
font-weight: 800;
font-size: 15px;
letter-spacing: 0.03em;
padding: 0 8px 18px;
}
.brand-icon{ width: 26px; height: 26px; flex-shrink: 0; }
.side-item{
display:flex; align-items:center; gap:10px;
padding: 10px 10px;
border-radius: 8px;
color: var(--ink-muted);
background: transparent;
border: none;
text-align: left;
cursor: pointer;
font-size: 14px;
}
.side-item:hover{ background: var(--surface-2); color: var(--ink); }
.side-item.active{ background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.sidebar-foot{ margin-top:auto; padding-top: 14px; border-top: 1px solid var(--border); }
.whoami{ font-size: 12px; color: var(--ink-muted); padding: 0 10px 8px; }
.whoami b{ color: var(--ink); }

.main{ flex:1; min-width:0; padding: 26px 30px 60px; }
.view{ display:none; }
.view.active{ display:block; }
.page-title{ font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.page-sub{ color: var(--ink-muted); font-size: 13px; margin: 0 0 22px; }

.grid{ display:grid; gap:16px; }
.grid-2{ grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3{ grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 900px){ .grid-2, .grid-3{ grid-template-columns: 1fr; } }

.card{
background: var(--surface);
border: 1px solid var(--border);
border-radius: 14px;
padding: 18px;
}
.card h3{ margin: 0 0 12px; font-size: 14px; color: var(--ink); }
.card h3 small{ color: var(--ink-muted); font-weight: 400; }

.task-row{
display:flex; align-items:center; gap:10px;
padding: 9px 6px;
border-bottom: 1px solid var(--border);
}
.task-row:last-child{ border-bottom: none; }
.task-row .cat-pill{
font-size: 11px; padding: 2px 8px; border-radius: 999px;
background: var(--muted-soft); color: var(--ink-muted); white-space:nowrap;
}
.task-row .txt{ flex:1; font-size: 14px; }
.task-row .txt[contenteditable]{ outline:none; }
.task-row .due{ font-size:12px; color: var(--ink-muted); white-space:nowrap; }
.status-select{
font-size: 12px; border-radius: 999px; border: 1px solid var(--border);
padding: 4px 8px; background: var(--surface-2); color: var(--ink);
}
.del-btn{
background:none; border:none; color: var(--ink-muted); cursor:pointer; font-size: 14px;
visibility: hidden;
}
.task-row:hover .del-btn{ visibility: visible; }
.del-btn:hover{ color: var(--bad); }

.add-row{ display:flex; gap:8px; margin-top:12px; flex-wrap: wrap; }
.add-row input{
flex:1; min-width: 120px;
background: var(--surface-2); border:1px solid var(--border); border-radius:8px;
color: var(--ink); padding: 8px 10px; font-size: 13px;
}
.add-row input.due{ max-width: 90px; flex: 0 0 90px; }

/* ---------- Rotina diária (grade com dias em colunas) ---------- */
.rotina-scroll{ overflow-x: auto; }
table.rotina-table{ border-collapse: collapse; font-size: 12px; white-space: nowrap; }
table.rotina-table th, table.rotina-table td{
border: 1px solid var(--border);
padding: 6px 8px;
text-align: center;
}
table.rotina-table thead th{ color: var(--ink-muted); font-weight:600; background: var(--surface); }
table.rotina-table th.rotina-col-tarefa, table.rotina-table td.rotina-col-tarefa{
text-align: left;
white-space: normal;
min-width: 200px;
max-width: 280px;
position: sticky;
left: 0;
background: var(--surface);
}
td.rotina-cell{ width: 40px; color: var(--ink-muted); }
td.rotina-cell.clicavel{ cursor: pointer; }
td.rotina-cell.clicavel:hover{ background: var(--surface-2); }
td.rotina-cell.feito{ color: var(--good); font-weight: 700; background: var(--good-soft); }
.rotina-meta{ font-size: 11px; color: var(--ink-muted); margin-top: 3px; font-weight: 400; }

.pack-gerador{ margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.pack-gerador-linha{ display:flex; gap:8px; margin-bottom: 10px; flex-wrap: wrap; }
.pack-gerador-linha input[type="date"]{
background: var(--surface-2); border:1px solid var(--border); border-radius:8px;
color: var(--ink); padding: 8px 10px; font-size: 13px;
}
.pack-saida{
width: 100%;
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: 10px;
padding: 10px 12px;
font-size: 13px;
line-height: 1.5;
color: var(--ink);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
white-space: pre-wrap;
resize: vertical;
}

.notepad{
min-height: 140px;
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: 10px;
padding: 12px;
font-size: 13px;
line-height: 1.5;
outline: none;
white-space: pre-wrap;
}

.pessoas-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap:14px; }
.pessoa-card{
background: var(--surface); border:1px solid var(--border); border-radius: 12px;
padding: 16px; cursor:pointer; text-align:center;
}
.pessoa-card:hover{ border-color: var(--accent); }
.avatar{
width:48px; height:48px; border-radius:50%;
display:flex; align-items:center; justify-content:center;
margin: 0 auto 10px;
background: var(--accent-soft); color: var(--accent); font-weight:700;
}
.pessoa-nome{ font-size: 14px; font-weight:600; }
.pessoa-meta{ font-size: 12px; color: var(--ink-muted); margin-top:2px; }
.pessoa-cargo{ font-size: 11px; color: var(--ink-muted); margin-top:1px; }

.equipe-grupo-titulo{
font-size: 13px; font-weight: 700; color: var(--ink-muted);
margin: 18px 0 10px; text-transform: uppercase; letter-spacing: 0.03em;
}
.equipe-grupo-titulo:first-child{ margin-top: 0; }
#pessoas-grid > .pessoas-grid{ grid-column: 1 / -1; }

.back-btn{ margin-bottom: 16px; }

.recado-item{
padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.recado-item:last-child{ border-bottom:none; }
.recado-meta{ color: var(--ink-muted); font-size: 11px; margin-top: 2px; }

table.rel-table{ width:100%; border-collapse: collapse; font-size: 13px; }
table.rel-table th, table.rel-table td{
text-align:left; padding: 8px 10px; border-bottom: 1px solid var(--border);
}
table.rel-table th{ color: var(--ink-muted); font-weight:600; font-size:12px; }

.save-indicator{
position: fixed; top: 14px; right: 18px;
display:flex; align-items:center; gap:8px;
background: var(--surface); border:1px solid var(--border); border-radius:999px;
padding: 6px 12px; font-size: 12px; color: var(--ink-muted);
box-shadow: var(--shadow); z-index: 50;
}
.save-indicator .dot{ width:8px; height:8px; border-radius:50%; background: var(--good); }
.save-indicator[data-state="saving"] .dot{ background: var(--warn); }
.save-indicator[data-state="error"] .dot{ background: var(--bad); }

.toolbar{ display:flex; gap:10px; align-items:center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input, .toolbar select{
background: var(--surface-2); border:1px solid var(--border); border-radius:8px;
color: var(--ink); padding: 8px 10px; font-size: 13px;
}

/* ---------- KPI cards e barras (ex: Prospecção B2B) ---------- */
.kpi-grid{ display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:14px; }
@media (max-width: 900px){ .kpi-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); } }
.kpi-card{
background: var(--surface); border:1px solid var(--border); border-radius: 14px;
padding: 16px;
}
.kpi-label{ font-size: 12px; color: var(--ink-muted); margin-bottom: 6px; }
.kpi-val{ font-size: 26px; font-weight: 700; color: var(--accent); }
.kpi-sub{ font-size: 11px; color: var(--ink-muted); margin-top: 4px; }

.bars{ display:flex; flex-direction:column; gap:10px; }
.bar-row{ display:flex; align-items:center; gap:10px; font-size: 13px; }
.bar-label{ flex: 0 0 140px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track{ flex:1; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill{ display:block; height:100%; background: var(--accent); border-radius: 999px; }
.bar-val{ flex: 0 0 auto; color: var(--ink); white-space: nowrap; font-size: 12px; }

@media (max-width: 760px){
.app-shell{ flex-direction: column; }
.sidebar{ width:100%; flex-direction: row; overflow-x:auto; border-right:none; border-bottom:1px solid var(--border); }
.sidebar-foot{ display:none; }
.brand{ display:none; }
.main{ padding: 18px; }
}


@media (max-width: 760px){
  table.rotina-table th.rotina-col-tarefa, table.rotina-table td.rotina-col-tarefa{ min-width: 150px; max-width: 190px; }
  td.rotina-cell{ width: 34px; }
}

@media (max-width: 480px){
  .main{ padding: 14px 16px; }
  .page-title{ font-size: 18px; }
  .grid-2, .grid-3, .kpi-grid{ grid-template-columns: 1fr; }
  table.rotina-table th.rotina-col-tarefa, table.rotina-table td.rotina-col-tarefa{ min-width: 130px; max-width: 160px; font-size: 12px; }
}
