/* NOCTURNE console, list + detail pages and the palette (M21 A3; mockups Inbox, Triage, Decisions,
   Palette, Mobile*). Loaded after nocturne.css: it only adds classes and, in the last block,
   restyles the 대화 · 조직 · 시스템 · 지식 pages and the phone pages toward the v4 mockups. Tokens
   only (no raw colours), no inline style, no effects (no shadow, gradient, blur). */

/* ---- split: a list on the left, the selected item on the right ------------------------- */

/* NOC-U9 보완 (2026-11-07): a notice above the split (승인함의 실거래 띠 · 요청서) used to take the
   only grid row and push the list and the detail to the bottom. A column instead: each notice
   takes its own height and the split the rest; with notices the page scrolls and the split keeps
   60% of the screen (desktop only: the stacked layouts below are unchanged). */
.content:has(> .split) { overflow: hidden; display: flex; flex-direction: column; }
.content:has(> .split) > * { flex: none; }
.content:has(> .split) > .split { flex: 1 1 0; }
@media (min-width: 1024px) {
  .content:has(> :not(.split) ~ .split) { overflow-y: auto; }
  .content:has(> :not(.split) ~ .split) > .split { min-height: 60vh; }
}
.split {
  display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); min-height: 0; height: 100%;
  width: 100%; margin: 0;
}
.split-list {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto;
  background: var(--surface);
}
.split-detail {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto;
  border-left: 1px solid var(--line2); background: var(--surface);
}
.split-empty { padding: var(--s5) var(--s4); text-align: center; margin: 0; }
.split-sort, .split-note { margin: 0; padding: 8px 14px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line2); }
.split-foot {
  margin-top: auto; position: sticky; bottom: 0; padding: 8px 14px; background: var(--surface);
  border-top: 1px solid var(--line2);
}
.keyhints { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.keyhints .k { margin-left: 2px; }

/* rows (the list items: 받은 알림, 분류함, 결재함) */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex; align-items: flex-start; gap: 10px; min-height: 56px; padding: 10px 14px;
  border-bottom: 1px solid var(--line2); color: var(--text); text-decoration: none;
}
.row:hover { background: var(--hover); text-decoration: none; }
.row.is-sel { background: var(--sel); }
.row-av {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 24px; height: 24px;
  margin-top: 1px; border-radius: 50%; background: var(--tone-bg, var(--hover)); color: var(--tone, var(--muted));
}
.row-main { display: grid; flex: 1; min-width: 0; gap: 2px; }
.row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.row-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.row.is-unread .row-title { font-weight: 700; }
.row-sub {
  display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--muted); font-size: 13px;
}
.row-time { flex: none; color: var(--muted); font-size: 13px; }
.row-time.is-urgent { color: var(--warn); font-weight: 600; }
.row-kind { color: var(--muted); font-size: 13px; }
.row-dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--accent); }
/* M21a polish: a request already decided or expired - muted, with its state word */
.row.is-settled .row-title { color: var(--muted); font-weight: 500; }
.row-state {
  flex: none; margin-right: auto; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px;
  color: var(--muted); font-size: 13px; line-height: 16px;
}
.detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: var(--s4); }

/* the detail pane: a sticky bar + the content */
.detail-bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line2);
}
.actions-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.actions-bar .btn .k { margin-left: 2px; }
/* NOC-U26: wrap - three labelled fields (자리 조절) or a sentence and a field (청산하기) no longer squeeze
   into one line; a form that fits stays one line */
