:root {
  /* Claude 다크 팔레트(따뜻한 무채색) + 포인트 보라 */
  --bg: #262624;
  --surface: #1f1e1d;
  --surface-2: #30302e;
  --border: #3d3b37;
  --text: #eeece6;
  --muted: #a3a097;
  --accent: #b39ddb;
  --risk: #e07a72;
  --hold: #d4a24c;
  --ok: #8fbf74;
  --font: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; letter-spacing: -0.01em; word-break: keep-all; }
/* 스크롤바: 항상 숨김 (스크롤 동작은 유지) */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-sm { width: 15px; height: 15px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea { font: inherit; color: inherit; }
input, textarea { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 6px 10px; height: 32px; outline: none; width: 100%; }
textarea { height: auto; min-height: 72px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ===== Claude형 3열 레이아웃: 사이드바 / 채팅 / 우측 패널 ===== */
.app { display: grid; grid-template-columns: 260px 1fr; grid-template-rows: 100vh; grid-auto-rows: 0; height: 100vh; overflow: hidden; }
.app .panel { display: none; }
.app.split .panel { display: flex; }
.app.split { grid-template-columns: 260px minmax(420px, 1fr) minmax(480px, 46%); }
/* 접힌 사이드바는 display:none 이라 격자 셀을 차지하지 않는다. 0px 열을 남기면 채팅이 그 열로 들어가 화면이 깨진다 */
.app.sb-collapsed { grid-template-columns: 1fr; }
.app.sb-collapsed.split { grid-template-columns: minmax(420px, 1fr) minmax(480px, 46%); }
.app.sb-collapsed .sidebar { display: none; }
.app.sb-collapsed #drawerBtn { display: inline-flex !important; }
/* 모바일 전용 요소 */
.mobile-only { display: none !important; }
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; display: none; }
.app.drawer-open .backdrop { display: block; }
.panel-mobile-bar { display: none; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 2; }
.panel-mobile-bar .back { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: none; color: var(--accent); font-size: 15px; cursor: pointer; padding: 4px 6px; }

/* 태블릿: 패널은 우측 오버레이 */
@media (max-width: 1100px) {
  .app.split { grid-template-columns: 260px 1fr; }
  .app.sb-collapsed.split { grid-template-columns: 1fr; }
  .app.split .panel { position: fixed; right: 0; top: 0; bottom: 0; width: min(92vw, 560px); z-index: 40; border-left: 1px solid var(--border); }
  .panel-mobile-bar { display: flex; }
}
/* 모바일: 사이드바 서랍, 패널 전체 화면, 채팅 단일 열 */
@media (max-width: 760px) {
  .mobile-only { display: inline-flex !important; }
  .app, .app.split, .app.sb-collapsed, .app.sb-collapsed.split { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(84vw, 320px); z-index: 40; transform: translateX(-100%); transition: transform .18s ease; display: flex !important; }
  .app.drawer-open .sidebar { transform: translateX(0); }
  .app.split .panel { width: 100vw; border-left: none; }
  .chat-head { padding: 0 8px; gap: 6px; }
  .chat-head .chip { display: none; }
  .chat-head b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .thread-inner { padding: 0 14px; }
  .m-user .bubble { max-width: 88%; }
  .composer { padding: 6px 10px 8px; }
  .composer-inner { padding: 10px 12px 6px; }
  .composer-bar .mode { display: none; }
  .composer-note { font-size: 11px; }
  /* 모바일 키보드가 떠 있는 동안(입력란 포커스)에는 입력 박스만 남기고 면책 줄은 숨긴다 */
  body.kb-open .composer-note { display: none; }
  body.kb-open .composer { padding-bottom: 6px; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .result-foot .btns { margin-left: 0; width: 100%; }
  .panel-body { padding: 12px 12px 40px; }
  .panel-body .kv-3, .kv-3 { grid-template-columns: 100px 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .settings-modal { width: 100vw; height: 100vh; border-radius: 0; grid-template-columns: 1fr; }
  .sm-nav { display: none; }
  .sm-body { padding: 16px 14px 40px; }
  .sm-mobile-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
  .sm-mobile-tabs .btn { flex: none; }
  .modal { width: calc(100vw - 24px); }
  .table { font-size: 12px; }
  .table th, .table td { padding: 6px 8px; }
}
@media (min-width: 761px) { .sm-mobile-tabs { display: none; } }
/* 사이드바 (Claude 데스크톱 앱 구조) */
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.sb-iconbar { display: flex; align-items: center; gap: 4px; height: 46px; padding: 0 12px; color: var(--muted); } /* 채팅 제목줄(46px)과 같은 높이·중심선 */
.sb-iconbar .ib { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: transparent; border: none; color: var(--muted); cursor: pointer; }
.sb-iconbar .ib:hover { background: var(--surface-2); color: var(--text); }
.sb-iconbar .brand { margin-left: auto; font-weight: 800; font-size: 16px; letter-spacing: -0.01em; color: var(--accent); }
.sb-nav { padding: 4px 8px 4px; }
.sb-nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 14px; cursor: pointer; background: transparent; border: none; width: 100%; text-align: left; }
.sb-nav-item:hover { background: var(--surface-2); text-decoration: none; }
.sb-nav-item.active { background: var(--surface-2); font-weight: 600; }
.sb-nav-item .ic { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
.sb-nav-item.more { color: var(--muted); }
.sb-section { display: flex; align-items: center; padding: 14px 12px 4px 18px; font-size: 12px; color: var(--muted); }
.sb-section .ops { margin-left: auto; display: flex; gap: 2px; }
.sb-section .ib { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; background: transparent; border: none; color: var(--muted); cursor: pointer; }
.sb-section .ib:hover { color: var(--text); background: var(--surface-2); }
.sb-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.sb-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 14px; cursor: pointer; }
.sb-item .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item .dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; }
.sb-item .dot.on { background: var(--muted); border-color: var(--muted); }
.sb-item .dot.new { background: var(--accent); border-color: var(--accent); }
.sb-item:hover { background: var(--surface-2); text-decoration: none; }
.sb-item.active { background: var(--surface-2); }
.sb-item.active .title { font-weight: 600; }
.sb-user { border-top: 1px solid var(--border); padding: 8px; position: relative; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; background: transparent; border: none; width: 100%; color: var(--text); text-align: left; }
.user-row:hover { background: var(--surface-2); }
.user-row .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.user-row .name { font-weight: 600; }
.user-row .plan { color: var(--muted); font-size: 13px; }
.user-row .chev { margin-left: auto; color: var(--muted); }
.popover { position: absolute; left: 8px; right: 8px; bottom: 56px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 6px; display: none; z-index: 45; }
.popover.open { display: block; }
.popover .email { padding: 8px 12px 6px; font-size: 13px; color: var(--muted); }
.popover .sep { border-top: 1px solid var(--border); margin: 4px 0; }
.pop-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text); background: transparent; border: none; width: 100%; text-align: left; }
.pop-item:hover { background: var(--surface); }
.pop-item .right { margin-left: auto; color: var(--muted); font-size: 12px; }

