/* Layout B: menu escuro + conteúdo claro */
:root {
    --bg: #f1f5f9; --fg: #0f172a; --muted: #64748b; --line: #e2e8f0;
    --sb-bg: #0f172a; --sb-fg: #94a3b8; --sb-hover: #1e293b;
    --sb-active-bg: #0ea5e9; --sb-active-fg: #ffffff;
    --top-bg: #ffffff; --chip: #f1f5f9; --card: #ffffff;
    --accent: #0ea5e9; --accent-grad: linear-gradient(135deg, #0ea5e9, #14b8a6);
    --shadow: 0 2px 6px rgba(15, 23, 42, .07);
    --sb-w: 230px; --sb-w-collapsed: 64px;
    --danger: #ef4444;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px; color: var(--fg); background: var(--bg);
}
a { color: var(--accent); }
h1 { font-size: 20px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }

svg.ic { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-grad); flex: none; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800; }

/* ---- estrutura ---- */
body.app-shell { display: flex; min-height: 100vh; }
.sb {
    width: var(--sb-w); transition: width .25s ease; background: var(--sb-bg); color: var(--sb-fg);
    display: flex; flex-direction: column; padding: 14px 10px; gap: 4px; overflow: hidden;
    position: sticky; top: 0; height: 100vh; flex: none;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-weight: 700; font-size: 15px; white-space: nowrap; color: #fff; }
.nav { display: flex; align-items: center; gap: 12px; padding: 9px 11px; border-radius: 9px; font-size: 13.5px; white-space: nowrap; color: var(--sb-fg); text-decoration: none; }
.nav:hover { background: var(--sb-hover); }
.nav.active { background: var(--sb-active-bg); color: var(--sb-active-fg); font-weight: 600; }
.navsep { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 12px 11px 4px; white-space: nowrap; }
.sb .spacer { flex: 1; }
body.collapsed .sb { width: var(--sb-w-collapsed); }
body.collapsed .lbl, body.collapsed .navsep, body.collapsed .brand span { display: none; }
body.collapsed .nav { justify-content: center; padding: 9px 0; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.top { height: 54px; display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--top-bg); position: sticky; top: 0; z-index: 5; }
.tog { border: none; background: var(--chip); color: var(--fg); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 16px; }
.search { flex: 1; max-width: 340px; display: flex; align-items: center; gap: 8px; background: var(--chip); border-radius: 9px; padding: 0 11px; color: var(--muted); }
.search svg.ic { width: 15px; height: 15px; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 0; font: inherit; font-size: 13px; color: var(--fg); outline: none; }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--muted); }
.icon-btn { color: var(--muted); display: grid; place-items: center; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-grad); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; cursor: pointer; list-style: none; }
.avatar::-webkit-details-marker { display: none; }
.usermenu { position: relative; }
.usermenu .menu { position: absolute; right: 0; top: 40px; min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 23, 42, .12); padding: 6px; display: flex; flex-direction: column; }
.menu-head { display: flex; flex-direction: column; padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; color: var(--fg); }
.menu-head small { color: var(--muted); overflow-wrap: anywhere; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 7px; font: inherit; color: var(--fg); text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--chip); }
.content { padding: 18px; flex: 1; min-width: 0; }
.card-box { background: var(--card); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); }