.actions-bar .inline-form, .inline-form { display: inline-flex; flex-wrap: wrap; margin: 0; }
.bar-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--line); }
.split-btn { display: inline-flex; align-items: center; }
.pager { display: none; align-items: center; gap: 2px; }
.pager-n { color: var(--muted); font-size: 13px; padding: 0 4px; }
.mobile-back { display: none; }
.detail-body { padding: 20px 28px 48px; max-width: 840px; }
.detail-body h1 { font-size: 22px; line-height: 1.35; margin: 8px 0 10px; }
.detail-body h2 { font-size: 13px; margin: 18px 0 6px; color: var(--text-2); }
.detail-body .meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; color: var(--muted); font-size: 13px; }
.detail-text { white-space: pre-line; overflow-wrap: anywhere; }
.detail-body .facts { margin-top: var(--s4); font-size: 13px; padding-top: var(--s3); border-top: 1px solid var(--line2); }
.evidence-links { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: var(--s4); }
.lock-note {
  display: flex; gap: 10px; align-items: flex-start; margin: var(--s5) 0 0; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--grp); color: var(--muted);
  font-size: 13px; line-height: 1.6;
}
.lock-note .ic { margin-top: 3px; }
.lock-note strong { color: var(--text); font-weight: 600; }
.prop-block { margin-top: var(--s4); }
.prop-tasks { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.prop-tasks li { display: grid; gap: 2px; }

/* a small dropdown menu (보류 기간, 항상 승인 범위) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-body {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; display: grid; gap: 2px; min-width: 200px;
  padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-card);
}
.menu-body .btn { justify-content: flex-start; }
.menu-body p { margin: 4px 6px 2px; }

/* 받은 알림 on a phone: the summary tiles and the two tabs sit above the list */
.m-summary, .m-tabs { display: none; }
.m-stat {
  display: grid; gap: 2px; padding: 10px 12px; color: var(--text); text-decoration: none;
  border-right: 1px solid var(--line); min-width: 0;
}
.m-stat:last-child { border-right: 0; }
.m-stat-k { color: var(--muted); font-size: 13px; }
.m-stat-v { font-size: 20px; font-weight: 700; line-height: 1.2; }
.m-stat-v.is-warn { color: var(--warn); }

/* ---- the Ctrl K palette and the shortcut help ------------------------------------------ */

.palette {
  width: min(640px, calc(100vw - 32px)); max-height: 72vh; margin: 12vh auto auto; padding: 0;
  display: flex; flex-direction: column; overflow: hidden; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px;
}
.palette:not([open]) { display: none; }
.palette:focus-visible { outline: none; }
.palette::backdrop { background: rgba(0, 0, 0, 0.35); }
.palette-form { margin: 0; flex: none; border-bottom: 1px solid var(--line); }
.palette-ctx {
  display: inline-flex; margin: 10px 14px 0; padding: 1px 8px; border-radius: 6px; background: var(--hover);
  color: var(--text-2); font-size: 13px;
}
.palette-input { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--muted); }
.palette .palette-input input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
  flex: 1; width: auto; min-height: 28px; padding: 0; border: 0; border-radius: 0; background: transparent;
  font-size: 15px; outline: none; appearance: none;
}
.palette-input input::-webkit-search-cancel-button { appearance: none; }
.palette-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 8px; }
.palette-gh { padding: 8px 8px 4px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.palette-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 10px;
  border-radius: 6px; color: var(--text); text-decoration: none;
}
.palette-item.is-active { background: var(--sel); }
.palette-hint { color: var(--muted); font-size: 13px; flex: none; }
.palette-empty { margin: 0; padding: var(--s4); text-align: center; }
.palette-foot {
  display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 8px 14px; flex: none;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.palette-foot .k { margin-right: 2px; }
.keys-help { padding-bottom: var(--s4); }
.keys-help .palette-gh { padding: 14px 18px 6px; font-size: 13px; color: var(--text); }
.keys-help .xs { margin: 0; padding: 0 18px; }
.keys-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; padding: 4px 18px 12px; overflow-y: auto; }
.keys-list dt { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.keys-list dd { margin: 0; color: var(--text-2); }
.sb-search { margin-left: auto; }
.search-group { margin-top: var(--s4); }
.search-list { margin: var(--s2) 0 0; padding-left: 18px; display: grid; gap: 4px; }

/* ---- stacked layouts: tablet and phone -------------------------------------------------- */

/* M21a polish 2: the J / K keyboard hints mean nothing on a touch screen or a stacked layout */
@media (max-width: 1023px), (pointer: coarse) {
  .kbd-hints, .split-foot:has(> .kbd-hints:only-child) { display: none; }
}

@media (max-width: 1023px) {
  .content:has(> .split) { overflow: visible; display: block; padding: 0; }
  .split { display: block; height: auto; }
  .split-list, .split-detail { overflow: visible; }
  .split-detail { border-left: 0; display: none; }
  .split.has-sel .split-detail { display: flex; }
  .split.has-sel .split-list { display: none; }
  .mobile-back { display: inline-flex; }
  .pager { display: inline-flex; }
  .detail-bar { top: var(--topbar-h); }  /* NOC-U26: under the sticky top bar, not behind it */
  .detail-body { padding: 16px; }
  .split-foot { position: static; }
}

@media (max-width: 599px) {
  .split-triage .split-list { display: none; }
  .split-triage .split-detail { display: flex; }
  .split-triage .mobile-back { display: none; }
  .m-summary {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 12px 16px 0;
    border: 1px solid var(--line); border-radius: var(--r-card);
  }
  .m-tabs { display: flex; gap: 8px; padding: 12px 16px; }
  .m-tabs .chip { display: inline-flex; gap: 6px; padding: 6px 14px; min-height: var(--touch-h); align-items: center; border: 1px solid var(--line); border-radius: var(--r-control); color: var(--text-2); }
  .m-tabs .chip.is-active { background: var(--hover); color: var(--text); font-weight: 600; }
  .topbar-tabs { display: none; }
  .row { min-height: 72px; padding: 12px 16px; }
  .row-av { width: 36px; height: 36px; }
  .row-title { white-space: normal; font-size: 15px; }
  .row-sub { white-space: normal; }
  .split-foot, .keyhints .k { display: none; }
  .detail-body h1 { font-size: 20px; }
  .actions-bar { gap: 8px; }
  .detail-bar .btn, .actions-bar .btn { min-height: var(--touch-h); }
  /* NOC-U26: the phone top bar is 56 px; the 보류 menu opens leftward from its button on the right */
  .detail-bar { top: 56px; }
  .detail-bar .menu-body { left: auto; right: 0; max-width: calc(100vw - 32px); }
  /* the decision buttons: a bar fixed above the tab bar, big targets, 이번만 on top */
  .decision-actions {
    position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 30;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 16px;
    background: var(--surface); border-top: 1px solid var(--line); border-bottom: 0;
  }
  .decision-actions .inline-form, .decision-actions .inline-form .btn, .decision-actions > .btn,
  .decision-actions .split-btn, .decision-actions .split-btn .btn { width: 100%; }
  .decision-actions .split-btn .menu, .decision-actions .bar-sep, .decision-actions kbd { display: none; }
  .decision-actions .btn-primary { min-height: 48px; }
  .content:has(.decision-actions) { padding-bottom: 180px; }
  .palette { margin-top: 8vh; }
}

/* ---- phone pages toward the mockups (Mobile, MobileApprove, MobileChat; 390 x 844) ---------- */

@media (max-width: 599px) {
  /* 승인 상세: the decision dock is a bar above the tab bar, 이번만 승인 on top (MobileApprove) */
  .decision-dock {
    position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 30;
    margin: 0; padding: 12px 16px 8px; border-width: 1px 0 0; border-radius: 0; background: var(--surface);
  }
  .decision-dock .btn-big { min-height: 48px; font-size: 15px; }
  .dock-note { margin: 6px 0 0; font-size: 13px; text-align: center; }
  .content:has(.decision-dock) { padding-bottom: 240px; }
  .breadcrumb { margin-bottom: var(--s2); }
}

/* ---- phone: the decision bars (결재함 / 분류함) ------------------------------------------- */

@media (max-width: 599px) {
  .decision-actions .once-form, .decision-actions .once-form .btn { width: 100%; }
  .decision-actions .btn-ghost { border: 1px solid var(--line-strong); }
  .decision-actions .btn { min-height: var(--touch-h); }
  .triage-actions {
    position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 30;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 12px 16px;
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .triage-actions .inline-form, .triage-actions .inline-form .btn, .triage-actions > .menu,
  .triage-actions > .menu > summary { width: 100%; }
  .triage-actions .btn { min-height: 48px; padding: 4px 6px; gap: 4px; }
  .triage-actions kbd { display: none; }
  .triage-actions .menu-body { top: auto; bottom: calc(100% + 6px); right: 0; left: auto; }
  .content:has(.triage-actions) { padding-bottom: 150px; }
}

/* ---- restyle toward the v4 mockups: 대화, 조직, 시스템, 지식 (CSS only; no markup or behaviour) -- */

/* density and quieter frames: the tone is a left rule, not a loud outline */
.facts, .agent-facts, .empty, .error-state, .lineage { font-size: 13px; }
.card, .agent-card, .proposal-card, .readiness-card, .probe-card, .kpi { padding: 14px 16px; }
.probe-card, .proposal-card, .readiness-card, .card.t-ok, .card.t-warn, .card.t-danger, .card.t-info {
  border-color: var(--line); border-left: 3px solid var(--tone, var(--neutral));
}
.agent-card.is-missing { border-color: var(--line); border-left: 3px solid var(--danger); }
.kpi-value { font-size: 20px; }
.page-header { margin-bottom: var(--s4); }
.page-header h1 { font-size: 18px; font-weight: 600; }
.sub-head, .section-head h2 { font-size: 13px; font-weight: 600; color: var(--text-2); }
.agent-group-head { text-transform: none; }
.tabs { gap: 4px; margin-bottom: var(--s4); border-bottom: 1px solid var(--line2); }
.tab { padding: 6px 12px; border-radius: var(--r-control) var(--r-control) 0 0; font-size: 13px; }
.tab[aria-current="page"], .tab.is-active { color: var(--text); font-weight: 600; background: var(--hover); }
.table-wrap { border-color: var(--line); }
.table th { text-transform: none; background: var(--grp); font-weight: 500; }
.table tbody tr:hover { background: var(--hover); }

/* 대화: a list column on the left, the conversation centred on the page card (mockup Chat) */
@media (min-width: 1024px) {
  .content:has(> .chat-page) { padding: 0; overflow: hidden; display: grid; grid-template-rows: minmax(0, 1fr); }
  .chat-page {
    grid-template-columns: 272px minmax(0, 1fr); gap: 0; align-items: stretch; width: 100%;
    max-width: none; margin: 0; height: 100%; min-height: 0;
  }
  .chat-rail { position: static; align-content: start; gap: 0; padding: 12px 0 0; overflow-y: auto; border-right: 1px solid var(--line2); }
  .chat-rail-head { padding: 0 16px 10px; }
  .chat-threads { gap: 0; }
  .chat-thread { border: 0; border-bottom: 1px solid var(--line2); border-radius: 0; padding: 10px 16px; }
  .chat-thread.is-current { background: var(--sel); }
  .chat-main { height: 100%; min-height: 0; gap: 0; }
  .chat-header { padding: 12px 24px; border-bottom: 1px solid var(--line2); }
  .chat-header h1 { font-size: 15px; font-weight: 600; margin: 0; }
  .chat-stream {
    border: 0; border-radius: 0; background: transparent; gap: 14px;
    padding: 20px max(24px, calc((100% - 820px) / 2));
  }
  .chat-edge { display: none; }
  .chat-main > .chat-composer { width: calc(100% - 48px); max-width: 820px; margin: 8px auto 16px; border-radius: 12px; }
  .chat-main > .card, .chat-main > .chat-card, .chat-main > .chat-turn, .chat-main > .chat-pinned { margin: 8px 24px 0; }
}
.chat-message { border-radius: 12px; background: var(--hover); }
.chat-message.is-owner { background: var(--hover); }
.chat-row.is-owner .chat-message { border-bottom-right-radius: 4px; }
.chat-card { border-color: var(--line); }
.chat-model { font-size: 13px; color: var(--muted); }
.chat-thread-title { font-weight: 500; }

/* 대화 on a phone (MobileChat): the stream is borderless, the composer rides above the tab bar */
@media (max-width: 599px) {
  .chat-stream { border: 0; background: transparent; padding: 0; gap: 12px; }
  .chat-edge { display: none; }
  .chat-message { max-width: 88%; }
  .chat-main > .chat-composer {
    position: sticky; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 5; margin: 0 -16px;
    border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 8px 12px;
  }
  .chat-composer textarea { min-height: 44px; border-radius: 22px; padding: 10px 14px; }
  .chat-hint { display: none; }
  .chat-header { padding: 0; }
  .chat-back { font-size: 14px; }
}

/* ---- M21a flow: one-click run sheet, inline approvals, chat sessions --------------------------- */
.flow-note {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  margin: 0; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--grp); color: var(--ink2); font-size: 13px; width: max-content;
  max-width: calc(100vw - 32px); border-color: var(--line-strong);
  animation: flow-note-out 0.4s ease 4s forwards;
}
@media (max-width: 599px) { .flow-note { bottom: 80px; } }
@keyframes flow-note-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .flow-note { animation-duration: 0.01s; } }

