/* 바로연결 — plain and calm. One accent colour, square-ish controls, no decoration. */
:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --line: #E3E6EB;
  --line-strong: #CBD0D8;
  --text: #191F28;
  --text-2: #4E5968;
  --text-3: #5F6B78;
  --accent: #1B4FD1;
  --accent-hover: #1641B0;
  --accent-soft: #EEF3FD;
  --danger: #D92D20;
  --danger-hover: #B42318;
  --ok: #12805C;
  --radius: 8px;
  --radius-sm: 6px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "D2Coding", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.6; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; word-break: keep-all; }
button, input { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#app:focus { outline: none; }

/* ---------- frame ---------- */
.page { min-height: 100%; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; }
.header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.main { flex: 1; padding: 40px 0 64px; }

/* logo: the word itself + one accent dot */
.logo { display: inline-flex; align-items: baseline; gap: 1px; color: var(--text); text-decoration: none; font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.logo:hover { text-decoration: none; }
.logo .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 2px; }

/* ---------- type ---------- */
.title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.35; }
.lead { margin-top: 8px; font-size: 16px; color: var(--text-2); }
.h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.desc { margin-top: 4px; color: var(--text-2); }
.small { font-size: 13px; color: var(--text-3); }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 20px; font-size: 14px; color: var(--text-3); }
.back:hover { color: var(--text); text-decoration: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 18px; border-radius: var(--radius); border: 1px solid transparent;
  font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .12s, border-color .12s, transform .08s;
}
.btn:hover { text-decoration: none; }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not([disabled]) { background: var(--accent-hover); }
.btn-line { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-line:hover:not([disabled]) { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not([disabled]) { background: var(--danger-hover); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; border-radius: var(--radius-sm); }

/* ---------- surfaces ---------- */
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.box + .box { margin-top: 16px; }

/* ---------- home ---------- */
.home-head { margin-bottom: 28px; }
.paths { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.path { padding: 28px; display: flex; flex-direction: column; gap: 4px; }
.path + .path { border-left: 1px solid var(--line); }
.path .who { font-size: 13px; font-weight: 600; color: var(--text-3); }
.path .btn { margin-top: 20px; align-self: flex-start; min-width: 140px; }
.start { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 28px; }
.start .btn { margin-top: 20px; min-width: 160px; }
.how { margin-top: 40px; display: grid; grid-template-columns: 200px 1fr; gap: 24px; }
.how ol { margin: 0; padding-left: 20px; color: var(--text-2); }
.how li + li { margin-top: 6px; }
.note { margin-top: 32px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; }

/* ---------- help (host) ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.code-box .label { font-size: 13px; color: var(--text-3); }
.code-line { display: flex; align-items: center; gap: 16px; margin-top: 6px; }
.code { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 52px; font-weight: 700; letter-spacing: .04em; line-height: 1.15; color: var(--text); }
.code .gap { display: inline-block; width: .4em; }
.expire { margin-top: 14px; }
.expire .bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; margin-top: 6px; max-width: 320px; }
.expire .bar i { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
.expire.low .bar i { background: var(--danger); }
.state { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); transition: background-color .2s; }
.state.waiting .dot { background: var(--accent); }
.state.request .dot { background: #E8A100; }
.state.live .dot { background: var(--ok); }
.side-steps h2 { font-size: 15px; font-weight: 700; }
.side-steps ol { margin: 10px 0 0; padding-left: 18px; color: var(--text-2); font-size: 14px; }
.side-steps li + li { margin-top: 8px; }

.livebar { position: sticky; top: 0; z-index: 40; background: #FFF4F2; border-bottom: 1px solid #F5C6C0; }
.livebar .wrap { display: flex; align-items: center; gap: 10px; height: 52px; }
.livebar .rec { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex: none; }
.livebar strong { font-weight: 700; white-space: nowrap; }
.livebar .small { margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview { width: 100%; margin-top: 16px; border-radius: var(--radius-sm); background: #111; aspect-ratio: 16 / 9; object-fit: contain; border: 1px solid var(--line); }
.ctl .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ctl .h2 { font-size: 16px; }

#after .again { margin-top: 16px; }
.ctl:not(:empty) { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.state.live { margin-top: 0; }

/* ---------- connect (viewer) ---------- */
.narrow { max-width: 480px; }
.otp { display: flex; gap: 8px; margin-top: 28px; }
.otp input {
  width: 52px; height: 60px; padding: 0; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface);
  font-family: var(--mono); font-size: 26px; font-weight: 700; text-align: center; color: var(--text);
}
.otp input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.otp .sep { width: 8px; }
.otp.error input { border-color: var(--danger); }
.otp.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.msg { min-height: 22px; margin-top: 10px; font-size: 14px; color: var(--text-3); }
.msg.error { color: var(--danger); }
.field { display: grid; gap: 6px; margin-top: 20px; font-size: 14px; font-weight: 600; color: var(--text); }
.field em { font-style: normal; font-weight: 400; color: var(--text-3); }
.field input { height: 44px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); font-weight: 400; }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.form-actions { margin-top: 24px; }
.wait { margin-top: 28px; }
.wait .row { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.wait .btn { margin-top: 20px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- dialog ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(17, 24, 39, .45); }
.modal { width: 100%; max-width: 400px; padding: 24px; border-radius: var(--radius); background: var(--surface); box-shadow: 0 10px 30px rgba(17, 24, 39, .18); }
.modal h2 { font-size: 18px; font-weight: 700; }
.modal p { margin-top: 8px; color: var(--text-2); }
.modal .who { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg); font-size: 14px; color: var(--text-2); }
.modal .who b { color: var(--text); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%); padding: 10px 16px; border-radius: var(--radius-sm); background: #1F2329; color: #fff; font-size: 14px; max-width: calc(100vw - 32px); }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.chat-msg { max-width: 80%; padding: 7px 11px; border-radius: var(--radius-sm); background: var(--bg); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; align-self: flex-start; }
.chat-msg.mine { background: var(--accent-soft); align-self: flex-end; }
.chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; height: 38px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); }
.chat-empty { margin: auto; color: var(--text-3); font-size: 13px; }
.chat-box { padding: 0; overflow: hidden; }
.chat-box .h2 { padding: 16px 16px 0; font-size: 16px; }
.chat-wrap { height: 220px; }

