:root {
  --k-ink: #101828;
  --k-navy: #0f1d33;
  --k-navy-2: #172a47;
  --k-orange: #f26511;
  --k-orange-2: #d9570b;
  --k-orange-soft: #fff1e8;
  --k-bg: #f5f6f8;
  --k-card: #ffffff;
  --k-border: #e4e7ec;
  --k-muted: #667085;
  --k-green: #12b76a;
  --k-red: #d92d20;
  --k-amber: #f79009;
  --k-blue: #2e90fa;
  --k-violet: #7a5af8;
  --radius: 12px;
}
html { font-size: 14px; }
body { background: var(--k-bg); color: var(--k-ink); font-family: "Segoe UI", Inter, system-ui, -apple-system, Roboto, Arial, sans-serif; }
body.anon { background: radial-gradient(1200px 600px at 10% -10%, #26436f 0%, transparent 60%), linear-gradient(135deg, var(--k-navy), #0b1526 60%, #3a1a07); min-height: 100vh; }
a { color: var(--k-orange-2); text-decoration: none; }
a:hover { color: #b54708; }
.pre-line { white-space: pre-line; }
.muted, .text-muted { color: var(--k-muted) !important; }
.small-caps { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--k-muted); font-weight: 600; }

/* Shell */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 244px; background: var(--k-navy); color: #c9d3e3; overflow-y: auto; z-index: 1030; padding-bottom: 2rem; scrollbar-width: thin; }
.sidebar .brand { display: flex; gap: .65rem; align-items: center; padding: 1rem 1.1rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-logo { width: 38px; height: 38px; border-radius: 50%; flex: none; }
.sidebar .brand strong { letter-spacing: .04em; }
.sidebar .brand small { display: block; font-size: .72rem; color: var(--k-orange); font-weight: 600; letter-spacing: .08em; }
.sidebar nav a { display: flex; align-items: center; gap: .6rem; padding: .42rem 1rem .42rem 1.15rem; color: #c9d3e3; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar nav a.active { background: linear-gradient(90deg, rgba(242,101,17,.22), rgba(242,101,17,0)); border-left-color: var(--k-orange); color: #fff; }
.sidebar nav a .ic { width: 18px; text-align: center; opacity: .85; }
.sidebar nav a .badge { margin-left: auto; }
.nav-section { font-size: .66rem; text-transform: uppercase; letter-spacing: .09em; color: #7d8ba3; padding: 1rem 1rem .3rem 1.2rem; }
.nav-moat { margin: .6rem .8rem 0; border: 1px solid rgba(242,101,17,.35); border-radius: 10px; padding-bottom: .3rem; background: rgba(242,101,17,.05); }
.nav-moat .nav-section { color: var(--k-orange); padding-top: .6rem; }
.main { margin-left: 244px; min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 1rem; height: 56px; padding: 0 1.4rem; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--k-border); position: sticky; top: 0; z-index: 1020; }
.topbar .org { font-weight: 600; }
.topbar .search { max-width: 360px; flex: 1; }
.topbar .search input { border-radius: 999px; background: var(--k-bg); border-color: transparent; padding-left: 1rem; }
.content { padding: 1.4rem; max-width: 1500px; }
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .topbar .search { display: none; }
}

/* Page */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1.1rem; }
.page-head h1 { font-size: 1.5rem; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.page-head .sub { color: var(--k-muted); width: 100%; margin-top: -.4rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.card { border: 1px solid var(--k-border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: transparent; font-weight: 600; border-bottom: 1px solid var(--k-border); padding: .8rem 1rem; display: flex; align-items: center; gap: .5rem; }
.card-header .ms-auto { font-weight: 400; }
.card > .table { margin-bottom: 0; }
.card > .table-responsive > .table { margin-bottom: 0; }
.kpi { padding: 1rem 1.1rem; height: 100%; }
.kpi .label { color: var(--k-muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kpi .value { font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; }
.kpi .sub { font-size: .8rem; color: var(--k-muted); }
.table { --bs-table-bg: transparent; }
.table thead th { background: #f9fafb; font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: #475467; white-space: nowrap; border-bottom-width: 1px; }
.table td { vertical-align: middle; }
.table-sm td, .table-sm th { padding: .45rem .6rem; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0; }
.dl-grid dt { color: var(--k-muted); font-weight: 500; }
.dl-grid dd { margin: 0; }
.progress.thin { height: 6px; border-radius: 99px; }
.progress-bar { background-color: var(--k-orange); }
.filters .form-label { font-size: .72rem; color: var(--k-muted); margin-bottom: .1rem; text-transform: uppercase; letter-spacing: .04em; }
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--k-muted); }

/* People */
.avatar { width: 34px; height: 34px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem; flex: none; letter-spacing: .02em; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.6rem; }
img.avatar { object-fit: cover; background: #e4e7ec; }
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .avatar.lg { width: 96px; height: 96px; font-size: 2rem; border: 3px solid rgba(255,255,255,.85); }
.photo-btn { position: absolute; right: -2px; bottom: -2px; width: 32px; height: 32px; border-radius: 50%; background: var(--k-orange, #F26511); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: .95rem; cursor: pointer; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); margin: 0; }
.photo-btn:hover { filter: brightness(1.08); }
.avatar.sm { width: 26px; height: 26px; font-size: .68rem; }
.person { display: inline-flex; align-items: center; gap: .55rem; color: inherit; }
.person .nm { font-weight: 600; line-height: 1.15; }
.person .jt { font-size: .78rem; color: var(--k-muted); line-height: 1.15; }
.profile-hero { background: linear-gradient(120deg, var(--k-navy), var(--k-navy-2) 60%, #4a2410); color: #fff; border-radius: var(--radius); padding: 1.4rem; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.profile-hero .muted { color: #b8c4d8 !important; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 99px; font-size: .74rem; font-weight: 600; background: #f2f4f7; color: #344054; white-space: nowrap; }
.chip.orange { background: var(--k-orange-soft); color: #b54708; }
.chip.green { background: #ecfdf3; color: #027a48; }
.chip.red { background: #fef3f2; color: #b42318; }
.chip.amber { background: #fffaeb; color: #b54708; }
.chip.blue { background: #eff8ff; color: #175cd3; }
.chip.violet { background: #f4f3ff; color: #5925dc; }
.chip.dark { background: #1d2939; color: #fff; }
.nav-tabs .nav-link { color: var(--k-muted); font-weight: 500; }
.nav-tabs .nav-link.active { color: var(--k-ink); border-bottom-color: #fff; font-weight: 600; }
.nav-pills .nav-link.active { background: var(--k-orange); }

/* Org chart */
.org ul { padding-left: 1.6rem; list-style: none; border-left: 1px dashed #d0d5dd; margin-left: .9rem; }
.org > ul { border-left: 0; padding-left: 0; margin-left: 0; }
.org li { margin: .35rem 0; position: relative; }
.org li::before { content: ""; position: absolute; left: -1.6rem; top: 1.1rem; width: 1.4rem; border-top: 1px dashed #d0d5dd; }
.org > ul > li::before { display: none; }
.org .node { display: inline-flex; gap: .55rem; align-items: center; background: #fff; border: 1px solid var(--k-border); border-radius: 10px; padding: .35rem .7rem .35rem .4rem; }
.org .node .count { font-size: .72rem; color: var(--k-muted); margin-left: .4rem; }
.org details > summary { list-style: none; cursor: pointer; }
.org details > summary::-webkit-details-marker { display: none; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: .8rem; overflow-x: auto; }
.kanban .col-k { background: #f2f4f7; border-radius: 10px; padding: .6rem; min-height: 120px; }
.kanban .col-k h6 { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: #475467; display: flex; justify-content: space-between; }
.kanban .card-k { background: #fff; border: 1px solid var(--k-border); border-radius: 8px; padding: .55rem .65rem; margin-bottom: .5rem; display: block; color: inherit; }
.kanban .card-k:hover { border-color: var(--k-orange); }

/* Insights (moat) */
.insight { border-left: 4px solid #d0d5dd; }
.insight.sev-Critical { border-left-color: #b42318; }
.insight.sev-High { border-left-color: var(--k-red); }
.insight.sev-Medium { border-left-color: var(--k-amber); }
.insight.sev-Low { border-left-color: var(--k-blue); }
.insight.sev-Info { border-left-color: #98a2b3; }
.insight .evidence { font-size: .83rem; color: #344054; margin: .4rem 0 0; padding-left: 1.1rem; }
.insight .rec { background: #f9fafb; border-radius: 8px; padding: .5rem .7rem; font-size: .86rem; margin-top: .5rem; }
.conf { display: inline-block; width: 60px; height: 6px; border-radius: 99px; background: #eaecf0; vertical-align: middle; overflow: hidden; }
.conf > i { display: block; height: 100%; background: var(--k-orange); }
.moat-banner { background: linear-gradient(120deg, #0f1d33, #1f3558 55%, #6a2c07); color: #fff; border-radius: var(--radius); padding: 1.2rem 1.4rem; }
.moat-banner .muted { color: #c3cde0 !important; }
.risk-bar { height: 8px; border-radius: 99px; background: #eaecf0; overflow: hidden; min-width: 90px; }
.risk-bar > i { display: block; height: 100%; }

/* Heatmap & 9-box */
.heat td { text-align: center; font-size: .78rem; font-weight: 600; min-width: 40px; }
.nine { display: grid; grid-template-columns: 30px repeat(3, 1fr); grid-template-rows: repeat(3, minmax(90px, auto)) 26px; gap: 6px; }
.nine .cell { background: #f9fafb; border: 1px solid var(--k-border); border-radius: 8px; padding: .4rem; font-size: .76rem; }
.nine .cell b { display: block; font-size: .72rem; color: var(--k-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .2rem; }
.nine .cell.hi { background: #ecfdf3; } .nine .cell.lo { background: #fef3f2; }
.nine .axis { font-size: .7rem; color: var(--k-muted); display: flex; align-items: center; justify-content: center; text-transform: uppercase; letter-spacing: .05em; }

/* Charts */
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font-family: inherit; }
.legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .78rem; color: var(--k-muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }

/* Calendar */
.cal { font-size: .78rem; }
.cal th { text-align: center; font-weight: 600; color: var(--k-muted); min-width: 26px; }
.cal td { text-align: center; padding: 2px !important; }
.cal td.we { background: #f9fafb; }
.cal .off { display: block; height: 18px; border-radius: 4px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-pitch { color: #fff; padding: 8vh 6vw; display: flex; flex-direction: column; justify-content: center; }
.login-pitch h1 { font-size: 2.4rem; font-weight: 700; letter-spacing: -.02em; }
.login-pitch li { margin: .45rem 0; color: #d0d8e6; }
.login-card { max-width: 420px; width: 100%; margin: auto; background: #fff; border-radius: 16px; padding: 2.2rem; box-shadow: 0 30px 60px rgba(0,0,0,.35); }
@media (max-width: 900px) { .login-wrap { grid-template-columns: 1fr; } .login-pitch { display: none; } }

/* Buttons */
.btn-primary { --bs-btn-bg: var(--k-orange); --bs-btn-border-color: var(--k-orange); --bs-btn-hover-bg: var(--k-orange-2); --bs-btn-hover-border-color: var(--k-orange-2); --bs-btn-active-bg: #c24e0a; --bs-btn-active-border-color: #c24e0a; --bs-btn-disabled-bg: var(--k-orange); --bs-btn-disabled-border-color: var(--k-orange); }
.btn-outline-primary { --bs-btn-color: var(--k-orange-2); --bs-btn-border-color: var(--k-orange); --bs-btn-hover-bg: var(--k-orange); --bs-btn-hover-border-color: var(--k-orange); --bs-btn-active-bg: var(--k-orange-2); --bs-btn-active-border-color: var(--k-orange-2); }
.btn { border-radius: 8px; font-weight: 500; }
.form-control, .form-select { border-radius: 8px; }
.form-control:focus, .form-select:focus { border-color: #f7a26d; box-shadow: 0 0 0 .2rem rgba(242,101,17,.15); }
.text-orange { color: var(--k-orange-2) !important; }

@media print {
  .sidebar, .topbar, .no-print, .btn, form.filters { display: none !important; }
  .main { margin: 0; } .content { padding: 0; } body { background: #fff; }
  .card { box-shadow: none; }
}

/* Language switch */
.lang-switch { display: inline-flex; border: 1px solid var(--k-border); border-radius: 999px; overflow: hidden; font-size: .72rem; font-weight: 700; letter-spacing: .04em; }
.lang-switch a { padding: .2rem .55rem; color: var(--k-muted); text-decoration: none; }
.lang-switch a.on { background: var(--k-orange); color: #fff; }
.lang-switch.dark { border-color: rgba(255,255,255,.3); }
.lang-switch.dark a { color: #cfd8e6; }
.lang-switch.dark a.on { color: #fff; }
.lang-float { position: fixed; top: 14px; right: 16px; z-index: 50; }

/* Construction */
.proj-hero { background: linear-gradient(120deg, var(--k-navy), var(--k-navy-2) 60%, #4a2410); color: #fff; border-radius: var(--radius); padding: 1.1rem 1.3rem; }
.proj-hero .muted { color: #b8c4d8 !important; }
.proj-hero h1 { font-size: 1.4rem; margin: 0; font-weight: 650; }
.proj-tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: .8rem 0 1rem; border-bottom: 1px solid var(--k-border); }
.proj-tabs a { padding: .45rem .8rem; color: var(--k-muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.proj-tabs a.on { color: var(--k-ink); border-bottom-color: var(--k-orange); font-weight: 600; }
.proj-tabs a:hover { color: var(--k-ink); }
.table-fin td, .table-fin th { font-size: .82rem; }
.table-fin tfoot td { font-weight: 700; background: #f9fafb; }
.row-sub td { background: #fcfcfd; font-size: .78rem; }
.gantt { position: relative; }
.gantt .g-row { display: grid; grid-template-columns: 300px 1fr; align-items: center; border-bottom: 1px solid #f2f4f7; min-height: 26px; }
.gantt .g-name { font-size: .78rem; padding: 2px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt .g-track { position: relative; height: 22px; }
.gantt .g-bar { position: absolute; top: 5px; height: 12px; border-radius: 3px; background: #98a2b3; }
.gantt .g-bar.crit { background: #d92d20; }
.gantt .g-bar.done { background: #12b76a; }
.gantt .g-base { position: absolute; top: 17px; height: 3px; background: #c7ccd4; border-radius: 2px; }
.gantt .g-prog { position: absolute; top: 5px; height: 12px; border-radius: 3px; background: rgba(16,24,40,.35); }
.gantt .g-ms { position: absolute; top: 4px; width: 12px; height: 12px; transform: rotate(45deg); background: #0f1d33; }
.gantt .g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--k-orange); z-index: 2; }
.gantt .g-head { display: grid; grid-template-columns: 300px 1fr; font-size: .7rem; color: var(--k-muted); border-bottom: 1px solid var(--k-border); }
.gantt .g-months { position: relative; height: 20px; }
.gantt .g-months span { position: absolute; top: 3px; border-left: 1px solid #eaecf0; padding-left: 3px; }
.health { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.bench { font-size: .74rem; }
.bench.low { color: #b42318; font-weight: 600; }
.bench.high { color: #b54708; }
.g702 td { padding: .3rem .6rem; }
.score-ring { width: 56px; height: 56px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; color: #fff; }
@media print { .proj-tabs { display: none; } .proj-hero { background: none; color: #000; padding: 0; } }

/* Church: 52-week attendance strip, check-in grid */
.weeks { display:flex; gap:3px; flex-wrap:wrap; }
.weeks i { width:11px; height:22px; border-radius:3px; background:#eaecf0; display:inline-block; }
.weeks i.on { background:#12b76a; }
.checkin-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:6px; }
.checkin-grid label { border:1px solid #eaecf0; border-radius:8px; padding:6px 8px; display:flex; gap:8px; align-items:center; cursor:pointer; }
.checkin-grid label.here { background:#ecfdf3; border-color:#abefc6; }
.statement { max-width:760px; margin:auto; }
@media print { .statement { max-width:none; } }

/* Help & user guide */
.help-link { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 1px solid #98a2b3; color: #344054; font-weight: 700; font-size: .85rem; line-height: 1; text-decoration: none; }
.help-link:hover { border-color: var(--k-orange); color: var(--k-orange-2); background: var(--k-orange-soft); }
.empty-state { text-align: center; padding: 2rem 1rem; color: #475467; background: #fff; }
.empty-state .empty-icon { width: 2.6rem; height: 2.6rem; margin: 0 auto .6rem; border-radius: 50%; background: var(--k-orange-soft); color: var(--k-orange-2); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 700; }
.help-toc { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto; }
.help-toc li a { display: block; padding: .18rem .35rem; border-radius: 5px; color: #344054; }
.help-toc li a:hover { background: var(--k-orange-soft); color: var(--k-ink); }
.help-topic { scroll-margin-top: 70px; }
.help-topic h2 { font-size: 1.2rem; font-weight: 650; margin-bottom: .6rem; }
.help-topic h3 { font-size: .98rem; font-weight: 650; margin: 1rem 0 .35rem; }
.help-topic ol.steps { padding-left: 1.4rem; }
.help-topic ol.steps li, .help-topic ul li { margin-bottom: .2rem; }
.help-topic code { color: #7a2e0e; }
.help-note { background: var(--k-orange-soft); border-left: 3px solid var(--k-orange); padding: .45rem .7rem; border-radius: 0 6px 6px 0; margin: .5rem 0 .8rem; }
.help-table th { text-transform: none; letter-spacing: 0; font-size: .8rem; }
.help-topic:focus { outline: none; box-shadow: 0 0 0 2px #f7a46f; }
@media print {
  .help-toc, .help-link { display: none !important; }
  .help .col-lg-9 { width: 100%; }
  .help-topic { break-inside: auto; page-break-before: always; }
  .help-topic:first-of-type { page-break-before: auto; }
}
