/* CorpDesk — estrutura. As cores, fontes e raios vêm das variáveis de static/css/themes.css. */
:root { --sidebar-w: 240px; }
body { background: var(--app-bg); color: var(--app-text); font-size: .925rem; }
h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5 { font-family: var(--heading-font); }
.sidebar { width: var(--sidebar-w); min-height: 100vh; background: var(--sidebar-bg); position: fixed; top: 0; left: 0; z-index: 1030; border-right: 1px solid var(--sidebar-border, transparent); }
.sidebar .brand { color: var(--sidebar-brand); font-weight: 700; font-size: 1.15rem; padding: 1rem 1.25rem; display:block; text-decoration:none; letter-spacing: var(--brand-spacing, .3px); font-family: var(--heading-font); text-transform: var(--brand-case, none); }
.sidebar .brand i { color: var(--sidebar-brand-icon, inherit); }
.sidebar .nav-link { color: var(--sidebar-text); padding: .55rem 1.25rem; border-left: 3px solid transparent; margin: var(--sidebar-item-margin, 0); border-radius: var(--sidebar-item-radius, 0); }
.sidebar .nav-link:hover { color: var(--sidebar-text-hover); background: var(--sidebar-hover-bg); }
.sidebar .nav-link.active { color: var(--sidebar-active-text); background: var(--sidebar-active-bg); border-left-color: var(--sidebar-active-border); }
.sidebar .nav-link i { width: 1.4rem; display: inline-block; }
.sidebar .section { color: var(--sidebar-section); font-size: .7rem; text-transform: uppercase; padding: 1rem 1.25rem .25rem; letter-spacing: .08em; font-family: var(--heading-font); }
.main { margin-left: var(--sidebar-w); }
.topbar { background: var(--topbar-bg); border-bottom: 1px solid var(--app-border); color: var(--app-text); }
.topbar h1 { color: var(--heading-color); }
.card { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--radius); box-shadow: var(--card-shadow); }
.card-header { background: transparent !important; border-bottom-color: var(--app-border); font-family: var(--heading-font); text-transform: var(--label-case, none); letter-spacing: var(--label-spacing, normal); color: var(--heading-color); }
.table > :not(caption) > * > * { vertical-align: middle; }
.table thead th { font-family: var(--heading-font); text-transform: var(--label-case, none); letter-spacing: var(--label-spacing, normal); font-size: var(--th-size, inherit); }
.stat .num { font-size: 1.8rem; font-weight: 700; color: var(--brand); }
.role-badge { font-size: .7rem; }
.btn, .form-control, .form-select, .page-link, .badge, .dropdown-menu, .list-group, .alert, .modal-content { --bs-border-radius: var(--control-radius); }
.btn { border-radius: var(--btn-radius); }
.btn-sm { border-radius: var(--btn-radius); }
.badge { border-radius: var(--badge-radius); }
@media (max-width: 991px) { .sidebar { left: calc(-1 * var(--sidebar-w)); transition: left .2s; } .sidebar.show { left: 0; } .main { margin-left: 0; } }

/* Kanban */
.kanban { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.kcol { flex: 0 0 290px; background: var(--kcol-bg); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 210px); border: 1px solid var(--kcol-border, transparent); overflow: hidden; }
.kcol-head { padding: .6rem .75rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; color: var(--kcol-head-text, inherit); background: var(--kcol-head-bg, transparent); font-family: var(--heading-font); text-transform: var(--label-case, none); letter-spacing: var(--label-spacing, normal); }
.kcol-body { padding: .25rem .5rem .75rem; overflow-y: auto; min-height: 60px; flex: 1; }
.kcard { background: var(--kcard-bg); color: var(--app-text); border-radius: var(--kcard-radius); padding: .6rem .7rem; margin-bottom: .5rem; box-shadow: var(--kcard-shadow); cursor: grab; border-left: 4px solid var(--prio-baixa); border-top: 1px solid var(--kcard-border, transparent); border-right: 1px solid var(--kcard-border, transparent); border-bottom: 1px solid var(--kcard-border, transparent); }
.kcard.locked { cursor: default; opacity: .92; }
.kcard.p-baixa { border-left-color: var(--prio-baixa) } .kcard.p-media { border-left-color: var(--prio-media) }
.kcard.p-alta { border-left-color: var(--prio-alta) } .kcard.p-urgente { border-left-color: var(--prio-urgente) }
.kcard.done .ktitle { text-decoration: line-through; color: var(--app-muted); }
.kcard .ktitle { font-weight: 500; }
.sortable-ghost { opacity: .4; }
.overdue { color: var(--danger-text); font-weight: 600; }

