/* 전자결재시스템 화면 스타일 */
:root {
  --bg: #f3f5f8; --surface: #fff; --line: #dfe3ea; --line-strong: #c3c9d4;
  --text: #1b2330; --muted: #667085; --primary: #1d4f9f; --primary-dark: #163d7c; --primary-soft: #e8eef9;
  --ok: #18794e; --ok-soft: #e3f4ea; --danger: #c0352b; --danger-soft: #fbe9e7; --warn: #a15c07; --warn-soft: #fdf1dc;
  --radius: 8px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ---------- 레이아웃 ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: #16233a; color: #cfd8e6; padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { color: #fff; font-weight: 700; font-size: 17px; padding: 4px 10px 14px; display: block; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: #93a3bd; }
.side a.nav { display: flex; justify-content: space-between; align-items: center; color: inherit; padding: 7px 10px; border-radius: 6px; flex-shrink: 0; }
.side a.nav:hover { background: #22324f; text-decoration: none; }
.side a.nav.on { background: #2a3d61; color: #fff; font-weight: 600; }
.side .sep { margin: 12px 10px 4px; font-size: 12px; color: #7e8fab; }
.side .who { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #2a3a57; font-size: 13px; }
.side .who strong { color: #fff; display: block; font-size: 14px; }
.side .who a, .side .who button { color: #a9b8d0; font-size: 13px; background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.side .who .row { display: flex; gap: 12px; margin-top: 6px; }
.badge { background: #e5484d; color: #fff; border-radius: 10px; font-size: 12px; font-weight: 700; padding: 0 7px; min-width: 20px; text-align: center; }
.main { padding: 24px 28px 60px; min-width: 0; }
.main > .inner { max-width: 1080px; margin: 0 auto; }
.topbar { display: none; }
#navtoggle { display: none; }

/* ---------- 공통 요소 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card > h2 .count { color: var(--primary); }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head h1 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f4f6f9; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--danger); border-color: #e3b5b0; }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn.lg { min-height: 46px; padding: 0 22px; font-size: 16px; }
input[type=text], input[type=search], input[type=password], input[type=date], input[type=number], input[type=email], input[type=file], select, textarea {
  width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px;
  font: inherit; background: #fff; color: var(--text);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid #7aa2e3; outline-offset: 1px; }
label { font-weight: 600; font-size: 14px; }
.field { margin-bottom: 14px; }
.field > label { display: block; margin-bottom: 5px; }
.field .help { font-size: 13px; color: var(--muted); margin-top: 4px; }
.field .err, .errorlist { color: var(--danger); font-size: 13px; margin: 4px 0 0; padding: 0; list-style: none; }
.field.check label { display: inline-flex; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.msgs { list-style: none; padding: 0; margin: 0 0 16px; }
.msgs li { padding: 10px 14px; border-radius: 6px; margin-bottom: 6px; background: var(--primary-soft); border: 1px solid #c9d8f2; }
.msgs li.success { background: var(--ok-soft); border-color: #b7e0c7; }
.msgs li.error { background: var(--danger-soft); border-color: #f0c2bd; color: #8f241c; }
.empty { color: var(--muted); padding: 22px 0; text-align: center; }

.st { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.st.draft { background: #eceff3; color: #56607a; }
.st.in_progress { background: var(--primary-soft); color: var(--primary); }
.st.approved { background: var(--ok-soft); color: var(--ok); }
.st.rejected { background: var(--danger-soft); color: var(--danger); }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.list td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list td.title a { color: var(--text); font-weight: 600; }
table.list tr:hover td { background: #fafbfd; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input[type=search] { flex: 1 1 200px; }
.filters select { width: auto; }
.pager { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 14px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--text); display: block; }
.tile:hover { border-color: var(--primary); text-decoration: none; }
.tile strong { display: block; font-size: 16px; }
.tile span { color: var(--muted); font-size: 13px; }
.tile.new { border-style: dashed; border-color: #9db5dd; background: #f7faff; }
.tile.new strong { color: var(--primary); }

/* ---------- 로그인 ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login h1 { text-align: center; }
.login .btn { width: 100%; }

/* ---------- 결재선 지정 ---------- */
.picker .results { border: 1px solid var(--line); border-radius: 6px; margin-top: 6px; max-height: 260px; overflow: auto; background: #fff; }
.picker .results:empty { display: none; }
.picker .res { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.picker .res:last-child { border-bottom: 0; }
.picker .res .who small, .line-item .who small { color: var(--muted); display: block; font-size: 12.5px; }
.picker .res .add { display: flex; gap: 4px; flex-shrink: 0; }
.line-list, .ref-list { list-style: none; margin: 10px 0 0; padding: 0; }
.line-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; background: #fff; }
.line-item .no { width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px; display: grid; place-items: center; flex-shrink: 0; }
.line-item .who { flex: 1; min-width: 0; }
.line-item select { width: auto; min-height: 30px; padding: 2px 6px; }
.line-item .ops { display: flex; gap: 4px; }
.line-item.fixed { background: #f7f8fa; }
.line-item.fixed .no { background: #e6e9ee; color: #56607a; }
.line-label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 0 6px; }
.iconbtn { width: 30px; height: 30px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
.iconbtn:disabled { opacity: .35; cursor: default; }

/* ---------- 입력 양식 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { font-weight: 500; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: inline-block; padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 18px; background: #fff; cursor: pointer; }
.chips input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.chips input:focus-visible + span { outline: 2px solid #7aa2e3; outline-offset: 1px; }
.chip-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.chip-group > b { font-size: 13px; color: var(--muted); min-width: 30px; }
.info-row { display: flex; flex-wrap: wrap; gap: 6px 22px; background: #f7f8fa; border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }
.info-row b { color: var(--muted); font-weight: 600; margin-right: 6px; }
.period { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period input[type=date] { width: 170px; }
.period input[type=number] { width: 90px; }

table.items { width: 100%; border-collapse: collapse; }
table.items th { font-size: 13px; color: var(--muted); text-align: left; padding: 4px 4px 6px; white-space: nowrap; }
table.items td { padding: 3px 4px; vertical-align: top; }
table.items input, table.items select { min-height: 36px; padding: 5px 8px; }
table.items .c-date { width: 150px; } table.items .c-amt { width: 120px; } table.items .c-sel { width: 112px; } table.items .c-x { width: 34px; }
table.items input.amt { text-align: right; }
.total-row { display: flex; justify-content: flex-end; align-items: baseline; gap: 14px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.total-row strong { font-size: 20px; font-variant-numeric: tabular-nums; }

.filelist { list-style: none; padding: 0; margin: 10px 0 0; }
.filelist li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 5px; background: #fff; }
.filelist li.gone { opacity: .45; text-decoration: line-through; }
.filelist .fname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.submitbar { position: sticky; bottom: 0; background: rgba(243,245,248,.95); padding: 12px 0; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 8px; }

/* ---------- 문서 보기 (종이 양식) ---------- */
.paper { background: #fff; border: 1px solid var(--line-strong); padding: 28px; margin-bottom: 16px; color: #000; overflow-x: auto; }
.paper-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.paper-title { font-size: 26px; font-weight: 700; letter-spacing: .35em; margin: 0; flex: 1 1 200px; }
.paper-title.tight { letter-spacing: .05em; }
.paper-meta { font-size: 13px; color: #333; margin-top: 6px; letter-spacing: 0; font-weight: 400; }
.stamps { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
table.stamp { border-collapse: collapse; font-size: 12.5px; flex-shrink: 0; }
table.stamp th, table.stamp td { border: 1px solid #000; text-align: center; padding: 2px 4px; }
table.stamp th.side-label { width: 24px; padding: 4px; line-height: 1.15; font-weight: 600; background: #f1f1f1; }
table.stamp th { font-weight: 600; background: #f1f1f1; min-width: 64px; }
table.stamp td.sig { height: 54px; min-width: 64px; }
table.stamp td.sig b { display: block; font-size: 14px; }
table.stamp td.sig .mk { display: inline-block; font-size: 11.5px; font-weight: 700; border: 1.5px solid currentColor; border-radius: 10px; padding: 0 6px; margin-bottom: 2px; }
table.stamp td.sig.approved .mk, table.stamp td.sig.done .mk { color: #b3261e; }
table.stamp td.sig.rejected .mk { color: #fff; background: #b3261e; border-color: #b3261e; }
table.stamp td.sig.pending .mk { color: #1d4f9f; border-style: dashed; }
table.stamp td.sig.skipped { color: #999; }
table.stamp td.sig.skipped .mk { border: 0; }
table.stamp td.dt { font-size: 11.5px; height: 20px; color: #333; }
table.form { width: 100%; border-collapse: collapse; border: 2px solid #000; }
table.form th, table.form td { border: 1px solid #000; padding: 7px 9px; font-size: 14px; }
table.form th { background: #f1f1f1; font-weight: 600; text-align: center; white-space: nowrap; }
table.form td.c { text-align: center; }
table.form td.pre { white-space: pre-wrap; vertical-align: top; }
table.form .pick { display: inline-block; padding: 0 8px; }
table.form .pick.on { background: #333; color: #fff; font-weight: 700; border-radius: 3px; }
.kind-pick span { margin: 0 6px; padding: 2px 6px; }
.kind-pick span.on { border: 2px solid #000; border-radius: 50%; padding: 4px 10px; }
.paper-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.paper-foot .stamps { margin-left: auto; }
.paper-foot img { height: 40px; width: auto; align-self: flex-end; }
.paper .plea { text-align: center; font-weight: 600; padding: 16px 0; }

.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.thumbs a { display: block; width: 140px; }
.thumbs img { width: 140px; height: 140px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; display: block; }
.thumbs span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.decide { border: 2px solid var(--primary); }
.decide .actions { margin-top: 10px; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.steps li:last-child { border-bottom: 0; }
.steps .stage { font-size: 12px; color: var(--muted); width: 62px; flex-shrink: 0; }
.steps .cm { flex-basis: 100%; margin-left: 72px; color: #444; background: #f7f8fa; border-radius: 6px; padding: 6px 10px; white-space: pre-wrap; }
.steps .st.pending { background: var(--warn-soft); color: var(--warn); }
.steps .st.waiting, .steps .st.skipped { background: #eceff3; color: #56607a; }

/* ---------- 휴대폰 ---------- */
@media (max-width: 860px) {
  .shell { display: block; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: #16233a; color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 20; }
  .topbar a { color: #fff; font-weight: 700; }
  .topbar label { border: 1px solid #40557d; border-radius: 6px; padding: 5px 12px; font-size: 14px; cursor: pointer; display: flex; gap: 6px; align-items: center; }
  .side { display: none; position: static; height: auto; }
  #navtoggle:checked ~ .side { display: flex; }
  .side .brand { display: none; }
  .main { padding: 16px 12px 60px; }
  .grid2 { grid-template-columns: 1fr; }
  h1 { font-size: 20px; }
  .card { padding: 14px; }
  .paper { padding: 14px; }
  .paper-title { font-size: 21px; }
  .stamps { max-width: 100%; overflow-x: auto; }
  table.form { min-width: 640px; }

  /* 목록 표를 카드 모양으로 */
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { padding: 10px 2px; border-bottom: 1px solid var(--line); }
  table.list tr:last-child { border-bottom: 0; }
  table.list td { border: 0; padding: 1px 0; }
  table.list td.title { font-size: 15.5px; }
  table.list td.meta { display: inline-block; width: auto; color: var(--muted); font-size: 13px; margin-right: 10px; }
  table.list td:empty { display: none; }

  /* 지출 내역 표를 카드 모양으로 */
  table.items thead { display: none; }
  table.items, table.items tbody { display: block; }
  table.items tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin-bottom: 8px; position: relative; background: #fbfcfd; }
  table.items td { display: block; padding: 0; width: auto !important; }
  table.items td::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); }
  table.items td.wide { grid-column: 1 / -1; }
  table.items td.c-x { position: absolute; top: 6px; right: 6px; }
  table.items td.c-x::before { content: none; }
  table.items td.c-date { padding-right: 40px; grid-column: 1 / -1; }
  .submitbar .btn { flex: 1; }
  .period input[type=date] { width: 100%; }
}

/* ---------- 인쇄 ---------- */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; font-size: 12pt; }
  .side, .topbar, .noprint, .msgs { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .paper { border: 0; padding: 0; margin: 0; overflow: visible; }
  .card { border: 0; padding: 0; break-inside: avoid; }
  .thumbs a { width: 48%; }
  .thumbs img { width: 100%; height: auto; object-fit: contain; }
}

/* ---------- 자재관리 ---------- */
.main > .inner.wide { max-width: 1400px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { position: sticky; top: 0; background: #f4f6f9; font-size: 12.5px; color: #4a5568; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; text-align: left; }
table.data th.num, table.data td.num { text-align: right; }
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #fafbfd; }
table.data tfoot td { background: #f4f6f9; font-weight: 700; border-top: 1px solid var(--line-strong); }
table.data td .sub { display: block; font-size: 12.5px; color: var(--muted); }
table.data td.name { min-width: 220px; }
table.data td.name a { color: var(--text); font-weight: 600; }
table.data input { min-height: 32px; padding: 3px 8px; }
table.data input.q { width: 110px; text-align: right; }
.neg { color: var(--danger); font-weight: 700; }
.pos { color: var(--ok); }
.zero { color: #a0a8b5; }
.canceled td { color: #9aa3b2; text-decoration: line-through; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 18px; background: #fff; color: var(--text); font-weight: 600; font-size: 14px; }
.tabs a:hover { text-decoration: none; border-color: var(--primary); }
.tabs a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat span { display: block; font-size: 12.5px; color: var(--muted); }
.stat strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.monthnav { display: flex; align-items: center; gap: 8px; }
.monthnav input[type=month] { width: 160px; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font: inherit; }
.lines-search { position: relative; }
.lines-search .drop { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; max-height: 300px; overflow: auto; box-shadow: 0 6px 18px rgba(20,30,50,.12); }
.lines-search .drop:empty { display: none; }
.lines-search .opt { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; }
.lines-search .opt:hover, .lines-search .opt:focus { background: var(--primary-soft); }
.lines-search .opt small { color: var(--muted); display: block; }
.lines-search .opt.dim { color: var(--muted); cursor: default; }
.bombar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; background: #f7f8fa; border-radius: 6px; padding: 12px; margin-bottom: 14px; }
.bombar .field { margin: 0; flex: 1 1 200px; }
.bombar .field.narrow { flex: 0 0 130px; }
details.paste { margin: 10px 0; }
details.paste summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: 14px; }
@media (max-width: 860px) { .grid3 { grid-template-columns: 1fr; } }
@media print { .tablewrap { border: 0; overflow: visible; } }

/* ---------- 메신저 ---------- */
.inner.chatpage { max-width: 1400px; }
.chat { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 48px); min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.rooms { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.rooms-head { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); gap: 8px; }
.rooms-head h1 { font-size: 17px; margin: 0; }
.roomlist { overflow-y: auto; flex: 1; }
.roomitem { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text); }
.roomitem:hover { background: #f7f9fc; text-decoration: none; }
.roomitem.on { background: var(--primary-soft); }
.roomitem .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.roomitem .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roomitem .tm { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.roomitem .bot { display: flex; justify-content: space-between; gap: 8px; margin-top: 2px; }
.roomitem .lt { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #eef2f7; }
.talk-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.talk-head .back { display: none; }
.talk-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk-menu { position: relative; }
.talk-menu summary { list-style: none; }
.talk-menu summary::-webkit-details-marker { display: none; }
.talk-pop { position: absolute; right: 0; top: 36px; z-index: 40; width: 290px; background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; padding: 12px; box-shadow: 0 8px 24px rgba(20,30,50,.15); }
ul.plain { list-style: none; padding: 0; margin: 0 0 10px; max-height: 200px; overflow: auto; }
ul.plain li { padding: 3px 0; }
.msgs-area { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.msgs-area #older { align-self: center; }
.day { align-self: center; font-size: 12px; color: var(--muted); background: #dfe5ee; border-radius: 10px; padding: 1px 10px; margin: 8px 0 2px; }
.sysmsg { align-self: center; font-size: 12.5px; color: #56607a; text-align: center; max-width: 90%; }
.notice { align-self: stretch; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; }
.notice a { font-weight: 600; }
.notice .when { font-size: 12px; color: var(--muted); margin-left: 6px; }
.msg { display: flex; flex-direction: column; max-width: 72%; align-self: flex-start; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg .who { font-size: 12.5px; color: #4a5568; margin: 4px 0 2px 2px; font-weight: 600; }
.msg .line { display: flex; align-items: flex-end; gap: 6px; }
.msg.mine .line { flex-direction: row-reverse; }
.bubble { background: #fff; border-radius: 12px; padding: 8px 11px; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(20,30,50,.06); }
.msg.mine .bubble { background: #d6e4ff; }
.bubble img { max-width: 260px; max-height: 260px; border-radius: 8px; display: block; }
.bubble.file a { font-weight: 600; }
.msg .meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.msg:not(.mine) .meta { align-items: flex-start; }
.msg .meta .unread { color: #c47f00; font-weight: 700; }
.bubble.gone, .msg.mine .bubble.gone { background: #e3e7ee; color: #8a93a3; font-style: italic; font-size: 13.5px; box-shadow: none; }
.delmsg { border: 0; background: none; padding: 0; font: inherit; font-size: 11.5px; color: #b3261e; cursor: pointer; opacity: 0; }
.msg:hover .delmsg, .delmsg:focus { opacity: 1; }
@media (hover: none) { .delmsg { opacity: .75; } }  /* 터치 화면에서는 항상 보이게 */
.composer { background: #fff; border-top: 1px solid var(--line); padding: 8px 10px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 40px; max-height: 140px; resize: none; }
.chips-files { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-files:not(:empty) { margin-bottom: 8px; }
.chips-files span { background: var(--primary-soft); border-radius: 14px; padding: 3px 6px 3px 10px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.chips-files button { border: 0; background: none; cursor: pointer; font-size: 13px; color: var(--muted); }
.talk-empty { margin: auto; }
.talk.drag { outline: 3px dashed var(--primary); outline-offset: -6px; }
.people { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; margin-top: 6px; }
.person { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 400; cursor: pointer; }
.person:last-child { border-bottom: 0; }
.person[hidden] { display: none; }
@media (max-width: 860px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 54px); height: calc(100dvh - 54px); border: 0; border-radius: 0; margin: -16px -12px -60px; }
  input, select, textarea { font-size: 16px !important; }  /* 아이폰에서 입력할 때 화면이 확대되지 않도록 */
  .chat.has-room .rooms { display: none; }
  .chat:not(.has-room) .talk { display: none; }
  .talk-head .back { display: inline-flex; }
  .msg { max-width: 86%; }
  .inner.chatpage { padding-bottom: 0; }
}

/* ---------- 공지사항 ---------- */
.notice-body { line-height: 1.75; overflow-wrap: anywhere; }
.noticebox { border-left: 4px solid var(--primary); }

/* ---------- 접속 상태 ---------- */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: #b6bdc9; vertical-align: 1px; flex-shrink: 0; }
.dot.green { background: #22a565; } .dot.orange { background: #e8870d; } .dot.blue { background: #2f7de1; }
.dot.yellow { background: #d9b100; } .dot.purple { background: #8e5bd0; } .dot.gray { background: #b6bdc9; }
.stpill { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12.5px; font-weight: 700; background: #eceff3; color: #56607a; }
.stpill.green { background: var(--ok-soft); color: var(--ok); } .stpill.orange { background: #fdebd3; color: #a55a00; }
.stpill.blue { background: var(--primary-soft); color: var(--primary); } .stpill.yellow { background: #fbf3c7; color: #7a6400; }
.stpill.purple { background: #efe6fb; color: #6a3bb0; }
.stlabel { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.mystatus { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 2px; }
.mystatus select, .mystatus input { min-height: 30px; padding: 3px 8px; font-size: 13px; background: #22324f; border-color: #3a4d72; color: #fff; }
.mystatus input::placeholder { color: #8ea0bd; }
.picker .who .dot, .line-item .who .dot { margin-right: 5px; }
.side .who.top { margin: 0 0 8px; padding: 0 10px 12px; border-top: 0; border-bottom: 1px solid #2a3a57; flex-shrink: 0; }
#peer-status { margin-left: 10px; }
@media (max-width: 860px) { table.list[style*="fixed"] { table-layout: auto !important; } }
