:root {
  --navy: #000A38;
  --navy-2: #0b1650;
  --blue: #1A44F1;
  --blue-soft: #e8edff;
  --orange: #EE6A2D;
  --orange-soft: #fff0e8;
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e3e7f1;
  --text: #1d2433;
  --muted: #636c80;
  --red: #d63b2f;
  --red-soft: #fdecea;
  --green: #12925c;
  --green-soft: #e5f6ee;
  --amber: #c27c0e;
  --amber-soft: #fff6e0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 10, 56, .06), 0 2px 8px rgba(0, 10, 56, .05);
  --rail: 232px;
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); font-size: 14px; }
body { -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; color: var(--navy); }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ───── Layout ───── */
.app { display: flex; min-height: 100vh; }
.rail {
  width: var(--rail); background: var(--navy); color: #c9d0ea; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 30;
}
.rail .brand { padding: 20px 20px 14px; }
.rail .brand img { height: 34px; display: block; }
.rail .brand small { display: block; color: #8d97bd; font-size: 11px; margin-top: 6px; letter-spacing: .04em; text-transform: uppercase; }
.rail nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
.rail .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6f7aa5; padding: 14px 12px 6px; }
.rail a {
  display: flex; align-items: center; gap: 10px; color: #c9d0ea; padding: 9px 12px; border-radius: 9px;
  font-weight: 500; margin-bottom: 2px;
}
.rail a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.rail a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.rail a.on { background: var(--blue); color: #fff; }
.rail a .count { margin-left: auto; background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.rail .me { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; gap: 10px; align-items: center; }
.rail .me .name { color: #fff; font-weight: 600; font-size: 13px; }
.rail .me button { background: none; border: 0; color: #8d97bd; cursor: pointer; padding: 0; font-size: 12px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 20;
}
.topbar .menu-btn { display: none; }
.content { padding: 22px 24px 60px; flex: 1; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .grow { min-width: 200px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* Barra do cronômetro / empresa ativa */
.timerbar { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.timer-chip {
  display: flex; align-items: center; gap: 10px; background: var(--orange-soft); border: 1px solid #fbd3bf;
  border-radius: 99px; padding: 5px 6px 5px 14px; min-width: 0; max-width: 620px;
}
.timer-chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--orange); animation: pulse 1.6s infinite; flex-shrink: 0; }
.timer-chip .what { min-width: 0; line-height: 1.2; }
.timer-chip .what b { color: var(--navy); font-size: 13px; }
.timer-chip .what span { display: block; font-size: 11.5px; color: var(--muted); }
.timer-chip .clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--orange); font-size: 15px; }
.timer-idle { color: var(--muted); font-size: 13px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ───── Componentes ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff;
  color: var(--navy); padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { border-color: #c8cfe3; background: #f8f9fd; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #1436c9; }
.btn.accent { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.accent:hover { background: #d95a20; }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #eef1f8; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.round-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; background: var(--orange); color: #fff;
}
.round-btn svg { width: 16px; height: 16px; }
.round-btn.pause { background: var(--navy); }
.round-btn.stop { background: #fff; color: var(--navy); border: 1px solid var(--line); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .card-h { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card .card-b { padding: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .v { white-space: nowrap; font-size: 26px; font-weight: 700; color: var(--navy); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.red .v { color: var(--red); }
.kpi.green .v { color: var(--green); }
.kpi.orange .v { color: var(--orange); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  border: 1px solid #d5dbea; border-radius: 9px; padding: 8px 11px; background: #fff; width: 100%; min-height: 37px;
}
textarea.input { resize: vertical; min-height: 80px; }
.input:focus { outline: 2px solid rgba(26, 68, 241, .25); border-color: var(--blue); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--blue); }
.seg { display: inline-flex; background: #e9ecf5; border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600;
  background: #eef1f8; color: var(--muted); white-space: nowrap;
}
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.orange { background: var(--orange-soft); color: #c4501b; }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.navy { background: var(--navy); color: #fff; }
.dot-c { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; flex-shrink: 0; letter-spacing: .02em;
}
.avatar.lg { width: 34px; height: 34px; font-size: 12.5px; }
img.avatar { object-fit: cover; background: #e9ecf5; }
.avatar.xl { width: 96px; height: 96px; font-size: 30px; }
.empty { text-align: center; color: var(--muted); padding: 34px 16px; }
.empty b { display: block; color: var(--navy); font-size: 15px; margin-bottom: 4px; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfe; }
table.t td { padding: 10px 12px; border-bottom: 1px solid #eef0f6; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f8f9fd; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.bar { height: 7px; background: #e9ecf5; border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.bar.green > i { background: var(--green); }
.bar.orange > i { background: var(--orange); }

/* ───── Kanban ───── */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 150px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 14px; align-items: start; }
.lane { margin-bottom: 22px; }
.lane-h { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-weight: 700; color: var(--navy); }
.col { background: #eaedf5; border-radius: var(--radius); padding: 8px; min-height: 120px; display: flex; flex-direction: column; gap: 8px; }
.col.drop { outline: 2px dashed var(--blue); background: var(--blue-soft); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 4px 6px 2px; font-weight: 700; font-size: 13px; color: var(--navy); }
.col-h .n { background: #fff; border-radius: 99px; padding: 0 8px; font-size: 12px; color: var(--muted); }
.col-h i { width: 8px; height: 8px; border-radius: 50%; }
.tcard {
  background: #fff; border-radius: 10px; padding: 10px 11px; box-shadow: 0 1px 2px rgba(0, 10, 56, .08); cursor: pointer;
  border-left: 4px solid var(--c, var(--blue)); display: flex; flex-direction: column; gap: 7px; position: relative;
}
.tcard:hover { box-shadow: 0 3px 10px rgba(0, 10, 56, .12); }
.tcard.dragging { opacity: .4; }
.tcard .client { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.tcard .title { font-weight: 600; color: var(--navy); line-height: 1.3; }
.tcard .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tcard .foot { display: flex; align-items: center; gap: 6px; }
.tcard.live { box-shadow: 0 0 0 2px var(--orange); }
.tcard.done .title { text-decoration: line-through; color: var(--muted); }
.more { text-align: center; }

/* Meu dia */
.company-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.company {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px;
  border-top: 4px solid var(--c, var(--blue)); box-shadow: var(--shadow);
}
.company.active { box-shadow: 0 0 0 2px var(--orange); }
.company h3 { font-size: 15px; }
.focus-head { display: flex; gap: 14px; align-items: center; background: var(--navy); color: #fff; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; flex-wrap: wrap; }
.focus-head h2 { color: #fff; }
.focus-head .clock { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; color: #ffb48f; }
.tlist { display: flex; flex-direction: column; }
.titem { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid #eef0f6; }
.titem:last-child { border-bottom: 0; }
.titem .grow { cursor: pointer; }
.titem .t { font-weight: 600; color: var(--navy); }
.titem.done .t { text-decoration: line-through; color: var(--muted); }
.titem.live { background: var(--orange-soft); }
.chk { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #c3cbe0; background: #fff; cursor: pointer; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.chk.on { background: var(--green); border-color: var(--green); }
.chk svg { width: 14px; height: 14px; }

/* Modal */
.overlay { position: fixed; inset: 0; background: rgba(0, 10, 56, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0, 10, 56, .3); }
.modal.wide { max-width: 900px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-b { padding: 18px 20px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.task-grid { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 20px; }
.side-box { background: #f8f9fd; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.cl-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.cl-item input[type=text] { border: 0; flex: 1; padding: 4px; border-radius: 6px; }
.cl-item input[type=text]:focus { outline: 1px solid var(--line); }
.cl-item.done input[type=text] { text-decoration: line-through; color: var(--muted); }
.events { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.ev { display: flex; gap: 9px; font-size: 13px; }
.ev .b { background: #f4f6fb; border-radius: 10px; padding: 8px 11px; flex: 1; }
.ev.sys { color: var(--muted); font-size: 12px; padding-left: 35px; }

/* Notificações */
.bell { position: relative; }
.bell .badge { position: absolute; top: 0; right: 0; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 1px 5px; }
.dropdown { position: absolute; right: 12px; top: 56px; width: 380px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 10, 56, .2); z-index: 60; max-height: 70vh; overflow-y: auto; }
.notif { padding: 11px 14px; border-bottom: 1px solid #eef0f6; cursor: pointer; display: flex; gap: 10px; }
.notif:hover { background: #f8f9fd; }
.notif.unread { background: #f3f6ff; }
.notif .ic { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: transparent; }
.notif.unread .ic { background: var(--blue); }

.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: 360px; animation: up .2s; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); padding: 20px; }
.login .box { background: #fff; border-radius: 16px; padding: 32px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.login img { height: 44px; align-self: flex-start; }

.chart-box { position: relative; height: 260px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--blue); border-bottom-color: var(--blue); }
.wd-pick { display: flex; gap: 4px; flex-wrap: wrap; }
.wd-pick button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 9px; cursor: pointer; font-weight: 600; font-size: 12px; }
.wd-pick button.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.preview-dates { background: var(--blue-soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--navy); }
.scrim { display: none; }

@media (max-width: 1100px) {
  .board { grid-template-columns: repeat(4, minmax(240px, 82vw)); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
  .board .col { scroll-snap-align: start; }
  .g3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .rail { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .rail { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 10, 56, .4); z-index: 25; }
  .topbar { padding: 0 12px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px 16px 60px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .task-grid { grid-template-columns: 1fr; }
  .timer-chip .what span { display: none; }
  .overlay { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
  .filters .input { min-width: 0; flex: 1 1 140px; }
  .hide-m { display: none; }
}

/* Cofre de acessos */
.vlist { display: flex; flex-direction: column; }
.vitem { padding: 14px 16px; border-bottom: 1px solid #eef0f6; display: flex; flex-direction: column; gap: 6px; }
.vitem:last-child { border-bottom: 0; }
.vrow { display: grid; grid-template-columns: 230px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; min-height: 30px; }
.vrow .vl { color: var(--muted); font-weight: 600; font-size: 12px; }
.vrow .vv { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; color: var(--navy); word-break: break-all; }
.vrow .vv.mask { letter-spacing: .15em; color: var(--muted); }
.vrow .vb { display: flex; gap: 2px; }
@media (max-width: 860px) {
  .vrow { grid-template-columns: minmax(0, 1fr) auto; }
  .vrow .vl { grid-column: 1 / -1; margin-bottom: -6px; }
}
