/* Gestão A&L — tema claro ("papel") e escuro ("grafite").
   Cor tem função: vermelho = prazo fatal, âmbar = prazo próximo, azul = processo administrativo, violeta = judicial. */
:root {
  --bg: #f7f4f2; --panel: #ffffff; --panel2: #efe9e6; --ink: #1f2328; --muted: #62696f; --line: #e0d8d4;
  --primary: #7a3b42; --primary-ink: #ffffff; --primary-soft: #f1e3e4; --gold: #c9a45c; --side: #4a2a2e;
  --adm: #2b5fa8; --adm-soft: #e1ebf8; --jud: #7b3f98; --jud-soft: #efe3f6;
  --danger: #b3403f; --danger-soft: #f7e3e1; --warn: #8f5a00; --warn-soft: #f8eed6; --ok: #34795a; --ok-soft: #e0f0e8;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 8px 24px rgba(20, 30, 40, .08);
  --radius: 8px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #11161c; --panel: #1a2129; --panel2: #222b35; --ink: #e8ecef; --muted: #98a4af; --line: #2d3843;
  --primary: #dcbc7c; --primary-ink: #2a0507; --primary-soft: #35191c; --gold: #dcbc7c; --side: #3a2326;
  --adm: #7aa6e6; --adm-soft: #1a2b45; --jud: #c196dc; --jud-soft: #2d1f3a;
  --danger: #f07a7a; --danger-soft: #3a1d1f; --warn: #e3aa4a; --warn-soft: #3a2c12; --ok: #66c48d; --ok-soft: #17301f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.005em; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Estrutura ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); border-right: 1px solid #3a2023; color: #f3ece0; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-family: var(--serif); font-size: 18px; font-weight: 700; padding: 6px 10px 16px; line-height: 1.2; color: #f3ece0; }
.brand img { display: block; width: 100%; height: auto; }
.brand .sub { display: block; font-family: var(--sans); font-weight: 400; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); margin-top: 8px; text-align: center; }
.brand small { display: block; font-family: var(--sans); font-weight: 400; font-size: 12px; color: #d8c7a6; margin-top: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: #f3ece0; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav a[aria-current="page"] { background: rgba(220, 188, 124, .18); color: #f2d9a0; }
.nav .count { margin-left: auto; background: #e8c987; color: #4a2a2e; font-weight: 700; font-size: 11px; border-radius: 10px; padding: 0 7px; min-width: 20px; text-align: center; }
.nav-sep { height: 1px; background: rgba(255, 255, 255, .14); margin: 10px 4px; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 20; }
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input { width: 100%; padding-left: 34px; border-radius: 20px; }
.topbar .search .icon { position: absolute; left: 11px; top: 9px; color: var(--muted); }
.menu-btn { display: none; }
.content { padding: 24px; max-width: 1280px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin-right: auto; }

/* ---------- Componentes ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--panel2); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel2); }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { padding: 6px; border-radius: 6px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: var(--panel2); color: var(--ink); }

input, select, textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--primary); }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
label.field { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
label.field .err { color: var(--danger); font-weight: 400; font-size: 12.5px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.banner { padding: 10px 12px; border-radius: 6px; background: var(--danger-soft); color: var(--danger); margin-bottom: 12px; }
.banner.info { background: var(--primary-soft); color: var(--primary); }
.banner.ok { background: #e6f4ea; color: #1b7a3d; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card > h2, .card > .card-head { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head h2, .card-head h3 { margin-right: auto; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1fr) 340px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.chip.adm { background: var(--adm-soft); color: var(--adm); }
.chip.jud { background: var(--jud-soft); color: var(--jud); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 9px 14px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type="search"], .toolbar input[type="text"] { width: 240px; }
.toolbar select { width: auto; max-width: 200px; }

table.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 9px 12px; background: var(--panel2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--panel2); }
.tbl td.actions { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty p { margin: 0 0 12px; }

/* ---------- Tipo de processo ---------- */
.kind-adm { border-left: 4px solid var(--adm); }
.kind-jud { border-left: 4px solid var(--jud); }

/* ---------- Painel ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12.5px; }
.kpi .value { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12.5px; color: var(--muted); }
.delta.up { color: var(--ok); } .delta.down { color: var(--danger); }
.bar { height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.bar.warn > span { background: var(--warn); }

/* Régua de prazos: os próximos 15 dias de uma olhada */
.ruler { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); margin-bottom: 18px; }
.ruler .day { padding: 8px 4px 10px; text-align: center; border-right: 1px solid var(--line); min-height: 76px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ruler .day:last-child { border-right: none; }
.ruler .day.weekend { background: var(--panel2); color: var(--muted); }
.ruler .day.today { box-shadow: inset 0 3px 0 var(--primary); font-weight: 700; }
.ruler .dow { font-size: 11.5px; color: var(--muted); }
.ruler .dom { font-family: var(--serif); font-size: 19px; line-height: 1; font-variant-numeric: tabular-nums; }
.ruler .marks { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; margin-top: auto; }
.ruler .mark { min-width: 20px; height: 20px; border-radius: 10px; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; color: #fff; padding: 0 5px; }
.ruler .mark.fatal { background: var(--danger); }
.ruler .mark.due { background: var(--warn); }
.ruler .mark.ev { background: var(--adm); }
.ruler .day.overdue-col { background: var(--danger-soft); }

.work-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.work-item:last-child { border-bottom: none; }
.work-item .title { font-weight: 600; }
.work-item .meta { grid-column: 2; font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.work-item.done .title { text-decoration: line-through; color: var(--muted); }
.list-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.group-title { font-family: var(--serif); font-size: 15px; font-weight: 600; margin: 18px 0 6px; display: flex; gap: 8px; align-items: center; }
.group-title .chip { font-family: var(--sans); }

.rank { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 8px 0; }
.rank .pos { font-family: var(--serif); font-size: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank .bar { grid-column: 2 / 4; }

/* ---------- Calendário ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.cal .dow { padding: 6px; text-align: center; font-size: 12.5px; color: var(--muted); background: var(--panel2); border-bottom: 1px solid var(--line); }
.cal .cell { min-height: 104px; padding: 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal .cell:nth-child(7n) { border-right: none; }
.cal .cell.other { background: var(--panel2); color: var(--muted); }
.cal .cell.today .dnum { background: var(--primary); color: var(--primary-ink); }
.cal .cell.sel { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal .dnum { align-self: flex-start; font-size: 12.5px; font-weight: 600; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.cal .it { font-size: 11.5px; padding: 1px 5px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; border: none; cursor: pointer; width: 100%; }
.cal .it.ev { background: var(--adm-soft); color: var(--adm); }
.cal .it.fatal { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.cal .it.due { background: var(--warn-soft); color: var(--warn); }
.cal .more { font-size: 11.5px; color: var(--muted); padding-left: 5px; }
.mini-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: 12.5px; }
.mini-cal .dow { color: var(--muted); padding: 2px 0; }
.mini-cal .d { position: relative; padding: 5px 0; border-radius: 6px; font-variant-numeric: tabular-nums; }
.mini-cal .d.other { color: var(--muted); opacity: .5; }
.mini-cal .d.today { background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.mini-cal .d.has::after { content: ""; position: absolute; left: 50%; bottom: 1px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--danger); }

/* ---------- Kanban ---------- */
.crm-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.crm-stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.crm-stat .v { font-size: 20px; font-weight: 700; }
.crm-stat .l { font-size: 12.5px; color: var(--muted); }
.crm-stat.danger .v { color: var(--danger, #b3261e); } .crm-stat.warn .v { color: #b26a00; } .crm-stat.ok .v { color: #1b7a3d; }
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; scroll-snap-type: x proximity; }
.col { background: var(--panel2); border-radius: var(--radius); padding: 10px; min-height: 160px; scroll-snap-align: start; display: flex; flex-direction: column; flex: 0 0 285px; min-width: 0; }
.col.over { outline: 2px dashed var(--primary); }
.col.collapsed { min-height: 0; flex: 0 0 56px; }
.col.collapsed h3 { flex-direction: column; align-items: center; }
.col.collapsed .col-name { writing-mode: vertical-rl; transform: rotate(180deg); max-height: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col.collapsed .spacer { display: none; }
.col h3 { font-family: var(--sans); font-size: 13.5px; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; position: sticky; top: 0; }
.col h3 .chip { background: var(--panel); }
.col h3 .spacer { flex: 1; }
.col h3 .col-name { min-width: 0; overflow-wrap: anywhere; }
.col-total { margin: -2px 0 8px; }
.col-list { max-height: calc(100vh - 330px); min-height: 80px; overflow-y: auto; padding-right: 2px; }
.col-empty { padding: 14px 4px; text-align: center; border: 1px dashed var(--line); border-radius: 6px; }
.kcard { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 6px; padding: 9px 10px; margin-bottom: 8px; cursor: grab; }
.kcard:hover { border-color: var(--primary); }
.kcard.late { border-left-color: var(--danger, #b3261e); } .kcard.soon { border-left-color: #e0a100; } .kcard.stale { border-left-color: #9aa0a6; }
.kcard.dragging { opacity: .4; }
.kcard .t { font-weight: 600; margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.kcard .num { display: flex; align-items: center; gap: 4px; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kcard .num .icon-btn { padding: 2px; }
.kcard .m { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.kcard .qa { display: flex; gap: 4px; margin-top: 6px; border-top: 1px solid var(--line); padding-top: 6px; }
.stale-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger, #b3261e); flex: none; }
.board.dense .kcard { padding: 6px 8px; margin-bottom: 5px; } .board.dense .kcard .qa { display: none; } .board.dense .kcard .m { margin-top: 3px; }

/* ---------- Linha do tempo e detalhes ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0 10px 16px; border-left: 2px solid var(--line); position: relative; margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--muted); }
.timeline li.fase::before { border-color: var(--primary); background: var(--primary); }
.timeline li.andamento::before { border-color: var(--adm); }
.timeline .when { font-size: 12.5px; color: var(--muted); }
.timeline .text { white-space: pre-wrap; overflow-wrap: anywhere; }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Modal, toast, lookup ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(8, 12, 16, .55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; z-index: 100; }
.modal { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); width: 100%; max-width: 560px; border: 1px solid var(--line); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin-right: auto; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel2); border-radius: 0 0 10px 10px; }
.modal-foot .left { margin-right: auto; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; }
.toast.error { background: var(--danger); color: #fff; }
.lookup { position: relative; }
.lookup .results { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); max-height: 240px; overflow-y: auto; margin-top: 2px; }
.lookup .results button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: none; background: none; cursor: pointer; }
.lookup .results button:hover, .lookup .results button:focus { background: var(--panel2); }
.lookup .sel { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel2); }
.lookup .sel span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bars { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 8px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .pair { display: flex; gap: 3px; align-items: flex-end; width: 100%; height: 100%; justify-content: center; }
.bars .pair span { flex: 1; max-width: 22px; border-radius: 3px 3px 0 0; min-height: 2px; }
.bars .in { background: var(--ok); } .bars .out { background: var(--danger); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
code.token { background: var(--panel2); padding: 6px 8px; border-radius: 6px; display: block; overflow-wrap: anywhere; font-size: 12.5px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .grid.main-side { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; width: 250px; transform: translateX(-100%); transition: transform .18s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 10px 14px; }
  .topbar .spacer { display: none; }
  .topbar .search { max-width: none; }
  .form-grid, .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .ruler { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .cal .cell { min-height: 70px; }
  .cal .it { font-size: 10.5px; }
  .toolbar input[type="search"], .toolbar input[type="text"], .toolbar select { width: 100%; max-width: none; }
}
@media (max-width: 520px) { .kpis { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .sidebar, .topbar, .btn, .toasts { display: none !important; } .shell { display: block; } body { background: #fff; } }

/* ---------- Menu suspenso ---------- */
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); min-width: 210px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; z-index: 50; }
.menu button, .menu a { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: none; background: none; text-align: left; border-radius: 6px; cursor: pointer; color: var(--ink); font-weight: 500; }
.menu button:hover, .menu a:hover { background: var(--panel2); text-decoration: none; }
.menu hr { border: none; border-top: 1px solid var(--line); margin: 4px 0; }

/* Botão Adicionar e sino de avisos */
.add-btn { gap: 8px; }
.bell { position: relative; }
.bell-dot { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #d93025; color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.menu.notif { width: 340px; max-width: calc(100vw - 24px); padding: 0; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: 380px; overflow: auto; }
.menu .notif-item { flex-direction: column; align-items: flex-start; gap: 2px; border-radius: 0; border-bottom: 1px solid var(--line); font-weight: 400; }
.menu .notif-item.unread { background: var(--primary-soft); font-weight: 600; }
@media (max-width: 760px) { .hello { display: none; } .add-btn { padding: 8px 10px; } .menu.notif { position: fixed; left: 12px; right: 12px; top: 56px; width: auto; } }
.menu.add-menu, .dropdown .menu { min-width: 250px; }
.menu.notif { min-width: 0; }

/* Avisos em destaque e avatar */
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.avatar.sys { background: var(--muted); }
.notif-row { display: flex; gap: 10px; align-items: flex-start; }
.pop-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-pop { position: fixed; top: 72px; right: 16px; z-index: 210; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.notif-pop .pop-clear { align-self: flex-end; }
.pop-card { position: relative; display: flex; gap: 10px; align-items: center; padding: 12px 28px 12px 12px; background: var(--ink); color: var(--bg); border-radius: 10px; box-shadow: var(--shadow); text-decoration: none; }
.pop-card .muted { color: inherit; opacity: .7; }
.pop-x { position: absolute; top: 4px; right: 8px; background: none; border: 0; color: inherit; font-size: 18px; cursor: pointer; }

.notice { background: var(--primary-soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; }

/* Janela da tarefa (formato Advbox) */
.modal.tv-modal { max-width: 1040px; width: calc(100vw - 32px); }
.tv { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 0; }
.tv-main { padding-right: 24px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tv-side { border-left: 1px solid var(--line); padding-left: 22px; display: flex; flex-direction: column; gap: 16px; }
.tv-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.tv-bar .btn svg, .tv-bar .btn .icon { margin-right: 4px; }
.tv-title { margin: 6px 0 0; font-size: 22px; }
.tv-text { margin: 0; line-height: 1.55; }
.tv-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; align-items: center; min-height: 34px; }
.tv-val { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tv-person { display: inline-flex; gap: 8px; align-items: center; }
.danger-text { color: var(--danger, #b3261e); }
.tv-panel { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.tv-form { display: flex; flex-direction: column; gap: 10px; }
.tv-line { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; align-items: center; }
.tv-chip { display: inline-flex; gap: 6px; align-items: center; padding: 2px 8px 2px 2px; border: 1px solid var(--line); border-radius: 999px; }
.tv-x { border: 0; background: none; cursor: pointer; font-size: 16px; color: var(--muted); }
.tv-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tv-actions input[type=date], .tv-actions input[type=time], .tv-actions select { width: auto; }
.tv-priv { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.tv-hist h4 { margin: 8px 0; }
.tv-c { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.tv-c.sys { opacity: .75; }
.tv-blk .row { gap: 6px; }
@media (max-width: 800px) { .tv { grid-template-columns: 1fr; } .tv-main { padding-right: 0; } .tv-side { border-left: 0; border-top: 1px solid var(--line); padding: 14px 0 0; margin-top: 14px; } .tv-row { grid-template-columns: 100px minmax(0, 1fr); } }
.tv-line .row.wrap select { width: auto; min-width: 150px; }

.tv-pts { margin-left: 10px; font-size: 14px; font-weight: 400; color: var(--muted); font-family: inherit; }
.tv-when { display: inline-flex; gap: 8px; align-items: center; }

/* Arquivos */
.dropzone { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 16px; margin-bottom: 12px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--panel); color: var(--muted); }
.dropzone.over { border-color: var(--primary); background: var(--primary-soft); color: var(--ink); }
.dropzone select { width: auto; }
.files-panel .tbl a { display: inline-flex; align-items: center; gap: 4px; }

/* ---- Interruptores de acesso por pessoa ---- */
.perm-box { grid-column: 1 / -1; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border: 1px solid var(--border, #d8dde6); border-radius: 10px; }
.perm-row.hot { border-color: var(--accent, #2f5fd0); }
.perm-name { font-weight: 600; font-size: 0.92rem; }
.perm-btn { white-space: nowrap; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 5px 11px; font-size: 0.82rem; cursor: pointer; font-weight: 600; }
.perm-btn svg { width: 15px; height: 15px; }
.perm-btn.off { background: #e8eaee; color: #5b6472; }
.perm-btn.view { background: #fff1cc; color: #7a5a00; }
.perm-btn.edit { background: #d6f3df; color: #17653a; }
.perm-btn:disabled { opacity: .55; cursor: not-allowed; }
.perm-box.locked::after { content: 'O administrador sempre tem acesso a tudo.'; display: block; margin-top: 6px; font-size: .82rem; color: #5b6472; }
@media (prefers-color-scheme: dark) {
  .perm-btn.off { background: #2b303a; color: #aab2c0; }
  .perm-btn.view { background: #4a3d12; color: #ffd873; }
  .perm-btn.edit { background: #163d27; color: #8fe0b0; }
}
:root[data-theme="dark"] .perm-btn.off { background: #2b303a; color: #aab2c0; }
:root[data-theme="dark"] .perm-btn.view { background: #4a3d12; color: #ffd873; }
:root[data-theme="dark"] .perm-btn.edit { background: #163d27; color: #8fe0b0; }

/* ---------- Tela de entrada (login, primeiro acesso, convite, nova senha) ---------- */
.auth {
  --panel: #fffdf9; --panel2: #f5efe6; --ink: #1d1517; --muted: #6b6062; --line: #e3d9ca; --primary: #6b0e14; --primary-ink: #fff; --primary-soft: #f4e5e5; --danger: #a82424; --danger-soft: #fbe6e6;
  position: relative; overflow: hidden; min-height: 100vh; min-height: 100dvh; padding: 24px;
  display: grid; align-items: center; justify-items: center; gap: 28px;
  background:
    radial-gradient(900px 600px at 12% 8%, rgba(201, 164, 92, .20), transparent 60%),
    radial-gradient(800px 600px at 92% 95%, rgba(150, 30, 40, .55), transparent 60%),
    linear-gradient(160deg, #6a0b11 0%, #4a0509 55%, #350306 100%);
  color: #f4e9d6; color-scheme: light;
}
.auth-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.auth-lines { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.auth-lines i { position: absolute; border: 1px solid rgba(201, 164, 92, .22); }
.auth-lines i:nth-child(1) { width: 46vmin; height: 46vmin; left: 6%; top: 10%; animation: auth-drift-a 26s ease-in-out infinite alternate; }
.auth-lines i:nth-child(2) { width: 30vmin; height: 30vmin; left: calc(6% + 9vmin); top: calc(10% + 9vmin); border-color: rgba(201, 164, 92, .14); animation: auth-drift-b 32s ease-in-out infinite alternate; }
.auth-lines i:nth-child(3) { width: 62vmin; height: 62vmin; right: -14vmin; bottom: -18vmin; border-color: rgba(201, 164, 92, .12); animation: auth-drift-b 38s ease-in-out infinite alternate-reverse; }
.auth-hero, .auth-box { position: relative; z-index: 1; }
.auth-hero { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.logo-wrap { position: relative; display: inline-block; line-height: 0; animation: auth-logo-in 1.2s cubic-bezier(.2, .7, .2, 1) both; will-change: transform; }
.auth-logo { width: 260px; max-width: 70vw; height: auto; display: block; filter: drop-shadow(0 6px 24px rgba(0, 0, 0, .35)); }
.logo-wrap::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 246, 220, .95) 50%, transparent 62%); background-size: 260% 100%; background-position: 160% 0;
  -webkit-mask: url(/img/logo-vertical.png) center / contain no-repeat; mask: url(/img/logo-vertical.png) center / contain no-repeat;
  animation: logo-shimmer 6s 1.6s ease-in-out infinite;
}
.auth-tag { margin: 0; max-width: 30ch; font-family: var(--serif); font-size: 21px; line-height: 1.35; color: #f1e2c3; animation: auth-field-in .8s .5s both; }
.auth-points { display: none; list-style: none; margin: 4px 0 0; padding: 0; gap: 10px; flex-direction: column; text-align: left; }
.auth-points li { display: flex; align-items: center; gap: 10px; color: rgba(244, 233, 214, .85); font-size: 14px; animation: auth-field-in .7s both; }
.auth-points li::before { content: ''; flex: none; width: 7px; height: 7px; transform: rotate(45deg); background: #c9a45c; box-shadow: 0 0 10px rgba(201, 164, 92, .7); }
.auth-points li:nth-child(1) { animation-delay: .8s; } .auth-points li:nth-child(2) { animation-delay: .95s; } .auth-points li:nth-child(3) { animation-delay: 1.1s; }
.auth-box { width: 100%; max-width: 420px; }
.auth .card {
  position: relative; overflow: hidden; width: 100%; padding: 30px 28px 26px; background: rgba(255, 253, 249, .97); color: var(--ink); border: 0; border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45), 0 0 0 1px rgba(201, 164, 92, .35); animation: auth-card-in .9s .2s cubic-bezier(.2, .7, .2, 1) both;
}
.auth .card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, #a67c2e, #e8cf94, #a67c2e); }
.auth .card::after { content: ''; position: absolute; top: 0; left: -50%; width: 40%; height: 3px; background: linear-gradient(90deg, transparent, #fff7dc, transparent); animation: auth-shine 5s 1.4s ease-in-out infinite; }
.auth h1 { margin-bottom: 4px; font-size: 25px; color: #3a0a0e; }
.auth form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.auth form > * { animation: auth-field-in .6s both; }
.auth form > *:nth-child(1) { animation-delay: .5s; } .auth form > *:nth-child(2) { animation-delay: .6s; } .auth form > *:nth-child(3) { animation-delay: .7s; }
.auth form > *:nth-child(4) { animation-delay: .8s; } .auth form > *:nth-child(5) { animation-delay: .9s; } .auth form > *:nth-child(6) { animation-delay: 1s; }
.auth input:not([type=checkbox]) { background: #fff; border-color: var(--line); transition: border-color .2s, box-shadow .2s; }
.auth input:not([type=checkbox]):focus { border-color: #b8893a; box-shadow: 0 0 0 3px rgba(201, 164, 92, .3); outline: none; }
.auth .btn.primary { position: relative; overflow: hidden; justify-content: center; padding: 11px 16px; border: 0; background: linear-gradient(135deg, #7d1118, #5a0a10); color: #fff; font-weight: 600; letter-spacing: .02em; box-shadow: 0 6px 18px rgba(90, 10, 16, .35); transition: transform .15s, box-shadow .2s; }
.auth .btn.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(90, 10, 16, .45); }
.auth .btn.primary::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; background: linear-gradient(100deg, transparent, rgba(255, 236, 190, .45), transparent); transform: skewX(-20deg); transition: left .6s; }
.auth .btn.primary:hover:not(:disabled)::after { left: 130%; }
.auth a { color: #6b0e14; }
@media (min-width: 900px) {
  .auth { grid-template-columns: minmax(320px, 1fr) minmax(380px, 440px); justify-items: stretch; padding: 40px clamp(32px, 7vw, 120px); gap: clamp(32px, 6vw, 110px); }
  .auth-hero { align-items: flex-start; text-align: left; gap: 26px; justify-self: center; }
  .auth-logo { width: 340px; }
  .auth-tag { font-size: 26px; }
  .auth-points { display: flex; }
  .auth-box { justify-self: end; }
}
@media (max-width: 899px) { .auth-hero { gap: 6px; } .auth-logo { width: 200px; } .auth-tag { font-size: 16px; } }
@media (max-height: 640px) and (max-width: 899px) { .auth-tag { display: none; } .auth-logo { width: 150px; } }
@keyframes auth-logo-in { from { opacity: 0; transform: translateY(-16px) scale(.94); filter: blur(10px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes auth-card-in { from { opacity: 0; transform: translateY(28px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes auth-field-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes auth-shine { 0% { left: -50%; } 55%, 100% { left: 130%; } }
@keyframes logo-shimmer { 0% { background-position: 160% 0; } 45%, 100% { background-position: -60% 0; } }
@keyframes auth-drift-a { to { transform: translate(40px, 30px) rotate(6deg); } }
@keyframes auth-drift-b { to { transform: translate(-36px, -28px) rotate(-8deg); } }
@media (prefers-reduced-motion: reduce) {
  .auth *, .auth *::before, .auth *::after { animation: none !important; transition: none !important; }
}

/* Meu Painel (modelo Advbox) */
.ts-row { display: grid; grid-template-columns: 96px minmax(0,1fr) 56px; gap: 10px; align-items: center; padding: 6px 0; }
.ts-l { color: var(--muted); font-size: 13px; }
.ts-row strong { text-align: right; }
.bar.ts { height: 12px; }
.bar.ts.prev span { background: var(--muted); opacity: .6; }
.bar.ts.goal span { background: var(--warn); }
.mini-cal.big .d { padding: 10px 0; min-height: 40px; }
.mini-cal .d .cnt { position: absolute; top: 1px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10.5px; line-height: 16px; font-weight: 700; }
.mini-cal .d.today .cnt { box-shadow: 0 0 0 2px var(--primary); }
h4.grp { margin: 14px 0 4px; font-size: 14px; }

/* Escolha de várias pessoas */
.multi-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.multi-chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 5px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.multi-chip.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.multi-short { margin-bottom: 8px; gap: 6px; }

/* Financeiro (tela única) */
.fin-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 14px; margin-bottom: 18px; }
.fin-grid .bars .b { gap: 2px; }
.acc-row { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line, rgba(128,128,128,.2)); padding: 9px 4px; text-align: left; cursor: pointer; color: inherit; font: inherit; align-items: center; }
.acc-row:hover, .acc-row.on { background: rgba(128,128,128,.12); }
.fin-totals { display: flex; gap: 28px; flex-wrap: wrap; justify-content: flex-end; margin: 0 0 10px; }
.fin-totals > div { display: flex; flex-direction: column; align-items: flex-end; }
.fin-totals strong { font-size: 18px; }
@media (max-width: 800px) { .fin-grid { grid-template-columns: minmax(0, 1fr); } .fin-totals { justify-content: flex-start; } .fin-totals > div { align-items: flex-start; } }

.dropzone { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; padding: 22px 14px; border: 2px dashed rgba(128,128,128,.5); border-radius: 12px; cursor: pointer; }
.dropzone:hover, .dropzone.over, .dropzone:focus-visible { border-color: var(--accent, #7a1018); background: rgba(128,128,128,.08); outline: none; }

/* Configurações: menu lateral */
.cfg-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; align-items: start; }
.cfg-nav-wrap { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.cfg-select { display: none; width: 100%; }
.cfg-group { margin-bottom: 14px; }
.cfg-group-title { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 4px 12px; }
.cfg-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 9px 12px; color: inherit; font: inherit; cursor: pointer; }
.cfg-item:hover { background: rgba(128,128,128,.12); }
.cfg-item.on { background: rgba(128,128,128,.2); font-weight: 600; }
.cfg-body { min-width: 0; }
@media (max-width: 860px) { .cfg-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; } .cfg-nav-wrap { position: static; max-height: none; } .cfg-nav { display: none; } .cfg-select { display: block; } }

/* Matriz / Filial e frase do dia */
.unit-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-left: 8px; background: rgba(201,162,39,.18); color: #c9a227; border: 1px solid rgba(201,162,39,.5); vertical-align: middle; }
.unit-pill.filial { background: rgba(70,130,180,.18); color: #7db3e0; border-color: rgba(70,130,180,.5); }
.unit-pill.big { margin: 0 0 10px; font-size: 12px; padding: 4px 14px; align-self: flex-start; }
.auth-quote { margin: 22px 0 0; max-width: 38ch; padding: 14px 0 0; border-top: 1px solid rgba(241,226,195,.25); animation: auth-field-in .8s .8s both; }
.auth-quote figcaption { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: rgba(241,226,195,.65); margin-bottom: 6px; }
.auth-quote blockquote { margin: 0; font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1.45; color: #f1e2c3; }
@media (max-width: 899px) { .auth-quote { margin-top: 10px; padding-top: 8px; } .auth-quote blockquote { font-size: 14px; } }

/* Detalhes em janela suspensa (contato / processo) */
.modal.xwide { max-width: 1100px; width: 96vw; }
.detail-modal > p.small:first-child { display: none; }
.detail-modal .page-head { margin-top: 0; }
.detail-modal .page-head h1 { font-size: 1.25rem; }
.detail-modal .grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.kcard { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.kcard.dragging { opacity: .35; }
.drag-ghost { position: fixed !important; z-index: 9999; pointer-events: none; opacity: .92; transform: rotate(2deg); box-shadow: 0 12px 28px rgba(0,0,0,.28); margin: 0 !important; }

/* Gráficos */
.chart { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-ax { fill: var(--muted); font-size: 11px; }
.ch-center { fill: var(--ink); font-size: 20px; font-weight: 700; }
.ch-bar:hover { opacity: .8; }
.donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.ch-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: .88rem; flex: 1; min-width: 160px; }
.ch-legend li { display: flex; align-items: center; gap: 8px; }
.ch-legend li b { margin-left: auto; font-weight: 600; white-space: nowrap; }
.ch-legend i { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.ch-legend.inline { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 6px; }
.hbars { display: grid; gap: 7px; }
.hb-row { display: grid; grid-template-columns: minmax(80px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: .88rem; }
.hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-t { height: 12px; background: var(--primary-soft); border-radius: 6px; overflow: hidden; }
.hb-t i { display: block; height: 100%; border-radius: 6px; }
.chart-card h3 { margin: 0 0 8px; }
.lead-view .timeline .text { white-space: pre-wrap; }

/* Painel lateral (ficha do usuário) */
.backdrop.side { align-items: stretch; justify-content: flex-end; padding: 0; }
.modal.side { max-width: 480px; width: 100%; height: 100%; border-radius: 0; display: flex; flex-direction: column; animation: slideIn .18s ease-out; }
.modal.side .modal-body { flex: 1; overflow-y: auto; }
.modal.side .modal-foot { border-radius: 0; flex-wrap: wrap; }
.modal.side form .grid, .modal.side .form-grid { grid-template-columns: 1fr !important; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.switch { position: relative; display: inline-block; width: 38px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 20px; cursor: pointer; transition: .15s; }
.switch span::before { content: ''; position: absolute; height: 14px; width: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }
.user-cell { display: flex; align-items: center; gap: 10px; }
@media print { .toolbar, .cfg-nav-wrap, .page-head .btn { display: none !important; } }

.avatar.has-photo { background: none; overflow: hidden; padding: 0; }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.menu .notif-item { position: relative; padding-right: 36px; }
.menu .notif-item .notif-x { position: absolute; top: 8px; right: 8px; left: auto; width: 22px; height: 22px; min-width: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; margin: 0; }
.menu .notif-item .notif-x:hover, .menu .notif-item .notif-x:focus-visible { background: var(--danger-soft); color: var(--danger); }

/* Atividades: lista rica, quadro, desempenho */
.work-item.rich { grid-template-columns: auto minmax(0, 1fr) auto; }
.work-item .lead { display: flex; align-items: center; gap: 6px; }
.work-item .marks { display: inline-flex; gap: 2px; }
.work-item .mark { border: 0; background: transparent; cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px; color: var(--muted); opacity: .55; font-weight: 700; }
.work-item .mark:hover:not(:disabled) { opacity: 1; }
.work-item .mark.star.on { color: #e0a100; opacity: 1; }
.work-item .mark.bang.on { color: var(--danger); opacity: 1; }
.work-item .who { font-weight: 400; }
.work-item .row.end { justify-content: flex-end; gap: 10px; align-items: center; }
.group-title.clickable { cursor: pointer; user-select: none; }
.group-title .arrow { width: 14px; color: var(--muted); }
.chip.big { padding: 6px 12px; font-size: 13.5px; }
.col h3 .dot, .ts-leg .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--line); }
.dot.danger { border-color: var(--danger); } .dot.warn { border-color: var(--warn); } .dot.ok, .dot.cur { border-color: var(--ok); background: var(--ok); } .dot.prev { border-color: var(--gold); background: var(--gold); } .dot.goal { border-color: var(--text); }
.kcard .m { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.kcard .m .spacer { flex: 1; }
.ts-row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; margin: 12px 0; }
.ts-l { color: var(--muted); font-size: 13px; }
.ts-t { background: var(--panel2); border-radius: 6px; overflow: hidden; }
.ts-f { padding: 6px 10px; text-align: right; color: #fff; font-variant-numeric: tabular-nums; min-width: 40px; }
.ts-f.cur { background: var(--ok); } .ts-f.prev { background: var(--gold); color: #222; } .ts-f.goal { background: var(--muted); }
.perf-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.seg { display: inline-flex; gap: 4px; }
.mini-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: 13px; }
.mini-cal .dow { color: var(--muted); font-size: 12px; padding: 4px 0; }
.mini-cal .day { position: relative; padding: 7px 0; border-radius: 8px; }
.mini-cal .day.today { background: var(--panel2); font-weight: 700; }
.mini-cal .badge { position: absolute; top: -2px; right: 0; background: var(--danger); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; line-height: 15px; }
@media (max-width: 900px) { .perf-grid { grid-template-columns: 1fr; } .work-item.rich { grid-template-columns: auto minmax(0, 1fr); } }
.dot.cur { border-color: var(--primary) !important; background: var(--primary) !important; }
.ts-f.cur { background: var(--primary); }
.shortcuts { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; border-left: 1px solid var(--line); padding-left: 10px; }
.sc-btn { position: relative; border: 0; background: transparent; cursor: pointer; font-size: 19px; padding: 4px 7px; border-radius: 8px; line-height: 1; }
.sc-btn:hover { background: var(--panel2); }
.sc-badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; border-radius: 9px; font-size: 10.5px; line-height: 16px; padding: 0 5px; font-weight: 700; }

/* Celular: Atividades / Meu Painel mais compactos e sem estouro lateral */
@media (max-width: 600px) {
  .work-item.rich { grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; padding: 12px 10px; }
  .work-item.rich .row.end { grid-column: 1 / -1; justify-content: space-between; flex-wrap: wrap; }
  .work-item.rich .meta { grid-column: 1 / -1; }
  .work-item .lead { flex-direction: column; align-items: center; gap: 2px; }
  .work-item .marks { flex-direction: row; }
  .work-item .mark { padding: 6px 8px; font-size: 18px; }
  .toolbar { gap: 8px; }
  .toolbar select { width: calc(50% - 4px); max-width: none; flex: 1 1 calc(50% - 4px); }
  .toolbar input[type="search"], .toolbar input[type="text"] { width: 100%; flex: 1 1 100%; }
  .shortcuts { margin-left: 0; border-left: 0; padding-left: 0; width: 100%; justify-content: space-around; border-top: 1px solid var(--line); padding-top: 8px; }
  .sc-btn { font-size: 22px; padding: 6px 12px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 10px 12px; }
  .kpi .value { font-size: 24px; }
  .col { flex: 0 0 84vw; }
  .ts-row { grid-template-columns: 78px 1fr; }
  .group-title .muted.small { display: none; }
  .chip.big { font-size: 12.5px; padding: 5px 9px; }
  .page-head { flex-wrap: wrap; gap: 8px; }
  .tabs button { padding: 9px 12px; }
}
@media (max-width: 600px) {
  /* tabelas viram cartões: cada linha empilha rótulo e valor */
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 6px 12px; background: var(--panel); }
  .tbl td { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; border: 0 !important; padding: 5px 0 !important; text-align: right; overflow-wrap: anywhere; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: 0 0 34%; }
  .tbl td[data-label=""]::before { display: none; }
  .tbl td > * { min-width: 0; }
  .table-wrap { overflow-x: visible; border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 0 !important; }
}
@media (max-width: 600px) { .tbl td:empty { display: none; } .crm-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
