:root {
  --navy-950: #06111e;
  --navy-900: #071522;
  --navy-850: #0a1c2b;
  --navy-800: #0d2435;
  --navy-700: #12344a;
  --ink: #102433;
  --muted: #6d7d8a;
  --line: #dce5ea;
  --paper: #f4f7f8;
  --card: #ffffff;
  --blue: #3d81a4;
  --blue-soft: #d9eaf2;
  --teal: #3da89d;
  --amber: #c8933e;
  --rose: #c56f71;
  --shadow: 0 18px 50px rgba(8, 27, 42, .08);
  font-family: "DM Sans", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }

.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 32px; background: var(--navy-900); color: white; position: sticky; top: 0; z-index: 30; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 245px; }
.brand strong { display: block; font-size: 16px; letter-spacing: .18em; line-height: 1; }
.brand em { display: block; margin-top: 5px; color: #90a7b8; font-size: 9px; font-style: normal; font-weight: 600; letter-spacing: .17em; white-space: nowrap; }
.brand-mark { width: 25px; height: 25px; display: flex; align-items: flex-end; gap: 3px; transform: skewY(-18deg); }
.brand-mark span { display: block; width: 6px; background: #6ca6bf; border-radius: 2px 2px 0 0; }
.brand-mark span:nth-child(1) { height: 13px; opacity: .7; }
.brand-mark span:nth-child(2) { height: 21px; background: #9ed1d2; }
.brand-mark span:nth-child(3) { height: 17px; opacity: .82; }
.topnav { display: flex; align-self: stretch; align-items: center; gap: 24px; }
.topnav a { color: #9dafbb; font-size: 13px; font-weight: 600; position: relative; white-space: nowrap; }
.topnav a:hover, .topnav a.active { color: white; }
.topnav a.active::after { content: ""; height: 2px; background: #9ed1d2; left: 0; right: 0; bottom: -29px; position: absolute; }
.nav-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; padding: 0 5px; margin-left: 3px; border-radius: 10px; background: rgba(158,209,210,.14); color: #b3dcde; font-size: 10px; }
.topbar-actions { display: flex; gap: 9px; align-items: center; min-width: 75px; justify-content: flex-end; }
.icon-button, .avatar-button { border: 1px solid rgba(255,255,255,.13); background: transparent; color: #c8d5dc; border-radius: 9px; width: 34px; height: 34px; }
.icon-button:hover, .avatar-button:hover { background: rgba(255,255,255,.08); }
.avatar-button { background: #b6d5d6; color: var(--navy-900); border: 0; font-size: 13px; font-weight: 700; }

.page { padding: 30px 34px 54px; max-width: 1500px; margin: 0 auto; }
.eyebrow { color: var(--blue); text-transform: uppercase; letter-spacing: .16em; font-size: 11px; font-weight: 700; }
.page-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 20px; }
.page-heading h1 { margin: 6px 0 0; font-size: clamp(26px, 3.2vw, 42px); letter-spacing: -.045em; line-height: 1.1; }
.page-heading p { color: var(--muted); margin: 8px 0 0; max-width: 660px; font-size: 15px; line-height: 1.65; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 39px; padding: 0 15px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); font-size: 13px; font-weight: 700; }
.button:hover { border-color: #a8c4d2; background: #f7fbfc; }
.button.primary { background: var(--navy-850); color: white; border-color: var(--navy-850); }
.button.primary:hover { background: #153b52; }
.button.subtle { background: #eef4f6; color: #335368; border-color: #dce9ee; }
.button.danger { color: #9a4b4d; }
.button.full { width: 100%; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 20px; padding: 6px 10px; font-size: 11px; font-weight: 700; line-height: 1; background: #edf3f5; color: #426276; white-space: nowrap; }
.pill.public { background: #e5f2f0; color: #26736c; }
.pill.synthetic { background: #f6eee1; color: #9a6d2d; }
.pill.review { background: #e8eef6; color: #486687; }
.pill.open { background: #edf2f6; color: #526b7b; }
.pill.saved { background: #e1f1ef; color: #287b75; }

.map-shell { background: var(--navy-900); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); min-height: 660px; position: relative; }
.map-toolbar { height: 60px; padding: 0 18px 0 24px; display: flex; align-items: center; justify-content: space-between; color: #b6c8d2; border-bottom: 1px solid rgba(255,255,255,.08); position: relative; z-index: 4; }
.map-toolbar-left, .map-toolbar-right { display: flex; gap: 10px; align-items: center; }
.map-toolbar strong { color: white; font-size: 14px; }
.map-toolbar .map-status { font-size: 11px; color: #85a2b0; padding-left: 8px; }
.map-button { background: rgba(255,255,255,.06); color: #d1dee5; border: 1px solid rgba(255,255,255,.1); border-radius: 8px; height: 32px; padding: 0 11px; font-size: 12px; }
.map-button:hover, .map-button.active { background: rgba(158,209,210,.18); border-color: rgba(158,209,210,.38); color: #e2ffff; }
.map-area { height: 600px; position: relative; overflow: hidden; background: radial-gradient(circle at 46% 48%, rgba(50,111,142,.24), transparent 33%), radial-gradient(circle at 70% 20%, rgba(56,102,126,.12), transparent 28%), #081725; }
.map-area::before { content: ""; position: absolute; inset: 0; opacity: .28; background-image: linear-gradient(rgba(127,178,192,.13) 1px, transparent 1px), linear-gradient(90deg, rgba(127,178,192,.13) 1px, transparent 1px); background-size: 56px 56px; mask-image: radial-gradient(ellipse at 52% 50%, black, transparent 80%); }
.map-canvas { position: absolute; inset: -8%; width: 116%; height: 116%; transform-origin: 50% 50%; transition: transform .16s ease; }
.map-grid-line { stroke: rgba(127,178,192,.18); stroke-width: .6; fill: none; }
.map-connection { stroke: #5d98ad; stroke-opacity: .34; stroke-width: 1.1; fill: none; }
.map-connection.policy { stroke: #b1c8d1; stroke-opacity: .26; stroke-dasharray: 4 4; }
.map-connection.constraint { stroke: #d2a262; stroke-opacity: .34; }
.map-node { cursor: pointer; }
.map-node circle.halo { fill: #9ed1d2; opacity: .12; }
.map-node circle.core { fill: #9ed1d2; stroke: #d9ffff; stroke-width: .8; opacity: .88; }
.map-node.synthetic circle.core { fill: #cf9c59; stroke: #ffe0ad; }
.map-node.selected circle.halo { opacity: .34; }
.map-node.selected circle.core { fill: white; stroke: #9ed1d2; stroke-width: 2; }
.map-legend { position: absolute; left: 24px; bottom: 23px; display: flex; gap: 15px; font-size: 11px; color: #93abb7; z-index: 2; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: #9ed1d2; }
.legend-dot.synthetic { background: #cf9c59; }
.legend-line { width: 16px; height: 1px; background: #5d98ad; }
.scale-loading { padding: 48px 32px; color: var(--muted, #7f95a3); }
.map-labels { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.map-label { position: absolute; top: 0; left: 0; margin-top: -26px; translate: -50% 0; pointer-events: auto; cursor: pointer; padding: 3px 6px; white-space: nowrap; font-size: 11px; letter-spacing: .02em; color: rgba(226,242,245,.88); text-shadow: 0 1px 7px rgba(0,0,0,.9), 0 0 2px rgba(0,0,0,.8); transition: opacity .18s ease, color .18s ease; }
.map-label.far { opacity: .3; }
.map-label.near { color: #fff; font-weight: 600; opacity: 1; }
.map-label:hover { color: #fff; opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 720px) { .map-label { font-size: 10px; margin-top: -22px; } }
.map-preview { position: absolute; z-index: 5; right: 23px; top: 22px; width: min(355px, calc(100% - 46px)); padding: 18px; background: rgba(10, 28, 43, .94); border: 1px solid rgba(155,204,211,.28); border-radius: 12px; color: white; backdrop-filter: blur(8px); box-shadow: 0 14px 36px rgba(0,0,0,.22); }
.map-preview h3 { font-size: 16px; margin: 9px 0 6px; line-height: 1.35; letter-spacing: -.02em; }
.map-preview p { color: #acc0ca; font-size: 12px; line-height: 1.62; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.map-preview .preview-footer { display: flex; justify-content: space-between; margin-top: 15px; color: #88a4b2; font-size: 11px; }
.map-preview .preview-footer strong { color: #d2ebed; font-weight: 600; }
.map-side-action { position: absolute; right: 23px; bottom: 21px; z-index: 5; }
.map-side-action .button { background: #e2f2f1; color: var(--navy-900); border: 0; }
.map-side-action .button:hover { background: white; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0 26px; }
.stat-card { padding: 16px 18px; background: white; border: 1px solid var(--line); border-radius: 12px; }
button.stat-card { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
button.stat-card[aria-pressed="true"] { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
button.stat-card:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.stat-card .stat-label { font-size: 12px; color: var(--muted); }
.stat-card strong { display: block; margin-top: 7px; font-size: 27px; letter-spacing: -.05em; }
.stat-card small { color: #76919f; font-size: 11px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(330px, .8fr); gap: 18px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.panel-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.03em; }
.panel-heading a { color: var(--blue); font-size: 12px; font-weight: 700; }
.activity-list { display: grid; gap: 11px; }
.activity { display: grid; grid-template-columns: 8px 1fr auto; gap: 11px; align-items: start; padding: 11px 0; border-bottom: 1px solid #edf1f2; }
.activity:last-child { border-bottom: 0; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); margin-top: 6px; }
.activity h3 { font-size: 13px; margin: 0 0 4px; }
.activity p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.activity time { color: #92a0a7; font-size: 10px; white-space: nowrap; }
.domain-bars { display: grid; gap: 13px; }
.domain-bar { display: grid; gap: 6px; }
.domain-bar-head { display: flex; justify-content: space-between; color: #567080; font-size: 12px; }
.bar-track { height: 7px; background: #edf3f4; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6ba5ba, #9ed1d2); }

.library-toolbar { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 13px; display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.search-input, .select-input { height: 39px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfc; color: var(--ink); padding: 0 11px; font-size: 13px; outline: none; }
.search-input { min-width: min(360px, 100%); flex: 1; }
.search-input:focus, .select-input:focus, textarea:focus { border-color: #7aadb9; box-shadow: 0 0 0 3px rgba(104,168,180,.12); }
.select-input { min-width: 150px; }
.result-count { color: var(--muted); font-size: 12px; margin-left: auto; }
.issue-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.issue-card { position: relative; display: flex; flex-direction: column; min-height: 245px; padding: 18px; background: white; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .16s, box-shadow .16s, transform .16s; }
.issue-card:hover { border-color: #a9c9d4; box-shadow: 0 10px 28px rgba(12, 46, 64, .08); transform: translateY(-2px); }
.issue-card .card-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.issue-card .card-id { color: #9aa9b1; font-family: "DM Sans", sans-serif; font-size: 10px; letter-spacing: .14em; }
.issue-card h3 { font-size: 16px; line-height: 1.4; margin: 14px 0 9px; letter-spacing: -.03em; }
.issue-card p { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.issue-card .card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 17px; }
.issue-card .card-date { color: #83959f; font-size: 11px; }
/* 묶음 표시: 분야 앞에 어느 저작 묶음에서 온 사안인지 작게 둔다. */
.issue-card .card-cohort { display: inline-block; margin-right: 6px; padding: 1px 6px; border: 1px solid #d7e0e5; border-radius: 999px; color: #5e727d; font-style: normal; font-size: 10px; letter-spacing: .02em; }
.cohort-note { margin: -4px 0 10px; color: #5e727d; font-size: 12.5px; line-height: 1.55; }
.save-toggle { border: 0; background: transparent; color: #9eafb7; font-size: 18px; line-height: 1; padding: 4px; }
.save-toggle.saved { color: #3da89d; }

.ledger-layout, .connector-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(290px, .7fr); gap: 18px; }
.ledger-row { display: grid; grid-template-columns: 90px 1fr auto; align-items: start; gap: 14px; padding: 17px 0; border-bottom: 1px solid #edf1f2; }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row .ledger-id { color: #7e96a3; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.ledger-row h3 { font-size: 14px; margin: 0 0 5px; }
.ledger-row p { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 0; }
.review-mark { color: #277b73; font-size: 11px; font-weight: 700; white-space: nowrap; }
.connector-list { display: grid; gap: 11px; }
.connector-card { border: 1px solid var(--line); border-radius: 11px; padding: 15px; background: #fff; }
.connector-card.active { border-color: #8ebac2; box-shadow: 0 7px 20px rgba(53,111,124,.08); }
.connector-card h3 { font-size: 14px; margin: 0; }
.connector-card p { color: var(--muted); font-size: 11px; line-height: 1.55; margin: 7px 0 0; }
.connector-card .connector-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 13px; color: #78919e; font-size: 10px; }
.connector-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: #45a89d; margin-right: 5px; }
.connector-dot.neutral { background: #c8933e; }
.connector-record { margin-top: 18px; display: grid; gap: 12px; }
.connector-record div { padding: 11px 12px; border-radius: 9px; background: #f5f8f8; }
.connector-record dt { color: #758c98; font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
.connector-record dd { margin: 4px 0 0; font-size: 12px; line-height: 1.52; }

.ask-layout { max-width: 900px; margin: 0 auto; }
.ask-card { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.ask-card textarea { width: 100%; min-height: 180px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 15px; line-height: 1.7; outline: none; }
.ask-footer { margin-top: 14px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.ask-result { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 18px; }
.ask-result h3 { margin: 0 0 8px; font-size: 15px; }
.ask-result p { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.suggestion { background: #f3f7f8; border: 1px solid #e1ebee; border-radius: 30px; padding: 8px 11px; color: #4f6e7d; font-size: 11px; }

.world-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 18px; }
.world-map-panel { min-height: 440px; }
.world-map-wrap { position: relative; min-height: 330px; border-radius: 12px; overflow: hidden; background: radial-gradient(circle at 52% 45%, #e9f3f4 0, #f7fafb 58%, #fff 100%); border: 1px solid #e5edef; }
.world-map { position: absolute; inset: 14px; width: calc(100% - 28px); height: calc(100% - 28px); }
.google-world-map { position: absolute; inset: 0; min-height: 330px; background: #dcebed; }
.google-world-map > div:first-child { height: 100%; }
.map-loading, .map-error { height: 100%; min-height: 330px; display: grid; place-content: center; justify-items: center; gap: 8px; color: #577482; text-align: center; font-size: 12px; padding: 20px; }
.map-loading::before { content: ""; width: 22px; height: 22px; border: 2px solid #9fc6cc; border-top-color: #3d81a4; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.map-error strong { color: #9b5b5d; font-size: 13px; }
.map-error span { color: #6c8089; }
.world-focus-card { position: absolute; z-index: 2; left: 15px; bottom: 15px; display: grid; gap: 3px; width: 205px; padding: 11px 12px; border: 1px solid rgba(255,255,255,.85); border-radius: 9px; background: rgba(255,255,255,.92); box-shadow: 0 8px 20px rgba(24,69,81,.12); pointer-events: none; }
.world-focus-card strong { color: #264d60; font-size: 13px; }
.world-focus-card > span:not(.eyebrow) { color: #9a6d2d; font-size: 11px; font-weight: 700; }
.world-focus-card p { margin: 2px 0 0; color: #6d838e; font-size: 10px; line-height: 1.4; }
.continent { fill: #d4e4e7; stroke: #abc7ce; stroke-width: .35; }
.equator { stroke: #a9c8ce; stroke-width: .25; stroke-dasharray: 1 1; }
.world-marker { cursor: default; }
.world-marker circle:first-child { fill: #c8933e; stroke: white; stroke-width: .45; }
.world-marker.teal circle:first-child { fill: #3da89d; }
.world-marker.rose circle:first-child { fill: #c56f71; }
.world-marker .ring { fill: none; stroke: currentColor; stroke-width: .45; opacity: .48; }
.world-label { position: absolute; transform: translate(-6px, 8px); display: grid; gap: 2px; pointer-events: none; white-space: nowrap; }
.world-label strong { color: #294d60; font-size: 11px; }
.world-label span { color: #76919d; font-size: 10px; }
.region-list { display: grid; gap: 12px; }
.region-row { display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid #edf1f2; }
.region-row:last-child { border-bottom: 0; }
.region-row strong { font-size: 13px; }
.region-row p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.posture-panel { margin-top: 18px; }
.posture-table { display: grid; gap: 8px; overflow-x: auto; }
.posture-head, .posture-row { min-width: 680px; display: grid; grid-template-columns: 1.1fr repeat(4, 1fr); gap: 12px; align-items: center; }
.posture-head { color: #8798a0; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; padding-bottom: 5px; }
.posture-row { border-top: 1px solid #edf1f2; padding: 11px 0; font-size: 12px; }
.posture-row > span { display: grid; grid-template-columns: minmax(20px, 1fr) auto; gap: 7px; align-items: center; color: #547181; }
.posture-row i { height: 6px; border-radius: 5px; background: #9fcfd1; display: block; min-width: 10px; }
.posture-row:nth-child(3) i { background: #78a8bf; }
.posture-row:nth-child(4) i { background: #c5a26c; }
.posture-row:nth-child(5) i { background: #9daeb7; }
.world-footnote { margin: 16px 0 0; line-height: 1.6; }

.overlay { position: fixed; inset: 0; z-index: 70; display: flex; justify-content: flex-end; background: rgba(6,17,30,.54); }
.overlay.hidden { display: none; }
.detail-drawer { width: min(670px, 100%); height: 100%; overflow-y: auto; background: #fbfcfc; padding: 28px 30px 40px; box-shadow: -15px 0 40px rgba(0,0,0,.15); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 18px; }
.close-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--muted); font-size: 18px; }
.detail-drawer h2 { font-size: 25px; line-height: 1.25; letter-spacing: -.04em; margin: 12px 0 14px; }
.detail-lede { font-size: 14px; line-height: 1.75; color: #415d6d; margin: 0 0 22px; }
/* 부연 and 건드리는 사안 follow the summary; a rule and a label keep them apart from it. */
.detail-lede.lede-aside { margin-bottom: 16px; padding-left: 13px; border-left: 2px solid var(--line); font-size: 13px; line-height: 1.7; color: #5b7382; }
.detail-lede .lede-label { display: block; margin-bottom: 4px; font-size: 11px; font-style: normal; letter-spacing: .06em; color: #83959f; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 19px; }
.detail-field { padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.detail-field dt { color: #80949e; font-size: 10px; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 6px; }
.detail-field dd { margin: 0; font-size: 12px; line-height: 1.58; }
.detail-section { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 20px; }
.detail-section h3 { margin: 0 0 11px; font-size: 14px; }
.detail-section p, .detail-section li { color: #4e6977; font-size: 12px; line-height: 1.7; }
.detail-section ul { margin: 0; padding-left: 18px; }
.option-list { display: grid; gap: 8px; }
.option-list div { padding: 10px 11px; border: 1px solid #e2ebed; border-radius: 8px; background: #f8fbfb; color: #4d6876; font-size: 12px; }
.source-link { color: var(--blue); font-size: 12px; font-weight: 700; }
.relation-list { display: grid; gap: 7px; }
.relation-link { display: flex; justify-content: space-between; gap: 10px; border: 1px solid #e0e9ec; border-radius: 8px; padding: 10px 11px; background: white; color: #466879; font-size: 11px; }
.relation-link span:last-child { color: #879ba5; text-align: right; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 0; }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: grid; gap: 8px; }
.toast { background: var(--navy-850); color: white; border: 1px solid rgba(158,209,210,.3); border-radius: 9px; padding: 12px 14px; font-size: 12px; box-shadow: 0 10px 25px rgba(0,0,0,.18); animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

body.dark { --paper: #0a1723; --card: #102535; --ink: #eef6f8; --muted: #a7b8c1; --line: #234052; --blue: #94ced3; }
body.dark .panel, body.dark .issue-card, body.dark .library-toolbar, body.dark .stat-card, body.dark .connector-card, body.dark .ask-card, body.dark .detail-field, body.dark .relation-link, body.dark .close-button { background: #102535; }
body.dark .search-input, body.dark .select-input, body.dark .button, body.dark .button.subtle { background: #122c3d; color: var(--ink); border-color: #2b4c5c; }
body.dark .detail-drawer { background: #0b1b29; }
body.dark .detail-lede, body.dark .detail-section p, body.dark .detail-section li { color: #b7c7cf; }
body.dark .detail-lede.lede-aside { border-left-color: #2a4756; color: #9db0ba; }
body.dark .detail-lede .lede-label { color: #7f97a3; }
body.dark .option-list div { background: #0d2332; border-color: #284655; }

@media (max-width: 1050px) {
  .topbar { padding: 0 20px; gap: 10px; }
  .brand { min-width: auto; }
  .brand em { display: none; }
  .topnav { gap: 14px; }
  .topnav a { font-size: 12px; }
  .home-grid, .ledger-layout, .connector-layout, .world-layout { grid-template-columns: 1fr; }
  .issue-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .topbar { height: auto; min-height: 68px; flex-wrap: wrap; padding: 15px 17px 0; }
  .topnav { order: 3; width: 100%; overflow-x: auto; height: 44px; gap: 19px; }
  .topnav a.active::after { bottom: -14px; }
  .topbar-actions { margin-left: auto; }
  .page { padding: 24px 15px 40px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .map-shell { min-height: 600px; border-radius: 13px; }
  .map-area { height: 540px; }
  .map-preview { right: 13px; top: 13px; width: calc(100% - 26px); }
  .map-side-action { right: 13px; bottom: 15px; }
  .map-legend { left: 14px; bottom: 18px; gap: 8px; flex-wrap: wrap; max-width: 48%; }
  .map-toolbar { padding: 0 13px; }
  .map-toolbar .map-status { display: none; }
  .issue-grid { grid-template-columns: 1fr; }
  .library-toolbar { align-items: stretch; }
  .search-input, .select-input { min-width: 100%; }
  .result-count { margin-left: 0; }
  .ledger-row { grid-template-columns: 1fr auto; }
  .ledger-row > div:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .detail-drawer { padding: 22px 18px 34px; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* The case library grows as the reader reaches its end; the button is there for keyboards and browsers with no observer. */
.issue-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; padding: 26px 0 8px; }
.issue-more span { color: var(--muted, #5d6b72); font-size: 13px; }
