/* Compras TI — tema */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --cti-ink: #14213d;
  --cti-sidebar: #0e1b2e;
  --cti-sidebar-2: #15253d;
  --cti-accent: #0f766e;
  --cti-accent-2: #14b8a6;
  --cti-bg: #f3f5f8;
  --cti-border: #e3e7ee;
  --cti-muted: #6b7a90;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: #1f2a3c;
  --bs-primary: #1d4ed8;
  --bs-primary-rgb: 29, 78, 216;
  --bs-link-color: #1d4ed8;
  --bs-link-color-rgb: 29, 78, 216;
  --bs-border-color: var(--cti-border);
}

body { background: var(--cti-bg); font-size: .9rem; -webkit-font-smoothing: antialiased; }
h1, .h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; color: var(--cti-ink); }
h2, .h2 { font-size: 1.15rem; font-weight: 600; color: var(--cti-ink); }
h3, .h3 { font-size: 1rem; font-weight: 600; }
.text-muted, .form-text { color: var(--cti-muted) !important; }
.small-caps { text-transform: uppercase; letter-spacing: .06em; font-size: .7rem; font-weight: 600; color: var(--cti-muted); }
.tabular { font-variant-numeric: tabular-nums; }

/* --- Layout --- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: 0 0 248px; background: var(--cti-sidebar); color: #c5d0e0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
}
.sidebar .brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.2rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.sidebar .brand-mark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, var(--cti-accent-2), var(--cti-accent)); display: grid; place-items: center; color: #fff; font-size: 1rem; }
.sidebar .nav-section { padding: 1rem 1.2rem .35rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #6f819c; font-weight: 600; }
.sidebar .nav-link { color: #c5d0e0; padding: .45rem 1.2rem; display: flex; align-items: center; gap: .65rem; border-left: 3px solid transparent; font-weight: 500; }
.sidebar .nav-link i { font-size: 1rem; width: 1.1rem; text-align: center; opacity: .85; }
.sidebar .nav-link:hover { color: #fff; background: var(--cti-sidebar-2); }
.sidebar .nav-link.active { color: #fff; background: var(--cti-sidebar-2); border-left-color: var(--cti-accent-2); }
.sidebar .nav-link .badge { margin-left: auto; }
.sidebar .sidebar-foot { margin-top: auto; padding: 1rem 1.2rem; font-size: .75rem; color: #6f819c; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--cti-border); padding: .6rem 1.5rem; display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 1020; }
.topbar .search { max-width: 380px; }
.content { padding: 1.5rem; flex: 1; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head .subtitle { color: var(--cti-muted); margin: .15rem 0 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #e0e7ff; color: #3730a3; display: inline-grid; place-items: center; font-weight: 700; font-size: .78rem; }

@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: -260px; z-index: 1040; transition: left .2s; }
  .sidebar.show { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .content { padding: 1rem; }
}

/* --- Cards / tabelas --- */
.card { border: 1px solid var(--cti-border); border-radius: .6rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--cti-border); font-weight: 600; padding: .8rem 1rem; }
.card-header.d-flex { gap: .5rem; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--cti-muted); font-weight: 600; background: #f8fafc; border-bottom-width: 1px; white-space: nowrap; }
.table td, .table th { padding: .6rem .75rem; vertical-align: middle; }
.table-hover tbody tr:hover { --bs-table-hover-bg: #f6f9ff; }
.table tr.row-inactive td { color: #98a2b3; }
.table-sm td, .table-sm th { padding: .4rem .6rem; }
.kpi { padding: 1rem 1.1rem; }
.kpi .kpi-label { font-size: .75rem; color: var(--cti-muted); font-weight: 500; }
.kpi .kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--cti-ink); line-height: 1.2; }
.kpi .kpi-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.15rem; }
.empty-state { padding: 2.5rem 1rem; text-align: center; color: var(--cti-muted); }
.empty-state i { font-size: 2rem; display: block; margin-bottom: .5rem; opacity: .6; }

