/* CMS styles — ported from GSS static/css/custom.css (gss- prefix renamed cms-). */
:root {
  --cms-navy: #1f3864;
  --cms-navy-dark: #16294a;
  --cms-accent: #2e74b5;
}

body {
  background-color: #f3f4f6;
}

#app-shell {
  min-height: 100vh;
}

.cms-sidebar {
  width: 260px;
  min-width: 260px;
  background-color: var(--cms-navy);
}

.cms-sidebar .nav-link {
  border-radius: .375rem;
}

.cms-sidebar .nav-link.active {
  background-color: var(--cms-accent);
  color: #fff;
}

.cms-sidebar .nav-link:not(.active):hover {
  background-color: var(--cms-navy-dark);
  color: #fff;
}

.cms-main {
  background-color: #f3f4f6;
  min-width: 0;
}

/* Let long unbroken values (URLs, file paths, IDs) wrap inside the
   detail list instead of forcing the page wider than the viewport.
   Scoped to just the value cells so it never affects normal text
   (table headers, short labels, table row content, etc.). */
.cms-main dl.row dd {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cms-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cms-navy), var(--cms-accent));
}

.cms-auth-card {
  max-width: 440px;
  width: 100%;
}

.seed-phrase-box {
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 1.1rem;
  line-height: 2.2rem;
  letter-spacing: .02em;
  background: #fff8e6;
  border: 1px solid #e8d9a8;
  border-radius: .5rem;
  padding: 1rem 1.25rem;
}

.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 600;
  color: var(--cms-navy);
}

.module-placeholder {
  text-align: center;
  padding: 4rem 1rem;
  color: #6c757d;
}

.dash-tile-link {
  display: block;
}

.dash-tile {
  border-radius: .75rem;
  transition: box-shadow .15s ease, transform .15s ease;
}

.dash-tile-link:hover .dash-tile {
  box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .12) !important;
  transform: translateY(-2px);
}

.dash-tile .card-body {
  padding: 2rem 1rem;
}

.dash-tile-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--cms-navy);
  line-height: 1.25;
}

.dash-tile-icon {
  display: block;
  font-size: 1.75rem;
  color: var(--cms-accent, var(--cms-navy));
  margin-bottom: .5rem;
}

.dash-tile-subtitle {
  font-size: .95rem;
  color: #6c757d;
  margin-top: .25rem;
}

.dash-metrics-bar {
  background-color: #e9ecf1;
  border-radius: .75rem;
  padding: 1.25rem;
}

/* In-app contextual Help panel (Bootstrap Offcanvas) — see
   templates/_help_drawer.html and static/js/help.js. Two independently
   scrolling columns: a narrow tree on the left, the page content on the
   right, matching the left-nav/right-content shape described for this
   feature rather than Bootstrap's single-scroll offcanvas-body default. */
.cms-help-drawer {
  --bs-offcanvas-width: min(760px, 100vw);
}

.cms-help-body {
  display: flex;
  height: 100%;
  min-height: 0;
}

.cms-help-nav {
  width: 240px;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cms-help-tree {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: .5rem 0;
}

.cms-help-section-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: .45rem .75rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--cms-navy);
}

.cms-help-section-toggle:hover {
  background-color: #f1f3f5;
}

.cms-help-section-toggle .bi-chevron-right {
  font-size: .7em;
  transition: transform .15s ease;
}

.cms-help-section-toggle[aria-expanded="true"] .bi-chevron-right {
  transform: rotate(90deg);
}

.cms-help-page-list {
  list-style: none;
  margin: 0;
  padding: 0 0 .25rem;
}

.cms-help-page-link {
  display: block;
  padding: .3rem .75rem .3rem 2rem;
  font-size: .85rem;
  color: #495057;
  text-decoration: none;
  border-radius: 0 .25rem .25rem 0;
}

.cms-help-page-link:hover {
  background-color: #f1f3f5;
  color: #212529;
}

.cms-help-page-link.active {
  background-color: var(--cms-accent);
  color: #fff;
  font-weight: 500;
}

.cms-help-content {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}

.cms-help-content :last-child {
  margin-bottom: 0;
}

@media (max-width: 576px) {
  .cms-help-body {
    flex-direction: column;
  }
  .cms-help-nav {
    width: 100%;
    min-width: 0;
    max-height: 40vh;
    border-right: none !important;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
  }
}

