/* 에이아이리랑 팩스 — Stitch 시안(프로젝트 15500538295293068930 «AIrirang Fax») 토큰을 옮긴 것 */
:root {
  --bg: #f7f9fb;
  --surface: #ffffff;
  --well: #f2f4f6;
  --well-2: #eceef0;
  --line: #e2e8f0;
  --line-strong: #c6c6cd;
  --text: #191c1e;
  --muted: #45464d;
  --faint: #76777d;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --ok-bg: #dcfce7; --ok-fg: #15803d; --ok-line: #bbf7d0;
  --run-bg: #fef3c7; --run-fg: #b45309; --run-line: #fde68a;
  --bad-bg: #fee2e2; --bad-fg: #b91c1c; --bad-line: #fecaca;
  --idle-bg: #f1f5f9; --idle-fg: #475569; --idle-line: #e2e8f0;
  --radius: 4px;
  --radius-lg: 8px;
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "D2Coding", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.mono, input.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── 상단 막대 ── */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
  height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; }
.brand svg { color: var(--accent); width: 22px; height: 22px; }
.top-mid { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--well); border: 1px solid var(--line-strong); border-radius: var(--radius);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill .lbl { color: var(--muted); font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: #16a34a; }
.dot.wait { background: #d97706; }
.dot.bad { background: #dc2626; }
.top-right { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.link-btn { background: none; border: 0; padding: 0; color: #ba1a1a; font-weight: 600; font-size: 12px; }
.link-btn:hover { text-decoration: underline; }

/* ── 본문 ── */
main {
  flex: 1;
  display: grid;
  grid-template-columns: 440px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
  align-items: start;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
}
.card-h { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-h h2 { margin: 0; font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.card-h h2 svg { color: var(--accent); }
.card-h p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; background: var(--well-2); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--muted); white-space: nowrap; }

/* 보내기 */
form.send { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.field label { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.field label .req { color: #ba1a1a; margin-left: 2px; }
.field label .opt { color: var(--muted); font-weight: 400; }
.field input[type=text], .field input[type=tel], .field input[type=password] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 9px 12px; font-size: 14px;
}
.field input:focus { outline: 2px solid rgba(37, 99, 235, .15); border-color: var(--accent); }
.field input.num { font-size: 15px; letter-spacing: .02em; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.hint.err { color: #b91c1c; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.chips:empty { display: none; }
.chips .lbl { font-size: 11px; color: var(--muted); margin-right: 2px; }
.chip { padding: 2px 8px; font-size: 12px; background: var(--well-2); border: 1px solid var(--line-strong); border-radius: var(--radius); font-variant-numeric: tabular-nums; }
.chip:hover { background: #e6e8ea; }

.drop {
  border: 2px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--well);
  padding: 22px 16px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.drop:hover, .drop.over { background: var(--well-2); border-color: var(--accent); }
.drop .ic { width: 38px; height: 38px; border-radius: var(--radius); background: #e0e3e5; display: grid; place-items: center; color: var(--muted); }
.drop strong { font-size: 14px; }
.drop span { font-size: 12px; color: var(--muted); }
.file {
  display: none;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 10px 12px; align-items: center; gap: 12px;
}
.file.on { display: flex; }
.file .pdf { width: 36px; height: 36px; border-radius: var(--radius); background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; display: grid; place-items: center; font-size: 10px; font-weight: 800; flex: none; }
.file .meta { min-width: 0; flex: 1; }
.file .name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .size { font-size: 12px; color: var(--muted); }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: var(--radius); color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--well-2); color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--surface); padding: 7px 12px; font-size: 13px; font-weight: 600;
  text-decoration: none; color: var(--text); white-space: nowrap;
}
.btn:hover { background: var(--bg); border-color: #94a3b8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; padding: 11px 16px; font-size: 14px; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary:disabled { background: #94a3b8; border-color: #94a3b8; cursor: not-allowed; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger { color: #b91c1c; border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.solid-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.solid-danger:hover { background: #b91c1c; }
.limit { font-size: 12px; color: var(--muted); text-align: center; }
.notice { font-size: 13px; border-radius: var(--radius); padding: 10px 12px; display: none; }
.notice.on { display: block; }
.notice.ok { background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-line); }
.notice.bad { background: var(--bad-bg); color: var(--bad-fg); border: 1px solid var(--bad-line); }
.notice.wait { background: var(--run-bg); color: var(--run-fg); border: 1px solid var(--run-line); }

/* 목록 */
.list { display: flex; flex-direction: column; min-width: 0; min-height: 480px; }
.toolbar { padding: 14px 16px; border-bottom: 1px solid var(--line-strong); background: var(--well); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.tabs { display: inline-flex; padding: 4px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); gap: 2px; }
.tab { white-space: nowrap; border: 0; background: none; padding: 6px 14px; border-radius: var(--radius); font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.tab[aria-selected=true] { background: var(--well-2); color: var(--accent); }
.tab .n { font-size: 11px; padding: 0 6px; border-radius: var(--radius); background: #e0e3e5; color: var(--muted); font-weight: 700; }
.tab[aria-selected=true] .n { background: var(--accent); color: #fff; }
.tab .new { font-size: 11px; font-weight: 700; color: #1e40af; background: #dbe1ff; padding: 0 6px; border-radius: var(--radius); }
.tools { display: flex; gap: 8px; align-items: center; }
.search { position: relative; }
.search input { width: 220px; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px 10px 6px 30px; font-size: 13px; background: var(--surface); }
.search svg { position: absolute; left: 8px; top: 8px; width: 16px; height: 16px; color: var(--muted); }

.table-wrap { overflow-x: auto; flex: 1; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 16px; background: var(--well); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
th.r, td.r { text-align: right; }
th.c, td.c { text-align: center; }
tr.unread { background: rgba(239, 246, 255, .7); box-shadow: inset 4px 0 0 var(--accent); }
tr.failed { background: rgba(254, 242, 242, .45); }
td .sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
td .sub.bad { color: #b91c1c; }
.st { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--radius); font-size: 11px; font-weight: 600; border: 1px solid; white-space: nowrap; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.done, .st.new { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-line); }
.st.sending, .st.waiting { background: var(--run-bg); color: var(--run-fg); border-color: var(--run-line); }
.st.failed { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-line); }
.st.read, .st.unknown, .st.canceled { background: var(--idle-bg); color: var(--idle-fg); border-color: var(--idle-line); }
.st.read::before, .st.unknown::before, .st.canceled::before { display: none; }
.acts { display: inline-flex; gap: 6px; }
.empty { padding: 56px 16px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.foot { padding: 10px 16px; border-top: 1px solid var(--line-strong); background: var(--well); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.err-box { padding: 40px 16px; text-align: center; color: #b91c1c; }

/* 로그인 */
.login-wrap { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; }
.login form { padding: 20px; display: flex; flex-direction: column; gap: 16px; }

/* 좁은 화면 */
@media (max-width: 1100px) {
  main { grid-template-columns: minmax(0, 1fr); }
  .top-mid .lbl-long { display: none; }
}
@media (max-width: 720px) {
  .top { padding: 0 16px; height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .top-mid { order: 3; width: 100%; overflow-x: auto; }
  main { padding: 16px; gap: 16px; }
  .search input { width: 150px; }
  th.hide-s, td.hide-s { display: none; }
  td, th { padding: 10px; }
}

/* 표 안 숫자·날짜는 줄을 바꾸지 않는다 */
td.num, td .num { white-space: nowrap; }
@media (max-width: 720px) {
  .tab { padding: 6px 10px; gap: 6px; }
  .tab svg { display: none; }
  .toolbar { padding: 12px; }
  .tools { width: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .top-right { gap: 10px; }
  td .acts { flex-direction: column; align-items: stretch; }
}

/* 비밀번호 바꾸기 창 */
.link-btn.plain { color: var(--muted); }
.pw-dialog { padding: 0; width: min(420px, calc(100vw - 32px)); border: 1px solid var(--line-strong); }
.pw-dialog::backdrop { background: rgba(15, 23, 42, .35); }
.pw-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.pw-acts { display: flex; justify-content: flex-end; gap: 8px; }
.pw-acts .btn.primary { padding: 8px 16px; font-size: 13px; }