/* --- Cores extra para estados --- */
.bg-teal { background-color: #0f766e !important; color: #fff; }
.bg-indigo { background-color: #4f46e5 !important; color: #fff; }
.bg-purple { background-color: #7c3aed !important; color: #fff; }
.bg-soft-primary { background: #eef2ff; color: #3730a3; }
.bg-soft-success { background: #ecfdf5; color: #047857; }
.bg-soft-warning { background: #fffbeb; color: #b45309; }
.bg-soft-info { background: #ecfeff; color: #0e7490; }
.bg-soft-danger { background: #fef2f2; color: #b91c1c; }
.status-badge { font-weight: 600; padding: .38em .6em; }
.badge.text-bg-light { border: 1px solid var(--cti-border); }

/* --- Pipeline de estados --- */
.pipeline { display: flex; gap: 0; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.pipeline li { flex: 1; min-width: 120px; position: relative; text-align: center; padding-top: 2.1rem; font-size: .75rem; color: var(--cti-muted); font-weight: 500; }
.pipeline li::before { content: ""; position: absolute; top: .8rem; left: 0; right: 0; height: 3px; background: var(--cti-border); }
.pipeline li:first-child::before { left: 50%; }
.pipeline li:last-child::before { right: 50%; }
.pipeline li .dot { position: absolute; top: .25rem; left: 50%; transform: translateX(-50%); width: 1.25rem; height: 1.25rem; border-radius: 50%; background: #fff; border: 3px solid var(--cti-border); z-index: 1; }
.pipeline li.done { color: var(--cti-ink); }
.pipeline li.done::before { background: var(--cti-accent-2); }
.pipeline li.done .dot { background: var(--cti-accent-2); border-color: var(--cti-accent-2); }
.pipeline li.current { color: var(--cti-ink); font-weight: 700; }
.pipeline li.current .dot { border-color: var(--cti-accent); background: #fff; box-shadow: 0 0 0 4px rgba(20,184,166,.2); }
.pipeline.cancelled li { opacity: .5; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.4rem; border-left: 2px solid var(--cti-border); margin-left: .4rem; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -.42rem; top: .2rem; width: .75rem; height: .75rem; border-radius: 50%; background: #fff; border: 2px solid var(--cti-accent); }
.timeline .when { font-size: .75rem; color: var(--cti-muted); }

/* --- Catálogo --- */
.price-best { color: #047857; font-weight: 700; }
.price-cell { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.matrix th.sup { writing-mode: initial; min-width: 92px; text-align: right; }
.matrix td.best { background: #ecfdf5; font-weight: 700; color: #047857; }
.supplier-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .5rem; border-radius: 999px; background: #f1f5f9; border: 1px solid var(--cti-border); font-size: .75rem; margin: .1rem .15rem .1rem 0; white-space: nowrap; }
.supplier-chip.best { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.filters .form-select, .filters .form-control { font-size: .85rem; }
pre.notes { white-space: pre-wrap; font-family: inherit; font-size: .85rem; margin: 0; background: #f8fafc; border: 1px solid var(--cti-border); border-radius: .4rem; padding: .7rem .8rem; }

/* --- Construtor de cotações --- */
.picker-results { max-height: 420px; overflow-y: auto; }
.picker-item { border-bottom: 1px solid var(--cti-border); padding: .6rem .75rem; }
.picker-item:last-child { border-bottom: 0; }
.picker-item .name { font-weight: 600; }
.picker-item .btn-add { font-size: .78rem; padding: .15rem .5rem; margin: .15rem .25rem .15rem 0; }
.items-table input.form-control-sm { min-width: 70px; }
.supplier-group td { background: #f8fafc !important; font-weight: 600; color: var(--cti-ink); }
.totals { min-width: 280px; }
.totals td { padding: .3rem .75rem; }
.totals .grand td { font-size: 1.05rem; font-weight: 700; border-top: 2px solid var(--cti-ink); }

/* --- Login --- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: radial-gradient(1200px 600px at -10% -10%, #134e4a 0%, transparent 60%), linear-gradient(160deg, #0e1b2e 0%, #13294b 100%); color: #dbe5f3; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { color: #fff; font-size: 2rem; line-height: 1.2; }
.auth-side .feature { display: flex; gap: .8rem; margin-bottom: 1rem; }
.auth-side .feature i { color: var(--cti-accent-2); font-size: 1.2rem; }
.auth-main { display: grid; place-items: center; padding: 2rem; background: #fff; }
.auth-card { width: 100%; max-width: 380px; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--cti-muted); font-size: .8rem; margin: 1.2rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--cti-border); }

.btn { font-weight: 500; }
.btn-primary { --bs-btn-bg: #1d4ed8; --bs-btn-border-color: #1d4ed8; --bs-btn-hover-bg: #1e40af; --bs-btn-hover-border-color: #1e40af; }
.btn-accent { --bs-btn-color: #fff; --bs-btn-bg: var(--cti-accent); --bs-btn-border-color: var(--cti-accent); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #115e59; --bs-btn-hover-border-color: #115e59; }
.form-label { font-weight: 500; font-size: .82rem; margin-bottom: .25rem; }
.required::after { content: " *"; color: #dc2626; }
.nav-tabs .nav-link { font-weight: 500; }
.perm-matrix th, .perm-matrix td { text-align: center; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
.hist-up { color: #b91c1c; }
.hist-down { color: #047857; }
.sparkline { width: 120px; height: 28px; }
.sparkline polyline { fill: none; stroke: var(--cti-accent); stroke-width: 2; }

/* --- Impressão --- */
.print-doc { max-width: 900px; margin: 0 auto; background: #fff; padding: 2.5rem; }
.print-doc h1 { font-size: 1.5rem; }
.print-doc .meta td { padding: .15rem .8rem .15rem 0; vertical-align: top; }
.print-toolbar { max-width: 900px; margin: 1rem auto; display: flex; gap: .5rem; justify-content: flex-end; }
@media print {
  body { background: #fff; font-size: 10.5pt; }
  .no-print, .print-toolbar { display: none !important; }
  .print-doc { padding: 0; max-width: none; }
  .table > thead th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}

/* Ligações sem sublinhado por defeito */
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .nav-link:hover, .dropdown-item:hover, a.card:hover { text-decoration: none; }
a.card:hover { border-color: #c7d2fe; }