/* ---- CMS additions ---- */
.cms-sidebar .cms-brand-sub { font-size: .75rem; letter-spacing: .04em; }
.cms-sidebar .nav-link { padding: .4rem .75rem; }
.cms-sidebar .nav-link .badge { font-size: .65rem; }
.cms-sidebar form.cms-logout button { background: none; border: 0; padding: 0; }
.cms-page-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.cms-kv dt { color: #6c757d; font-weight: 500; }
.cms-phase-badge { background-color: #e9ecf1; color: var(--cms-navy); }

/* ---------------------------------------------------------------- case workflow panel (W4) */
.wf-rail { background: var(--cms-navy); color: #dbe4f3; border-radius: .5rem; padding: 1rem .9rem; }
.wf-rail a { color: #fff; }
.wf-rail .wf-meta { font-size: .78rem; color: #aebcd6; }
.wf-rail .progress { height: .4rem; background: rgba(255,255,255,.15); }
.wf-rail .progress-bar { background: #4fc28f; }
.wf-phase { margin-top: .55rem; }
.wf-phase > .wf-phase-head { display: flex; align-items: center; gap: .45rem; font-weight: 600; font-size: .86rem;
  padding: .25rem .4rem; border-radius: .35rem; cursor: pointer; user-select: none; }
.wf-phase.current > .wf-phase-head { background: var(--cms-accent); color: #fff; }
.wf-phase.done > .wf-phase-head { color: #c8f0dc; }
.wf-phase.upcoming > .wf-phase-head { color: #8ea0be; }
.wf-phase.before > .wf-phase-head { color: #8ea0be; background: repeating-linear-gradient(135deg, rgba(255,255,255,.06) 0 6px, transparent 6px 12px); }
.wf-stages { list-style: none; margin: .15rem 0 .2rem 1.35rem; padding: 0; font-size: .8rem; }
.wf-stages li { padding: .12rem .35rem; border-left: 2px solid rgba(255,255,255,.12); display: flex; gap: .35rem; align-items: baseline; }
.wf-stages li.current { color: #fff; font-weight: 700; border-left-color: #7fb6ff; background: rgba(127,182,255,.12); }
.wf-stages li.done { color: #bfe9d3; border-left-color: #4fc28f; }
.wf-stages li.upcoming { color: #8ea0be; }
.wf-stages li.before { color: #8ea0be; font-style: italic;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 5px, transparent 5px 10px); }
.wf-tree { list-style: none; padding-left: .8rem; margin: 0; font-size: .8rem; }
.wf-tree .wf-mini { height: .25rem; background: rgba(255,255,255,.15); border-radius: 1rem; overflow: hidden; }
.wf-tree .wf-mini > span { display: block; height: 100%; background: #7fb6ff; }
.wf-tree .this { font-weight: 700; }
.wf-stay { background: #fff3cd; border: 1px solid #f0c36d; color: #6b4e00; }
.wf-action-blocked { opacity: .65; }
.dl-tone-overdue { color: #b02a37; font-weight: 600; }
.dl-tone-soon { color: #b02a37; }
.dl-tone-near { color: #a96b00; }
.dl-tone-later { color: #1f7a4c; }
.dl-tone-met, .dl-tone-waiting { color: #6c757d; }
.dl-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .3rem; }
.dl-dot.overdue, .dl-dot.soon { background: #dc3545; }
.dl-dot.near { background: #f0ad4e; }
.dl-dot.later { background: #28a745; }
.dl-dot.met, .dl-dot.waiting { background: #adb5bd; }
.wf-verify-banner { background: #fff8e1; border: 1px solid #f0c36d; }
@media print { .cms-sidebar, .no-print, nav.mb-2 { display: none !important; } }

/* Phase 8 — drafts */
.draft-body { line-height: 1.6; }
.draft-body h1 { font-size: 1.4rem; } .draft-body h2 { font-size: 1.2rem; } .draft-body h3 { font-size: 1.05rem; }
.diff div { white-space: pre-wrap; padding: 0 .25rem; }
.diff-add { background: #e6ffed; color: #144620; }
.diff-del { background: #ffeef0; color: #86181d; text-decoration: line-through; }
.diff-same { color: #6c757d; }
.list-group-item.active-version { background: #eef4fb; }

/* Style template fixed content shown around a draft */
.fixed-block { border: 1px dashed #b6c2d1; background: #f8fafc; border-radius: .35rem; padding: .6rem .9rem; color: #334155; }
.fixed-block .fixed-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; margin-bottom: .35rem; }
.fixed-block .fixed-blank { height: .7em; }

/* Knowledge graph (Phase 9) */
.kg-canvas { height: 520px; border: 1px solid #e2e8f0; border-radius: .4rem; background: #fbfcfe; }
.kg-canvas.graph-empty { display: flex; align-items: center; justify-content: center; }
.kg-canvas.graph-empty::after { content: "No entities to show — add some below, or bring in the case's parties."; color: #94a3b8; font-size: .85rem; }
.kg-dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; background: #475569; vertical-align: middle; }
.kg-PERSON { background: #2563eb; } .kg-JUDGE { background: #7c3aed; } .kg-ORGANIZATION { background: #0d9488; }
.kg-COURT { background: #9333ea; } .kg-EVENT { background: #d97706; } .kg-DOCUMENT { background: #64748b; }
.kg-STATUTE { background: #b45309; } .kg-RULING { background: #be123c; } .kg-CLAIM_ISSUE { background: #dc2626; }
.kg-EVIDENCE { background: #15803d; } .kg-LOCATION { background: #0891b2; } .kg-CASE { background: #334155; border-radius: 2px; }
.kg-detail { min-height: 6rem; }
.kg-legend span { white-space: nowrap; margin-right: .6rem; }

/* Organization Intelligence (Phase 10) */
.intel-bar { height: .55rem; border-radius: .2rem; background: #2563eb; opacity: .75; min-width: 2px; }
.intel-kpi .num { font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.intel-kpi .lbl { font-size: .78rem; color: #64748b; }
.report-body a.case-ref { text-decoration: none; font-weight: 600; }