/* ---------- remote screen (viewer) ---------- */
.remote { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: #111315; }
.toolbar { display: flex; align-items: center; gap: 2px; height: 44px; padding: 0 8px 0 14px; flex: none; background: #1F2329; color: #E6E8EB; border-bottom: 1px solid #2B3036; }
.toolbar .who { display: flex; align-items: center; gap: 8px; margin-right: auto; min-width: 0; font-size: 14px; }
.toolbar .who .dot { width: 8px; height: 8px; border-radius: 50%; background: #3CCB7F; flex: none; }
.toolbar .who .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar .quality { margin-right: 10px; font-family: var(--mono); font-size: 12px; color: #9AA1AB; }
.toolbar .quality.ok { color: #E8A100; } .toolbar .quality.bad { color: #FF6B5E; }
.tool { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 0; background: transparent; color: #E6E8EB; cursor: pointer; }
.tool:hover:not([disabled]) { background: #2B3036; }
.tool[aria-pressed="true"] { background: #2B3A5C; color: #fff; }
.tool[disabled] { opacity: .35; cursor: not-allowed; }
.tool.danger { color: #FF6B5E; }
.tool .tip { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 5; pointer-events: none; padding: 5px 8px; border-radius: 4px; background: #000; color: #fff; font-size: 12px; white-space: nowrap; opacity: 0; }
.tool:hover .tip, .tool:focus-visible .tip { opacity: 1; }
.tool:last-child .tip { left: auto; right: 0; transform: none; }
.sep-v { width: 1px; height: 20px; margin: 0 6px; background: #3A4048; }
.stage { position: relative; flex: 1; min-height: 0; display: flex; }
.stage video { flex: 1; min-width: 0; width: 100%; height: 100%; object-fit: contain; background: #111315; outline: none; }
.stage video.control { cursor: crosshair; }
.stage .overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: #9AA1AB; font-size: 14px; pointer-events: none; }
.stage .overlay .spinner { border-color: #3A4048; border-top-color: #9AA1AB; }
.side { width: 320px; flex: none; background: var(--surface); color: var(--text); border-left: 1px solid #2B3036; }
.menu { position: absolute; top: 42px; z-index: 6; min-width: 160px; padding: 4px; border-radius: var(--radius-sm); background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.menu button { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 8px 10px; border: 0; border-radius: 4px; background: none; cursor: pointer; font-size: 14px; text-align: left; }
.menu button:hover { background: var(--bg); }
.menu button[aria-checked="true"] { font-weight: 700; color: var(--accent); }


/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .main { padding: 28px 0 48px; }
  .title { font-size: 22px; }
  .paths { grid-template-columns: 1fr; }
  .path + .path { border-left: 0; border-top: 1px solid var(--line); }
  .path { padding: 22px 20px; }
  .path .btn, .start .btn { width: 100%; }
  .how { grid-template-columns: 1fr; gap: 8px; }
  .two-col { grid-template-columns: 1fr; }
  .code { font-size: 44px; }
  .otp { gap: 6px; }
  .otp input { width: calc((100vw - 40px - 5 * 6px - 8px) / 6); max-width: 52px; height: 56px; }
  .form-actions .btn { width: 100%; }
  .modal .actions .btn { flex: 1; }
  .side { position: absolute; inset: 0 0 0 auto; width: min(100%, 340px); }
  .toolbar .quality { display: none; }
  .livebar .small { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

.two-col { margin-top: 28px; }
.two-col > .box + .box { margin-top: 0; }

/* ---------- programs (customer / 상담원) ---------- */
.in-app .main { padding: 24px 0 32px; }
.app-view .code-line { margin-top: 8px; }
.app-view .note { margin-top: 24px; }
.again { margin-top: 16px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 14px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.live .lead { margin-top: 16px; font-size: 14px; }
.ctl-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 14px 16px; font-size: 14px; font-weight: 600; }
.tabs { display: flex; gap: 4px; margin-top: 20px; }
.tabs [role="tab"] { height: 36px; padding: 0 14px; border: 1px solid transparent; border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: none; color: var(--text-3); font-weight: 600; cursor: pointer; }
.tabs [role="tab"][aria-selected="true"] { background: var(--surface); border-color: var(--line); color: var(--text); }
.tab-body { padding: 0; height: 300px; overflow: hidden; border-top-left-radius: 0; }

/* ---------- file transfer ---------- */
.files { display: flex; flex-direction: column; height: 100%; }
.drop { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.file-list { list-style: none; margin: 0; padding: 0 12px 12px; overflow: auto; flex: 1; display: grid; gap: 6px; align-content: start; }
.file-empty { padding: 0 12px; }
.file { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.file-top { display: flex; justify-content: space-between; gap: 8px; }
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.file-bar { height: 4px; margin-top: 6px; border-radius: 2px; background: var(--line); overflow: hidden; }
.file-bar i { display: block; height: 100%; background: var(--accent); }
.file-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.file.bad .file-state { color: var(--danger); }

/* ---------- 상담원 program ---------- */
.header .wrap { gap: 12px; }
.userbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.userbar .small { margin-right: 6px; }
.back.link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.form .check { margin-top: 16px; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: end; }
.grid-form .form-actions { margin-top: 20px; }
.field select { height: 44px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); font-weight: 400; }
.box + .box, section.box { margin-top: 16px; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
.users { width: 100%; border-collapse: collapse; font-size: 14px; }
.users th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 13px; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.users td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.users td.off { color: var(--danger); }
.users .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.mono { font-family: var(--mono); }
.danger-text { color: var(--danger); }
.ctl-badge { margin-left: 8px; padding: 1px 8px; border-radius: 4px; background: #2B3036; color: #9AA1AB; font-size: 12px; }
@media (max-width: 760px) { .grid-form { grid-template-columns: 1fr; } }
.logo .logo-sub { margin-left: 8px; font-size: 13px; font-weight: 600; color: var(--text-3); letter-spacing: 0; }
.wrap .wrap { padding: 0; }

[hidden] { display: none !important; }
.note a { text-decoration: underline; }