/* Organograma */
.orgchart { overflow-x: auto; padding: 1rem 0 2rem; }
.orgchart ul { padding-top: 20px; position: relative; display: flex; justify-content: center; padding-left: 0; margin: 0; }
.orgchart li { list-style: none; text-align: center; position: relative; padding: 20px 6px 0; }
.orgchart li::before, .orgchart li::after { content: ''; position: absolute; top: 0; right: 50%; border-top: 2px solid var(--org-line); width: 50%; height: 20px; }
.orgchart li::after { right: auto; left: 50%; border-left: 2px solid var(--org-line); }
.orgchart li:only-child::after, .orgchart li:only-child::before { 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(--org-line); border-radius: 0 5px 0 0; }
.orgchart li:first-child::after { border-radius: 5px 0 0 0; }
.orgchart ul ul::before { content: ''; position: absolute; top: 0; left: 50%; border-left: 2px solid var(--org-line); width: 0; height: 20px; }
.orgchart > ul { padding-top: 0; width: max-content; min-width: 100%; margin: 0 auto; }
.orgchart-zoom { transform-origin: top left; }
.orgnode { display: inline-block; background: var(--app-surface); color: var(--app-text); border: 1px solid var(--app-border); border-top: 4px solid var(--c, var(--brand-2)); border-radius: var(--kcard-radius); padding: .5rem .75rem; min-width: 150px; max-width: 200px; box-shadow: var(--card-shadow); }
.orgnode .n { font-weight: 600; font-family: var(--heading-font); } .orgnode .p { font-size: .8rem; color: var(--app-text-2); } .orgnode .d { font-size: .7rem; color: var(--app-muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--avatar-bg); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem; }
.mail-unread td { font-weight: 600; }
iframe.mailhtml { width: 100%; min-height: 480px; border: 1px solid var(--app-border); border-radius: .375rem; background: #fff; }

/* Seletor de tema */
.theme-opt { display: flex; align-items: center; gap: .6rem; }
.theme-sw { display: inline-flex; border-radius: .3rem; overflow: hidden; border: 1px solid rgba(0,0,0,.12); flex: none; }
.theme-sw span { width: 12px; height: 22px; display: block; }
.theme-card { border: 2px solid var(--app-border); border-radius: var(--radius); padding: .7rem; cursor: pointer; background: var(--app-surface); color: var(--app-text); text-align: left; width: 100%; height: 100%; }
.theme-card.on { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 25%, transparent); }
.theme-card .theme-sw span { width: 22px; height: 30px; }

