/* Agent Lounge — 업무 모드 (AL-STEP3-V1)
   토큰: [지식] 라운지디자인 1장 · 직원 화면 기준: 작업규칙 7-1 */
:root {
  --navy-900: #0F1B2D; --navy-700: #1B2A41; --navy-500: #34465F;
  --ivory-50: #F8F5EE; --ivory-100: #F2EEE4; --ivory-200: #E9E3D6;
  --gold-500: #B8975A; --gold-300: #D9C39A;
  --slate-500: #6B7787; --ink: #1E2633;
  --ok: #4E8F6A; --warn: #C08A2E; --critical: #A8483E; --info: #3F6E9E;
  --r: 7px;
  --sans: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --serif: "Noto Serif KR", "Nanum Myeongjo", "AppleMyungjo", "Batang", serif;
  --mono: "D2Coding", "Consolas", "Menlo", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 13.5px/1.55 var(--sans); color: var(--ink); background: var(--ivory-50); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }

/* 브랜드 */
.al-brand { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.al-brand-main { font-family: var(--serif); font-size: 19px; letter-spacing: .22em; color: #fff; }
.al-brand-sub { font-family: var(--serif); font-size: 14px; color: var(--gold-300); letter-spacing: .04em; }
.al-brand-lg .al-brand-main { font-size: 26px; color: var(--navy-900); }
.al-brand-lg .al-brand-sub { font-size: 17px; color: var(--gold-500); }

/* 버튼·칩 */
.al-btn { height: 34px; padding: 0 14px; border: 1px solid var(--ivory-200); border-radius: var(--r); background: #fff; cursor: pointer; }
.al-btn:hover { border-color: var(--gold-500); }
.al-btn-primary { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.al-btn-primary:hover { background: var(--navy-700); }
.al-btn:disabled { opacity: .5; cursor: default; }
.al-link { background: none; border: 0; color: var(--ivory-200); cursor: pointer; padding: 4px 6px; }
.al-link:hover { color: #fff; text-decoration: underline; }
.al-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.al-chip-ok { color: var(--ok); background: #E8F2EC; border-color: #CFE3D7; }
.al-chip-warn { color: var(--warn); background: #FBF1DF; border-color: #EEDCB8; }
.al-chip-critical { color: var(--critical); background: #F6E5E3; border-color: #E8C8C4; }
.al-chip-info { color: var(--info); background: #E6EEF6; border-color: #C9D9EA; }
.al-chip-idle { color: var(--slate-500); background: var(--ivory-100); border-color: var(--ivory-200); }

/* 상단 */
.al-top { display: flex; align-items: center; gap: 24px; height: 56px; padding: 0 20px; background: var(--navy-900); border-bottom: 1px solid var(--gold-500); }
.al-mode { display: inline-flex; border: 1px solid var(--navy-500); border-radius: var(--r); overflow: hidden; }
.al-mode button { background: transparent; border: 0; color: var(--ivory-200); padding: 5px 14px; cursor: pointer; }
.al-mode button.on { background: var(--navy-700); color: #fff; box-shadow: inset 0 -2px 0 var(--gold-500); }
.al-mode button:disabled { color: var(--slate-500); cursor: default; }
.al-top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.al-user { color: #fff; }

.al-mock { margin: 12px 20px 0; padding: 9px 14px; border: 1px solid var(--gold-500); border-left-width: 4px; border-radius: var(--r); background: #FFFBF2; color: #6A5326; }
.al-mock b { color: #5B4416; }

/* AI 직원 카드 */
.al-agents { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 12px 20px 0; }
.al-agent { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; background: #fff; border: 1px solid var(--ivory-200); border-radius: var(--r); }
.al-agent.is-working { border-color: var(--gold-500); box-shadow: inset 3px 0 0 var(--gold-500); }
.al-agent.is-error { border-color: var(--critical); box-shadow: inset 3px 0 0 var(--critical); }
.al-agent-desk { grid-column: 1 / -1; font-size: 11px; letter-spacing: .14em; color: var(--gold-500); font-weight: 700; }
.al-agent-name { font-family: var(--serif); font-size: 16px; }
.al-agent-state { align-self: center; }
.al-agent-role, .al-agent-now { grid-column: 1 / -1; color: var(--slate-500); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al-agent-now b { color: var(--ink); font-weight: 600; }
.al-dots::after { content: "…"; display: inline-block; animation: al-dots 1.4s ease-in-out infinite; }
@keyframes al-dots { 0%,100% { opacity: .3; } 50% { opacity: 1; } }

/* 본문 3단 */
.al-main { display: grid; grid-template-columns: 280px minmax(440px, 1fr) minmax(440px, 500px); gap: 12px; padding: 12px 20px 70px; align-items: start; }
.al-panel { background: #fff; border: 1px solid var(--ivory-200); border-radius: var(--r); padding: 14px; min-width: 0; }
.al-panel h2 { font-size: 15px; margin-bottom: 10px; }

/* 지시하기 */
.al-field { display: block; margin-bottom: 10px; color: var(--slate-500); font-size: 12.5px; }
.al-field select, .al-field textarea { display: block; width: 100%; margin-top: 4px; padding: 7px 9px; border: 1px solid var(--ivory-200); border-radius: var(--r); background: #fff; color: var(--ink); font-size: 13.5px; }
.al-field select { height: 34px; }
.al-field textarea { resize: vertical; min-height: 96px; }
.al-field select:focus, .al-field textarea:focus { outline: 2px solid var(--gold-300); border-color: var(--gold-500); }
.al-ask-row { display: flex; align-items: center; justify-content: space-between; }
.al-hint { color: var(--slate-500); font-size: 12px; }
.al-ask-msg { min-height: 20px; margin: 8px 0 0; font-size: 12.5px; color: var(--slate-500); }
.al-ask-msg.err { color: var(--critical); }
.al-examples { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--ivory-200); }
.al-examples h3 { font-size: 12.5px; color: var(--slate-500); font-weight: 500; margin-bottom: 6px; }
.al-ex { display: block; width: 100%; text-align: left; margin-bottom: 6px; padding: 7px 10px; border: 1px solid var(--ivory-200); border-radius: var(--r); background: var(--ivory-50); cursor: pointer; }
.al-ex:hover { border-color: var(--gold-500); }

/* 업무 안내판 */
.al-board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.al-board-head h2 { margin: 0; }
.al-board-en { font-family: var(--mono); letter-spacing: .12em; color: var(--gold-500); font-size: 13px; margin-right: 6px; }
.al-tabs { display: inline-flex; gap: 4px; }
.al-tabs button { height: 28px; padding: 0 10px; border: 1px solid var(--ivory-200); border-radius: 14px; background: #fff; cursor: pointer; font-size: 12.5px; }
.al-tabs button b { font-variant-numeric: tabular-nums; margin-left: 2px; }
.al-tabs button.on { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.al-table-wrap { overflow-x: auto; }
.al-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.al-table th { text-align: left; font-weight: 500; color: var(--slate-500); font-size: 12px; padding: 7px 6px; border-bottom: 1px solid var(--ivory-200); background: var(--ivory-50); }
.al-table td { padding: 8px 6px; border-bottom: 1px solid var(--ivory-100); vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al-table tbody tr { cursor: pointer; }
.al-table tbody tr:hover td { background: #FCFAF5; }
.al-table tbody tr.sel td { background: #F6EFDF; }
.al-table tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--gold-500); }
.al-table tr.al-empty td { text-align: center; color: var(--slate-500); padding: 28px 8px; cursor: default; background: none; }
.c-code { width: 78px; } .c-agent { width: 92px; } .c-status { width: 118px; } .c-user { width: 62px; } .c-time { width: 58px; }
td.code, td.time { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }
td.code { color: var(--navy-700); font-weight: 600; }
.st { display: inline-flex; gap: 6px; align-items: baseline; }
.st-en { font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; font-weight: 700; }
.st-ko { font-size: 12px; color: var(--slate-500); }
.st-queued .st-en { color: var(--slate-500); }
.st-working .st-en { color: var(--gold-500); }
.st-waiting_approval .st-en { color: var(--warn); }
.st-done .st-en { color: var(--ok); }
.st-failed .st-en { color: var(--critical); }
.al-board-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; color: var(--slate-500); font-size: 12.5px; min-height: 34px; }

/* 업무 상세 */
.al-detail { position: sticky; top: 12px; max-height: calc(100vh - 100px); overflow-y: auto; }
.al-detail-empty { color: var(--slate-500); text-align: center; padding: 48px 10px; }
.al-d-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.al-d-code { font-family: var(--mono); font-weight: 700; color: var(--navy-700); }
.al-d-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; word-break: keep-all; }
.al-d-meta { color: var(--slate-500); font-size: 12.5px; margin-bottom: 12px; }
.al-tl { list-style: none; margin: 0 0 14px; padding: 8px 10px; background: var(--ivory-50); border: 1px solid var(--ivory-100); border-radius: var(--r); font-size: 12.5px; }
.al-tl li { display: grid; grid-template-columns: 58px 112px 1fr; gap: 6px; padding: 2px 0; color: var(--slate-500); }
.al-tl .t { font-family: var(--mono); }
.al-tl .k { font-weight: 600; color: var(--navy-700); white-space: nowrap; }
.al-tl li > span:last-child { overflow-wrap: anywhere; }
.al-tl li.handoff .k { color: var(--gold-500); }
.al-tl li.error .k { color: var(--critical); }
.al-msg { margin-bottom: 12px; }
.al-msg-who { font-size: 12px; color: var(--slate-500); margin-bottom: 4px; }
.al-msg-body { padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--ivory-200); background: #fff; word-break: keep-all; overflow-wrap: anywhere; }
.al-msg.user .al-msg-body { background: var(--ivory-50); }
.al-msg.assistant .al-msg-body { border-left: 3px solid var(--gold-500); }
.al-msg.system .al-msg-body { border-left: 3px solid var(--critical); color: var(--critical); }
.al-msg-body p { margin: 0 0 6px; }
.al-msg-body ol { margin: 0 0 8px; padding-left: 20px; }
.al-msg-body .stamp { color: var(--slate-500); font-size: 12px; margin-top: 8px; }
.al-ans-table { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 12.5px; }
.al-ans-table th, .al-ans-table td { border: 1px solid var(--ivory-200); padding: 5px 7px; text-align: left; vertical-align: top; }
.al-ans-table th { background: var(--ivory-50); font-weight: 600; white-space: nowrap; }
.al-ans-table td { word-break: keep-all; }
.al-ans-table td:not(.num):not(.nw) { min-width: 8em; }
.al-ans-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.al-ans-table td.nw { white-space: nowrap; font-variant-numeric: tabular-nums; }
.al-ans-scroll { overflow-x: auto; }
.al-working { color: var(--gold-500); font-weight: 600; padding: 6px 0; }

/* 하단 */
.al-foot { position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 20px; background: var(--navy-900); color: var(--ivory-200); font-size: 12.5px; z-index: 5; }
.al-foot a { color: var(--gold-300); }
.al-foot-ver { margin-left: auto; color: var(--slate-500); font-family: var(--mono); font-size: 11px; }

.al-dlg { border: 1px solid var(--ivory-200); border-radius: var(--r); padding: 20px 22px; max-width: 560px; }
.al-dlg::backdrop { background: rgba(15, 27, 45, .45); }
.al-dlg h2 { font-size: 16px; margin-bottom: 10px; }
.al-dlg ul { padding-left: 18px; margin: 0 0 14px; }
.al-dlg li { margin-bottom: 6px; }

/* 로그인 */
.al-login-body { min-height: 100vh; display: grid; place-items: center; background: var(--navy-900); }
.al-login { width: 340px; padding: 28px; background: var(--ivory-50); border-radius: 8px; border-top: 3px solid var(--gold-500); }
.al-login .al-brand { justify-content: center; margin-bottom: 4px; }
.al-login-note { text-align: center; color: var(--slate-500); margin: 0 0 18px; }
.al-login label { display: block; font-size: 12.5px; color: var(--slate-500); margin-bottom: 10px; }
.al-login input { display: block; width: 100%; height: 38px; margin-top: 4px; padding: 0 10px; border: 1px solid var(--ivory-200); border-radius: var(--r); background: #fff; font-size: 14px; }
.al-login button { width: 100%; height: 40px; margin-top: 6px; }
.al-login-err { min-height: 18px; margin: 10px 0 0; color: var(--critical); font-size: 12.5px; text-align: center; }

/* 좁은 화면 */
@media (max-width: 1599px) { .c-user, td.user { display: none; } }
@media (max-width: 1200px) {
  .al-main { grid-template-columns: 280px 1fr; }
  .al-detail { grid-column: 1 / -1; position: static; max-height: none; }
}
@media (max-width: 760px) {
  .al-top { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
  .al-mode { display: none; }
  .al-agents { grid-template-columns: 1fr; padding: 10px 14px 0; }
  .al-main { grid-template-columns: 1fr; padding: 10px 14px 70px; }
  .al-mock { margin: 10px 14px 0; }
  .c-user, td.user, .c-agent, td.agent { display: none; }
  .c-status { width: 92px; } .st-ko { display: none; }
  .al-foot { position: static; flex-wrap: wrap; height: auto; padding: 10px 14px; }
  .al-main { padding-bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) { .al-dots::after { animation: none; } }