/* 설정 모달 (Claude 설정 화면 구조) */
.settings-modal { width: min(1100px, calc(100vw - 48px)); height: min(760px, calc(100vh - 48px)); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; display: grid; grid-template-columns: 240px 1fr; overflow: hidden; }
.sm-nav { border-right: 1px solid var(--border); padding: 16px 12px; overflow-y: auto; }
.sm-nav .search { margin-bottom: 14px; }
.sm-nav .grp { font-size: 12px; color: var(--muted); padding: 10px 10px 4px; }
.sm-nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text); background: transparent; border: none; width: 100%; text-align: left; }
.sm-nav-item:hover { background: var(--surface-2); }
.sm-nav-item.active { background: var(--surface-2); font-weight: 600; }
.sm-body { overflow-y: auto; padding: 20px 28px 40px; position: relative; }
.sm-body .close { position: absolute; top: 14px; right: 16px; }
.sm-body h2.h { font-size: 20px; margin: 4px 0 18px; }
.sm-row { display: flex; gap: 20px; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid var(--border); }
.sm-row:last-child { border-bottom: none; }
.sm-row .lbl { flex: 1; }
.sm-row .lbl b { display: block; font-weight: 600; margin-bottom: 4px; }
.sm-row .lbl .d { color: var(--muted); font-size: 13px; }
.sm-row .ctl { width: 260px; flex: none; }
.sm-row .ctl.wide { width: 420px; }
@media (max-width: 900px) { .settings-modal { grid-template-columns: 1fr; } .sm-nav { display: none; } .sm-row { flex-direction: column; } .sm-row .ctl, .sm-row .ctl.wide { width: 100%; } }
.switch { width: 40px; height: 22px; border-radius: 11px; background: var(--border); position: relative; cursor: pointer; border: none; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: left .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 21px; }

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); position: relative; }
.chat-head { height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 16px; font-size: 14px; }
.chat-head b { font-weight: 600; }
.chat-head .chip { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 2px 8px; }
.chat-head .ops { margin-left: auto; display: flex; gap: 2px; color: var(--muted); }
.chat-head .ib { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: transparent; border: none; color: var(--muted); cursor: pointer; }
.chat-head .ib:hover { background: var(--surface-2); color: var(--text); }
.thread { flex: 1; overflow-y: auto; padding: 8px 0 12px; }
.thread-inner { max-width: 880px; margin: 0 auto; padding: 0 24px; }
.m { margin: 0 0 26px; }
.m-user { display: flex; justify-content: flex-end; margin-top: 30px; }
.m-user .bubble { background: var(--surface-2); border-radius: 12px; padding: 9px 14px; max-width: 72%; white-space: pre-wrap; line-height: 1.55; }
.m-ai { display: block; }
.m-ai .who { display: none; }
.m-ai .body { line-height: 1.7; }
.m-ai .body p { margin: 0 0 10px; }
.m-ai .body > p:first-child { margin-top: 0; }
.m-ai .body .muted { font-size: 13px; }
.m-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thinking { color: var(--muted); font-size: 14px; }
.thinking::after { content: "…"; }
.scroll-down { position: absolute; left: 50%; transform: translateX(-50%); bottom: 132px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted); display: none; align-items: center; justify-content: center; cursor: pointer; z-index: 5; }
.scroll-down.show { display: inline-flex; }
.composer { padding: 6px 24px 10px; background: var(--bg); }
.composer-inner { max-width: 880px; margin: 0 auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 12px 14px 8px; }
.composer-inner:focus-within { border-color: var(--muted); }
.composer textarea { border: none; background: transparent; padding: 0 2px; min-height: 26px; max-height: 220px; resize: none; font-size: 15px; line-height: 1.6; }
.composer-bar { display: flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--muted); }
.composer-bar .ib { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: transparent; border: none; color: var(--muted); cursor: pointer; }
.composer-bar .ib:hover { background: var(--surface-2); color: var(--text); }
.composer-bar .mode { font-size: 13px; padding: 0 8px; display: inline-flex; align-items: center; gap: 4px; height: 30px; border-radius: 8px; cursor: pointer; }
.composer-bar .mode:hover { background: var(--surface-2); color: var(--text); }
.composer-bar .spacer { flex: 1; }
.composer-bar .send { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--bg); border: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.composer-bar .send:disabled { opacity: .4; cursor: default; }
.composer-note { max-width: 880px; margin: 6px auto 0; font-size: 12px; color: var(--muted); text-align: center; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.quick .btn { font-size: 13px; height: 28px; padding: 0 10px; border-radius: 8px; }

/* 목록 화면 (관심 물건 / 저장한 물건): 가운데 영역을 채팅 대신 차지 */
.chat.mode-list .thread, .chat.mode-list .composer, .chat.mode-list .scroll-down { display: none; }
.list-view { flex: 1; overflow-y: auto; padding: 8px 0 40px; }
.list-inner { max-width: 880px; margin: 0 auto; padding: 0 24px; }
.list-head { padding: 12px 0 4px; }
.list-head h1 { font-size: 16px; font-weight: 700; margin: 0; }
.list-head .d { color: var(--muted); font-size: 13px; margin-top: 4px; }
.list-empty { color: var(--muted); font-size: 14px; padding: 40px 0; text-align: center; border: 1px dashed var(--border); border-radius: 8px; margin-top: 12px; }
.list-memo { margin-top: 4px; font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .list-inner { padding: 0 14px; } }

/* 결과 목록 (채팅 내) */
.result { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 12px 14px; margin: 8px 0; }
.result:hover { border-color: var(--muted); }
.result.active { border-color: var(--accent); background: rgba(179,157,219,.08); }
.result-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.result-no { font-family: var(--mono); color: var(--muted); }
.result-title { font-weight: 700; }
.result-sub { font-size: 12px; color: var(--muted); width: 100%; }
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 14px; margin-top: 8px; font-size: 13px; }
@media (max-width: 640px) { .result-grid { grid-template-columns: 1fr 1fr; } }
.result-grid .k { color: var(--muted); font-size: 11px; display: block; }
.result-grid .v { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.result-line { margin-top: 8px; font-size: 14px; line-height: 1.55; }
.result-risk { margin-top: 4px; font-size: 13px; color: var(--muted); }
.result-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.result-foot .chips { display: flex; gap: 4px; flex-wrap: wrap; }
.result-foot .btns { margin-left: auto; display: flex; gap: 6px; }
.summary-line { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 4px 0 6px; }
.summary-line b { color: var(--text); font-family: var(--mono); }

/* 우측 패널 */
.panel { border-left: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.panel-head { height: 48px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; padding: 0 14px; }
.panel-head .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-head .s { color: var(--muted); font-size: 12px; font-family: var(--mono); white-space: nowrap; }
.panel-head .close { margin-left: auto; }
.panel-tabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
.panel-tab { height: 30px; padding: 0 10px; background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer; white-space: nowrap; font-size: 13px; }
.panel-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.panel-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.panel-body { flex: 1; overflow-y: auto; padding: 16px 16px 40px; }
.panel-title { padding: 6px 2px 12px; }
.panel-title .t { font-weight: 700; font-size: 17px; }
.panel-title .s { color: var(--muted); font-size: 13px; font-family: var(--mono); margin-top: 2px; }
.panel-title .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
/* 제목 줄의 관심 별 아이콘: 켜지면 보라 채움. 저장된 물건은 별 대신 "저장됨" 칩 */
.panel-title .t-row { display: flex; align-items: center; gap: 8px; }
.panel-title .star { width: 28px; height: 28px; border-radius: 6px; background: transparent; border: none; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.panel-title .star:hover { background: var(--surface-2); color: var(--text); }
.panel-title .star.on { color: var(--accent); }
.panel-title .star.on .icon { fill: currentColor; }
.panel-body .section { padding: 12px; }
.panel-body .kv-3 { grid-template-columns: 110px 1fr 110px 1fr; }
@media (max-width: 1300px) { .panel-body .kv-3 { grid-template-columns: 110px 1fr; } }
.panel-empty { color: var(--muted); font-size: 13px; padding: 40px 20px; text-align: center; }

/* nav (설정·작업 현황 등 페이지형 화면의 상단 제목줄) */
.nav { height: 52px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.nav-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 100%; display: flex; align-items: center; gap: 28px; }
.nav-brand { font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.nav-tabs { display: flex; gap: 4px; height: 100%; }
.nav-tab { display: flex; align-items: center; padding: 0 12px; color: var(--muted); border-bottom: 2px solid transparent; height: 100%; }
.nav-tab:hover { color: var(--text); text-decoration: none; }
.nav-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* layout */
.page { max-width: 1280px; margin: 0 auto; padding: 20px 24px 80px; }
.page-title { font-size: 16px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 12px; }
.page-title .sub { font-weight: 400; color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.grid-2 { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
@media (max-width: 1024px) { .grid-2 { grid-template-columns: 1fr; } }
.section { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px; margin-bottom: 16px; }
.section-title { font-size: 14px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.section-title .sub { color: var(--muted); font-weight: 400; font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }

/* banner */
.banner { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 8px 12px; display: flex; gap: 16px; align-items: center; margin-bottom: 14px; font-size: 13px; flex-wrap: wrap; }
@media (max-width: 480px) { .nav-inner { gap: 12px; padding: 0 12px; } .nav-right .badge { display: none; } .page { padding: 12px 12px 80px; } }
@media (max-width: 900px) { .kv-3 { grid-template-columns: 120px 1fr; } }
.banner-warn { border-left: 3px solid var(--hold); }
.banner-risk { border-left: 3px solid var(--risk); }

/* buttons */
.btn { height: 32px; padding: 0 12px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 4px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.btn-primary:hover { border-color: var(--accent); opacity: .9; }
.btn-danger { color: var(--risk); border-color: var(--risk); background: transparent; }
.btn-sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* badges / chips */
.badge, .chip { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border: 1px solid var(--muted); border-radius: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.badge-risk, .chip-risk { color: var(--risk); border-color: var(--risk); background: rgba(224,122,114,.12); }
.badge-hold, .chip-hold { color: var(--hold); border-color: var(--hold); background: rgba(212,162,76,.12); }
.badge-ok, .chip-ok { color: var(--ok); border-color: var(--ok); background: rgba(143,191,116,.12); }
.badge-accent { color: var(--accent); border-color: var(--accent); }

/* table */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { background: var(--surface-2); color: var(--muted); font-weight: 600; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { color: var(--accent); }
.table tr.selected td:first-child { border-left: 3px solid var(--accent); padding-left: 7px; }
.badge-neutral { color: var(--muted); border-color: var(--muted); }
.table-wrap { overflow-x: auto; }
.table tfoot td { font-weight: 600; border-top: 1px solid var(--border); }

/* kv */
.kv { display: grid; grid-template-columns: 120px 1fr; row-gap: 6px; column-gap: 12px; font-size: 13px; }
.kv dt { color: var(--muted); margin: 0; }
.kv dd { margin: 0; }
.kv-3 { display: grid; grid-template-columns: repeat(3, 120px 1fr); gap: 6px 12px; }

/* field */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--risk); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check .box { width: 14px; height: 14px; border: 1px solid var(--muted); border-radius: 3px; display: inline-block; position: relative; }
.check.on .box { border-color: var(--accent); background: var(--accent); }
.check.on .box::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* dropdown */
.dd { position: relative; }
.dd-btn { width: 100%; height: 32px; padding: 0 30px 0 10px; text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn::after { content: ""; position: absolute; right: 12px; top: 11px; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1px 1px 0; transform: rotate(45deg); }
.dd.open .dd-btn { border-color: var(--accent); }
.dd-list { position: absolute; left: 0; right: 0; top: 34px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; max-height: 240px; overflow-y: auto; z-index: 30; display: none; }
.dd.open .dd-list { display: block; }
.dd-item { padding: 6px 10px 6px 14px; cursor: pointer; border-left: 4px solid transparent; }
.dd-item:hover { background: var(--surface-2); }
.dd-item.on { border-left-color: var(--accent); }
.dp { font-family: var(--mono); }

/* card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px; margin-bottom: 12px; cursor: pointer; }
.card:hover { border-color: var(--muted); }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.card-title { font-weight: 700; font-size: 15px; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-chips { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.card-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
@media (max-width: 760px) { .card-body { grid-template-columns: 1fr; } }
.card-block { border-top: 1px solid var(--border); padding-top: 8px; }
.card-block h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.card-foot { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 8px; display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.card-foot .reasons { color: var(--text); }
.card-actions { margin-left: auto; display: flex; gap: 6px; }
.big { font-size: 18px; font-weight: 700; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.diff-pos { color: var(--ok); }
.diff-neg { color: var(--risk); }

/* sort tabs */
.sort-bar { display: flex; gap: 4px; align-items: center; margin: 8px 0 12px; flex-wrap: wrap; }
.sort-bar .lbl { color: var(--muted); font-size: 12px; margin-right: 6px; }
.sort-tab { height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: 4px; background: transparent; cursor: pointer; font-size: 12px; color: var(--muted); }
.sort-tab.active { color: var(--text); border-color: var(--accent); }

/* chat */
.chat-log { border: 1px solid var(--border); border-radius: 4px; background: var(--bg); padding: 10px; height: 180px; overflow-y: auto; font-size: 13px; }
.msg { margin-bottom: 8px; }
.msg .who { color: var(--muted); font-size: 11px; }
.msg.sys .body { color: var(--text); }
.msg .body { white-space: pre-wrap; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; z-index: 50; }
.overlay.open { display: flex; }
.modal { width: 480px; max-width: calc(100% - 32px); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 18px; }
.modal h3 { margin: 0 0 12px; font-size: 15px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* toast */
.toast { position: fixed; top: 64px; right: 24px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--ok); padding: 10px 14px; border-radius: 4px; z-index: 60; display: none; font-size: 13px; }
.toast.risk { border-left-color: var(--risk); }
.toast.show { display: block; }

/* skeleton */
.skeleton { background: var(--surface-2); border-radius: 4px; height: 14px; }

/* disclaimer */
.disclaimer { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 8px 24px; font-size: 12px; color: var(--muted); display: flex; gap: 20px; flex-wrap: wrap; z-index: 15; }

/* doc viewer placeholder */
.doc-box { border: 1px dashed var(--border); border-radius: 4px; padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }
.photo { width: 120px; height: 90px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; margin-right: 8px; }

/* count line */
.count-line { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }
.count-line b { color: var(--text); font-family: var(--mono); }

/* jobs */
.stage-cells span { display: inline-block; min-width: 54px; text-align: center; font-size: 11px; padding: 1px 4px; border: 1px solid var(--border); border-radius: 3px; margin: 1px; color: var(--muted); }
.stage-cells .DONE { color: var(--ok); border-color: var(--ok); }
.stage-cells .FAILED { color: var(--risk); border-color: var(--risk); }
.stage-cells .GIVEN_UP { color: var(--risk); border-color: var(--risk); border-style: dashed; }
.stage-cells .WAITING { color: var(--hold); border-color: var(--hold); }
.stage-cells .RUNNING { color: var(--accent); border-color: var(--accent); }
.stage-cells .PENDING { color: var(--muted); border-color: var(--border); }
.pager { display: flex; gap: 4px; justify-content: flex-end; margin-top: 8px; }
.pager .btn { min-width: 32px; }
