/* IT Risk Management — application styles (Bootstrap 5 based) */
:root {
  --app-primary: #1f4e79;
  --app-primary-dark: #163a5a;
}
body { background: #f4f6f9; }

.bg-primary-app { background: var(--app-primary) !important; }
.text-primary-app { color: var(--app-primary) !important; }
.btn-primary-app { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
.btn-primary-app:hover, .btn-primary-app:focus { background: var(--app-primary-dark); border-color: var(--app-primary-dark); color: #fff; }

.auth-page { background: linear-gradient(160deg, #1f4e79 0%, #163a5a 45%, #f4f6f9 45.1%); min-height: 100vh; }
.auth-card { max-width: 440px; margin: 6vh auto 0; }
.auth-brand { color: #fff; text-align: center; margin-bottom: 1.25rem; }

/* Components */
.card { border: 0; box-shadow: 0 1px 2px rgba(16,24,40,.06); }
.card-header { background: #fff; font-weight: 600; }
.stat-card { border-left: 4px solid var(--app-primary); }
.stat-card .stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; }
.stat-card a { text-decoration: none; color: inherit; }
.score-badge { font-weight: 600; }
.page-title { font-size: 1.45rem; font-weight: 600; margin-bottom: 0; }
.chart-box { position: relative; height: 260px; }
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.table th { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: #475467; }
.table td { vertical-align: middle; }
.row-overdue td { background: #fdf0f1 !important; }
.filter-bar .form-select, .filter-bar .form-control { font-size: .875rem; }
.dl-grid dt { font-weight: 600; color: #475467; font-size: .85rem; }
.dl-grid dd { margin-bottom: .7rem; }
.section-title { font-size: 1.05rem; font-weight: 600; color: var(--app-primary); }
.workflow { display: flex; flex-wrap: wrap; gap: .25rem; font-size: .78rem; }
.workflow span { padding: .25rem .6rem; border-radius: 1rem; background: #eef2f7; color: #475467; }
.workflow span.done { background: #d1e7dd; color: #0f5132; }
.workflow span.current { background: var(--app-primary); color: #fff; font-weight: 600; }
.recovery-codes { font-family: SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.05rem; columns: 2; }
.qr-box { display: inline-block; padding: 8px; background: #fff; border: 1px solid #dee2e6; border-radius: .5rem; }
.qr-box img, .qr-box svg { display: block; width: 200px; height: 200px; }
.secret-key { font-family: SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; word-break: break-all; }
.audit-json { font-family: SFMono-Regular, Menlo, Consolas, monospace; font-size: .75rem; white-space: pre-wrap; word-break: break-word; max-width: 420px; }

/* Risk matrix */
.risk-matrix { border-collapse: separate; border-spacing: 4px; width: 100%; table-layout: fixed; }
.risk-matrix td.cell { height: 72px; text-align: center; border-radius: 6px; cursor: pointer; position: relative; transition: transform .1s; }
.risk-matrix td.cell:hover { transform: scale(1.03); box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.risk-matrix td.cell a { display: block; height: 100%; color: inherit; text-decoration: none; padding: 6px 2px; }
.risk-matrix .cell-count { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.risk-matrix .cell-count.zero { opacity: .35; font-weight: 400; }
.risk-matrix .cell-meta { font-size: .7rem; opacity: .9; }
.risk-matrix th { font-size: .75rem; font-weight: 600; text-align: center; color: #475467; text-transform: none; letter-spacing: 0; }
.risk-matrix th.row-head { text-align: right; padding-right: 6px; width: 120px; }
.risk-matrix .axis-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #98a2b3; }
.risk-matrix-sm td.cell { height: 48px; }
.risk-matrix-sm .cell-count { font-size: 1.1rem; }
.risk-matrix-sm .cell-meta { display: none; }
@media (max-width: 576px) {
  .risk-matrix th.row-head { width: 28px !important; font-size: .75rem; }
  .risk-matrix .lbl { display: none; }
  .risk-matrix .cell-meta { display: none; }
}

@media print {
  body { background: #fff; }
  .card { box-shadow: none !important; border: 1px solid #dee2e6; }
  a[href]::after { content: none !important; }
}

/* Compact data tables (register, lists) */
.table-register { font-size: .85rem; }
.table-register .badge { font-size: .7rem; white-space: normal; text-align: left; }
.table-register .score-badge { white-space: nowrap; }
.table-register th { font-size: .72rem; letter-spacing: 0; }
.table-register td:nth-child(2) { min-width: 180px; }
.table a { text-decoration: none; }
.table a:hover { text-decoration: underline; }
.risk-matrix th.row-head { width: 130px; font-size: .72rem; }
.risk-matrix-sm th.row-head { width: 105px; font-size: .68rem; }

/* Top menu */
.navbar .dropdown-item.active, .navbar .dropdown-item:active { background: var(--app-primary); color: #fff; }
.navbar .nav-link.active { font-weight: 600; }
