/* ==========================================================================
   SIG-CIMBAJU — Design System (tokens + componentes)
   Contraste mínimo AA; foco visível; sem dependências externas.
   ========================================================================== */
:root {
    --c-navy-900: #0a2540;
    --c-navy-800: #0f3560;
    --c-navy-700: #14487f;
    --c-navy-600: #1b5c9e;
    --c-teal-600: #0b7a75;
    --c-teal-100: #d9f2f0;
    --c-gold-500: #c8962b;
    --c-ink-900: #16202c;
    --c-ink-700: #364152;
    --c-ink-500: #5b6675;
    --c-line: #dfe4ea;
    --c-surface: #ffffff;
    --c-bg: #f2f5f9;
    --c-purple: #5b3fa8;
    --radius: .6rem;
    --shadow-sm: 0 1px 2px rgba(10, 37, 64, .06), 0 1px 3px rgba(10, 37, 64, .08);
    --shadow-md: 0 4px 14px rgba(10, 37, 64, .10);
    --sidebar-w: 268px;
    --topbar-h: 60px;

    --bs-primary: var(--c-navy-700);
    --bs-primary-rgb: 20, 72, 127;
    --bs-link-color: var(--c-navy-700);
    --bs-link-hover-color: var(--c-navy-900);
    --bs-body-color: var(--c-ink-900);
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-border-color: var(--c-line);
}

