/* Portal Oliveira — mobile first. Layout: barra lateral no desktop, barra inferior no celular. */
:root {
  color-scheme: light;
  --bg: #f4f5ef;
  --surface: #ffffff;
  --surface-2: #f8f9f4;
  --ink: #1e2619;
  --muted: #646d5c;
  --line: #e1e5d7;
  --olive: #4e6b26;
  --olive-strong: #3c5419;
  --olive-soft: #eaf0dc;
  --leaf: #8fae4c;
  --info: #2f6db3;
  --info-soft: #e5eefa;
  --ok: #2f7d4a;
  --ok-soft: #e3f3e8;
  --warn: #a86a00;
  --warn-soft: #fbf0d9;
  --link: #6a4bb0;
  --link-soft: #efe9fa;
  --danger: #b4372f;
  --danger-soft: #fbe7e5;
  --shadow: 0 1px 2px rgba(30, 38, 25, .06), 0 4px 14px rgba(30, 38, 25, .05);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--olive); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: .98rem; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- Estrutura ---------- */
.shell { min-height: 100%; }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; color: var(--olive-strong); letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--olive); display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; }
.topbar .spacer { flex: 1; }
@media (max-width: 420px) { .topbar .brand-text { display: none; } }
.main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom, 0px)); max-width: 1200px; margin: 0 auto; }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
}
.bottomnav button {
  border: 0; background: none; padding: 6px 2px; border-radius: 10px; display: flex; flex-direction: column; align-items: center;
  gap: 2px; font-size: .7rem; color: var(--muted); cursor: pointer; min-height: 52px; justify-content: center;
}
.bottomnav button .ico { font-size: 1.25rem; line-height: 1; }
.bottomnav button.active { color: var(--olive-strong); background: var(--olive-soft); font-weight: 650; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--sidebar) 1fr; }
  .topbar, .bottomnav { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px;
  }
  .main { padding: 28px 32px 48px; width: 100%; }
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; background: none; border-radius: 10px;
  text-align: left; cursor: pointer; color: var(--ink); font-weight: 500;
}
.nav button:hover { background: var(--surface-2); }
.nav button.active { background: var(--olive-soft); color: var(--olive-strong); font-weight: 700; }
.nav .ico { width: 22px; text-align: center; }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.side-user .who { min-width: 0; flex: 1; }
.side-user .who strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.envswitch { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.envswitch button { border: 0; background: none; border-radius: 9px; padding: 6px 8px; cursor: pointer; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.envswitch button.active { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: var(--shadow); }
.topbar .envswitch { grid-template-columns: auto auto; }
.topbar .envswitch button { padding: 5px 8px; }

/* ---------- Componentes ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.page-head .titles { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; font-size: .85rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--olive); }
.crumbs .sep { opacity: .5; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.section { margin-top: 22px; }
.section > h2 { margin-bottom: 10px; }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
.split { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .split { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; min-height: 40px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600;
  font-size: .9rem; white-space: nowrap; text-decoration: none; color: var(--ink);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--olive); border-color: var(--olive); color: #fff; }
.btn.primary:hover { background: var(--olive-strong); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--danger); border-color: #efc9c5; }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: none; }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.iconbtn { border: 0; background: none; cursor: pointer; border-radius: 8px; padding: 6px; line-height: 1; font-size: 1rem; }
.iconbtn:hover { background: var(--surface-2); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .76rem;
  font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.badge.st-nao_iniciada { background: #f1f2ee; color: #5b6255; border-color: #e1e3dc; }
.badge.st-em_andamento { background: var(--info-soft); color: var(--info); border-color: #cddcf1; }
.badge.st-concluida { background: var(--ok-soft); color: var(--ok); border-color: #c6e6d0; }
.badge.st-vinculada { background: var(--link-soft); color: var(--link); border-color: #dcd0f3; }
.badge.st-aberta { background: var(--info-soft); color: var(--info); border-color: #cddcf1; }
.badge.st-congelada { background: #e8f3f8; color: #2c6e8a; border-color: #cbe3ee; }
.badge.st-cancelada { background: var(--danger-soft); color: var(--danger); border-color: #f1cdc9; }
.badge.pr-alta { background: var(--danger-soft); color: var(--danger); border-color: #f1cdc9; }
.badge.pr-media { background: var(--warn-soft); color: var(--warn); border-color: #f0dcb0; }
.badge.pr-baixa { background: var(--olive-soft); color: var(--olive-strong); border-color: #d6e1bd; }
.badge.lvl { background: var(--olive-soft); color: var(--olive-strong); border-color: #d6e1bd; }

.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--olive-soft); color: var(--olive-strong);
  display: inline-grid; place-items: center; font-weight: 700; font-size: .85rem; overflow: hidden; border: 2px solid var(--surface);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar.xl { width: 96px; height: 96px; font-size: 1.8rem; }
.avatar.xs { width: 24px; height: 24px; font-size: .65rem; border-width: 1px; }

.progress { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--leaf), var(--olive)); }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: .85rem; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stats .card { padding: 12px 14px; }

.kv { display: grid; grid-template-columns: 1fr; gap: 10px 18px; }
@media (min-width: 640px) { .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kv.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kv > div { min-width: 0; }
.kv dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; margin-bottom: 2px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv .wide { grid-column: 1 / -1; }
.desc { white-space: pre-wrap; }

.depends { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--link-soft); color: var(--link); font-size: .85rem; font-weight: 600; }
.depends.done { background: var(--ok-soft); color: var(--ok); }

.empty { padding: 26px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); }

/* Cards de setor / projeto */
.tile { display: flex; flex-direction: column; gap: 10px; }
.tile-top { display: flex; align-items: center; gap: 12px; }
.sector-icon { width: 52px; height: 52px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 1.7rem; background: var(--olive-soft); }
.tile-title { font-weight: 700; font-size: 1.05rem; color: var(--ink); overflow-wrap: anywhere; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.tile-title:hover { color: var(--olive); text-decoration: underline; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .85rem; }

/* Lista de tarefas responsiva */
.tasklist { display: flex; flex-direction: column; gap: 8px; }
.trow {
  display: grid; gap: 8px 12px; grid-template-columns: minmax(0, 1fr); align-items: center;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.trow.sub { margin-left: 18px; background: var(--surface-2); border-style: dashed; }
.trow .t-title { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.trow .t-cells { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; color: var(--muted); align-items: center; }
.trow .t-status { display: flex; gap: 6px; align-items: center; justify-content: flex-start; flex-wrap: wrap; }
@media (min-width: 640px) {
  .trow { grid-template-columns: minmax(0, 1fr) auto; }
  .trow .t-status { justify-content: flex-end; grid-column: 2; grid-row: 1; }
}
.linklike { background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); font-weight: 650; text-align: left; overflow-wrap: anywhere; }
.linklike:hover { color: var(--olive); text-decoration: underline; }
.thead { display: none; }
@media (min-width: 1000px) {
  .tasklist.table .thead, .tasklist.table .trow {
    grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.2fr) 90px 92px 92px 150px;
  }
  .tasklist.table .thead { display: grid; gap: 12px; padding: 0 14px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
  .tasklist.table .trow .t-cells { display: contents; color: var(--ink); }
  .tasklist.table .trow .t-cells > span { font-size: .88rem; }
  .tasklist.table .trow .t-cells .lbl { display: none; }
  .tasklist.table .trow .t-status { grid-column: 6; grid-row: 1; }
  .tasklist.table .trow.sub { margin-left: 28px; }
}

/* Tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 14px; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--olive-strong); border-bottom-color: var(--olive); }
.tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--surface-2); font-size: .75rem; }

/* Barra de ações da tarefa */
.actionbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
@media (max-width: 899px) {
  .actionbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actionbar .btn { width: 100%; }
}

/* Histórico */
.history { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; border-top: 1px solid var(--line); padding-top: 12px; }
.hitem { display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.hitem .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; background: var(--surface-2); border: 1px solid var(--line); }
.hitem.comentario .dot { background: var(--info-soft); }
.hitem.anexo .dot { background: var(--warn-soft); }
.hitem .body { min-width: 0; }
.hitem .line1 { font-size: .88rem; }
.hitem .when { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hitem .detail { font-size: .88rem; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.hitem.comentario .detail { color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 4px; }
.filelink { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: .85rem; margin-top: 4px; max-width: 100%; }
.filelink span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.composer .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Formulários */
.form { display: flex; flex-direction: column; gap: 12px; }
.form .row2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .form .row2 { grid-template-columns: 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: .82rem; font-weight: 650; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); min-height: 42px;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--olive-soft); border-color: var(--olive); }
.field .hint { font-size: .78rem; color: var(--muted); }
.static-field { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--olive); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: .85rem; }
.chip.on { background: var(--olive); color: #fff; border-color: var(--olive); }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: 10px; font-size: .88rem; }

.iconlib { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; }
.iconlib button { aspect-ratio: 1; max-width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; font-size: 1.4rem; cursor: pointer; }
.iconlib button.on { border-color: var(--olive); background: var(--olive-soft); box-shadow: inset 0 0 0 1px var(--olive); }

.picklist { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.picklist label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.picklist label:has(input:checked) { border-color: var(--olive); background: var(--olive-soft); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(30, 38, 25, .35); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal {
  background: var(--surface); width: 100%; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .15);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
@media (max-width: 559px) { .modal-foot .btn { flex: 1; } }
@media (min-width: 640px) {
  .modal-back { align-items: center; padding: 24px; }
  .modal { max-width: 620px; border-radius: 18px; padding: 22px; }
  .modal.wide { max-width: 860px; }
}

.toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
@media (min-width: 900px) { .toast-wrap { bottom: 24px; } }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: .9rem; }
.toast.error { background: var(--danger); }

/* Login */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(circle at 15% 10%, var(--olive-soft), transparent 45%), var(--bg); }
.login { width: 100%; max-width: 400px; }
.login .brand { font-size: 1.5rem; margin-bottom: 4px; }
.login .card { padding: 22px; }

/* Dashboard */
.hello { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hello .who { min-width: 0; flex: 1; }
.deadline { display: grid; grid-template-columns: 58px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.deadline:last-child { border-bottom: 0; }
.datechip { border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); text-align: center; padding: 4px 0; font-variant-numeric: tabular-nums; }
.datechip b { display: block; font-size: 1.1rem; line-height: 1.1; }
.datechip small { font-size: .7rem; color: var(--muted); text-transform: uppercase; }
.datechip.late { background: var(--danger-soft); border-color: #f1cdc9; color: var(--danger); }

/* Agenda */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .dow { font-size: .72rem; text-transform: uppercase; color: var(--muted); text-align: center; font-weight: 650; padding: 4px 0; }
.cal .day {
  min-height: 52px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 4px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-variant-numeric: tabular-nums;
}
.cal .day.other { opacity: .4; }
.cal .day.today { border-color: var(--olive); }
.cal .day.today .n { background: var(--olive); color: #fff; }
.cal .day.sel { background: var(--olive-soft); border-color: var(--olive); box-shadow: inset 0 0 0 1px var(--olive); }
.cal .day .n { font-weight: 650; font-size: .85rem; border-radius: 99px; min-width: 24px; text-align: center; padding: 1px 4px; }
.cal .day .dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.cal .day .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--olive); }
.cal .day .dots i.simples { background: var(--warn); }
.cal .day .dots i.done { background: var(--line); }
.cal .day .cnt { font-size: .68rem; color: var(--muted); }
@media (min-width: 900px) { .cal .day { min-height: 76px; align-items: flex-start; } }
.agitem { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.agitem:last-child { border-bottom: 0; }
.agitem .grow { flex: 1; min-width: 0; }
.agitem.done .linklike { text-decoration: line-through; color: var(--muted); }

/* Gantt */
.gantt-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.gantt { position: relative; min-width: max-content; }
.g-row { display: flex; border-bottom: 1px solid var(--line); min-height: 40px; }
.g-row:last-child { border-bottom: 0; }
.g-label {
  position: sticky; left: 0; z-index: 2; width: 190px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  padding: 6px 10px; display: flex; flex-direction: column; justify-content: center; min-width: 0;
}
.g-label .linklike { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.g-row.sub .g-label { padding-left: 22px; background: var(--surface-2); }
.g-row.sub .g-label .linklike { font-weight: 500; }
.g-track { position: relative; flex: none; }
.g-head .g-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.g-week { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); font-size: .72rem; color: var(--muted); padding: 4px 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.g-week b { display: block; color: var(--ink); font-size: .76rem; }
.g-grid { position: absolute; top: 0; bottom: 0; border-left: 1px dashed #edf0e6; }
.g-bar {
  position: absolute; top: 9px; height: 22px; border-radius: 6px; background: var(--info); color: #fff; font-size: .72rem;
  font-weight: 650; display: flex; align-items: center; padding: 0 6px; white-space: nowrap; cursor: pointer; border: 0;
  font-variant-numeric: tabular-nums;
}
.g-bar.st-concluida { background: var(--ok); }
.g-bar.st-vinculada { background: var(--link); }
.g-bar.st-nao_iniciada { background: #8a9481; }
.g-row.sub .g-bar { height: 14px; top: 13px; opacity: .85; font-size: 0; }
.g-dur { position: absolute; top: 12px; font-size: .72rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); opacity: .55; z-index: 1; }
.g-arrows { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 1; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Organograma / hierarquia */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 16px; padding-left: 16px; border-left: 2px solid var(--line); }
.tree li { position: relative; padding: 5px 0; }
.tree ul > li::before { content: ""; position: absolute; left: -16px; top: 24px; width: 14px; border-top: 2px solid var(--line); }
.node {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); cursor: pointer; max-width: 100%; text-align: left;
}
.node:hover { border-color: var(--olive); }
.node .nt { font-weight: 650; overflow-wrap: anywhere; }
.node.root { background: var(--olive); color: #fff; border-color: var(--olive); }
.node.sector { background: var(--olive-soft); border-color: #d6e1bd; }
.node.sub { background: var(--surface-2); font-size: .9rem; }
.node .sd { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #8a9481; }
.node .sd.st-em_andamento { background: var(--info); }
.node .sd.st-concluida { background: var(--ok); }
.node .sd.st-vinculada { background: var(--link); }
.node .who { font-size: .78rem; color: var(--muted); }
.node.root .who { color: #e8efd9; }

/* Equipe / acessos */
.person { display: flex; gap: 12px; align-items: center; }
.person .who { min-width: 0; flex: 1; }
.person .who strong { display: block; overflow-wrap: anywhere; }
.utable { display: flex; flex-direction: column; gap: 8px; }
.urow { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.urow .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.urow.off { opacity: .65; }
@media (min-width: 1000px) { .urow { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto; align-items: center; } }
.pwbox { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.15rem; padding: 10px 12px; background: var(--surface-2); border: 1px dashed var(--olive); border-radius: 10px; user-select: all; overflow-wrap: anywhere; }

.simple { display: flex; flex-direction: column; gap: 8px; }
.simple .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.simple.st-concluida .tile-title, .simple.st-cancelada .tile-title { text-decoration: line-through; color: var(--muted); }

.loading { padding: 40px; text-align: center; color: var(--muted); }
.preview-note { font-size: .8rem; background: var(--warn-soft); color: var(--warn); border: 1px solid #f0dcb0; padding: 8px 12px; border-radius: 10px; }

@media (prefers-reduced-motion: no-preference) {
  .modal { animation: rise .18s ease-out; }
  @keyframes rise { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }
}

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 82vw); gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
@media (min-width: 900px) { .kanban { grid-auto-columns: minmax(160px, 1fr); scroll-snap-type: none; } }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; scroll-snap-align: start; border-top: 4px solid #8a9481; }
.kcol.kc-concluida { border-top-color: var(--ok); }
.kcol.kc-agendada { border-top-color: #a7ae9f; }
.kcol.kc-aguardando { border-top-color: var(--link); }
.kcol.kc-a_fazer { border-top-color: var(--olive); }
.kcol.kc-em_execucao { border-top-color: var(--info); }
.kcol.kc-atrasada { border-top-color: var(--danger); }
.kcol.over { background: var(--olive-soft); border-color: var(--olive); }
.khead { display: flex; justify-content: space-between; align-items: center; font-weight: 700; padding: 2px 4px; }
.khead .count { min-width: 22px; text-align: center; padding: 0 7px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: .78rem; }
.kbody { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.kcard[draggable=true] { cursor: grab; }
.kcard.dragging { opacity: .5; }
.kempty { color: var(--muted); font-size: .85rem; text-align: center; padding: 14px 6px; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.kmove { display: flex; flex-direction: column; align-items: stretch; gap: 3px; font-size: .8rem; color: var(--muted); }
.kmove select { flex: 1; min-width: 0; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: .82rem; }

/* Organograma de cima para baixo */
.orgchart-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 8px; }
.orgchart { min-width: max-content; display: flex; justify-content: center; }
.orgchart ul { display: flex; justify-content: center; margin: 0; padding: 20px 0 0; list-style: none; position: relative; }
.orgchart > ul { padding-top: 0; }
.orgchart li { display: flex; flex-direction: column; align-items: center; position: relative; padding: 20px 6px 0; }
.orgchart > ul > li { padding-top: 0; }
.orgchart li::before, .orgchart li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 20px; border-top: 2px solid var(--line); }
.orgchart li::after { right: auto; left: 50%; border-left: 2px solid var(--line); }
.orgchart li:only-child::before, .orgchart li:only-child::after { display: none; }
.orgchart li:only-child { padding-top: 0; }
.orgchart li:first-child::before, .orgchart li:last-child::after { border: 0 none; }
.orgchart li:last-child::before { border-right: 2px solid var(--line); border-radius: 0 8px 0 0; }
.orgchart li:first-child::after { border-radius: 8px 0 0 0; }
.orgchart > ul > li::before, .orgchart > ul > li::after { display: none; }
.orgchart ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 20px; border-left: 2px solid var(--line); }
.obox { display: flex; flex-direction: column; gap: 3px; align-items: center; text-align: center; width: 168px; padding: 10px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; box-shadow: var(--shadow); }
.obox:hover { border-color: var(--olive); }
.obox .ot { font-weight: 700; font-size: .88rem; overflow-wrap: anywhere; }
.obox .om { font-size: .75rem; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.obox .sd { width: 8px; height: 8px; border-radius: 50%; background: #8a9481; }
.obox .sd.st-em_andamento { background: var(--info); }
.obox .sd.st-concluida { background: var(--ok); }
.obox .sd.st-vinculada { background: var(--link); }
.obox.root { background: var(--olive); border-color: var(--olive); color: #fff; width: 200px; }
.obox.root .om { color: #e8efd9; }
.obox.sub { background: var(--surface-2); width: 140px; }
@media (max-width: 640px) { .obox { width: 132px; } .obox.sub { width: 116px; } .obox.root { width: 170px; } }

/* Seleção de várias pessoas */
.picker { display: flex; flex-direction: column; gap: 6px; }
.picker .chips { max-height: 180px; overflow-y: auto; padding: 2px; }
.picker-search { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); font: inherit; }
.member { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: .85rem; }

/* Organograma da equipe */
.obox.person-box { cursor: default; gap: 4px; padding: 12px 10px; }
.obox.person-box .avatar { margin-bottom: 2px; }
.obox.person-box.lv-administrador { border-top: 4px solid var(--olive); }
.obox.person-box.lv-gestor { border-top: 4px solid var(--info); }

/* Relatórios e premiação */
.rtable-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.rtable { width: 100%; border-collapse: collapse; font-size: .88rem; }
.rtable th, .rtable td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.rtable th { background: var(--surface-2); font-weight: 650; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
.rtable tr:last-child td { border-bottom: 0; }
.rtable td.num, .rtable th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rtable .late { color: var(--danger); font-weight: 650; }
.rtable tfoot td { font-weight: 700; background: var(--surface-2); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters select, .filters input { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font: inherit; }
.level-cards { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .level-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.level-card { border-top: 4px solid #8a9481; }
.level-card.lv-alta { border-top-color: var(--danger); }
.level-card.lv-media { border-top-color: var(--warn); }
.level-card.lv-baixa { border-top-color: var(--ok); }
.level-card .big { font-size: 1.8rem; font-weight: 800; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin: 10px 0; font-size: .88rem; }
.kpis b { font-variant-numeric: tabular-nums; }
.sit { font-size: .75rem; font-weight: 650; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.sit.no_prazo { background: var(--ok-soft); color: var(--ok); }
.sit.atrasada { background: var(--warn-soft); color: var(--warn); }
.sit.nao_feita, .sit.vencida { background: var(--danger-soft); color: var(--danger); }
.sit.a_vencer { background: var(--surface-2); color: var(--muted); }
.pay { font-weight: 800; color: var(--olive-strong); }

.print-head { display: none; }
@media print {
  .sidebar, .topbar, .bottomnav, .no-print, .actions, .tabs, .toast-wrap, .print-hide, .modal-backdrop, .crumbs { display: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 2px solid #3d5a1e; padding-bottom: 6px; margin-bottom: 12px; font-size: 13px; color: #444; }
  .print-head strong { font-size: 18px; color: #111; }
  body.env-familia, body { background: #fff !important; background-image: none !important; }
  .gantt-scroll, .orgchart-scroll, .rtable-wrap, .kanban { overflow: visible !important; }
  .kanban { grid-auto-flow: row !important; grid-template-columns: repeat(6, minmax(0, 1fr)) !important; grid-auto-columns: auto !important; }
  .kanban .kmove, .kanban select, .kanban button.btn { display: none !important; }
  .rtable { font-size: 11px; }
  .rtable tr { break-inside: avoid; }
  .rtable td:first-child { min-width: 130px; }
  .section > h2, .section > .person { break-after: avoid; }
  a[href]::after { content: none !important; }
  .shell { display: block !important; }
  .main { padding: 0 !important; }
  body { background: #fff; }
  .card, .rtable-wrap { box-shadow: none; break-inside: avoid; }
}
ol.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; font-size: .92rem; }
details.card > summary { cursor: pointer; }
@media (max-width: 700px) { .money-stats .stat .v { font-size: 1.05rem; overflow-wrap: anywhere; } }
.stats.s4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 700px) { .stats.s4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Status automáticos das atividades */
.badge.st-agendada { background: #f1f2ee; color: #5b6255; border-color: #e1e3dc; }
.badge.st-aguardando { background: var(--link-soft); color: var(--link); border-color: #dcd0f3; }
.badge.st-a_fazer { background: var(--olive-soft); color: var(--olive-strong); border-color: #d6e2c2; }
.badge.st-em_execucao { background: var(--info-soft); color: var(--info); border-color: #cddcf1; }
.badge.st-atrasada { background: var(--danger-soft); color: var(--danger); border-color: #f1cdc9; }
.badge.st-concluida_atraso { background: var(--warn-soft); color: var(--warn); border-color: #f0dcb4; }
.g-bar.st-agendada { background: #a7ae9f; }
.g-bar.st-aguardando { background: var(--link); }
.g-bar.st-a_fazer { background: var(--olive); }
.g-bar.st-em_execucao { background: var(--info); }
.g-bar.st-atrasada { background: var(--danger); }
.g-bar.st-concluida_atraso { background: var(--warn); }
.sd.st-agendada { background: #a7ae9f; }
.sd.st-aguardando { background: var(--link); }
.sd.st-a_fazer { background: var(--olive); }
.sd.st-em_execucao { background: var(--info); }
.sd.st-atrasada { background: var(--danger); }
.sd.st-concluida, .sd.st-concluida_atraso { background: var(--ok); }

/* ---------- Sino de concluídas ---------- */
.envswitch button { position: relative; }
.bell { position: absolute; top: -7px; right: -5px; z-index: 1; padding: 1px 6px; border-radius: 99px; background: #e8552f; color: #fff; font-size: .72rem; font-weight: 750; line-height: 1.4; box-shadow: 0 0 0 2px var(--surface); animation: bell-pop .4s ease-out; }
.bell[hidden] { display: none; }
@keyframes bell-pop { from { transform: scale(.4); } to { transform: scale(1); } }
.news { border-left: 4px solid var(--ok); }
.news-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px; }

/* ---------- Ambiente Família: mais descontraído ---------- */
body.env-familia {
  --bg: #fff6ee;
  --surface-2: #fff1e6;
  --line: #f4dccb;
  --olive: #e0663a;
  --olive-strong: #b84a22;
  --olive-soft: #ffe6d8;
  --leaf: #ffb35c;
  --radius: 20px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Ctext x='12' y='34' font-size='20' opacity='.10'%3E🎈%3C/text%3E%3Ctext x='92' y='70' font-size='18' opacity='.10'%3E🐶%3C/text%3E%3Ctext x='30' y='120' font-size='18' opacity='.10'%3E🎵%3C/text%3E%3Ctext x='110' y='145' font-size='18' opacity='.10'%3E🌻%3C/text%3E%3C/svg%3E");
}
body.env-familia h1, body.env-familia h2, body.env-familia .tile-title, body.env-familia .brand { font-family: "Baloo 2", var(--font); letter-spacing: .01em; }
body.env-familia .btn.primary { border-radius: 99px; }
body.env-familia .card { border-radius: 20px; }
body.env-familia .sidebar { background: linear-gradient(180deg, #fff 0%, #fff4ea 100%); }
body.env-familia .brand-mark { background: #e0663a; }
body.env-familia .envswitch button.active { background: #ffe6d8; color: #b84a22; }
.fam-badge { background: #ffe6d8 !important; color: #b84a22 !important; border-color: #f4c9b0 !important; }
.fam-hero { background: linear-gradient(120deg, #fff1e6 0%, #fff9e8 60%, #eef8ee 100%); border: 1px solid #f4dccb; }
.fam-emoji { font-size: 2.6rem; line-height: 1; filter: drop-shadow(0 2px 4px rgba(224, 102, 58, .25)); }
.fam-people { display: flex; gap: 8px; flex-wrap: wrap; }
.fam-person { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: rgba(255, 255, 255, .7); border-radius: 16px; padding: 6px 8px; cursor: pointer; font: inherit; font-size: .8rem; min-width: 64px; }
.fam-person small { color: var(--muted); font-size: .7rem; }
.fam-person.add .avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 2px dashed #e0663a; color: #e0663a; font-weight: 800; }
.badge.kin { background: #ffe6d8; color: #b84a22; border-color: #f4c9b0; margin-top: 4px; }
.qr { width: min(260px, 70vw); margin: 8px auto; background: #fff; padding: 8px; border-radius: 16px; border: 1px solid var(--line); }
.qr svg { display: block; width: 100%; height: auto; }
.invite { display: flex; flex-direction: column; gap: 10px; }
.invite-link { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: .8rem; background: var(--surface-2); color: var(--ink); }
