/* RPA 메일 작성기 */
:root {
  --font: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  --mono: 'D2Coding', 'Cascadia Mono', Consolas, 'Courier New', monospace;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e2e6ec;
  --border-strong: #cdd3dc;
  --text: #1a1f2b;
  --text-2: #4a5263;
  --text-3: #7c8495;

  --primary: #1f5eff;
  --primary-hover: #1a50db;
  --primary-soft: #eaf0ff;
  --primary-ring: rgba(31, 94, 255, 0.22);

  --ok: #0f8a4f;      --ok-soft: #e6f6ee;
  --warn: #b26a00;    --warn-soft: #fff4e0;
  --error: #d1343b;   --error-soft: #fdecec;
  --info: #2763c9;    --info-soft: #e9f1ff;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, 0.25);

  --topbar-h: 52px;
  --gap: 16px;
  --control-h: 34px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.muted { color: var(--text-3); }
.strong { font-weight: 600; }
.mono { font-family: var(--mono); font-size: 13px; }
.tabular { font-variant-numeric: tabular-nums; }
.num { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.text-error { color: var(--error); }
.icon { display: inline-flex; flex: none; }
.icon svg { display: block; }

/* ---------- 상단 바 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 28px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: -0.02em; white-space: nowrap; }
.topnav { display: flex; gap: 4px; height: 100%; }
.topnav a {
  display: flex; align-items: center; padding: 0 12px;
  color: var(--text-2); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.topnav a:hover { color: var(--text); }
.topnav a.active { color: var(--primary); border-bottom-color: var(--primary); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--text-2); }
.version { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.user { font-weight: 500; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control-h); padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); border-color: #b9c1cd; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn-danger:hover { background: #b82a30; border-color: #b82a30; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 40px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-primary .spinner, .btn-danger .spinner { border-color: rgba(255,255,255,.4); border-top-color: #fff; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--text-3); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn-danger:hover { background: var(--error-soft); color: var(--error); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
a.icon-btn { text-decoration: none; }
.icon-btn.is-disabled { opacity: .35; pointer-events: none; cursor: default; }

/* ---------- 입력 ---------- */
.input {
  width: 100%; height: var(--control-h); padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
  min-width: 0;
}
.input:hover { border-color: #b9c1cd; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.input:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.input.is-readonly, .input[readonly] { background: var(--surface-2); color: var(--text-2); }
.input.is-readonly:focus { box-shadow: none; border-color: var(--border-strong); }
select.input { padding-right: 28px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237c8495' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }
.input-sm { height: 30px; font-size: 13px; padding: 0 8px; }
.input.is-unmatched { border-color: #e6b866; background: #fffaf0; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field-label .req { color: var(--error); margin-left: 3px; }
.inline-field { display: flex; align-items: center; gap: 8px; }
.inline-field .input { width: 200px; }

.search-box { position: relative; display: flex; align-items: center; }
.search-box > svg, .search-box > .icon { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.search-box .input { padding-left: 32px; }
.search-inline { width: 240px; }

/* ---------- 배지·스피너 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.badge-xs { height: 18px; padding: 0 6px; font-size: 11px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-error { background: var(--error-soft); color: var(--error); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #eef0f4; color: var(--text-3); }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); font-weight: 500; }
.method-ai { border-color: #c7d6ff; color: var(--primary); background: var(--primary-soft); }
.method-rule { border-color: #b9e2cc; color: var(--ok); background: var(--ok-soft); }
.method-cache { border-color: var(--border-strong); color: var(--text-2); }
.count-badge { font-size: 12px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }

.spinner {
  display: inline-block; flex: none;
  width: 14px; height: 14px;
  border: 2px solid rgba(39, 99, 201, 0.25); border-top-color: var(--info);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.badge .spinner { width: 11px; height: 11px; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px;
}
.alert-error { background: var(--error-soft); color: var(--error); }

/* ---------- 카드·표 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 15px; }
.panel-title { font-size: 14px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  position: sticky; top: 0;
  padding: 9px 12px; text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--text-3);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table th.num { text-align: right; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfc; }
.table td.act { width: 1%; white-space: nowrap; text-align: right; }
.table-dense td { padding: 7px 12px; }
.cell-clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-foot { padding: 10px 18px; font-size: 12.5px; border-top: 1px solid var(--border); text-align: right; }
.row-actions { display: inline-flex; gap: 2px; }

.empty-state, .state-box {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 36px 16px; color: var(--text-3); font-size: 13.5px;
}
.state-box { flex-direction: column; padding: 56px 16px; }
.state-error { color: var(--error); }

/* ---------- 메인 ---------- */
.page-main { overflow: hidden; }
.workspace {
  height: calc(100vh - var(--topbar-h));
  display: grid; grid-template-columns: 280px minmax(0, 1fr);
}
.exporter-panel {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-right: 1px solid var(--border);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px; }
.exporter-panel .search-box { margin: 0 12px 10px; }
.exporter-list { list-style: none; margin: 0; padding: 0 8px 12px; overflow-y: auto; flex: 1; min-height: 0; }
.exporter-item {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: center;
  padding: 8px 10px; margin-bottom: 2px;
  border-radius: var(--radius-sm); cursor: pointer;
}
.exporter-item:hover { background: var(--surface-2); }
.exporter-item:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--primary-ring); }
.exporter-item.selected { background: var(--primary-soft); }
.exporter-item.selected::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}
.exporter-item.selected .exporter-name { color: var(--primary); }
.exporter-name { grid-column: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exporter-sub { grid-column: 1; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exporter-item .badge { grid-column: 2; grid-row: 1 / span 2; }
.list-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 8px; color: var(--text-3); font-size: 13px; }
.list-error { color: var(--error); }

.job { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.job-scroll {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 20px 24px; display: flex; flex-direction: column; gap: var(--gap);
}
.job-scroll > * { width: 100%; max-width: 1200px; margin: 0 auto; }

.dropzone {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 92px; padding: 16px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text-2);
  font-weight: 600; cursor: pointer;
  transition: border-color .12s, background-color .12s, color .12s;
}
.dropzone:hover, .dropzone:focus-visible { outline: none; border-color: var(--primary); color: var(--primary); background: #fbfcff; }
.dropzone.dragover { border-color: var(--primary); border-style: solid; background: var(--primary-soft); color: var(--primary); }
.dropzone.disabled { cursor: not-allowed; color: var(--text-3); background: var(--surface-2); border-color: var(--border); }

.file-table { table-layout: fixed; min-width: 960px; }
.file-table .c-name { width: auto; }
.file-table .c-status { width: 108px; }
.file-table .c-method { width: 84px; }
.file-table .c-type { width: 104px; }
.file-table .c-inv { width: 22%; }
.file-table .c-buyer { width: 24%; }
.file-table .c-cost { width: 76px; }
.file-table .c-act { width: 76px; }
.file-table td { padding: 7px 12px; }
.doc-select {
  height: 24px; max-width: 100%; padding: 0 22px 0 9px;
  border: 1px solid transparent; border-radius: 999px;
  font-size: 12px; font-weight: 600; cursor: pointer; appearance: none;
  background-color: var(--surface-2); color: var(--text-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%237c8495' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center;
}
.doc-select:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.doc-select:disabled { opacity: .5; cursor: not-allowed; }
.doc-select option { background: var(--surface); color: var(--text); font-weight: 500; }
.doc-none { background-color: transparent; border-color: var(--border); color: var(--text-3); font-weight: 500; }
.doc-invoice { background-color: var(--primary-soft); color: var(--primary); }
.doc-packing_list { background-color: #f1ecff; color: #6a3fd1; }
.doc-invoice_packing { background-color: #e6f6f4; color: #0b7a6e; }
.doc-other { background-color: #eef0f4; color: var(--text-3); }
.file-name { min-width: 0; }
.file-name-line { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--text); }
.file-name-line .icon { color: var(--text-3); }
.file-msg { font-size: 12px; color: var(--text-3); padding-left: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-msg:empty { display: none; }
.row-failed .file-msg { color: var(--error); }
.file-extra { padding-left: 22px; }
.file-extra:empty { display: none; }
.file-extra .btn { margin-top: 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.text-warn { color: var(--warn); }

/* 창 전체 드롭 */
.drop-overlay {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(31, 94, 255, 0.10);
  backdrop-filter: blur(1px);
}
.drop-overlay::before {
  content: ''; position: absolute; inset: 16px;
  border: 2px dashed var(--primary); border-radius: var(--radius-lg);
  pointer-events: none;
}
.drop-overlay-inner {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 28px 44px; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--primary);
  font-size: 16px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

/* 수출자 선택 대화상자 */
.dialog-pick { width: min(440px, calc(100vw - 32px)); }
.dialog-pick .dialog-body { gap: 10px; }
.pick-file { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-2); font-size: 13px; }
.pick-file .icon { color: var(--text-3); }
.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick-list-all { max-height: 46vh; overflow-y: auto; gap: 2px; margin: 0 -4px; padding: 0 4px; }
.pick-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  width: 100%; padding: 9px 12px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer;
  transition: background-color .12s, border-color .12s;
}
.pick-list-all .pick-item { border-color: transparent; }
.pick-item:hover { background: var(--primary-soft); border-color: #c7d6ff; }
.pick-item:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.pick-name { max-width: 100%; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-sub { max-width: 100%; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-empty { padding: 20px 8px; text-align: center; font-size: 13px; }
.foot-spacer { flex: 1; }

.field-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px; padding: 18px;
}
.field-wide { grid-column: 1 / -1; }

.actionbar {
  flex: none; position: relative; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  min-height: 60px; padding: 10px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 12px -8px rgba(16, 24, 40, 0.12);
}
.actionbar-info { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; }
.actionbar-exporter { min-width: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actionbar-exporter:empty { display: none; }
.actionbar-status { flex: none; display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.actionbar-buttons { flex: none; display: flex; align-items: center; gap: 8px; }
.actionbar-buttons .btn { white-space: nowrap; }

/* ---------- 대화상자 ---------- */
.dialog {
  padding: 0; border: 0; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
}
.dialog[open] { display: flex; flex-direction: column; animation: dlg-in .14s ease-out; }
.dialog::backdrop { background: rgba(15, 20, 30, 0.42); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
.dialog-sm { width: min(400px, calc(100vw - 32px)); }
.dialog-form { width: min(640px, calc(100vw - 32px)); }
.dialog-result { width: min(720px, calc(100vw - 32px)); }
.dialog-form-inner { display: flex; flex-direction: column; min-height: 0; max-height: inherit; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; }
.dialog-head h2 { font-size: 16px; }
.dialog-body { padding: 4px 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.dialog-text { margin: 0; color: var(--text-2); word-break: break-all; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-section { font-size: 13px; color: var(--text-3); font-weight: 600; padding-top: 6px; border-top: 1px solid var(--border); padding-top: 14px; }

.preview {
  margin: 0; padding: 14px 16px;
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-all;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  max-height: 52vh; overflow: auto;
  user-select: all;
}
.result-meta { display: flex; align-items: center; gap: 8px; min-height: 22px; font-size: 13px; color: var(--text-2); }
.result-meta:empty { display: none; }
.result-rpa { margin-right: auto; min-width: 0; font-family: var(--mono); font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-meta .icon { color: var(--ok); }
.meta-sep { width: 1px; height: 14px; background: var(--border-strong); }
.result-autoclose { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; min-width: 0; font-size: 13px; font-weight: 600; color: var(--ok); white-space: nowrap; }
.result-autoclose[hidden] { display: none; }
.result-autoclose:not([hidden]) + .result-rpa { display: none; }
.result-autoclose-sec { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; background: var(--ok); color: #fff; font-size: 14px; font-variant-numeric: tabular-nums; }

/* 메일 발송 확인 */
.dialog-mail { width: min(600px, calc(100vw - 32px)); }
.mail-meta { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px 12px; margin: 0; font-size: 13.5px; }
.mail-meta dt { color: var(--text-3); padding-top: 1px; }
.mail-meta dd { margin: 0; min-width: 0; word-break: break-all; }
.mail-to { font-family: var(--mono); font-size: 13px; }
.mail-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mail-files li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mail-files .icon { color: var(--text-3); flex: none; }
.mail-files .truncate { flex: 1 1 auto; }
.mail-files .mail-size { flex: none; color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.mail-files li.is-missing .truncate { color: var(--error); }
.mail-body summary { cursor: pointer; font-size: 13px; color: var(--text-2); user-select: none; }
.mail-body summary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); border-radius: var(--radius-sm); }
.mail-body .preview { margin-top: 8px; max-height: 32vh; font-size: 12.5px; user-select: text; }
/* 메일 이력(관리 화면) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mail-table .mail-row { cursor: pointer; }
.mail-toggle .icon { transition: transform .15s ease; }
.mail-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.mail-table .mail-row.is-open td { background: var(--surface-2); border-bottom-color: transparent; }
.mail-table tr.mail-detail td { background: var(--surface-2); padding: 4px 18px 16px 52px; }
.mail-table tr.mail-detail:hover td { background: var(--surface-2); }
.mail-detail-body { display: flex; flex-direction: column; gap: 12px; }
.mail-detail-grid { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 10px 12px; align-items: start; }
.mail-detail-label { font-size: 12.5px; color: var(--text-3); padding-top: 2px; }
.mail-body-text { margin: 0; font-family: inherit; font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-all; color: var(--text); }
.mail-attach-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mail-attach-list .file-link { max-width: 100%; }
.mail-error-code { color: var(--text-3); font-size: 12px; word-break: break-all; }
.mail-detail-body .alert { flex-wrap: wrap; }
.mail-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.dialog-foot .mail-total { margin-right: auto; align-self: center; color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ---------- 토스트 ---------- */
.toast-host { position: fixed; left: 50%; top: calc(var(--topbar-h) + 72px); transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  background: #1a1f2b; color: #fff; font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-8px);
  transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: none; }
.toast-ok .icon { color: #5fd69a; }
.toast-error { background: var(--error); }

/* ---------- 로그인 ---------- */
.page-login { background: linear-gradient(180deg, #eef2f8 0%, var(--bg) 100%); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 16px;
  padding: 32px 30px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-brand h1 { font-size: 20px; letter-spacing: -0.02em; }
.login-card .input { height: 40px; }

/* ---------- 관리 ---------- */
.admin { max-width: 1280px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.admin-head { display: flex; flex-direction: column; gap: 14px; }
.page-title { font-size: 20px; letter-spacing: -0.02em; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  padding: 10px 16px; border: 0; background: transparent;
  color: var(--text-2); font-weight: 500; white-space: nowrap; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--primary-ring); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.admin-body { overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.settings-form { display: flex; flex-direction: column; gap: 14px; max-width: 480px; padding: 18px; }
.settings-actions { display: flex; justify-content: flex-end; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; max-width: 240px; height: 22px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; overflow: hidden; }
.chip-key { padding: 0 6px; height: 100%; display: inline-flex; align-items: center; background: var(--surface-2); color: var(--text-3); border-right: 1px solid var(--border); white-space: nowrap; }
.chip-val { padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.alias-box { display: flex; flex-direction: column; gap: 8px; }
.alias-add { display: flex; gap: 8px; }
.alias-add .input { flex: 1; }
.alias-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 220px; overflow-y: auto; }
.alias-list:empty { display: none; }
.alias-item { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 3px 4px 3px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.alias-item:last-child { border-bottom: 0; }
.alias-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alias-state { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 8px; font-size: 13px; color: var(--text-3); }

.streak { display: flex; align-items: center; gap: 10px; }
.progress { width: 120px; height: 6px; border-radius: 999px; background: #e8ebf0; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: inherit; transition: width .2s; }
.progress-bar.is-done { background: var(--ok); }

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 18px; }
.stat-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; background: var(--surface); }
.stat-title { font-size: 13px; font-weight: 600; color: var(--text-3); }
.stat-main { display: flex; align-items: baseline; gap: 4px; margin: 6px 0 14px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.stat-unit { color: var(--text-3); font-weight: 500; }
.stat-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; padding-top: 12px; border-top: 1px solid var(--border); }
.stat-list dt { font-size: 12px; color: var(--text-3); }
.stat-list dd { margin: 2px 0 0; font-weight: 600; }
.section-title { font-size: 14px; padding: 4px 18px 10px; }

/* ---------- 수정 기록 ---------- */
.nowrap { white-space: nowrap; }
.summary-head { display: flex; align-items: baseline; gap: 8px; padding: 16px 18px 10px; }
.summary-title { font-size: 14px; }
.corr-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 0 18px 18px; }
.mini-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; min-width: 0; }
.mini-title { padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--border); }
.mini-scroll { max-height: 232px; overflow-y: auto; }
.table-mini { font-size: 13px; }
.table-mini th, .table-mini td { padding: 7px 12px; }
.mini-empty { padding: 24px 12px; font-size: 13px; text-align: center; }
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; padding: 12px 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.filter-bar .inline-field .input { width: 180px; }
.filter-bar .inline-field .input-date { width: 150px; }
.corr-auto { color: var(--text-3); }
.corr-final { font-weight: 600; }
.file-link { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; color: var(--primary); }
.file-link:hover span { text-decoration: underline; }

/* ---------- 캘린더 ---------- */
/* 사이드바(일정 쓰기·미니 달력) + 툴바 + 본문. 화면 높이를 채우고 스크롤은 본문 안에서만. */
.page-calendar { overflow: hidden; }
.cal-app {
  --cal-head-h: 28px; --cal-lane-h: 22px; --cal-wk-pad: 6px;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "side toolbar" "side body";
  background: var(--surface);
}
.cal-side {
  grid-area: side; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 20px;
  padding: 16px; border-right: 1px solid var(--border); background: var(--surface);
}
.cal-write { width: 100%; height: 38px; font-size: 14px; font-weight: 600; }

/* 미니 달력 */
.cal-mini { display: flex; flex-direction: column; gap: 4px; }
.cal-mini-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 4px 6px; }
.cal-mini-title { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-mini-nav { display: flex; gap: 2px; }
.cal-mini-nav .icon-btn { width: 26px; height: 26px; color: var(--text-2); }
.cal-mini-dow, .cal-mini-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-mini-dow span { font-size: 11px; line-height: 22px; color: var(--text-3); text-align: center; }
.cal-mini-dow .is-sun { color: var(--error); }
.cal-mini-dow .is-sat { color: var(--info); }
.cal-mini-day {
  position: relative; display: flex; flex-direction: column; align-items: center;
  height: 32px; padding: 2px 0 0; border: 0; background: transparent;
  color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer;
}
.cal-mini-day.is-in-view { background: var(--primary-soft); }
.cal-mini-num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 999px; }
.cal-mini-day:hover .cal-mini-num { background: rgba(16, 24, 40, 0.07); }
.cal-mini-day:focus-visible { outline: none; }
.cal-mini-day:focus-visible .cal-mini-num { box-shadow: 0 0 0 2px var(--primary-ring); }
.cal-mini-day.is-sat { color: var(--info); }
.cal-mini-day.is-sun, .cal-mini-day.is-holiday { color: var(--error); }
.cal-mini-day.is-outside { opacity: .45; }
.cal-mini-day.is-today { opacity: 1; }
.cal-mini-day.is-today .cal-mini-num { background: var(--primary); color: #fff; font-weight: 600; }
.cal-mini-dot { position: absolute; bottom: 2px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 999px; background: var(--text-3); }

/* 툴바 */
.cal-toolbar {
  grid-area: toolbar; min-width: 0;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
}
.cal-toolbar-nav { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cal-arrows { display: flex; gap: 2px; }
.cal-arrows .icon-btn { color: var(--text-2); }
.cal-title { margin-left: 4px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-mini-toggle, .cal-add-mobile { display: none; }
.cal-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.cal-search { width: 220px; }
.cal-search .input { padding-right: 30px; }
.cal-search input::-webkit-search-cancel-button { display: none; -webkit-appearance: none; }
.cal-search-clear { position: absolute; right: 2px; width: 26px; height: 26px; }
.cal-views { display: inline-flex; height: 32px; padding: 2px; gap: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.cal-view-btn {
  min-width: 44px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent;
  color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer;
}
.cal-view-btn:hover { color: var(--text); }
.cal-view-btn[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--border), var(--shadow-sm); }
.cal-view-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }

/* 본문 */
.cal-body { grid-area: body; position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.cal-progress { position: absolute; top: 0; left: 0; right: 0; z-index: 3; height: 2px; overflow: hidden; opacity: 0; pointer-events: none; transition: opacity .15s; }
.cal-progress.is-on { opacity: 1; transition-delay: .15s; }
.cal-progress::before { content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: var(--primary); animation: cal-progress 1.1s ease-in-out infinite; }
@keyframes cal-progress { to { left: 100%; } }
.cal-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cal-state { flex: 1; }
.cal-state .btn { margin-top: 4px; }

/* 월 보기: 주 줄 높이 고정, 넘치는 날은 +N */
.cal-month, .cal-weekview { flex: 1; min-height: 0; display: flex; flex-direction: column; -webkit-user-select: none; user-select: none; }
.cal-dow { flex: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.cal-dow > div { height: 32px; padding: 0 12px; font-size: 12px; font-weight: 500; line-height: 32px; color: var(--text-3); }
.cal-dow .is-sun { color: var(--error); }
.cal-dow .is-sat { color: var(--info); }
.cal-weeks { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-height: 0; }
.cal-week > * { min-width: 0; }
.cal-weeks > .cal-week { flex: 1 1 0; overflow: hidden; border-bottom: 1px solid var(--border); }
.cal-weeks > .cal-week:last-child { border-bottom: 0; }
.cal-cell {
  min-height: 0; padding: 4px 4px 0 6px;
  border-right: 1px solid var(--border); background: var(--surface);
  cursor: pointer; outline: none;
}
.cal-cell:nth-child(7) { border-right: 0; }
.cal-cell:hover { background: #fafbfd; }
.cal-cell:focus-visible { box-shadow: inset 0 0 0 2px var(--primary-ring); }
.cal-cell.is-selecting { background: #eef3ff; }
.cal-cell.is-drop { background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary-ring); }
.cal-view.is-dragging .cal-cell:not(.is-selecting) { background: var(--surface); }
.cal-day { display: flex; align-items: center; gap: 6px; height: 24px; min-width: 0; }
.cal-num {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums;
}
.cal-holiday { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--error); }
.cal-cell.is-sat .cal-num { color: var(--info); }
.cal-cell.is-sun .cal-num, .cal-cell.is-holiday .cal-num { color: var(--error); }
.cal-cell.is-outside .cal-num, .cal-cell.is-outside .cal-holiday { opacity: .45; }
.cal-cell.is-today .cal-num { background: var(--primary); color: #fff; font-weight: 600; opacity: 1; }

/* 일정 색 팔레트: 키(data-color) → --cal-ev. 모두 흰 글자 대비 4.5:1 이상. 키 목록은 api.py EVENT_COLORS와 같다. */
.cal-event, .cal-swatch, .cal-dot { --cal-ev: var(--primary); }
.cal-event[data-color="green"], .cal-swatch[data-color="green"], .cal-dot[data-color="green"] { --cal-ev: #0f7b45; }
.cal-event[data-color="red"], .cal-swatch[data-color="red"], .cal-dot[data-color="red"] { --cal-ev: #c62f36; }
.cal-event[data-color="orange"], .cal-swatch[data-color="orange"], .cal-dot[data-color="orange"] { --cal-ev: #b45309; }
.cal-event[data-color="purple"], .cal-swatch[data-color="purple"], .cal-dot[data-color="purple"] { --cal-ev: #7c3aed; }
.cal-event[data-color="teal"], .cal-swatch[data-color="teal"], .cal-dot[data-color="teal"] { --cal-ev: #0f766e; }
.cal-event[data-color="pink"], .cal-swatch[data-color="pink"], .cal-dot[data-color="pink"] { --cal-ev: #be185d; }
.cal-event[data-color="gray"], .cal-swatch[data-color="gray"], .cal-dot[data-color="gray"] { --cal-ev: #4b5563; }

/* 일정 막대 */
.cal-event {
  position: relative; z-index: 1; align-self: start;
  display: block; min-width: 0; height: calc(var(--cal-lane-h) - 2px); margin: 0 4px; padding: 0 6px;
  border: 0; border-radius: 4px; background: var(--cal-ev); color: #fff;
  font-size: 12px; font-weight: 500; line-height: calc(var(--cal-lane-h) - 2px); text-align: left; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-event-kind { color: rgba(255, 255, 255, 0.85); font-weight: 400; }
.cal-event-memo { margin-left: 4px; vertical-align: middle; position: relative; top: -1px; color: rgba(255, 255, 255, 0.8); }
.cal-event.is-cont-left { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-event.is-cont-right { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-event.is-outside { opacity: .6; }
.cal-event:hover { box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.14); }
.cal-event:focus-visible { outline: none; box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.14), 0 0 0 2px var(--surface), 0 0 0 4px var(--cal-ev); }
.cal-event-handle { position: absolute; top: 0; right: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.cal-event.is-drag-src { opacity: .35; }
.cal-more {
  position: relative; z-index: 1; align-self: start;
  height: calc(var(--cal-lane-h) - 2px); margin: 0 4px; padding: 0 6px;
  border: 0; border-radius: 4px; background: transparent;
  color: var(--text-2); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; overflow: hidden; cursor: pointer;
}
.cal-more:hover { background: var(--surface-2); color: var(--text); }
.cal-more:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--primary-ring); }
.cal-drag-chip {
  position: fixed; z-index: 950; max-width: 280px; height: 22px; margin: 0;
  line-height: 22px; opacity: .9; pointer-events: none; box-shadow: var(--shadow-lg);
}
.cal-drag-range { margin-left: 8px; color: rgba(255, 255, 255, 0.85); font-weight: 400; font-variant-numeric: tabular-nums; }
body.cal-moving, body.cal-moving * { cursor: grabbing !important; }
body.cal-resizing, body.cal-resizing * { cursor: ew-resize !important; }

/* 좁은 화면 월 칸: 짧은 막대 */
.cal-month.is-compact .cal-dow > div { padding: 0; text-align: center; }
.cal-month.is-compact .cal-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 3px 2px 0; }
.cal-month.is-compact .cal-day { justify-content: center; height: 22px; }
.cal-month.is-compact .cal-holiday { display: none; }
.cal-marks { display: flex; flex-direction: column; align-items: stretch; gap: 2px; width: 100%; padding: 0 3px; }
.cal-mark { display: block; height: 4px; border-radius: 2px; background: var(--cal-ev); }
.cal-mark-more { font-size: 10px; line-height: 12px; color: var(--text-3); text-align: center; font-variant-numeric: tabular-nums; }

/* 주 보기: 종일 일정만, lane 제한 없음 */
.cal-wk-head { flex: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.cal-wk-day { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 8px 10px; border-right: 1px solid var(--border); }
.cal-wk-day:last-child { border-right: 0; }
.cal-wk-dow { flex: none; font-size: 12px; font-weight: 500; color: var(--text-3); }
.cal-wk-num {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums;
}
.cal-wk-day.is-sat .cal-wk-dow, .cal-wk-day.is-sat .cal-wk-num { color: var(--info); }
.cal-wk-day.is-sun .cal-wk-dow, .cal-wk-day.is-sun .cal-wk-num,
.cal-wk-day.is-holiday .cal-wk-dow, .cal-wk-day.is-holiday .cal-wk-num { color: var(--error); }
.cal-wk-day.is-today .cal-wk-num { background: var(--primary); color: #fff; }
.cal-wk-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.cal-wk-scroll > .cal-week { flex: 1 0 auto; padding-bottom: 8px; }
.cal-weekview .cal-cell { padding: 0; }

/* 목록 보기·검색 결과 */
.cal-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 24px 32px; }
.cal-list-head { display: flex; align-items: baseline; gap: 8px; padding: 16px 0 10px; border-bottom: 1px solid var(--border); }
.cal-list-head h2 { font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-list-count { flex: none; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.cal-list-group { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cal-list-date { padding: 7px 0 0 4px; font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-list-date.is-sat { color: var(--info); }
.cal-list-date.is-sun, .cal-list-date.is-holiday { color: var(--error); }
.cal-list-date.is-today { color: var(--primary); }
.cal-list-items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-list-item {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  width: 100%; min-height: 34px; padding: 6px 10px;
  border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--text); font-size: 13.5px; text-align: left; cursor: pointer;
}
.cal-list-item:hover { background: var(--surface-2); }
.cal-list-item:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--primary-ring); }
.cal-list-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--cal-ev); }
.cal-list-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cal-list-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cal-list-memo-mark { margin-left: 6px; vertical-align: middle; position: relative; top: -1px; color: var(--text-3); }
.cal-list-memo { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-3); }
.cal-list-kind { color: var(--text-3); font-weight: 400; }
.cal-list-period { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-list-holiday {
  display: grid; grid-template-columns: 10px minmax(0, 1fr); align-items: center; gap: 10px;
  min-height: 34px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13.5px;
}
.cal-list-holiday .cal-list-dot { background: var(--border-strong); }
.cal-list-holiday-name { color: var(--error); font-weight: 500; }

/* 팝오버(상세·그날 일정·추가 폼). 좁은 화면에서는 하단 시트. */
.cal-pop {
  position: fixed; z-index: 900; width: 300px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: cal-pop-in .12s ease-out;
}
.cal-pop:focus { outline: none; }
@keyframes cal-pop-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.cal-pop.is-sheet {
  left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-width: none; max-height: 75vh;
  border-bottom: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding-bottom: env(safe-area-inset-bottom); animation: cal-sheet-in .18s ease-out;
}
@keyframes cal-sheet-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.cal-sheet-backdrop { position: fixed; inset: 0; z-index: 899; background: rgba(15, 20, 30, 0.32); }
.cal-pop-detail { width: 320px; }
.cal-detail-bar { display: flex; align-items: center; justify-content: flex-end; gap: 2px; padding: 8px 8px 0; }
.cal-detail-bar .btn-sm { height: 30px; }
.cal-detail-body { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 6px 12px; padding: 2px 20px 18px; }
.cal-detail-sq { width: 14px; height: 14px; margin-top: 5px; border-radius: 4px; background: var(--cal-ev); }
.cal-detail-title { font-size: 16px; font-weight: 600; line-height: 1.5; word-break: break-all; }
.cal-detail-kind { color: var(--text-3); font-weight: 400; }
.cal-detail-period { grid-column: 2; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.cal-detail-memo {
  grid-column: 2; max-height: 180px; overflow-y: auto; padding: 8px 10px;
  border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: 13px; line-height: 1.55; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere;
}
.cal-detail-memo:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--primary-ring); }
.cal-detail-meta { grid-column: 2; font-size: 12px; color: var(--text-3); }
.cal-pop-day { width: 264px; }
.cal-daypop-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 6px 14px; min-width: 0; }
.cal-daypop-date { flex: none; font-size: 14px; font-weight: 600; }
.cal-daypop-date.is-sat { color: var(--info); }
.cal-daypop-date.is-sun, .cal-daypop-date.is-holiday { color: var(--error); }
.cal-daypop-holiday { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--error); }
.cal-daypop-actions { margin-left: auto; display: flex; gap: 2px; flex: none; }
.cal-daypop-list { display: flex; flex-direction: column; gap: 3px; padding: 2px 12px 12px; }
.cal-daypop-list .cal-event { width: 100%; height: 22px; margin: 0; line-height: 22px; }
.cal-daypop-empty { padding: 4px 14px 14px; font-size: 13px; color: var(--text-3); }

/* 추가·수정 폼(팝오버와 대화상자 공용) */
.cal-pop-form { width: 380px; }
.cal-pop-form .dialog-head { padding: 14px 16px 8px; }
.cal-pop-form .dialog-body { padding: 4px 16px 14px; }
.cal-pop-form .dialog-foot { padding: 10px 16px; }
.cal-dialog { width: min(420px, calc(100vw - 32px)); }
.cal-form-body { gap: 12px; }
.cal-form-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 12px; }
.cal-form-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.cal-form-row.is-top { align-items: start; }
.cal-form-row.is-top .cal-form-label { padding-top: 7px; }
.cal-memo { height: auto; min-height: 72px; max-height: 240px; padding: 6px 10px; line-height: 1.5; resize: vertical; }
.cal-pop-form .cal-memo { max-height: 160px; }
.cal-kind-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cal-range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; }
.cal-range .input { padding: 0 8px; }
.cal-range .input[aria-invalid="true"] { border-color: var(--error); }
.cal-range-sep { color: var(--text-3); }
.cal-colors { display: flex; flex-wrap: wrap; gap: 8px; padding: 3px 2px; }
.cal-swatch { position: relative; display: inline-flex; cursor: pointer; }
.cal-swatch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.cal-swatch-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 999px; background: var(--cal-ev); color: #fff;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px transparent; transition: box-shadow .12s;
}
.cal-swatch-dot .icon { visibility: hidden; }
.cal-swatch:hover .cal-swatch-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border-strong); }
.cal-swatch input:checked + .cal-swatch-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--cal-ev); }
.cal-swatch input:checked + .cal-swatch-dot .icon { visibility: visible; }
.cal-swatch input:focus-visible + .cal-swatch-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--cal-ev), 0 0 0 7px var(--primary-ring); }
.dialog-foot .cal-delete { margin-right: auto; }
.dialog-foot .cal-delete.btn-ghost { color: var(--error); }
.dialog-foot .cal-delete.btn-ghost:hover { background: var(--error-soft); }

/* 되돌리기 토스트 */
.cal-toast { pointer-events: auto; padding: 6px 6px 6px 16px; }
.cal-toast-btn {
  height: 28px; margin-left: 6px; padding: 0 12px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, 0.12); color: #a9c4ff; font-size: 13px; font-weight: 600; cursor: pointer;
}
.cal-toast-btn:hover { background: rgba(255, 255, 255, 0.2); }
.cal-toast-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px #a9c4ff; }

@media (max-width: 640px) {
  .cal-app {
    --cal-lane-h: 20px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "toolbar" "side" "body";
  }
  .cal-side { display: none; padding: 8px 16px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .cal-app.is-mini-open .cal-side { display: flex; }
  .cal-write { display: none; }
  .cal-mini { width: 100%; max-width: 320px; margin: 0 auto; }
  .cal-toolbar { gap: 8px; padding: 10px 12px; }
  .cal-toolbar-nav { width: 100%; gap: 4px; }
  .cal-title { margin-left: 2px; font-size: 17px; cursor: pointer; }
  .cal-mini-toggle, .cal-add-mobile { display: inline-flex; }
  .cal-mini-toggle svg { transition: transform .15s ease; }
  .cal-mini-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  .cal-add-mobile { margin-left: auto; color: var(--primary); }
  .cal-tools { width: 100%; margin-left: 0; gap: 8px; }
  .cal-search { flex: 1; width: auto; min-width: 0; }
  .cal-view-btn { min-width: 0; padding: 0 10px; }
  .cal-wk-day { flex-direction: column; gap: 2px; padding: 6px 2px; }
  .cal-wk-day .cal-holiday { display: none; }
  .cal-wk-num { min-width: 24px; height: 24px; font-size: 13px; }
  .cal-weekview .cal-event { margin: 0 2px; padding: 0 3px; font-size: 10.5px; }
  .cal-weekview .cal-event.is-cont-left { margin-left: 0; }
  .cal-weekview .cal-event.is-cont-right { margin-right: 0; }
  .cal-list { padding: 0 12px 24px; }
  .cal-list-group { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .cal-list-date { padding: 4px 0 2px 10px; }
  .cal-form-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .cal-form-row.is-top .cal-form-label { padding-top: 0; }
  .cal-pop-day, .cal-pop-detail { width: 100%; }
}

/* ---------- 필증 변환 ---------- */
.exp { max-width: 1440px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.exp-head { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.exp-summary { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-3); }
.exp-stat strong { margin-left: 4px; color: var(--text); font-weight: 700; }
.exp-stat-warn strong { color: var(--warn); }
.exp-stat-error strong { color: var(--error); }
.exp-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.exp-progress { display: inline-flex; align-items: center; gap: 8px; margin-right: 4px; font-size: 13px; color: var(--text-2); }
.exp-download { display: inline-flex; align-items: center; gap: 8px; }
.exp-excluded { font-size: 12px; color: var(--error); white-space: nowrap; }
.exp-card { overflow: hidden; }
.exp-table { table-layout: fixed; min-width: 1120px; }
.exp-table .c-toggle { width: 48px; }
.exp-table .c-seq { width: 56px; }
.exp-table .c-file { width: auto; }
.exp-table .c-no { width: 168px; }
.exp-table .c-date { width: 100px; }
.exp-table .c-party { width: 15%; }
.exp-table .c-dest { width: 110px; }
.exp-table .c-lines { width: 60px; }
.exp-table .c-amount { width: 128px; }
.exp-table .c-status { width: 96px; }
.exp-table .c-act { width: 84px; }
.exp-table td { padding: 7px 12px; }
.exp-table td.act { width: auto; }
.exp-table .cell-clip { max-width: none; }
.exp-file { min-width: 0; }
.exp-row.is-openable { cursor: pointer; }
.exp-toggle .icon { transition: transform .15s ease; }
.exp-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.exp-toggle:disabled { opacity: .35; cursor: default; }
.exp-toggle:disabled:hover { background: transparent; color: var(--text-2); }
.exp-row.is-open td { background: var(--surface-2); border-bottom-color: transparent; }
.exp-table > tbody > tr.exp-detail > td { background: var(--surface-2); padding: 4px 18px 18px 60px; }
.exp-table > tbody > tr.exp-detail:hover > td { background: var(--surface-2); }
.exp-detail-body { display: flex; flex-direction: column; gap: 16px; }
.exp-warnings { list-style: none; margin: 0; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.exp-warnings li { display: flex; align-items: center; gap: 8px; }
.exp-section { display: flex; flex-direction: column; gap: 10px; }
.exp-section-title { font-size: 13px; font-weight: 600; color: var(--text-2); padding-top: 12px; border-top: 1px solid var(--border); }
.exp-section:first-child .exp-section-title, .exp-warnings + .exp-section .exp-section-title { border-top: 0; padding-top: 0; }
.exp-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; }
.exp-grid .field { gap: 4px; }
.exp-grid .field-label { font-size: 12px; font-weight: 500; color: var(--text-3); }
.exp-grid .input { background: var(--surface); }
.exp-field-wide { grid-column: span 2; }
.exp-models-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.exp-models { table-layout: fixed; min-width: 900px; }
.exp-models th, .exp-models td { padding: 6px 8px; vertical-align: top; }
.exp-models tbody tr:hover td { background: transparent; }
.exp-models .m-no { width: 64px; }
.exp-models .m-spec { width: auto; }
.exp-models .m-component { width: 240px; }
.exp-models .m-qty { width: 110px; }
.exp-models .m-price { width: 100px; }
.exp-models .m-amount { width: 120px; }
.exp-models .input { width: 100%; }
.exp-textarea { height: auto; min-height: 30px; padding: 5px 8px; line-height: 1.45; resize: vertical; }
.exp-empty { padding: 56px 16px; cursor: pointer; font-weight: 600; color: var(--text-2); }
.exp-empty:hover, .exp-empty:focus-visible { outline: none; color: var(--primary); background: #fbfcff; }
@media (max-width: 1100px) {
  .exp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .exp { padding: 16px 12px; }
  .exp-actions { margin-left: 0; width: 100%; }
  .exp-grid { grid-template-columns: 1fr; }
  .exp-field-wide { grid-column: auto; }
  .exp-table > tbody > tr.exp-detail > td { padding: 4px 12px 16px; }
}

/* ---------- 좁은 화면 ---------- */
@media (max-width: 1100px) {
  .file-table .c-method { width: 70px; }
}
@media (max-width: 900px) {
  .page-main { overflow: auto; }
  .workspace { height: auto; min-height: calc(100vh - var(--topbar-h)); grid-template-columns: 1fr; }
  .exporter-panel { border-right: 0; border-bottom: 1px solid var(--border); }
  .exporter-list { max-height: 220px; }
  .job-scroll { overflow: visible; padding: 16px; }
  .actionbar { position: sticky; top: var(--topbar-h); padding: 10px 16px; }
  .topbar { gap: 12px; padding: 0 12px; }
  .version { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .corr-summary { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .field-grid, .form-grid { grid-template-columns: 1fr; }
  .brand span { display: none; }
  .user { display: none; }
  .admin { padding: 16px 12px; }
  .search-inline, .inline-field .input { width: 100%; }
  .filter-bar .inline-field { width: 100%; }
  .filter-bar .inline-field .input, .filter-bar .inline-field .input-date { width: 100%; min-width: 0; }
  .toolbar-right { margin-left: 0; width: 100%; }
  .stat-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actionbar { gap: 10px; padding: 8px 12px; }
  .actionbar-info { flex-direction: column; align-items: flex-start; gap: 2px; }
  .actionbar-exporter { max-width: 100%; font-size: 14px; }
  .actionbar-status { font-size: 12px; }
  .dialog-result .dialog-foot { flex-wrap: wrap; }
  .result-rpa { flex-basis: 100%; }
  .mail-table tr.mail-detail td { padding-left: 12px; padding-right: 12px; }
  .mail-meta { grid-template-columns: 64px minmax(0, 1fr); }
}

/* 정정 비교 */
.cmp { max-width: 1440px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.cmp-head { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.cmp-summary { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-3); }
.cmp-stat strong { margin-left: 4px; color: var(--text); font-weight: 700; }
.cmp-stat-warn strong { color: var(--warn); }
.cmp-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cmp-progress { display: inline-flex; align-items: center; gap: 8px; margin-right: 4px; font-size: 13px; color: var(--text-2); }
.cmp-actions .btn[aria-busy="true"] { cursor: progress; }

/* 정정 비교: PDF 파일별 다운로드 메뉴 */
.cmp-menu-wrap { position: relative; display: inline-flex; }
.cmp-caret { margin-left: 2px; color: var(--text-3); transition: transform .15s ease; }
#cmp-pdf[aria-expanded="true"] .cmp-caret { transform: rotate(180deg); }
.cmp-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
  width: max-content; min-width: 260px; max-width: min(440px, calc(100vw - 32px)); max-height: 360px; overflow-y: auto;
  padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.cmp-menu[hidden] { display: none; }
.cmp-menu-group + .cmp-menu-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }
.cmp-menu-label { padding: 6px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.cmp-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 6px 10px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text);
  font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.cmp-menu-item:hover, .cmp-menu-item:focus-visible { outline: none; background: var(--surface-2); }
.cmp-menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--primary-ring); }
.cmp-menu-item .icon { flex: none; color: var(--text-3); }
.cmp-menu-item .truncate { flex: 1 1 auto; }
.cmp-menu-item .spinner { flex: none; width: 14px; height: 14px; }
.cmp-menu-item[aria-busy="true"] { cursor: progress; color: var(--text-2); }
.cmp-menu-item:disabled { cursor: default; }

.cmp-files-card { overflow: hidden; }
.cmp-files { table-layout: fixed; min-width: 640px; }
.cmp-files .c-file { width: auto; }
.cmp-files .c-kind { width: 80px; }
.cmp-files .c-role { width: 132px; }
.cmp-files .c-size { width: 96px; }
.cmp-files .c-act { width: 52px; }
.cmp-files td { padding: 7px 12px; }
.cmp-files td.act { width: auto; }
.cmp-file-name { min-width: 0; }
.cmp-file-error { display: inline-flex; color: var(--error); }
.cmp-file-msg { padding-left: 21px; margin-top: 2px; font-size: 12px; color: var(--error); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-role { width: 100%; }
.cmp-file.is-ignored .file-name-line, .cmp-file.is-ignored td:nth-child(2), .cmp-file.is-ignored td:nth-child(4) { color: var(--text-3); }
.cmp-file.is-ignored .file-name-line .truncate { text-decoration: line-through; text-decoration-color: var(--border-strong); }
.cmp-empty { padding: 56px 16px; cursor: pointer; font-weight: 600; color: var(--text-2); }
.cmp-empty:hover, .cmp-empty:focus-visible { outline: none; color: var(--primary); background: #fbfcff; }

.cmp-results { display: flex; flex-direction: column; gap: 16px; transition: opacity .15s ease; }
.cmp-results.is-stale { opacity: .55; pointer-events: none; }
.cmp-state { gap: 10px; }
.cmp-state .btn { margin-top: 4px; }

.cmp-card { overflow: hidden; }
.cmp-card-head { align-items: flex-start; gap: 12px 16px; flex-wrap: wrap; }
.cmp-card-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 320px; }
.cmp-card-sub { display: flex; gap: 6px 14px; flex-wrap: wrap; min-width: 0; font-size: 12.5px; }
.cmp-card-sub .truncate { max-width: 100%; }
.cmp-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cmp-decl-badge .mono { font-size: 12px; font-weight: 600; }

.cmp-table { table-layout: fixed; min-width: 980px; }
.cmp-table .c-type { width: 72px; }
.cmp-table .c-rows { width: 96px; }
.cmp-table .c-key { width: 20%; }
.cmp-table .c-field { width: 15%; }
.cmp-table .c-before, .cmp-table .c-after { width: auto; }
.cmp-table .c-decl { width: 200px; }
.cmp-table td { padding: 7px 12px; vertical-align: top; }
.cmp-table tbody tr:hover td { background: transparent; }
.cmp-table tbody.cmp-group:hover td { background: #fafbfc; }
.cmp-table tbody.cmp-group tr:last-child td { border-bottom: 1px solid var(--border); }
.cmp-table tbody.cmp-group:last-child tr:last-child td { border-bottom: 0; }
.cmp-table tr.is-cont td { border-top: 0; }
.cmp-table tbody.cmp-group tr:not(:last-child) td.cmp-field,
.cmp-table tbody.cmp-group tr:not(:last-child) td.cmp-before,
.cmp-table tbody.cmp-group tr:not(:last-child) td.cmp-after { border-bottom: 1px dashed var(--border); }
.cmp-table td[rowspan] { border-bottom: 1px solid var(--border); }
.cmp-table tbody.cmp-group:last-child td[rowspan] { border-bottom: 0; }
.cmp-type .badge { min-width: 40px; justify-content: center; }
.cmp-rows { color: var(--text-2); }
.cmp-key { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cmp-field > span:first-child { margin-right: 6px; }
.cmp-col { display: inline-block; padding: 0 5px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); font-size: 11.5px; line-height: 17px; }
.cmp-before, .cmp-after { overflow-wrap: anywhere; white-space: pre-wrap; }
.cmp-before { color: var(--text-2); }
.cmp-change.is-changed .cmp-before:not(.cmp-blank), .cmp-change.is-removed .cmp-before:not(.cmp-blank) { background: var(--warn-soft); }
.cmp-after { color: var(--error); font-weight: 500; }
.cmp-blank { color: var(--text-3); font-weight: 400; font-size: 12.5px; }
.cmp-table tbody.cmp-group:hover td.cmp-before:not(.cmp-blank) { background: var(--warn-soft); }
.cmp-decl-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cmp-note { margin-top: 2px; font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }

.cmp-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cmp-line { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.cmp-line .icon { color: var(--text-3); }
.cmp-line-label { flex: none; font-weight: 600; color: var(--text); }
.cmp-line-body { min-width: 0; overflow-wrap: anywhere; }
.cmp-line.is-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.cmp-line.is-warn .icon, .cmp-line.is-warn .cmp-line-label { color: var(--warn); }
.cmp-line.is-error { background: var(--error-soft); border-color: transparent; color: var(--error); }
.cmp-line.is-error .icon, .cmp-line.is-error .cmp-line-label { color: var(--error); }

/* 정정 비교: 고치기(칸 제외·필증 란/행) */
.cmp-table { min-width: 1040px; }
.cmp-table .c-show { width: 52px; }
.cmp-table .c-decl { width: 232px; }
.cmp-table th.cmp-show, .cmp-table td.cmp-show { text-align: center; padding-left: 8px; padding-right: 8px; }
.cmp-table tbody.cmp-group tr:not(:last-child) td.cmp-show { border-bottom: 1px dashed var(--border); }
.cmp-check { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--primary); cursor: pointer; vertical-align: top; }
.cmp-check:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); border-radius: 3px; }
.cmp-check:disabled { cursor: default; opacity: .5; }
.cmp-change.is-excluded td.cmp-field, .cmp-change.is-excluded td.cmp-before, .cmp-change.is-excluded td.cmp-after { opacity: .45; }
.cmp-change.is-excluded td.cmp-before:not(.cmp-blank), .cmp-table tbody.cmp-group:hover .cmp-change.is-excluded td.cmp-before:not(.cmp-blank) { background: transparent; }
.cmp-change.is-excluded td.cmp-after { color: var(--text-2); }
.cmp-change.is-excluded td.cmp-before, .cmp-change.is-excluded td.cmp-after { text-decoration: line-through; text-decoration-color: var(--border-strong); }
.cmp-table tbody.cmp-group.is-excluded td[rowspan] { opacity: .45; }
.cmp-table tbody.cmp-group.is-excluded td.cmp-decl { opacity: .6; }
.cmp-table tbody.cmp-group.is-busy { cursor: progress; }
.cmp-table tbody.cmp-group.is-busy td { opacity: .55; }
.cmp-auto-off { margin-left: 6px; vertical-align: 1px; }
.cmp-decl-line { min-height: 24px; }
.cmp-decl-none { color: var(--text-2); font-size: 12.5px; }
.cmp-decl-acts { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
.cmp-icon-btn { width: 26px; height: 26px; }
.cmp-icon-btn:disabled { opacity: .4; cursor: default; background: transparent; }
.cmp-decl.is-editing { padding-top: 5px; padding-bottom: 5px; }
.cmp-decl-form { display: flex; align-items: center; gap: 6px; }
.cmp-decl-field { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.cmp-decl-input { width: 46px; height: 28px; padding: 0 6px; text-align: center; }
.cmp-decl-field:nth-of-type(2) .cmp-decl-input { width: 38px; }
.cmp-decl-form .cmp-decl-acts { margin-left: 2px; }
.cmp-decl-save { color: var(--primary); }
.cmp-decl-save:hover { background: var(--primary-soft); color: var(--primary); }
.cmp-learn-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
#cmp-rule-table .row-actions { align-items: center; gap: 6px; }

@media (max-width: 640px) {
  .cmp { padding: 16px 12px; }
  .cmp-actions { margin-left: 0; width: 100%; }
  .cmp-actions .btn { flex: 1 1 auto; }
  .cmp-menu-wrap { flex: 1 1 auto; }
  .cmp-menu-wrap .btn { width: 100%; }
  .cmp-menu { left: 0; right: auto; min-width: 0; width: 100%; max-width: none; }
  .cmp-progress { flex-basis: 100%; }
  .cmp-summary { gap: 12px; flex-wrap: wrap; }
  .cmp-card-head { padding: 12px 14px; }
  .cmp-card-titles { flex-basis: 100%; }
  .cmp-line { align-items: flex-start; flex-wrap: wrap; }
  .cmp-line-body { flex-basis: 100%; padding-left: 22px; }
}

/* ---------- PDF 편집 ---------- */
.pdft { max-width: 1440px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.pdft-top { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.pdft-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pdft-head { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.cmp-stat-error strong { color: var(--error); }

/* 탭 전환(세그먼트) */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius); background: #eceff4; border: 1px solid var(--border); }
.seg-btn {
  height: 30px; padding: 0 14px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color .12s, color .12s, box-shadow .12s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-selected="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.seg-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }

/* 인보이스 분리: 건 카드 */
.sp-results { display: flex; flex-direction: column; gap: 14px; transition: opacity .15s ease; }
.sp-results.is-stale { opacity: .55; pointer-events: none; }
.sp-group, .sp-excluded { overflow: hidden; transition: border-color .12s, box-shadow .12s; }
.sp-group.is-review { border-color: #f0d29c; }
.sp-group-head { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.sp-group-no { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; font-weight: 700; color: var(--text-2); }
.sp-name-wrap { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 0 1 340px; }
.sp-name { font-weight: 600; }
.sp-ext { flex: none; font-size: 13px; color: var(--text-3); }
.sp-group-meta { flex: none; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.sp-group-head .badge { flex: none; }
.sp-group-head .badge .icon { margin-left: -1px; }
.sp-spacer { flex: 1 1 auto; }
.sp-dl { flex: none; }
.sp-dl[aria-busy="true"] { cursor: progress; }
.sp-excluded-title { font-size: 14px; color: var(--text-2); }

/* 페이지 썸네일 띠 */
.sp-strip { display: flex; flex-wrap: wrap; gap: 14px; padding: 14px; min-height: 120px; }
.sp-strip.is-drop-end::after { content: ''; align-self: stretch; width: 3px; margin-left: -9px; border-radius: 2px; background: var(--primary); }
.sp-thumb { position: relative; display: flex; flex-direction: column; gap: 6px; width: 132px; cursor: grab; }
.sp-thumb.is-dragging { opacity: .4; }
.sp-thumb.is-drop-before::before { content: ''; position: absolute; top: 0; bottom: 0; left: -9px; width: 3px; border-radius: 2px; background: var(--primary); }
.sp-thumb-img {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 132px; height: 172px; padding: 6px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  cursor: zoom-in; transition: border-color .12s, box-shadow .12s;
}
.sp-thumb-img:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.sp-thumb-img:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.sp-thumb-img img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; box-shadow: 0 0 0 1px rgba(16, 24, 40, 0.06); pointer-events: none; user-select: none; }
.sp-thumb-fail { display: none; color: var(--text-3); }
.sp-thumb-img.is-failed img { display: none; }
.sp-thumb-img.is-failed .sp-thumb-fail { display: inline-flex; }
.sp-thumb-cap { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 26px; }
.sp-thumb-more { width: 26px; height: 26px; }
.sp-thumb-more[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.sp-thumb-src { margin-top: -4px; font-size: 11.5px; color: var(--text-3); }

/* 끄는 동안만 보이는 놓을 곳 */
.sp-newzone {
  display: none; align-items: center; justify-content: center; gap: 8px; min-height: 64px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  color: var(--text-3); font-weight: 600; font-size: 13.5px;
  transition: background-color .12s, border-color .12s, color .12s;
}
body.sp-dragging .sp-newzone { display: flex; }
.sp-newzone.is-drop-over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.sp-excludezone.is-drop-over { border-color: var(--error); background: var(--error-soft); color: var(--error); }
.sp-group.is-drop-over, .sp-excluded.is-drop-over { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

/* 페이지 메뉴(화면 고정 위치) */
.sp-menu {
  position: fixed; z-index: 60; min-width: 200px; max-width: min(320px, calc(100vw - 16px)); max-height: min(360px, calc(100vh - 16px)); overflow-y: auto;
  padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.sp-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 6px 10px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text);
  font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.sp-menu-item .icon { flex: none; color: var(--text-3); }
.sp-menu-item .truncate { flex: 1 1 auto; }
.sp-menu-item:hover, .sp-menu-item:focus-visible { outline: none; background: var(--surface-2); }
.sp-menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--primary-ring); }
.sp-menu-item:disabled { color: var(--text-3); cursor: default; background: transparent; opacity: .55; }
.sp-menu-item.is-back { font-weight: 600; }
.sp-menu-item.is-danger, .sp-menu-item.is-danger .icon { color: var(--error); }
.sp-menu-item.is-danger:hover, .sp-menu-item.is-danger:focus-visible { background: var(--error-soft); }
.sp-menu-sep { height: 1px; margin: 4px 2px; background: var(--border); }

/* 큰 미리보기 */
.sp-viewer { width: min(1080px, calc(100vw - 32px)); height: calc(100vh - 48px); }
.sp-viewer .dialog-head { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.sp-viewer-titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sp-viewer-sub { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--text-2); }
.sp-viewer-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.sp-viewer-nav { justify-self: center; width: 40px; height: 40px; border-radius: 20px; }
.sp-viewer-nav:disabled { opacity: .3; cursor: default; background: transparent; }
.sp-viewer-stage { position: relative; height: 100%; min-height: 0; padding: 16px 0; display: flex; align-items: center; justify-content: center; }
.sp-viewer-stage img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; box-shadow: var(--shadow); }
.sp-viewer-stage .spinner { position: absolute; display: none; width: 22px; height: 22px; }
.sp-viewer-stage.is-loading .spinner { display: inline-block; }
.sp-viewer-stage.is-loading img, .sp-viewer-stage.is-failed img { visibility: hidden; }

/* 엑셀 → PDF */
.xl-table { table-layout: fixed; min-width: 600px; }
.xl-table .c-file { width: auto; }
.xl-table .c-size { width: 96px; }
.xl-table .c-status { width: 132px; }
.xl-table .c-act { width: 148px; }
.xl-table td { padding: 8px 12px; }
.xl-pdf-name { padding-left: 21px; margin-top: 2px; font-size: 12px; color: var(--text-3); }
.xl-table .badge[title] { cursor: help; }
#xl-error { gap: 10px; }

@media (max-width: 640px) {
  .pdft { padding: 16px 12px; }
  .seg { width: 100%; }
  .seg-btn { flex: 1 1 0; }
  .sp-group-head { flex-wrap: wrap; }
  .sp-name-wrap { flex: 1 1 100%; order: 1; }
  .sp-spacer { display: none; }
  .sp-dl { margin-left: auto; }
  .sp-strip { gap: 10px; padding: 12px; }
  .sp-thumb, .sp-thumb-img { width: 104px; }
  .sp-thumb-img { height: 136px; }
  .sp-viewer-body { grid-template-columns: 36px minmax(0, 1fr) 36px; }
}

/* CO 발송 */
.co { max-width: 1280px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.co-top { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.co-new { margin-left: auto; flex: none; }
.co-band { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; border-radius: var(--radius); font-size: 13.5px; font-weight: 600; }
.co-band-text { min-width: 0; overflow-wrap: anywhere; }
.co-band .btn, .co-band .icon-btn { margin-left: auto; flex: none; }
.co-band.is-ok { background: var(--ok-soft); color: var(--ok); }
.co-band.is-error { background: var(--error-soft); color: var(--error); }
.co-band.is-error .icon-btn { color: var(--error); }
.co-band.is-error .icon-btn:hover { background: rgba(209, 52, 59, 0.1); }

.co-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); gap: 16px; align-items: start; }
.co-main, .co-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.co-card { overflow: hidden; }
.co-card:has(.co-combo) { overflow: visible; }
.co-head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.co .input[aria-invalid="true"] { border-color: var(--error); }
.co .input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(209, 52, 59, 0.18); }
.co .input.is-review { border-color: #e6b866; background: #fffaf0; }

/* 파일 목록 */
.co-files-hint {
  display: flex; align-items: flex-start; gap: 6px; padding: 8px 18px;
  border-bottom: 1px solid var(--border); font-size: 12px; line-height: 1.45; color: var(--text-3);
}
.co-files-hint .icon { flex: none; margin-top: 1px; }
.co-files-hint span { min-width: 0; overflow-wrap: anywhere; }
.co-empty { padding: 32px 16px; }
.co-file-list { list-style: none; margin: 0; padding: 0; }
.co-file {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto auto 30px; align-items: center; gap: 10px;
  min-height: 48px; padding: 6px 10px 6px 18px; border-bottom: 1px solid var(--border);
}
.co-file:last-child { border-bottom: 0; }
.co-file > .icon { color: var(--text-3); }
.co-file.is-pending .co-file-name { color: var(--text-2); }
.co-file-main { display: flex; flex-direction: column; min-width: 0; }
.co-file-name { font-weight: 500; }
.co-file-msg { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-file-msg.is-warn { color: var(--warn); }
.co-file-msg.is-error { color: var(--error); }
.co-file-size { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.co-file-gap { width: 30px; }
.co-role-btn { gap: 4px; border: 0; font-family: inherit; }
button.co-role-btn { cursor: pointer; transition: box-shadow .12s; }
button.co-role-btn:hover { box-shadow: inset 0 0 0 1px currentColor; }
button.co-role-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
button.co-role-btn:disabled { cursor: progress; opacity: .7; }
.co-role-btn .icon { opacity: .75; }
.co-role-goods { background: #f1ecff; color: #6a3fd1; }

/* 입력 */
.co-form { display: flex; flex-direction: column; gap: 16px; padding: 18px; }
.co-grid-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.co-field { gap: 5px; }
.input.co-input-manual, .input.co-input-manual:focus { background-color: #fff8d6; }
.co-combo { position: relative; }
.co-combo .co-combo-input { padding-right: 38px; }
.co-combo-btn {
  position: absolute; top: 0; right: 0; bottom: 0; width: 36px; display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--text-3); cursor: pointer;
}
.co-combo-btn:hover { color: var(--text); }
.co-combo-list {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.co-combo-item {
  padding: 8px 10px; border-radius: var(--radius-sm); font-size: 14px; color: var(--text); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.co-combo-item:hover, .co-combo-item.is-active { background: var(--primary-soft); }
.co-label-row { display: flex; align-items: center; gap: 8px; min-height: 18px; min-width: 0; }
.co-label-row .field-label { min-width: 0; }
.co-src { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; flex: none; }
.co-src:empty { display: none; }
.co-src-text { font-size: 11.5px; color: var(--text-3); }
.co-src-btn {
  display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 5px;
  border: 0; border-radius: 4px; background: transparent;
  color: var(--text-3); font: inherit; font-size: 11.5px; cursor: pointer;
}
.co-src-btn:hover { background: var(--primary-soft); color: var(--primary); }
.co-src-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--primary-ring); }
.co-src .badge-warn { cursor: help; }
.co-msg { font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.co-msg.is-error { color: var(--error); }
.co-msg.is-warn { color: var(--warn); }
.co-hint { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.co-section-head { display: flex; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.co-section-title { font-size: 13px; font-weight: 600; color: var(--text-3); }
.co-section-actions { margin-left: auto; display: flex; gap: 8px; }

/* 제출 내역 표 */
.co-rows { display: flex; flex-direction: column; gap: 6px; }
.co-rows-head, .co-row {
  display: grid; grid-template-columns: 32px minmax(0, 1.5fr) minmax(0, 1fr) 76px 30px; align-items: center; gap: 4px 8px;
}
.co-rows-head { font-size: 12px; font-weight: 600; color: var(--text-3); }
.co-rows-head span:first-child { text-align: center; }
.co-seq { text-align: center; font-size: 12.5px; color: var(--text-3); }
.co-cell { min-width: 0; }
.co-row-msg { grid-column: 2 / -1; }

/* 제출 내역 메모(상호별, 메일 미포함) */
.co-memo { border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.co-memo-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--border); }
.co-memo-title { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.co-memo-copy { margin-left: auto; }
.co-memo-text {
  margin: 0; padding: 10px 12px; max-height: 240px; overflow: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); user-select: text;
}
.co-memo-text:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* 제출번호 목록 */
.co-submit-list { display: flex; flex-direction: column; gap: 6px; }
.co-submit-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 30px; align-items: center; gap: 4px 8px; }
.co-submit-row .co-msg { grid-column: 2 / -1; }

/* 메일 미리보기 */
.co-preview {
  position: sticky; top: calc(var(--topbar-h) + 16px);
  display: flex; flex-direction: column; min-width: 0;
  max-height: calc(100vh - var(--topbar-h) - 32px);
}
.co-preview-state { margin-left: auto; display: inline-flex; }
.co-preview-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 16px 18px; }
.co-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.co-body-text { max-height: 46vh; min-height: 120px; user-select: text; transition: opacity .15s; }
.co-body-text.is-stale { opacity: .55; }
.co-body-rich { white-space: normal; }
.co-body-head { margin: 0 0 10px; font: inherit; white-space: pre-wrap; word-break: break-all; }
.co-body-table { border-collapse: collapse; font-size: 12.5px; line-height: 1.4; }
.co-body-table th, .co-body-table td { padding: 3px 8px; border: 1px solid var(--border-strong); text-align: left; white-space: nowrap; }
.co-body-table th { background: var(--surface-2); font-weight: 400; color: var(--text); }
.co-body-table td.is-num { text-align: right; min-width: 40px; }
.co-body-table td.co-cell-no { min-width: 220px; }
.co-body-loading {
  display: flex; align-items: center; justify-content: center; min-height: 120px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.co-body-error { flex-wrap: wrap; }
.co-body-error .btn { margin-left: auto; }
.co-attach-total { margin-left: auto; font-size: 12.5px; color: var(--text-3); }
.co-attach li { font-size: 13.5px; }
.co-attach .spinner { width: 13px; height: 13px; }
.co-errors { list-style: none; margin: 0; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; border-radius: var(--radius-sm); background: var(--error-soft); color: var(--error); font-size: 13px; }
.co-errors li { display: flex; align-items: flex-start; gap: 8px; }
.co-errors .icon { margin-top: 2px; }
.co-preview-foot {
  flex: none; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px;
  border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.co-preview-foot .btn[aria-busy="true"] { cursor: progress; }

/* 관리 › CO 관리 */
.co-admin-section + .co-admin-section { border-top: 1px solid var(--border); }
.co-admin-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px 10px; }
.co-admin-title { font-size: 14px; }
.co-edit-table { table-layout: fixed; min-width: 720px; }
.co-edit-table .c-code { width: 132px; }
.co-edit-table .c-name { width: 26%; }
.co-edit-table .c-country { width: 96px; }
.co-edit-table .c-alias { width: auto; }
.co-edit-table .c-act { width: 52px; }
.co-edit-table.co-edit-exporters { min-width: 480px; }
.co-edit-exporters .c-name { width: auto; }
.co-edit-exporters .c-agree { width: 160px; }
.co-edit-table td { padding: 6px 12px; }
.co-edit-table tbody tr:hover td { background: transparent; }
.co-edit-table .input[aria-invalid="true"] { border-color: var(--error); }
.co-alias-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.co-alias {
  display: inline-flex; align-items: center; max-width: 220px; height: 22px; padding-left: 7px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 12px;
}
.co-alias-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-alias-del {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 20px; height: 20px; margin-left: 1px; padding: 0;
  border: 0; border-radius: 4px; background: transparent; color: var(--text-3); cursor: pointer;
}
.co-alias-del:hover { background: var(--error-soft); color: var(--error); }
.co-alias-del:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--primary-ring); }
.co-preset-list { display: flex; flex-direction: column; gap: 12px; padding: 0 18px 4px; }
.co-preset { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.co-preset-head {
  display: grid; grid-template-columns: minmax(0, 1fr) 132px 30px; align-items: end; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.co-preset-field { gap: 4px; min-width: 0; }
.co-preset-del { margin-bottom: 2px; }
.co-preset-rows { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; }
.co-preset-foot { display: flex; }
.co-preset .input[aria-invalid="true"] { border-color: var(--error); }

@media (max-width: 900px) {
  .co-grid { grid-template-columns: minmax(0, 1fr); }
  .co-preview { position: static; max-height: none; }
  .co-preview-body { overflow: visible; }
}
@media (max-width: 640px) {
  .co { padding: 16px; }
  .co-top .seg-btn { min-width: 0; height: auto; min-height: 30px; padding: 4px 6px; font-size: 13px; line-height: 1.25; white-space: normal; }
  .co-band { flex-wrap: wrap; }
  .co-grid-fields { grid-template-columns: minmax(0, 1fr); }
  .co-form { padding: 16px; }
  .co-preview-body { padding: 16px; }
  .co-preview-foot { padding: 12px 16px; }
  .co-preview-foot .btn { flex: 1 1 0; }
  .co-file { grid-template-columns: 16px minmax(0, 1fr) auto 30px; padding-left: 14px; }
  .co-file-size { display: none; }
  .co-rows-head { display: none; }
  .co-row { grid-template-columns: 24px minmax(0, 1fr) 76px 30px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .co-row .co-seq { grid-column: 1; grid-row: 1 / span 2; }
  .co-cell-submit_no { grid-column: 2 / 4; grid-row: 1; }
  .co-cell-submit_date { grid-column: 2; grid-row: 2; }
  .co-cell-agreement_code { grid-column: 3; grid-row: 2; }
  .co-row-del { grid-column: 4; grid-row: 1 / span 2; }
  .co-row .co-row-msg { grid-column: 2 / -1; grid-row: 3; }
  .co-admin-head .toolbar-right { margin-left: auto; width: auto; }
  .co-preset-list { padding: 0 12px 4px; }
  .co-preset-head { grid-template-columns: minmax(0, 1fr) 96px 30px; }
}
.co-memo-admin-head { grid-template-columns: minmax(0, 1fr) 30px; }
.co-memo-input { width: 100%; min-height: 120px; resize: vertical; padding: 8px 10px; font-size: 12.5px; line-height: 1.55; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.co-preset .co-memo-input[aria-invalid="true"] { border-color: var(--error); }

/* PDF 편집: PDF 병합 */
.mg-name-wrap { display: flex; align-items: center; gap: 4px; flex: 0 1 260px; min-width: 160px; }
.mg-name { flex: 1 1 auto; min-width: 0; width: 100%; font-weight: 500; }
.mg-alert { margin: 12px 12px 0; }
.mg-alert .icon { flex: none; }
.mg-table { table-layout: fixed; }
.mg-table .c-no { width: 72px; }
.mg-table .c-thumb { width: 64px; }
.mg-table .c-file { width: auto; }
.mg-table .c-pages { width: 64px; }
.mg-table .c-size { width: 92px; }
.mg-table .c-status { width: 112px; }
.mg-table .c-act { width: 116px; }
.mg-table td { padding: 6px 12px; }
.mg-table .badge[title] { cursor: help; }
.mg-row { cursor: grab; }
.mg-row.is-locked { cursor: default; }
.mg-row.is-dragging td { opacity: .4; }
.mg-row.is-drop-before td { box-shadow: inset 0 2px 0 var(--primary); }
.mg-row.is-drop-after td { box-shadow: inset 0 -2px 0 var(--primary); }
.mg-row.is-fail .file-name-line { color: var(--text-2); }
.mg-no { color: var(--text-3); white-space: nowrap; }
.mg-no .icon { display: inline-flex; vertical-align: -2px; margin-right: 6px; color: var(--border-strong); transition: color .12s; }
.mg-row:hover .mg-no .icon { color: var(--text-3); }
.mg-row.is-locked .mg-no .icon { visibility: hidden; }
.mg-thumb {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 52px; overflow: hidden;
  border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2);
}
.mg-thumb img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; pointer-events: none; user-select: none; }
.mg-thumb-fail { display: none; color: var(--text-3); }
.mg-thumb.is-failed img { display: none; }
.mg-thumb.is-failed .mg-thumb-fail { display: inline-flex; }
.mg-inline-status { display: none; }
.mg-table .row-actions { justify-content: flex-end; }
.mg-table .icon-btn:disabled { opacity: .35; cursor: default; background: transparent; color: var(--text-3); }

@media (max-width: 640px) {
  .mg-name-wrap { flex: 1 1 100%; min-width: 0; }
  .mg-table td { padding: 6px 6px; }
  .mg-table th { padding: 9px 6px; }
  .mg-table .c-no { width: 36px; }
  .mg-table .c-thumb { width: 48px; }
  .mg-table .c-pages { width: 40px; }
  .mg-table .c-act { width: 96px; }
  .mg-table .c-size, .mg-table .c-status { display: none; }
  .mg-no .icon { display: none; }
  .mg-thumb { width: 34px; height: 44px; }
  .mg-table .row-actions { gap: 0; }
  .mg-table .icon-btn { width: 28px; height: 28px; }
  .mg-inline-status { display: flex; margin-top: 3px; }
}
