:root{
  --navy:#132a4d; --navy-2:#1a3a6c; --teal:#0e9594; --teal-dark:#0b7b7a;
  --amber:#f2a541; --coral:#e0673d; --slate:#5b6b82;
  --bg:#f4f7fa; --card:#ffffff; --border:#e3e9f0; --text:#1c2b3d; --text-dim:#64748b;
  --ok:#1f9d6a; --warn:#f2a541; --danger:#e0673d;
  --radius:12px;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-head: 'Sora', system-ui, sans-serif;
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family:var(--font-body); background:var(--bg); color:var(--text);
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{font-family:var(--font-head); margin:0; color:var(--navy);}
a{color:inherit;}
button{font-family:inherit; cursor:pointer;}
::-webkit-scrollbar{height:8px; width:8px;}
::-webkit-scrollbar-thumb{background:#c7d2df; border-radius:8px;}

/* ---------- login ---------- */
.login-screen{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background: radial-gradient(1200px 600px at 20% -10%, #1a3a6c 0%, #132a4d 55%, #0d1b30 100%);
  padding:24px;
}
.login-card{
  background:var(--card); border-radius:20px; padding:40px 36px; width:100%; max-width:400px;
  box-shadow:0 30px 60px rgba(10,20,40,.35);
}
.login-logo{display:flex; align-items:center; gap:10px; margin-bottom:6px;}
.login-logo .mark{
  width:38px; height:38px; border-radius:10px; background:linear-gradient(135deg,var(--teal),var(--navy-2));
  display:flex; align-items:center; justify-content:center; color:#fff; font-family:var(--font-head); font-weight:700;
}
.login-card h1{font-size:22px;}
.login-card p.tag{color:var(--text-dim); font-size:13.5px; margin:4px 0 24px;}
.login-field{margin-bottom:14px;}
.login-field label{display:block; font-size:12.5px; color:var(--text-dim); margin-bottom:5px; font-weight:600;}
.login-field input{
  width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:9px; font-size:14px; background:#fbfdfe;
}
.btn-primary{
  width:100%; padding:11px; border:none; border-radius:9px; background:var(--teal); color:#fff;
  font-weight:600; font-size:14.5px; margin-top:6px;
}
.btn-primary:hover{background:var(--teal-dark);}
.login-quick{display:flex; flex-direction:column; gap:8px; margin-top:18px;}
.login-quick button{
  padding:9px; border:1px solid var(--border); border-radius:9px; background:#fff; font-size:13px; color:var(--navy-2); font-weight:600;
  text-align:left; display:flex; justify-content:space-between; align-items:center;
}
.login-quick button:hover{border-color:var(--teal); color:var(--teal-dark);}
.login-quick .role{background:#eef4fb; color:var(--navy-2); font-size:11px; padding:2px 8px; border-radius:20px; font-weight:700;}

/* ---------- app shell ---------- */
.app-shell{display:grid; grid-template-columns:238px 1fr; min-height:100vh;}
.sidebar{
  background:linear-gradient(180deg,var(--navy) 0%, #0f2039 100%); color:#dbe6f5; padding:20px 14px; position:fixed; top:0; bottom:0; width:238px; overflow-y:auto;
}
.sidebar .brand{display:flex; align-items:center; gap:10px; padding:4px 8px 20px;}
.sidebar .brand .mark{width:32px; height:32px; border-radius:9px; background:linear-gradient(135deg,var(--teal),#4f6fb0); display:flex; align-items:center; justify-content:center; font-family:var(--font-head); font-weight:700; color:#fff; font-size:14px;}
.sidebar .brand b{font-family:var(--font-head); color:#fff; font-size:16px;}
.nav-group{margin-bottom:14px;}
.nav-group .nav-title{font-size:10.5px; text-transform:uppercase; letter-spacing:.06em; color:#7f93b3; padding:6px 10px; font-weight:700;}
.nav-link{
  display:flex; align-items:center; gap:10px; padding:9px 10px; border-radius:8px; font-size:13.6px; color:#c6d5ea;
  text-decoration:none; margin-bottom:2px; font-weight:500;
}
.nav-link:hover{background:rgba(255,255,255,.06); color:#fff;}
.nav-link.active{background:var(--teal); color:#fff; font-weight:700;}
.nav-link .ic{width:18px; text-align:center; opacity:.9;}
.nav-badge{margin-left:auto; background:var(--coral); color:#fff; font-size:10.5px; padding:1px 6px; border-radius:20px; font-weight:700;}

.main{grid-column:2; padding:22px 28px 60px; min-width:0;}
.topbar{display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; flex-wrap:wrap; gap:10px;}
.topbar h1{font-size:21px;}
.topbar .sub{color:var(--text-dim); font-size:13px; margin-top:2px;}
.topbar-right{display:flex; align-items:center; gap:12px;}
.user-chip{display:flex; align-items:center; gap:8px; background:#fff; border:1px solid var(--border); padding:6px 12px; border-radius:30px; font-size:13px; font-weight:600;}
.user-chip .role{font-size:10.5px; color:var(--teal-dark); background:#e4f6f5; padding:1px 8px; border-radius:20px; font-weight:700;}
.btn{padding:8px 14px; border-radius:8px; border:1px solid var(--border); background:#fff; font-size:13.4px; font-weight:600; color:var(--navy-2);}
.btn:hover{border-color:var(--teal); color:var(--teal-dark);}
.btn-teal{background:var(--teal); border-color:var(--teal); color:#fff;}
.btn-teal:hover{background:var(--teal-dark); color:#fff;}
.btn-ghost{background:transparent; border:none; color:var(--text-dim);}
.btn-sm{padding:5px 10px; font-size:12px;}

/* ---------- cards / grid ---------- */
.grid{display:grid; gap:16px;}
.grid-4{grid-template-columns:repeat(4,1fr);}
.grid-3{grid-template-columns:repeat(3,1fr);}
.grid-2{grid-template-columns:repeat(2,1fr);}
@media(max-width:1100px){ .grid-4{grid-template-columns:repeat(2,1fr);} .grid-3{grid-template-columns:repeat(2,1fr);} }
@media(max-width:720px){ .grid-4,.grid-3,.grid-2{grid-template-columns:1fr;} .app-shell{grid-template-columns:1fr;} .sidebar{position:static; width:auto;} .main{grid-column:1; margin-left:0;} }

.card{background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:18px;}
.card h3{font-size:14.5px; margin-bottom:12px;}
.card .card-head{display:flex; justify-content:space-between; align-items:center; margin-bottom:12px;}
.card .card-head h3{margin:0;}

.kpi{padding:16px 18px;}
.kpi .kpi-label{font-size:12px; color:var(--text-dim); font-weight:600; text-transform:uppercase; letter-spacing:.03em;}
.kpi .kpi-value{font-family:var(--font-head); font-size:27px; color:var(--navy); margin-top:6px;}
.kpi .kpi-note{font-size:12px; color:var(--text-dim); margin-top:4px;}
.kpi .kpi-note.up{color:var(--ok);} .kpi .kpi-note.warn{color:var(--danger);}
.kpi-link{transition:box-shadow .15s, transform .15s;}
.kpi-link:hover{box-shadow:0 6px 18px rgba(19,42,77,.12); transform:translateY(-1px);}

/* ---------- badges / status (espelha o enum StatusProcesso real do Monday) ---------- */
.badge{display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:20px; font-size:11.5px; font-weight:700; white-space:nowrap;}
.st-autorizando{background:#fdf1de; color:#a6660e;}
.st-autorizado{background:#e2f7ee; color:#177a4d;}
.st-negado{background:#fbe6e1; color:#b13d1d;}
.st-perdeu_nao_fez{background:#eef1f5; color:#8a94a3;}
.st-apto{background:#e3ecfb; color:#2e5eb0;}
.st-realizado{background:#dcf3e2; color:#1f7a3d;}
.st-em_programacao{background:#eae6fb; color:#5b3fbf;}
.st-agendado{background:#dff4f3; color:#0b7b7a;}
.st-duvida_pendencia{background:#ffe8cc; color:#b5650c;}
.st-insuficiente{background:#f8d7da; color:#842029;}

/* ---------- tabela ---------- */
table{width:100%; border-collapse:collapse; font-size:13.4px;}
th{text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.03em; color:var(--text-dim); padding:8px 10px; border-bottom:1px solid var(--border);}
td{padding:10px; border-bottom:1px solid #edf1f6; vertical-align:middle;}
tr:last-child td{border-bottom:none;}
tr.clickable{cursor:pointer;}
tr.clickable:hover{background:#f7fafc;}
.table-wrap{overflow-x:auto;}
.table-wrap-scroll{overflow-x:auto; max-height:64vh; overflow-y:auto;}
.table-toolbar{display:flex; gap:10px; align-items:center; margin-bottom:14px; flex-wrap:wrap;}
input[type=text],input[type=search],input[type=date],input[type=time],input[type=tel],select,textarea{
  padding:8px 11px; border:1px solid var(--border); border-radius:8px; font-size:13.5px; font-family:inherit; background:#fff;
}
label.field{display:block; font-size:12px; font-weight:600; color:var(--text-dim); margin-bottom:5px;}
.form-row{display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px;}
@media(max-width:600px){.form-row{grid-template-columns:1fr;}}

/* ---------- kanban ---------- */
.kanban{display:flex; gap:14px; overflow-x:auto; padding-bottom:12px; align-items:flex-start;}
.kanban-col{
  background:#eef2f6; border-radius:12px; min-width:250px; max-width:250px; flex-shrink:0; padding:10px; min-height:200px;
  max-height:calc(100vh - 230px); overflow-y:auto;
}
.kanban-col.dragover{outline:2px dashed var(--teal); outline-offset:-4px;}
.kanban-col-head{display:flex; justify-content:space-between; align-items:center; padding:4px 6px 10px; font-size:12.5px; font-weight:700; color:var(--navy-2);}
.kanban-col-head .count{background:#fff; padding:1px 8px; border-radius:20px; font-size:11px;}
.kcard{
  background:#fff; border-radius:10px; padding:11px 12px; margin-bottom:9px; border:1px solid var(--border);
  box-shadow:0 1px 2px rgba(20,30,50,.04); cursor:grab; font-size:12.8px;
}
.kcard:active{cursor:grabbing;}
.kcard.dragging{opacity:.4;}
.kcard .kc-title{font-weight:700; color:var(--navy); font-size:13px; margin-bottom:3px;}
.kcard .kc-meta{color:var(--text-dim); font-size:11.6px; margin-bottom:2px;}
.kcard .kc-foot{display:flex; justify-content:space-between; align-items:center; margin-top:8px;}
.kcard .kc-days{font-size:11px; color:var(--text-dim);}

/* ---------- timeline ---------- */
.timeline{border-left:2px solid var(--border); margin-left:8px; padding-left:18px;}
.timeline-item{position:relative; padding-bottom:18px;}
.timeline-item:last-child{padding-bottom:0;}
.timeline-item::before{content:""; position:absolute; left:-24px; top:3px; width:10px; height:10px; border-radius:50%; background:var(--teal); border:2px solid #fff; box-shadow:0 0 0 2px var(--teal);}
.timeline-item .t-date{font-size:11.5px; color:var(--text-dim);}
.timeline-item .t-body{font-size:13.4px; margin-top:2px;}

/* ---------- whatsapp bubble ---------- */
.wa-log{display:flex; flex-direction:column; gap:10px;}
.wa-bubble{background:#dcf8c6; border-radius:10px 10px 2px 10px; padding:9px 12px; max-width:80%; align-self:flex-end; font-size:13px;}
.wa-bubble .wa-meta{font-size:10.5px; color:#4a7a3a; margin-top:4px; display:flex; gap:6px; justify-content:flex-end;}

/* ---------- integrações ---------- */
.integ-card{display:flex; gap:14px; align-items:flex-start;}
.integ-icon{width:44px; height:44px; border-radius:11px; display:flex; align-items:center; justify-content:center; font-size:20px; flex-shrink:0; color:#fff;}
.integ-status{display:inline-flex; align-items:center; gap:5px; font-size:11.5px; font-weight:700; color:var(--ok);}
.integ-status .dot{width:7px; height:7px; border-radius:50%; background:var(--ok);}
.integ-log{font-size:12.5px; color:var(--text-dim); margin-top:10px; max-height:180px; overflow-y:auto;}
.integ-log-item{padding:6px 0; border-bottom:1px solid #edf1f6;}
.integ-log-item:last-child{border-bottom:none;}

/* ---------- charts ---------- */
.chart-donut-total{font-family:var(--font-head); font-size:22px; fill:var(--navy);}
.chart-donut-sub{font-size:10.5px; fill:var(--text-dim);}
.chart-legend{display:flex; flex-wrap:wrap; gap:10px; margin-top:10px; font-size:12px; color:var(--text-dim);}
.chart-legend .dot{display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:5px;}
.hbar-row{display:grid; grid-template-columns:120px 1fr 40px; align-items:center; gap:8px; margin-bottom:9px; font-size:12.6px;}
.hbar-track{background:#eef1f5; border-radius:6px; height:9px; overflow:hidden;}
.hbar-fill{height:100%; border-radius:6px;}
.hbar-value{text-align:right; font-weight:700; color:var(--navy);}
.chart-grid{stroke:#e9edf3; stroke-width:1;}
.chart-area{fill:rgba(14,149,148,.12);}
.chart-stroke{stroke:var(--teal); stroke-width:2.5;}
.chart-dot{fill:#fff; stroke:var(--teal); stroke-width:2;}
.chart-axis-label{font-size:10px; fill:var(--text-dim);}
.gauge-track{stroke:#eef1f5; stroke-width:14;}
.gauge-fill{stroke-width:14; stroke-linecap:round;}
.gauge-value{font-family:var(--font-head); font-size:24px; fill:var(--navy);}
.gauge-caption{font-size:10.5px; fill:var(--text-dim);}

/* ---------- calendário ---------- */
.cal-grid{display:grid; grid-template-columns:repeat(7,1fr); gap:6px;}
.cal-day-head{font-size:11px; text-transform:uppercase; color:var(--text-dim); font-weight:700; text-align:center; padding:4px;}
.cal-cell{background:#fff; border:1px solid var(--border); border-radius:8px; min-height:86px; padding:6px; font-size:11px;}
.cal-cell.other-month{background:#f7f9fb; color:#c3ccd8;}
.cal-cell .cal-num{font-weight:700; color:var(--navy-2); font-size:12px; margin-bottom:4px;}
.cal-cell .cal-num.today{color:#fff; background:var(--teal); border-radius:50%; width:20px; height:20px; display:inline-flex; align-items:center; justify-content:center;}
.cal-evt{background:#e4f6f5; color:var(--teal-dark); border-radius:5px; padding:2px 5px; margin-bottom:3px; font-size:10.3px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}

/* ---------- modal ---------- */
.modal-overlay{position:fixed; inset:0; background:rgba(15,25,45,.5); display:flex; align-items:center; justify-content:center; z-index:100; padding:20px;}
.modal{background:#fff; border-radius:14px; padding:24px; width:100%; max-width:520px; max-height:88vh; overflow-y:auto;}
.modal h3{margin-bottom:14px;}
.modal-actions{display:flex; justify-content:flex-end; gap:10px; margin-top:18px;}

/* ---------- empty / misc ---------- */
.empty{color:var(--text-dim); font-size:13px; text-align:center; padding:30px 10px;}
.pill-select{display:flex; gap:6px; flex-wrap:wrap;}
.pill-select button{border:1px solid var(--border); background:#fff; border-radius:20px; padding:5px 13px; font-size:12.5px; font-weight:600; color:var(--text-dim);}
.pill-select button.active{background:var(--navy-2); border-color:var(--navy-2); color:#fff;}
.section-title{font-size:12px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-dim); font-weight:700; margin:22px 0 10px;}
.section-title:first-child{margin-top:0;}
.note-box{background:#fff8ea; border:1px solid #f4dfa8; border-radius:10px; padding:12px 14px; font-size:12.6px; color:#7a5c14; margin-top:16px;}
.tag-doc{display:inline-flex; align-items:center; gap:5px; font-size:12px; padding:5px 10px; border-radius:8px; background:#f4f6f9; margin:0 6px 6px 0;}
.tag-doc.ok{background:#e2f7ee; color:#177a4d;}
.tag-doc.pending{background:#fdf1de; color:#a6660e;}
.avatar{width:34px; height:34px; border-radius:50%; background:var(--navy-2); color:#fff; display:inline-flex; align-items:center; justify-content:center; font-weight:700; font-size:12.5px; flex-shrink:0;}
.flex{display:flex;} .items-center{align-items:center;} .gap-8{gap:8px;} .gap-12{gap:12px;}
.text-dim{color:var(--text-dim);} .small{font-size:12px;}
