/* SecureGRC — vizuelni sistem
   petrol #0F3B47 (navigacija), papir #F4F6F7 (pozadina), tinta #17232B (tekst),
   signal #D9952B (aktivno/fokus), linija #DCE3E6 */
:root {
  --sg-petrol: #0F3B47;
  --sg-petrol-2: #15505F;
  --sg-paper: #F4F6F7;
  --sg-ink: #17232B;
  --sg-muted: #5B6B73;
  --sg-line: #DCE3E6;
  --sg-signal: #D9952B;
  --sg-white: #FFFFFF;
  --lvl-low: #3B8B5A;
  --lvl-medium: #C9A227;
  --lvl-high: #D9772B;
  --lvl-critical: #B83A3A;
  --bs-body-font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: var(--sg-ink);
  --bs-body-bg: var(--sg-paper);
  --bs-link-color: #13617A;
  --bs-link-hover-color: var(--sg-petrol);
  --bs-border-color: var(--sg-line);
  --bs-body-font-size: .925rem;
}
body { background: var(--sg-paper); font-variant-numeric: tabular-nums; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--sg-signal) !important; outline-offset: 2px; }
h1, .h1 { font-size: 1.45rem; font-weight: 650; letter-spacing: -.01em; }
h2, .h2 { font-size: 1.15rem; font-weight: 650; }
h3, .h3 { font-size: 1rem; font-weight: 650; }