body { background: var(--c-bg); color: var(--c-ink-900); font-size: .94rem; }
a { text-decoration-thickness: 1px; text-underline-offset: 2px; }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; border-radius: 3px; }
.skip-link { position: absolute; left: -999px; top: 0; background: #fff; color: var(--c-navy-900); padding: .6rem 1rem; z-index: 2000; }
.skip-link:focus { left: 8px; top: 8px; }

.btn-primary { --bs-btn-bg: var(--c-navy-700); --bs-btn-border-color: var(--c-navy-700); --bs-btn-hover-bg: var(--c-navy-900); --bs-btn-hover-border-color: var(--c-navy-900); --bs-btn-active-bg: var(--c-navy-900); }
.btn-outline-primary { --bs-btn-color: var(--c-navy-700); --bs-btn-border-color: var(--c-navy-700); --bs-btn-hover-bg: var(--c-navy-700); --bs-btn-hover-border-color: var(--c-navy-700); }
.btn { border-radius: .5rem; font-weight: 500; }
.form-label { font-weight: 600; font-size: .85rem; color: var(--c-ink-700); margin-bottom: .25rem; }
.form-control, .form-select { border-color: #c5cdd8; }
.form-control:focus, .form-select:focus { border-color: var(--c-navy-600); box-shadow: 0 0 0 .2rem rgba(27, 92, 158, .2); }
.required::after { content: " *"; color: #b42318; }

/* ---------- Layout administrativo ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: linear-gradient(180deg, var(--c-navy-900), #0c2e52);
    color: #cfd9e6; position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 1030; display: flex; flex-direction: column;
}
.sidebar .brand { display: flex; align-items: center; gap: .7rem; padding: 1rem 1.1rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar .brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--c-gold-500); color: var(--c-navy-900); display: grid; place-items: center; font-weight: 800; font-size: 1.05rem; }
.sidebar .brand small { display: block; color: #9fb3ca; font-size: .7rem; letter-spacing: .04em; }
.sidebar .brand strong { font-size: 1.02rem; letter-spacing: .02em; }
.nav-section { padding: 1rem 1.1rem .35rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: #8ea6c1; font-weight: 700; }
.sidebar .nav-link { color: #cfd9e6; padding: .5rem 1.1rem; display: flex; align-items: center; gap: .65rem; border-left: 3px solid transparent; font-size: .9rem; }
.sidebar .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .9; }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar .nav-link.active { background: rgba(255, 255, 255, .10); color: #fff; border-left-color: var(--c-gold-500); font-weight: 600; }
.sidebar .nav-link.disabled { opacity: .55; cursor: default; }
.sidebar .soon { margin-left: auto; font-size: .62rem; text-transform: uppercase; background: rgba(255, 255, 255, .12); padding: .1rem .4rem; border-radius: 999px; }
.sidebar-foot { margin-top: auto; padding: .9rem 1.1rem; font-size: .72rem; color: #7f97b3; border-top: 1px solid rgba(255, 255, 255, .08); }

.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); background: var(--c-surface); border-bottom: 1px solid var(--c-line); display: flex; align-items: center; gap: 1rem; padding: 0 1.4rem; position: sticky; top: 0; z-index: 1020; }
.topbar .search { flex: 1; max-width: 460px; }
.topbar .search .form-control { border-radius: 999px; padding-left: 2.3rem; background: #f6f8fb; }
.topbar .search i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--c-ink-500); }
.icon-btn { position: relative; background: none; border: 0; width: 40px; height: 40px; border-radius: 50%; color: var(--c-ink-700); font-size: 1.2rem; display: grid; place-items: center; }
.icon-btn:hover { background: #eef2f7; }
.icon-btn .count { position: absolute; top: 3px; right: 2px; background: #c0271d; color: #fff; font-size: .62rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.content { padding: 1.4rem 1.6rem 3rem; flex: 1; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.page-head h1 { font-size: 1.45rem; font-weight: 700; margin: 0; color: var(--c-navy-900); }
.page-head .sub { color: var(--c-ink-500); font-size: .88rem; margin: .15rem 0 0; }
.breadcrumb { font-size: .8rem; margin-bottom: .5rem; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--c-ink-500); }

.card { border: 1px solid var(--c-line); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--c-surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--c-line); font-weight: 600; padding: .8rem 1.1rem; }
.card-body { padding: 1.1rem; }

.stat-card { padding: 1rem 1.1rem; height: 100%; }
.stat-card .label { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--c-ink-500); font-weight: 700; }
.stat-card .value { font-size: 1.9rem; font-weight: 700; color: var(--c-navy-900); line-height: 1.1; }
.stat-card .icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; font-size: 1.3rem; }
.stat-blue .icon { background: #e4eefb; color: var(--c-navy-700); }
.stat-teal .icon { background: var(--c-teal-100); color: var(--c-teal-600); }
.stat-amber .icon { background: #fdf0d3; color: #8a5a00; }
.stat-green .icon { background: #dcf3e2; color: #17693a; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-ink-500); background: #f7f9fc; border-bottom: 1px solid var(--c-line); white-space: nowrap; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f6f9fd; }
.filters { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1rem; }
.empty { text-align: center; color: var(--c-ink-500); padding: 2.5rem 1rem; }
.empty i { font-size: 2rem; display: block; margin-bottom: .4rem; opacity: .6; }

/* badges de situação */
.badge { font-weight: 600; letter-spacing: .01em; padding: .38em .65em; border-radius: 999px; }
.badge-primary { background: #dfeafb; color: #0e3d78; }
.badge-info { background: #d8f0f8; color: #0b5670; }
.badge-warning { background: #fdefc9; color: #7a4f00; }
.badge-success { background: #d9f2e0; color: #145c33; }
.badge-secondary { background: #e8ebf0; color: #3c4756; }
.badge-danger { background: #fbdcd8; color: #8f1d14; }
.badge-dark { background: #2b3441; color: #fff; }
.badge-purple { background: #e7e0f7; color: #45308a; }

/* cabeçalho do processo */
.process-head { background: linear-gradient(135deg, var(--c-navy-900), var(--c-navy-700)); color: #fff; border-radius: var(--radius); padding: 1.2rem 1.4rem; box-shadow: var(--shadow-md); }
.process-head .num { font-size: 1.5rem; font-weight: 700; letter-spacing: .01em; }
.process-head .meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem 1.5rem; margin-top: .9rem; }
.process-head .meta dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #a9c1dc; font-weight: 600; margin: 0; }
.process-head .meta dd { margin: 0; font-weight: 500; }
.process-tabs { border-bottom: 1px solid var(--c-line); gap: .15rem; flex-wrap: nowrap; overflow-x: auto; margin: 1rem 0; }
.process-tabs .nav-link { color: var(--c-ink-700); border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: .65rem .95rem; white-space: nowrap; font-weight: 500; }
.process-tabs .nav-link:hover { background: #eaf0f7; }
.process-tabs .nav-link.active { color: var(--c-navy-900); border-bottom-color: var(--c-gold-500); font-weight: 700; background: transparent; }

/* árvore documental */
.tree { list-style: none; margin: 0; padding: 0; }
.tree ul { list-style: none; margin: 0; padding-left: 1.6rem; border-left: 2px solid #d5dde8; margin-left: .8rem; }
.tree-node { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: .5rem; }
.tree-node:hover { background: #f1f5fa; }
.tree-node .seq { font-variant-numeric: tabular-nums; color: var(--c-ink-500); font-weight: 700; min-width: 2.6rem; }
.tree-node .ico { font-size: 1.15rem; color: var(--c-navy-600); }
.tree-node.folder .ico { color: var(--c-gold-500); }
.tree-node .title { font-weight: 600; }
.tree-node.cancelled .title { text-decoration: line-through; color: var(--c-ink-500); }
.tree-node .actions { margin-left: auto; display: flex; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; }
.hash { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .72rem; color: var(--c-ink-500); word-break: break-all; }

/* linha do tempo de movimentações */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid #d5dde8; }
.timeline li { position: relative; padding: 0 0 1.15rem 1.4rem; }
.timeline li::before { content: ""; position: absolute; left: -1.62rem; top: .25rem; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--c-navy-600); }
.timeline .when { font-size: .78rem; color: var(--c-ink-500); font-weight: 600; }
.timeline .who { font-size: .8rem; color: var(--c-ink-500); }

/* tramitação */
.flow { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.flow .unit { background: #e9f0f9; color: var(--c-navy-800); padding: .25rem .7rem; border-radius: 999px; font-weight: 600; font-size: .82rem; }
.flow .unit.now { background: var(--c-navy-700); color: #fff; }
.flow i { color: var(--c-ink-500); }

/* login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--c-bg); }
.auth-hero { background: linear-gradient(160deg, var(--c-navy-900), var(--c-navy-700)); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: center; }
.auth-hero .brand-mark { width: 64px; height: 64px; border-radius: 16px; background: var(--c-gold-500); color: var(--c-navy-900); display: grid; place-items: center; font-weight: 800; font-size: 1.8rem; margin-bottom: 1.5rem; }
.auth-hero h1 { font-size: 2rem; font-weight: 700; }
.auth-hero p { color: #c3d3e6; max-width: 34rem; }
.auth-card { align-self: center; justify-self: center; width: min(420px, 92%); background: #fff; border: 1px solid var(--c-line); border-radius: 1rem; padding: 2rem; box-shadow: var(--shadow-md); }

.public-doc-list .list-group-item { display: flex; align-items: center; gap: .8rem; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar.open { transform: none; box-shadow: var(--shadow-md); }
    .main { margin-left: 0; }
    .content { padding: 1rem 1rem 3rem; }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .tree-node { flex-wrap: wrap; }
    .tree-node .actions { margin-left: 0; width: 100%; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .sidebar, .topbar, .no-print { display: none !important; } .main { margin: 0; } }

/* ---------- Kanban de contratações ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: .8rem; overflow-x: auto; padding-bottom: .8rem; align-items: start; }
.kanban-col { background: #e9eef5; border-radius: var(--radius); padding: .6rem; min-height: 120px; }
.kanban-col > header { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--c-ink-700); padding: .2rem .3rem .6rem; }
.kanban-card { display: block; background: #fff; border: 1px solid var(--c-line); border-radius: .5rem; padding: .7rem; margin-bottom: .6rem; color: inherit; text-decoration: none; box-shadow: var(--shadow-sm); }
.kanban-card:hover { border-color: var(--c-navy-600); box-shadow: var(--shadow-md); }
/* processo digital (rolagem contínua) */
.dp-index { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
.dp-page { background: #fff; border: 1px solid var(--c-line); border-radius: .5rem; box-shadow: var(--shadow-sm, 0 1px 3px rgba(10, 37, 64, .08)); margin-bottom: 1.25rem; scroll-margin-top: 1rem; }
.dp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding: .55rem .9rem; background: var(--c-bg, #f4f6f9); border-bottom: 1px solid var(--c-line); }
.dp-title { font-weight: 600; flex: 1 1 16rem; }
.dp-actions { display: flex; gap: .3rem; }
.dp-view { container-type: inline-size; background: #e9ecef; padding: 0; }
.dp-view img { display: block; margin: 0 auto; max-width: 100%; }
.dp-frame { display: block; width: 100%; border: 0; min-height: 480px; height: 1200px; background: #e9ecef; }
@supports (width: 1cqw) { .dp-frame { height: calc(var(--pages, 1) * (100cqw * var(--ratio, 1.414) + 8px) + 16px); } }
.dp-note { padding: .35rem .9rem; border-top: 1px solid var(--c-line); }
.dp-placeholder { display: flex; gap: .8rem; align-items: center; padding: 1.2rem; color: #5b6b7d; }
.dp-placeholder .bi { font-size: 1.8rem; }
.dp-section { margin: 1.5rem 0 .6rem; padding: .35rem .2rem; font-weight: 700; color: var(--c-navy-900); border-bottom: 2px solid var(--c-gold-500); scroll-margin-top: 1rem; }
.dp-cover { min-height: 62rem; display: flex; }
.dp-cover-inner { width: 100%; padding: 3.5rem 3rem 2rem; display: flex; flex-direction: column; }
.dp-logo { max-height: 90px; max-width: 320px; margin-bottom: .6rem; }
.dp-org { font-weight: 700; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .04em; color: var(--c-navy-900); }
.dp-kind { text-align: center; letter-spacing: .25em; text-transform: uppercase; color: #6b7b8c; font-size: .85rem; margin-top: 1.5rem; }
.dp-number { text-align: center; font-size: 2.6rem; font-weight: 800; color: var(--c-navy-900); margin: .2rem 0 2rem; }
.dp-table { width: 100%; border-collapse: collapse; }
.dp-table th { width: 32%; text-align: left; vertical-align: top; padding: .55rem .8rem; background: #f4f6f9; border: 1px solid var(--c-line); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: #4b5b6d; }
.dp-table td { padding: .55rem .8rem; border: 1px solid var(--c-line); }
.dp-foot { margin-top: auto; padding-top: 2rem; text-align: center; font-size: .75rem; color: #7a8896; }
@media print { .dp-index, .dp-bar .dp-actions { display: none; } .dp-page { break-inside: avoid; box-shadow: none; } }