/* ---- alertas e formulários ---- */
.alert { padding: 10px 12px; border-radius: 9px; margin-bottom: 14px; font-size: 13.5px; }
.alert-success { background: #dcfae6; color: #067647; }
.alert-error { background: #fde2e1; color: #b42318; }
.alert-warn { background: #fef3c7; color: #92400e; }
.form { display: flex; flex-direction: column; gap: 14px; margin: 14px 0; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.form input { font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: var(--fg); }
.form input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.btn { display: inline-block; border: 0; border-radius: 9px; padding: 10px 16px; font: inherit; font-weight: 600; color: #fff; background: var(--accent-grad); cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { filter: brightness(.95); }

/* ---- telas de acesso ---- */
body.guest-shell { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.guest-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 14px; padding: 28px 24px; box-shadow: 0 8px 30px rgba(15, 23, 42, .1); border: 1px solid var(--line); }
.guest-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; margin-bottom: 20px; }

/* ---- telas estreitas: menu vira gaveta ---- */
.sb-backdrop { display: none; }
@media (max-width: 899px) {
    .sb { position: fixed; left: 0; top: 0; z-index: 20; width: var(--sb-w); transform: translateX(-100%); transition: transform .25s ease; }
    body.drawer-open .sb { transform: none; }
    body.drawer-open .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 15; }
    /* recolhido não se aplica à gaveta */
    body.collapsed .sb { width: var(--sb-w); }
    body.collapsed .lbl, body.collapsed .brand span { display: inline; }
    body.collapsed .navsep { display: block; }
    body.collapsed .nav { justify-content: flex-start; padding: 9px 11px; }
    .search { max-width: none; }
}

/* Gestão de usuários */
.ph { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ph h1 { margin: 0; }
.ph-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ph-actions .btn { padding: 7px 12px; font-size: 13px; }
.report-list { display: grid; gap: 14px; }
.report-list .card-box h2 { margin-top: 0; }
.report-list form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.report-list select { font: inherit; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: var(--fg); max-width: 100%; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.row-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
form.inline { display: inline; margin: 0; }
button.link { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.form select { font: inherit; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: var(--fg); }
.field-error { color: #b42318; font-weight: 400; }
@media (max-width: 720px) { .card-box { overflow-x: auto; } }

/* Projetos */
.tabs a.on { color: var(--fg); font-weight: 700; border-bottom-color: var(--accent); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.form textarea { font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: var(--fg); }
/* Tarefas */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: #fff; background: #94a3b8; vertical-align: middle; }
.badge-late { background: #ef4444; }
.badge-draft { background: #ede9fe; color: #5b21b6; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-status-em_andamento { background: #0ea5e9; }
.badge-status-pausado { background: #64748b; }
.badge-status-concluido { background: #22c55e; }
.badge-status-cancelado { background: #b42318; }
.btn-light { background: var(--chip); color: var(--fg); }
.task-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.task-filters select { font: inherit; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: var(--fg); }
label.check { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
.form fieldset.deps { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.form fieldset.deps legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.md p, .md ul { margin: 10px 0 0; }

/* Kanban */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; }
.col { background: #e8eef5; border-radius: 12px; padding: 10px; min-width: 0; }
.colh { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; margin-bottom: 9px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.cnt { margin-left: auto; color: var(--muted); font-weight: 500; }
.cards { min-height: 60px; }
.kcard { background: var(--card); border-radius: 10px; padding: 10px; margin-bottom: 8px; font-size: 12px; box-shadow: var(--shadow); border: 1px solid var(--line); cursor: grab; }
.kcard .t { display: block; font-weight: 600; margin-bottom: 8px; color: var(--fg); text-decoration: none; overflow-wrap: anywhere; }
.kcard .meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.kcard .meta + .meta { margin-top: 6px; }
.kcard.late { border-left: 3px solid #ef4444; }
.late-tag { color: #ef4444; font-weight: 600; }
.pill { padding: 2px 7px; border-radius: 20px; font-size: 10.5px; font-weight: 600; }
.p-urgent { background: #fee4e2; color: #912018; } .p-high { background: #fde2e1; color: #b42318; }
.p-medium { background: #fef0c7; color: #93370d; } .p-low { background: #dcfae6; color: #067647; }
.mini-av { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-grad); color: #fff; font-size: 9px; display: grid; place-items: center; font-weight: 700; }
.sortable-ghost { opacity: .4; }
.task-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
@media (max-width: 720px) { .board { grid-template-columns: repeat(4, 260px); } }

/* Cronograma (Frappe Gantt, somente leitura) */
.gantt-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 12px; }
.view-switch { display: flex; gap: 6px; }
.view-switch .btn.on { background: #0ea5e9; color: #fff; }
.gantt-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: #64748b; flex: 1; }
.gantt-legend .dot { display: inline-block; margin-right: 4px; }
.planned-key { display: inline-block; width: 16px; height: 3px; background: #0f172a; margin-right: 4px; vertical-align: middle; }
.gantt-wrap { overflow-x: auto; padding: 8px; }
.gantt-wrap .gantt .bar-wrapper { cursor: default; }
.gantt-wrap .gantt .handle-group { display: none; }
.gantt-wrap .gantt .bar-progress { display: none; }
.gantt-wrap .gantt .bar-wrapper.st-todo .bar { fill: #94A3B8; }
.gantt-wrap .gantt .bar-wrapper.st-in_progress .bar { fill: #0EA5E9; }
.gantt-wrap .gantt .bar-wrapper.st-in_review .bar { fill: #EAB308; }
.gantt-wrap .gantt .bar-wrapper.st-done .bar { fill: #22C55E; }
.gantt-wrap .gantt .bar-wrapper.st-late .bar { fill: #EF4444; }
.gantt-wrap .gantt .bar-label { fill: #0f172a; }
.gantt-wrap .gantt .planned-line { fill: #0f172a; opacity: .75; pointer-events: none; }
.gantt-popup { padding: 8px 10px; font-size: 12px; line-height: 1.5; min-width: 180px; }
.gantt-popup strong { display: block; margin-bottom: 2px; }

/* Painel gerencial */
.dash-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.dash-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.dash-filters input, .dash-filters select { font: inherit; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: var(--fg); }
.dash-kpis { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.dash-kpis li { flex: 1 1 140px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.dash-kpis a, .dash-kpis div { display: block; padding: 12px; text-align: center; color: var(--fg); text-decoration: none; }
.dash-kpis strong { display: block; font-size: 26px; }
.dash-kpis span { font-size: 12px; color: var(--muted); }
.dash-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 20px; }
.dash-charts h2, section[aria-label] > h2 { font-size: 15px; margin: 0 0 8px; }
.chart-box { position: relative; height: 240px; }
.load-bar { background: var(--chip); border-radius: 4px; height: 10px; min-width: 120px; }
.load-bar span { display: block; height: 10px; border-radius: 4px; }
section[aria-label] { margin-bottom: 20px; }

.icon-btn { position: relative; }
.bell-count { position: absolute; top: -6px; right: -8px; padding: 1px 5px; font-size: 10.5px; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li { padding: 10px 0; border-bottom: 1px solid #e2e8f0; }
.notif-list li.unread { font-weight: 600; border-left: 3px solid #0ea5e9; padding-left: 10px; }
.check { display: flex; align-items: center; gap: 8px; }

.quick-add { margin-top: 4px; }
.quick-add input { width: 100%; box-sizing: border-box; padding: 7px 9px; border: 1px dashed var(--line); border-radius: 8px; background: transparent; font-size: 12px; }
.quick-add input:focus { border-style: solid; background: var(--card); }
.quick-add .quick-error { display: block; margin-top: 4px; color: #b42318; font-size: 11px; }
.nav-count { margin-left: auto; min-width: 18px; padding: 1px 6px; border-radius: 9px; background: #EF4444; color: #fff; font-size: 11px; font-weight: 600; text-align: center; }
body.collapsed .nav-count { display: none; }
.followup-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.followup-form input[type=text] { flex: 1 1 220px; max-width: 420px; }

/* Pílulas de filtro */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid #e2e8f0; color: #475569; font-size: 13px; font-weight: 400; text-decoration: none; cursor: pointer; position: relative; }
.pill svg.ic { width: 16px; height: 16px; }
a.pill:hover, label.pill:hover { border-color: #0ea5e9; }
.pill.on { background: #0ea5e9; border-color: #0ea5e9; color: #fff; font-weight: 600; }
a.pill:focus-visible, .pill:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.pill:has(input:checked) { background: #0ea5e9; border-color: #0ea5e9; color: #fff; font-weight: 600; }
.task-filters select, .dash-filters select { border-radius: 999px; }