/* Okvir */
.sg-shell { display: flex; min-height: 100vh; }
.sg-side {
  width: 248px; flex: 0 0 248px; background: var(--sg-petrol); color: #cfe0e5;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding-bottom: 2rem;
}
.sg-brand { display: flex; align-items: center; gap: .55rem; padding: 1.05rem 1.1rem .9rem; color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .01em; font-size: 1.05rem; }
.sg-brand:hover { color: #fff; }
.sg-brand .mark { width: 26px; height: 26px; border-radius: 6px; background: var(--sg-signal); display: grid; place-items: center; color: var(--sg-petrol); font-size: .95rem; }
.sg-nav-group { padding: .9rem 1.1rem .25rem; font-size: .76rem; color: #8fb1bb; font-weight: 600; }
.sg-nav a { display: flex; align-items: center; gap: .6rem; padding: .38rem 1.1rem; color: #d9e7eb; text-decoration: none; font-size: .9rem; border-left: 3px solid transparent; }
.sg-nav a:hover { background: var(--sg-petrol-2); color: #fff; }
.sg-nav a.active { border-left-color: var(--sg-signal); background: rgba(255,255,255,.06); color: #fff; font-weight: 600; }
.sg-nav a .bi { opacity: .8; width: 1rem; }
.sg-main { flex: 1; min-width: 0; }
.sg-top { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.5rem; border-bottom: 1px solid var(--sg-line); background: var(--sg-white); position: sticky; top: 0; z-index: 20; }
.sg-top .org { font-weight: 600; color: var(--sg-petrol); }
.sg-content { padding: 1.35rem 1.5rem 3rem; max-width: 1500px; }
.sg-toggle { display: none; }
@media (max-width: 991.98px) {
  .sg-side { position: fixed; left: -260px; z-index: 50; transition: left .2s; }
  body.nav-open .sg-side { left: 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .sg-toggle { display: inline-flex; }
  .sg-content { padding: 1rem; }
}

/* Naslov stranice */
.sg-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.sg-head .crumbs { font-size: .82rem; color: var(--sg-muted); margin-bottom: .2rem; }
.sg-head .crumbs a { color: var(--sg-muted); }
.sg-head h1 { margin: 0; }

/* Površine */
.sg-panel { background: var(--sg-white); border: 1px solid var(--sg-line); border-radius: 8px; }
.sg-panel > .sg-panel-h { padding: .7rem 1rem; border-bottom: 1px solid var(--sg-line); display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sg-panel > .sg-panel-h h2, .sg-panel > .sg-panel-h h3 { margin: 0; font-size: .98rem; }
.sg-panel > .sg-panel-b { padding: 1rem; }
.sg-panel + .sg-panel { margin-top: 1rem; }

/* Tabele */
.sg-table { margin: 0; font-size: .89rem; }
.sg-table thead th { background: #EEF2F4; color: #3f525b; font-weight: 600; font-size: .8rem; border-bottom: 1px solid var(--sg-line); white-space: nowrap; }
.sg-table thead th a { color: inherit; text-decoration: none; }
.sg-table td { vertical-align: middle; }
.sg-table tbody tr:hover { background: #F8FAFB; }
.sg-table tr[data-lvl] td:first-child { box-shadow: inset 4px 0 0 var(--rail, transparent); }
tr[data-lvl="low"] { --rail: var(--lvl-low); }
tr[data-lvl="medium"] { --rail: var(--lvl-medium); }
tr[data-lvl="high"] { --rail: var(--lvl-high); }
tr[data-lvl="critical"] { --rail: var(--lvl-critical); }
.table-responsive { border-radius: 8px; }

/* Značke nivoa i statusa */
.badge { font-weight: 600; font-size: .74rem; padding: .32em .55em; border-radius: 4px; }
.lvl-success { background: #E3F1E8; color: #23603B; }
.lvl-warning { background: #FBF3D5; color: #7A5F06; }
.lvl-orange { background: #FCE8D6; color: #8E4612; }
.lvl-danger { background: #F7DEDE; color: #8A2323; }
.lvl-secondary, .st-secondary { background: #E9EDEF; color: #4B5A61; }
.st-success { background: #E3F1E8; color: #23603B; }
.st-warning { background: #FBF3D5; color: #6F5604; }
.st-danger { background: #F7DEDE; color: #8A2323; }

/* KPI */
.sg-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; }
.sg-kpi { background: var(--sg-white); border: 1px solid var(--sg-line); border-radius: 8px; padding: .8rem .95rem; text-decoration: none; color: inherit; display: block; position: relative; }
.sg-kpi:hover { border-color: #9fb6bd; color: inherit; }
.sg-kpi .v { font-size: 1.65rem; font-weight: 700; line-height: 1.1; color: var(--sg-petrol); }
.sg-kpi .l { font-size: .84rem; color: var(--sg-muted); margin-top: .15rem; }
.sg-kpi.warn .v { color: var(--lvl-high); }
.sg-kpi.bad .v { color: var(--lvl-critical); }
.sg-kpi .f { position: absolute; top: .55rem; right: .6rem; color: #9aabb2; font-size: .8rem; }

/* Polja */
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
.form-text { font-size: .8rem; }
.req::after { content: " *"; color: var(--lvl-critical); }
.btn-primary { --bs-btn-bg: var(--sg-petrol); --bs-btn-border-color: var(--sg-petrol); --bs-btn-hover-bg: var(--sg-petrol-2); --bs-btn-hover-border-color: var(--sg-petrol-2); --bs-btn-active-bg: #0a2c35; }
.btn-outline-primary { --bs-btn-color: var(--sg-petrol); --bs-btn-border-color: #8EAAB2; --bs-btn-hover-bg: var(--sg-petrol); --bs-btn-hover-border-color: var(--sg-petrol); }
.btn { font-weight: 500; }
.nav-tabs .nav-link { color: var(--sg-muted); }
.nav-tabs .nav-link.active { color: var(--sg-ink); font-weight: 600; border-top: 2px solid var(--sg-signal); }

/* Definicione liste (detalji zapisa) */
.sg-dl { display: grid; grid-template-columns: minmax(150px, 34%) 1fr; gap: .45rem 1rem; margin: 0; }
.sg-dl dt { font-weight: 500; color: var(--sg-muted); font-size: .85rem; }
.sg-dl dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 575.98px) { .sg-dl { grid-template-columns: 1fr; } .sg-dl dd { margin-bottom: .4rem; } }

/* Toplotna mapa rizika */
.heat { border-collapse: separate; border-spacing: 3px; }
.heat td { width: 62px; height: 46px; text-align: center; border-radius: 4px; font-weight: 700; color: #fff; font-size: .95rem; }
.heat td a { color: #fff; text-decoration: none; display: block; }
.heat th { font-size: .76rem; color: var(--sg-muted); font-weight: 600; text-align: center; padding: 0 .3rem; }
.heat .c-low { background: var(--lvl-low); } .heat .c-medium { background: var(--lvl-medium); }
.heat .c-high { background: var(--lvl-high); } .heat .c-critical { background: var(--lvl-critical); }
.heat .zero { opacity: .32; }

/* Grafikoni (SVG) */
.sg-chart text { font-size: 11px; fill: #5B6B73; font-family: inherit; }
.bar-track { height: 8px; background: #E6ECEE; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--sg-petrol); }
.bar-fill.good { background: var(--lvl-low); } .bar-fill.mid { background: var(--lvl-medium); } .bar-fill.bad { background: var(--lvl-critical); }

/* Upozorenja u BIA/CIA */
.sg-warn { border-left: 4px solid var(--lvl-high); background: #FFF7EE; padding: .55rem .8rem; border-radius: 4px; margin-bottom: .4rem; font-size: .88rem; }
.sg-warn.crit { border-left-color: var(--lvl-critical); background: #FDF1F1; }
.sg-ok { border-left: 4px solid var(--lvl-low); background: #F0F8F3; padding: .55rem .8rem; border-radius: 4px; font-size: .88rem; }

/* BIA matrica */
.bia-grid select { min-width: 64px; }
.bia-grid th { font-size: .78rem; }
.score-1 { background: #EEF6F1 !important; } .score-2 { background: #F4F7E8 !important; } .score-3 { background: #FDF6DC !important; }
.score-4 { background: #FDEBDD !important; } .score-5 { background: #F9E0E0 !important; }

/* Graf zavisnosti */
.dep-graph { width: 100%; overflow-x: auto; }
.dep-graph svg text { font-size: 11px; font-family: inherit; }

/* Prijava i portal */
.sg-guest { min-height: 100vh; display: grid; justify-items: center; align-content: start; padding: clamp(2rem, 9vh, 6rem) 1rem 2rem; background: linear-gradient(180deg, var(--sg-petrol) 0 clamp(200px, 30vh, 280px), var(--sg-paper) clamp(200px, 30vh, 280px)); }
.sg-guest-card { width: 100%; max-width: 440px; }
.sg-guest-wide { max-width: 920px; }
.sg-portal-top { background: var(--sg-petrol); color: #fff; padding: .8rem 1.25rem; }
.sg-q { border-top: 1px solid var(--sg-line); padding: 1rem 0; }
.sg-q:first-child { border-top: 0; }
.sg-q .qn { color: var(--sg-muted); font-size: .8rem; font-weight: 600; }
.sg-q.missing { background: #FFF7EE; margin: 0 -1rem; padding: 1rem; }

.text-pre { white-space: pre-wrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
.empty { color: var(--sg-muted); padding: 1.4rem; text-align: center; }
.sg-filters .form-select, .sg-filters .form-control { font-size: .85rem; }
@media print {
  .sg-side, .sg-top, .no-print, .btn { display: none !important; }
  .sg-content { padding: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