/* M21a polish: one centred 760 px column (header, callouts and sheet share the left edge), compact
   task rows and a footer bar that stays in view while the list scrolls. */
.content.content-narrow > * { max-width: 760px; }
.run-sheet { display: flex; flex-direction: column; gap: 10px; }
.run-sheet .section { margin: 0; }
.sheet-tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sheet-task { padding: 8px 12px; }
.sheet-task.is-blocked { border-style: dashed; }
.sheet-title { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sheet-summary { margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-meta { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.sheet-meta .muted { margin-right: 2px; }
.sheet-files { margin: 2px 0 0; overflow-wrap: anywhere; }
.sheet-total { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; }
.sheet-note { margin: 0; }
.sheet-form {
  position: sticky; bottom: 0; z-index: 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin: 0; padding: 10px 0; background: var(--surface); border-top: 1px solid var(--line2);
}
@media (max-width: 599px) {
  .sheet-form { bottom: calc(56px + env(safe-area-inset-bottom)); }  /* above the fixed tab bar */
}

.inline-approval {
  margin: 8px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); display: flex; flex-direction: column; gap: 8px;
}
.inline-summary { margin: 0; font-size: 13px; line-height: 1.5; }
.inline-decision { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-decision .once-form { margin: 0; }
.inline-always { position: relative; }
.inline-always .menu-body { position: absolute; z-index: 20; top: 100%; left: 0; min-width: 190px; padding: 6px; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.inline-more > summary { cursor: pointer; color: var(--ink2); }
.inline-more[open] > summary { margin-bottom: 6px; }

.thread-switcher { position: relative; }
.thread-switcher > summary { list-style: none; cursor: pointer; }
.thread-switcher-list {
  position: absolute; z-index: 30; right: 0; top: calc(100% + 4px); width: 280px; max-height: 340px; overflow: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
}
.thread-switcher-list ul { list-style: none; margin: 0 0 6px; padding: 0; }
.thread-switcher-list a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 13px; }
.thread-switcher-list a:hover, .thread-switcher-list a[aria-current="true"] { background: var(--hover); }
.thread-group { margin: 6px 4px 2px; }
.chat-stale { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--grp); font-size: 13px; }
.chat-stale > span { flex: 1 1 180px; }
.chat-manage { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; }
.chat-rename-form { display: flex; gap: 6px; margin-top: 6px; }
.chat-rename-form input { min-width: 220px; }
.chat-archive-link { margin: 10px 0 0; }

/* ---- M21a flow: the docked panel (Ctrl J) in the v4 mockup's Linear style ---------------------
   One column: a 44 px header (title, switcher, 새 대화, 전체 화면, close), a one-line model note,
   flat messages (NOCTURNE: avatar + name line; Owner: a soft bubble), compact system lines instead
   of cards, a thin scrollbar on the stream only, and a framed composer with the attach button. */
.chat-panel:not([hidden]) { overflow: hidden; background: var(--panel); }
.chat-panel-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.chat-panel .chat-panel-head {
  display: flex; align-items: center; gap: 2px; height: var(--topbar-h); flex: none;
  padding: 0 8px 0 14px; border-bottom: 1px solid var(--line2);
}
.chat-panel-title {
  flex: 1; min-width: 0; font-weight: 600; font-size: 13px; color: var(--ink); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-panel-title:hover { text-decoration: underline; }
.chat-panel .thread-switcher > summary { height: 26px; padding: 0 6px; font-size: 13px; color: var(--ink3); }
.chat-panel .chat-model {
  flex: none; flex-wrap: nowrap; margin: 0; padding: 6px 14px; border-bottom: 1px solid var(--line2);
  font-size: 13px; white-space: nowrap; overflow: hidden;
}
.chat-panel .chat-model > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chat-panel .chat-stale { margin: 8px 12px 0; }
.chat-panel .chat-stream {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 14px;
  padding: 14px 14px 8px; border: 0; border-radius: 0; background: transparent;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; scroll-snap-type: none;
}
.chat-panel .chat-stream::-webkit-scrollbar { width: 6px; }
.chat-panel .chat-stream::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.chat-panel .chat-stream:hover::-webkit-scrollbar-thumb { background: var(--line); }
.chat-panel .chat-row.is-owner .chat-message { max-width: 86%; padding: 8px 11px; border: 1px solid var(--line); background: var(--hover); }
.chat-panel .chat-row.is-owner .chat-time { display: none; }
.chat-agent { display: flex; gap: 9px; align-items: flex-start; }
.chat-avatar {
  flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ink3); color: var(--panel);
  display: inline-flex; align-items: center; justify-content: center; font: 600 13px/1 var(--font);
}
.chat-agent-body { flex: 1; min-width: 0; line-height: 1.55; }
.chat-who { margin: 0 0 2px; font-size: 13px; color: var(--ink3); display: flex; gap: 6px; align-items: baseline; }
.chat-sys { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 8px; align-items: start; font-size: 13px; color: var(--ink2); }
/* M22.3 U6b: the running chain step of this conversation (일하는 중 / 응답 없음) */
.chat-activity { margin: 6px 0 0; padding: 6px 10px; border-left: 3px solid var(--line-strong); font-size: 13px; line-height: 18px; color: var(--ink2); overflow-wrap: anywhere; }
.chat-activity.is-wait { border-left-color: var(--yel); color: var(--ink); }
.chat-sys-icon { display: inline-flex; padding-top: 1px; color: var(--ink3); }
.chat-sys-icon .icon { width: 14px; height: 14px; }
.chat-sys.t-warn .chat-sys-icon { color: var(--yel); }
.chat-sys.t-ok .chat-sys-icon { color: var(--grn); }
.chat-sys-text { margin: 0; line-height: 18px; overflow-wrap: anywhere; min-width: 0; }
.chat-sys-head, .chat-sys-body { margin: 0; }
.chat-sys-body { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.chat-sys-text strong { color: var(--ink); font-weight: 500; }
.chat-sys-time, .chat-who .chat-sys-time { color: var(--ink3); font-size: 13px; margin-left: auto; }
.chat-sys-text .chat-sys-time { margin-left: 4px; }
.chat-sys > .inline-approval { grid-column: 2; margin-top: 6px; }
.chat-panel .inline-approval { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.chat-panel .inline-summary { display: none; }
.chat-panel .chat-system { font-size: 13px; color: var(--ink3); }
.chat-panel .chat-row.wide > .chat-card { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.chat-panel .chat-turn { margin: 0 14px 6px; }
.chat-panel .chat-composer {
  flex: none; margin: 4px 12px 12px; padding: 8px 10px; gap: 6px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel);
}
.chat-panel .chat-composer:focus-within { border-color: var(--accent); }
.chat-panel .chat-composer textarea {
  min-height: 40px; max-height: 160px; padding: 2px 0; border: 0; background: transparent; resize: none;
}
.chat-panel .chat-composer textarea:focus { outline: none; }
.chat-panel .chat-attach-limits { display: none; }
/* M22.3.1 V6: the panel says how to send, like the full chat (desktop pointers only) */
.chat-panel .chat-hint { margin: 2px 0 0; font-size: 13px; }
.chat-panel .chat-attach-bar { display: inline-flex; }
.chat-panel .chat-attach-bar .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.chat-panel .chat-attach-bar .btn { border-color: transparent; background: transparent; padding: 0 6px; }
.chat-panel .chat-composer-row { font-size: 13px; }

/* 대화 page: the daily report is one collapsible line above the stream (no longer a full card) */
.chat-pinned { margin: 0 0 8px; padding: 0; border: 0; background: transparent; }
.chat-daily { border: 1px solid var(--line2); border-radius: 8px; background: var(--grp); font-size: 13px; }
.chat-daily > summary {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; cursor: pointer; list-style: none; min-width: 0;
}
.chat-daily > summary::-webkit-details-marker { display: none; }
.chat-daily > summary .icon { width: 14px; height: 14px; color: var(--ink3); }
.chat-daily-line { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
.chat-daily-body { padding: 4px 12px 10px; border-top: 1px solid var(--line2); }

/* M22.5 U2: 맡기기 한 장 (`_delegate_sheet.html`): label / value rows, the two limit numbers and
   one primary button. */
.delegate-sheet { display: flex; flex-direction: column; gap: 10px; }
.dg-fields { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.dg-field { display: grid; grid-template-columns: 96px 1fr; gap: 4px 12px; }
.dg-field dt { color: var(--muted, inherit); font-size: 13px; }
.dg-field dd { margin: 0; overflow-wrap: anywhere; }
.dg-line { margin: 0; }
.dg-steps { margin: 0; padding-left: 18px; }
.dg-quota { margin: 4px 0 0; }
.dg-form { display: flex; flex-direction: column; gap: 8px; margin: 0; padding-top: 10px; border-top: 1px solid var(--line2); }
.dg-limits { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.dg-limits p { flex-basis: 100%; margin: 0; }
.dg-limit input { width: 5em; margin: 0 4px; }
.dg-limit > span { font-weight: 600; margin-right: 4px; }
.dg-more textarea { width: 100%; margin-top: 4px; }
.dg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 599px) { .dg-field { grid-template-columns: 1fr; } }

/* 받은 알림: the preview as a card on the grouped background, like the 결과물 · 할 일 pages */
.split-detail[data-inbox-detail] { background: var(--grp); }
[data-inbox-detail] .detail-bar { background: var(--grp); border-bottom: 0; }
[data-inbox-detail] .detail-body {
  margin: 8px 24px 32px; padding: 22px 26px 26px; max-width: 760px;
  background: var(--surface); border: 1px solid var(--line2); border-radius: 12px;
}
[data-inbox-detail] .detail-text { font-size: 15px; line-height: 1.6; margin: 14px 0 0; }
@media (max-width: 720px) { [data-inbox-detail] .detail-body { margin: 8px 12px 24px; padding: 16px; } }

/* ---- assemble-2 NOC-U39: the 결재함's 「결재 문서 틀」 (`_ask_doc.html`): ① ~ ⑦ and one line per button -- */
.ask-doc[data-money="live"] { border-left: 3px solid var(--danger); }
.ask-frame dt { white-space: nowrap; }
.ask-lines, .ask-choices { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--s1); }
.ask-money.is-live { color: var(--danger); }
.ask-original { margin-top: var(--s2); }
.ask-form { display: flex; flex-direction: column; gap: var(--s2); }
.ask-choices li { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2); }