/* Mural News */
.flex-none { flex: none; } .min-w-0 { min-width: 0; }
.nw-tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.nw-tabs a { padding: .25rem .8rem; border-radius: 999px; border: 1px solid var(--app-border); color: var(--app-text-2); text-decoration: none; font-size: .82rem; background: var(--app-surface); }
.nw-tabs a.on { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.nw-post { padding: .9rem 0; border-bottom: 1px solid var(--app-border); }
.nw-post:last-child { border-bottom: 0; }
.nw-text { margin: .5rem 0 0 2.6rem; overflow-wrap: anywhere; }
.nw-cat { font-size: .68rem; font-weight: 600; padding: .05rem .45rem; border-radius: 999px; border: 1px solid var(--app-border); color: var(--app-text-2); white-space: nowrap; }
.mention { color: var(--brand-2); font-weight: 600; }
.nw-imgs { display: grid; gap: 4px; margin: .5rem 0 0 2.6rem; border-radius: var(--kcard-radius); overflow: hidden; max-width: 560px; }
.nw-imgs.n1 { grid-template-columns: 1fr; } .nw-imgs.n2, .nw-imgs.n4 { grid-template-columns: 1fr 1fr; } .nw-imgs.n3 { grid-template-columns: 2fr 1fr; }
.nw-imgs img { width: 100%; height: 100%; max-height: 320px; object-fit: cover; display: block; }
.nw-imgs.n1 img { max-height: 420px; }
.nw-post footer { margin-left: 2.6rem; }
.nw-like { border: 0; background: none; color: var(--app-text-2); padding: 0; font-size: .85rem; }
.nw-like.on { color: #d03b3b; }
.nw-like:disabled { opacity: .6; }
.nw-comments { margin: .5rem 0 0 2.6rem; padding: .5rem .7rem; background: color-mix(in srgb, var(--app-border) 35%, transparent); border-radius: var(--kcard-radius); font-size: .85rem; }
.nw-comment + .nw-comment { margin-top: .3rem; }
.nw-mention-box { position: absolute; z-index: 3000; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: .5rem; box-shadow: 0 8px 24px rgba(0,0,0,.15); min-width: 240px; overflow: hidden; }
.nw-mention-box button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .4rem .6rem; color: var(--app-text); font-size: .85rem; }
.nw-mention-box button.on, .nw-mention-box button:hover { background: color-mix(in srgb, var(--brand-2) 12%, transparent); }
.nw-mention-box small { color: var(--app-muted); }

/* Notificações */
.notif-dot { position: absolute; top: -4px; right: -6px; background: #d03b3b; color: #fff; border-radius: 999px; font-size: .62rem; font-weight: 700; padding: 0 .3rem; min-width: 1rem; text-align: center; }
.notif-menu { width: 360px; max-height: 70vh; overflow-y: auto; }
.notif-item { white-space: normal; font-size: .85rem; }
.notif-item.unread { background: color-mix(in srgb, var(--brand-2) 8%, transparent); font-weight: 500; }
.notif-item small { color: var(--app-muted); }

/* Etapas do fluxo de aprovação */
.stg { display: inline-flex; gap: 2px; border: 0; background: none; padding: 0; vertical-align: middle; }
button.stg { cursor: pointer; border-radius: 4px; }
button.stg:hover i:not(.on) { background: color-mix(in srgb, var(--app-border) 80%, var(--app-text) 10%); }
button.stg:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.stg i { font-style: normal; width: 16px; height: 18px; border-radius: 3px; font-size: .62rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--app-border) 70%, transparent); color: var(--app-muted); }
.stg i.on.s1 { background: var(--stg1); color: var(--stg1-ink); } .stg i.on.s2 { background: var(--stg2); color: #fff; }
.stg i.on.s3 { background: var(--stg3); color: #fff; } .stg i.on.s4 { background: var(--stg4); color: #fff; }
.stg-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .75rem; color: var(--app-text-2); align-items: center; }
.leg-box { display: inline-block; width: 14px; height: 12px; border-radius: 3px; vertical-align: -1px; border: 2px solid; }
.leg-box.done { border-color: var(--stg4); background: color-mix(in srgb, var(--stg4) 15%, transparent); }
.leg-box.postponed { border-color: var(--stg2); border-style: dashed; }
.leg-box.late { border-color: #d03b3b; background: color-mix(in srgb, #d03b3b 15%, transparent); }
.tag-postponed, .tag-late { font-size: .64rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; border-radius: 999px; padding: .05rem .45rem; white-space: nowrap; }
.tag-postponed { color: var(--stg2); border: 1px dashed var(--stg2); }
.tag-late { background: #d03b3b; color: #fff; }
.flow-steps { display: flex; gap: 4px; margin: .25rem 0 .75rem; }
.flow-steps div { flex: 1; text-align: center; font-size: .72rem; padding: .35rem .2rem; border-radius: 6px; background: color-mix(in srgb, var(--app-border) 60%, transparent); color: var(--app-muted); }
.flow-steps div.on { color: #fff; } .flow-steps div.on.s1 { background: var(--stg1); color: var(--stg1-ink); }
.flow-steps div.on.s2 { background: var(--stg2); } .flow-steps div.on.s3 { background: var(--stg3); } .flow-steps div.on.s4 { background: var(--stg4); }
.flow-steps div.cur { box-shadow: 0 0 0 2px var(--app-text) inset; font-weight: 700; }
.flow-hist { font-size: .8rem; max-height: 200px; overflow-y: auto; }
.flow-hist li { padding: .25rem 0; border-bottom: 1px solid var(--app-border); }
