/* GRC360 — Identité visuelle professionnelle GRC */
:root {
  --navy-900: #0b1f33; --navy-800: #0f2a43; --navy-700: #163a5c; --navy-600: #1d4a74;
  --teal: #14b8a6; --teal-dark: #0d9488; --teal-light: #ccfbf1;
  --bg: #f4f6f9; --panel: #ffffff; --line: #e3e8ef; --line-strong: #cbd5e1;
  --txt: #1e293b; --muted: #64748b; --faint: #94a3b8;
  --red: #dc2626; --red-bg: #fee2e2; --orange: #ea580c; --orange-bg: #ffedd5;
  --amber: #d97706; --amber-bg: #fef3c7; --green: #16a34a; --green-bg: #dcfce7;
  --blue: #2563eb; --blue-bg: #dbeafe; --violet: #7c3aed; --violet-bg: #ede9fe;
  --sidebar-w: 250px; --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 42, 67, .08), 0 4px 14px rgba(15, 42, 67, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: "Segoe UI", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--txt); font-size: 14px; }
a { color: var(--navy-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: linear-gradient(180deg, var(--navy-900), var(--navy-800)); color: #cbd5e1; position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 40; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 12px 14px 10px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--teal), #0891b2); display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; letter-spacing: .5px; }
.brand-txt strong { display: block; font-size: 16px; color: #fff; }
.brand-txt small { font-size: 10px; color: #7f9cb8; letter-spacing: .3px; }
.nav-section { padding: 9px 16px 2px; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #5d7d9c; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 18px; color: #b6c8da; font-size: 12.2px; border-left: 3px solid transparent; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(20,184,166,.12); border-left-color: var(--teal); color: #fff; }
.nav a .ico { width: 17px; text-align: center; opacity: .85; }
.side-foot { margin-top: auto; padding: 8px 14px; font-size: 11px; color: #5d7d9c; border-top: 1px solid rgba(255,255,255,.06); }
.side-foot .user-chip { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--navy-600); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.user-chip b { color: #e2e8f0; display: block; font-size: 12px; font-weight: 600; }
.user-chip span { color: #7f9cb8; font-size: 10.5px; }
.link-btn { background: none; border: none; color: #8fb3d4; cursor: pointer; font-size: 11.5px; padding: 2px 0; }
.link-btn:hover { color: #fff; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 10px 22px; min-height: 56px; }
.topbar h1 { font-size: 16.5px; font-weight: 600; color: var(--navy-800); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 15px; }
.search-pill { flex: 0 1 420px; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; color: var(--faint); cursor: text; font-size: 13px; }
.search-pill input { border: none; outline: none; background: transparent; flex: 1; font-size: 13px; color: var(--txt); }
.top-user { display: flex; align-items: center; gap: 10px; }
.role-tag { font-size: 11px; background: var(--teal-light); color: var(--teal-dark); border-radius: 999px; padding: 3px 10px; font-weight: 600; }

.view { padding: 22px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* ===== Composants ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi-card .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.kpi-card .v { font-size: 26px; font-weight: 700; color: var(--navy-800); margin-top: 4px; }
.kpi-card .s { font-size: 11px; color: var(--faint); margin-top: 2px; }
.kpi-card.accent-red .v { color: var(--red); } .kpi-card.accent-orange .v { color: var(--orange); }
.kpi-card.accent-green .v { color: var(--green); } .kpi-card.accent-teal .v { color: var(--teal-dark); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2 { font-size: 14.5px; color: var(--navy-800); font-weight: 600; flex: 1; }
.panel-body { padding: 16px 18px; }
.panel-body.flush { padding: 0; }

.table-wrap { overflow-x: auto; }
table.grc { width: 100%; border-collapse: collapse; font-size: 12.8px; }
/* Colonne d'actions toujours visible (collée à droite) dans les tableaux larges */
table.grc td.act-col { position: sticky; right: 0; background: #fff; box-shadow: -3px 0 6px rgba(15, 42, 67, .08); z-index: 1; }
table.grc tbody tr:hover td.act-col { background: #f8fafc; }
table.grc th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #f8fafc; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.grc td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grc tbody tr:hover { background: #f8fafc; }
table.grc td.wrap { white-space: normal; min-width: 180px; max-width: 460px; }
.mono { font-family: Consolas, monospace; font-size: 12px; color: var(--navy-600); font-weight: 600; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2.5px 9px; white-space: nowrap; }
.b-red { background: var(--red-bg); color: var(--red); } .b-orange { background: var(--orange-bg); color: var(--orange); }
.b-amber { background: var(--amber-bg); color: var(--amber); } .b-green { background: var(--green-bg); color: var(--green); }
.b-blue { background: var(--blue-bg); color: var(--blue); } .b-violet { background: var(--violet-bg); color: var(--violet); }
.b-gray { background: #eef2f7; color: var(--muted); } .b-teal { background: var(--teal-light); color: var(--teal-dark); }
/* Badges niveaux : échelle 5 couleurs vert → rouge (identique à la cartographie) */
.b-z1 { background: #15803d; color: #fff; } .b-z2 { background: #65a30d; color: #fff; }
.b-z3 { background: #ca8a04; color: #fff; } .b-z4 { background: #ea580c; color: #fff; }
.b-z5 { background: #b91c1c; color: #fff; }

.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--navy-800); color: #fff; border: 1px solid var(--navy-800); border-radius: 8px; padding: 7px 14px; font-size: 12.8px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--navy-700); }
.btn.ghost { background: #fff; color: var(--navy-700); border-color: var(--line-strong); }
.btn.ghost:hover { background: #f8fafc; }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn.small { padding: 4px 10px; font-size: 11.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input[type="text"], .filters input[type="search"] {
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 6.5px 10px; font-size: 12.8px; background: #fff; color: var(--txt); min-width: 130px; }
.filters label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .3px; }

.pager { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.pager .grow { flex: 1; }

.empty { padding: 40px 20px; text-align: center; color: var(--faint); font-size: 13px; }
.loading { padding: 60px 20px; text-align: center; color: var(--faint); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--teal); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Modale */
.modal-back { position: fixed; inset: 0; background: rgba(11,31,51,.45); z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal { background: #fff; border-radius: 12px; max-width: 860px; width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(11,31,51,.35); }
.modal-head { display: flex; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-head h3 { flex: 1; font-size: 15px; color: var(--navy-800); }
.modal-body { padding: 18px 20px; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }

/* Fiche détail */
.detail-head { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 22px; margin-bottom: 20px; }
.detail-head .codes { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.detail-head h2 { font-size: 19px; color: var(--navy-800); margin-bottom: 4px; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 20px; margin-top: 12px; }
.meta-grid .m b { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }
.meta-grid .m span { font-size: 13px; color: var(--txt); }

.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.tabs button .cnt { background: #eef2f7; border-radius: 999px; padding: 1px 7px; font-size: 11px; margin-left: 5px; color: var(--muted); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; text-align: center; }
.stat-box .v { font-size: 20px; font-weight: 700; color: var(--navy-800); }
.stat-box .k { font-size: 11px; color: var(--muted); }

/* Cartographie 5x5 */
.map-grid { display: grid; grid-template-columns: 90px repeat(5, 1fr); gap: 6px; }
.map-cell { border-radius: 8px; min-height: 74px; padding: 6px; display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; }
.map-cell.lbl { display: grid; place-items: center; font-size: 11.5px; color: var(--muted); font-weight: 600; text-align: center; background: transparent; }
/* Échelle 5 couleurs (vert → rouge) — teintes foncées lisibles, texte blanc */
.z1 { background: #15803d; color: #fff; }
.z2 { background: #65a30d; color: #fff; }
.z3 { background: #ca8a04; color: #fff; }
.z4 { background: #ea580c; color: #fff; }
.z5 { background: #b91c1c; color: #fff; }
.ax-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.risk-dot { font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 2.5px 6px; cursor: pointer; border: 1px solid rgba(0,0,0,.12); background: #fff; color: #111827; }
.risk-dot:hover { transform: scale(1.06); }
.map-cell-clickable { cursor: pointer; border: 1px solid rgba(15, 23, 42, .08); }
.map-cell-clickable:hover { box-shadow: 0 0 0 2px rgba(37, 99, 235, .25); }
.risk-count { width: 100%; font-size: 20px; line-height: 1; color: #fff; }
.map-cell .inline-note { color: rgba(255,255,255,.92); }
.risk-dots { display: flex; flex-wrap: wrap; gap: 4px; }
.map-legend { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.map-legend span { padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.map-detail { margin-top: 16px; }
.axis-x { display: grid; grid-template-columns: 90px repeat(5, 1fr); gap: 6px; margin-top: 6px; }
.axis-x div { text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.axis-y { display: grid; place-items: center; font-size: 11.5px; color: var(--muted); font-weight: 600; writing-mode: initial; }

/* Barres de répartition */
.hbar { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12.5px; }
.hbar .lbl { width: 130px; color: var(--muted); flex: none; }
.hbar .track { flex: 1; background: #eef2f7; border-radius: 999px; height: 18px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 999px; }
.hbar .val { width: 64px; text-align: right; font-weight: 700; color: var(--navy-800); flex: none; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy-900), var(--navy-700)); padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 36px 34px; width: 100%; max-width: 400px; box-shadow: 0 24px 80px rgba(0,0,0,.4); }
.login-card .brand-mark { margin: 0 auto 14px; width: 52px; height: 52px; font-size: 19px; }
.login-card h1 { font-size: 20px; text-align: center; color: var(--navy-800); }
.login-card .sub { text-align: center; color: var(--muted); font-size: 12.5px; margin: 6px 0 22px; }
.login-card label { display: block; font-size: 12px; font-weight: 600; color: var(--navy-800); margin: 12px 0 5px; }
.login-card input { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9.5px 12px; font-size: 13.5px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 18px; padding: 10px; }
.form-err { background: var(--red-bg); color: var(--red); border-radius: 8px; padding: 9px 12px; font-size: 12.5px; margin-top: 12px; display: none; }
.form-err.show { display: block; }
.form-ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; border-radius: 8px; padding: 9px 12px; font-size: 12.5px; margin-top: 12px; display: none; }
.form-ok.show { display: block; }
.login-note { margin-top: 18px; font-size: 11px; color: var(--faint); text-align: center; line-height: 1.5; }

.crumb { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--navy-600); }
.count-pill { font-size: 11.5px; color: var(--muted); }
.inline-note { font-size: 11.5px; color: var(--faint); }

/* ===== Menu latéral par modules ===== */
.nav-group { border-left: 3px solid transparent; }
.nav-group.open { background: rgba(255,255,255,.04); }
.nav-parent { justify-content: space-between; }
.nav-parent .arrow { margin-left: auto; font-size: 10px; opacity: .7; transition: transform .2s; }
.nav-children { display: none; padding-left: 12px; background: rgba(0,0,0,.08); }
.nav-group.open > .nav-children { display: block; }
.nav-child { padding: 3px 16px 3px 34px !important; font-size: 11.5px !important; color: #9fb6cc !important; }
.nav-child .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); opacity: .6; margin-right: 8px; }
.nav-child.active { color: #fff !important; background: rgba(20,184,166,.12) !important; border-left-color: var(--teal) !important; }
/* Ligne de menu : lien + bouton « + » d'ajout sur la même ligne (menu compact, entièrement visible) */
.nav-row { display: flex; align-items: stretch; }
.nav-row > a:first-child { flex: 1; min-width: 0; }
.nav a.nav-add {
  flex: none; width: 26px; padding: 0 !important; display: grid; place-items: center;
  font-size: 14px; font-weight: 700; color: var(--teal) !important; white-space: nowrap;
  border-left: none;
}
.nav a.nav-add:hover { background: rgba(20,184,166,.15) !important; color: #fff !important; text-decoration: none; }

/* Menu latéral masquable */
.shell { position: relative; }
.sidebar {
  transition: transform .25s ease, width .25s ease;
  will-change: transform;
}
.shell.collapsed .sidebar {
  transform: translateX(-100%);
  width: 0 !important; padding: 0; overflow: hidden;
}
.shell.collapsed .main {
  margin-left: 0 !important;
}
.menu-toggle {
  position: fixed; top: 10px; left: 10px; z-index: 80;
  background: var(--navy-800); color: #fff; border: none; border-radius: 8px;
  width: 36px; height: 36px; font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: left .25s ease;
}
.shell.collapsed .menu-toggle { left: 10px; }
.shell:not(.collapsed) .menu-toggle { left: calc(250px - 46px); }

@media (max-width: 960px) {
  .menu-toggle { display: none; }
}

/* ===== Arborescence référentiel ===== */
.tree { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tree-node { border-bottom: 1px solid var(--line); }
.tree-node:last-child { border-bottom: none; }
.tree-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer;
  transition: background .15s;
}
.tree-row:hover { background: #f8fafc; }
.tree-row .arrow { width: 16px; text-align: center; font-size: 11px; color: var(--muted); transition: transform .2s; }
.tree-row.open .arrow { transform: rotate(90deg); }
.tree-row .code { font-family: Consolas, monospace; font-size: 12px; color: var(--navy-600); font-weight: 600; background: #f1f5f9; padding: 2px 7px; border-radius: 6px; }
.tree-row .name { flex: 1; font-size: 13px; }
.tree-row .meta { font-size: 11px; color: var(--muted); }
.tree-children { display: none; padding-left: 28px; border-left: 1px dashed var(--line); margin-left: 20px; }
.tree-node.open > .tree-children { display: block; }
.tree-leaf { padding: 8px 14px 8px 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.tree-leaf:last-child { border-bottom: none; }
.tree-leaf .code { font-size: 11.5px; }
.tree-leaf .name { font-size: 12.5px; }
.tree-level-1 > .tree-row { background: #f8fafc; }
.tree-level-0 > .tree-row { background: #fff; padding: 12px 16px; }

/* ===== Tuiles de choix mission ===== */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin: 18px 0; }
.choice-card {
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px;
  cursor: pointer; transition: all .15s; text-align: center;
}
.choice-card:hover { border-color: var(--teal); box-shadow: var(--shadow); transform: translateY(-2px); }
.choice-card .icon { font-size: 28px; margin-bottom: 10px; }
.choice-card h3 { font-size: 14px; color: var(--navy-800); margin-bottom: 6px; }
.choice-card p { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ===== Formulaires ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 11.5px; font-weight: 600; color: var(--navy-800); text-transform: uppercase; letter-spacing: .3px; }
.form-group input, .form-group select, .form-group textarea {
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; font-size: 13px; color: var(--txt); background: #fff;
}
.form-group textarea { resize: vertical; min-height: 60px; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: flex-end; }

/* ===== Assistant IA (fenêtre flottante à droite) ===== */
.ai-toggle {
  position: fixed; right: 18px; bottom: 18px; z-index: 90; width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-700), var(--teal-dark)); color: #fff; border: none; font-size: 19px;
  cursor: pointer; box-shadow: 0 8px 24px rgba(11,31,51,.35); transition: transform .15s;
}
.ai-toggle:hover { transform: scale(1.08); }
.ai-panel {
  position: fixed; right: 18px; bottom: 74px; z-index: 89; width: 350px; max-width: calc(100vw - 36px);
  height: min(560px, calc(100vh - 110px)); background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(11,31,51,.3); display: none; flex-direction: column; overflow: hidden;
}
.ai-panel.open { display: flex; }
.ai-panel.wide { width: 560px; }
.ai-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; background: var(--navy-800); color: #fff; }
.ai-head b { font-size: 13px; flex: 1; }
.ai-head button { background: none; border: none; color: #cbd5e1; cursor: pointer; font-size: 14px; padding: 2px 7px; border-radius: 6px; }
.ai-head button:hover { background: rgba(255,255,255,.12); color: #fff; }
.ai-warn { background: var(--amber-bg); color: var(--amber); font-size: 10.5px; padding: 5px 12px; border-bottom: 1px solid var(--line); font-weight: 600; }
.ai-search { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.ai-search input { flex: 1; min-width: 0; border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; font-family: inherit; }
.ai-search input:focus { outline: 2px solid rgba(37, 99, 235, .25); border-color: var(--navy-700); }
.ai-list { flex: 1; overflow-y: auto; padding: 8px 10px; background: #fbfcfe; }
.hp-cat { margin-bottom: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.hp-cat summary { cursor: pointer; font-weight: 700; font-size: 12.5px; color: var(--navy-800); padding: 8px 12px; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hp-cat summary::before { content: '▸'; color: var(--muted); font-size: 11px; }
.hp-cat[open] summary::before { content: '▾'; }
.hp-cat summary:hover { background: #f1f5f9; }
.hp-n { color: var(--muted); font-weight: 600; font-size: 10.5px; white-space: nowrap; }
.hp-qs { padding: 2px 8px 8px; }
.hp-q { display: block; width: 100%; text-align: left; background: #f6f8fb; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; margin: 4px 0; font-size: 12px; cursor: pointer; color: var(--txt); font-family: inherit; }
.hp-q:hover { border-color: var(--navy-700); background: #eef2f7; }
.hp-back { display: inline-block; background: none; border: none; color: var(--navy-700); font-weight: 700; font-size: 12px; cursor: pointer; padding: 2px 4px; margin-bottom: 8px; font-family: inherit; }
.hp-back:hover { text-decoration: underline; }
.hp-q-title { font-weight: 700; font-size: 13px; color: var(--navy-800); margin-bottom: 8px; }
.hp-a { font-size: 12.5px; line-height: 1.55; }
.ai-msg { border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; background: #fff; color: var(--txt); border: 1px solid var(--line); box-shadow: var(--shadow); }
.ai-msg .hp-copy { display: block; margin-top: 8px; }
.ai-foot { font-size: 10px; color: var(--faint); padding: 4px 12px 8px; text-align: center; border-top: 1px solid var(--line); }
@media (max-width: 640px) {
  .ai-panel { right: 8px; left: 8px; width: auto; bottom: 70px; }
  .ai-panel.wide { width: auto; }
}

/* Responsive */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-block; }
  .view { padding: 14px; }
  .search-pill { flex: 1 1 auto; }
}
