/* =====================================================================
   수출면장 자동작성 — 화면 스타일
   ===================================================================== */
:root {
  --blue: #2563eb;
  --blue-600: #1d4ed8;
  --blue-50: #eff5ff;
  --blue-100: #dbe7ff;
  --green: #16a34a;
  --green-50: #ecfdf3;
  --yellow: #ca8a04;
  --yellow-50: #fefce8;
  --orange: #ea580c;
  --orange-50: #fff4ec;
  --red: #dc2626;
  --red-50: #fef2f2;
  --violet: #7c3aed;
  --violet-50: #f4f0ff;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --text: #171c26;
  --text-2: #4a5263;
  --muted: #7b8496;
  --border: #e4e8ef;
  --border-2: #d6dce6;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .10);
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 10px; }
.ic { flex: none; vertical-align: middle; }
code { background: #f1f3f7; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* ---------------- 앱 틀 ---------------- */
.shell { display: flex; min-height: 100vh; background: linear-gradient(to right, var(--surface) calc(var(--sidebar-w) - 1px), var(--border) calc(var(--sidebar-w) - 1px), var(--border) var(--sidebar-w), var(--bg) var(--sidebar-w)); }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); padding: 4px 8px 16px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--blue); color: #fff; display: grid; place-items: center; }
.brand-text { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.brand-text b { font-weight: 800; margin-left: 3px; }
.tenant-chip { background: #f6f8fb; border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; margin: 0 2px 12px; }
.tenant-chip.acting { background: var(--orange-50); border-color: #fed7aa; }
.tenant-name { font-weight: 700; font-size: 14px; }
.tenant-role { font-size: 12px; color: var(--muted); margin-top: 1px; }
.new-case-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--blue); color: #fff;
  font-weight: 700; font-size: 14px; border-radius: 10px; padding: 10px; margin: 0 2px 14px;
}
.new-case-btn:hover { background: var(--blue-600); text-decoration: none; }
.side-nav { flex: 1; }
.nav-group { font-size: 11.5px; font-weight: 700; color: #9aa2b1; text-transform: uppercase; letter-spacing: .04em; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text-2);
  font-size: 14px; font-weight: 600; margin-bottom: 2px;
}
.nav-item:hover { background: #f3f5f9; text-decoration: none; color: var(--text); }
.nav-item.on { background: var(--blue-50); color: var(--blue); }
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.side-foot { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { width: 100%; max-width: 1120px; margin: 0 auto; padding: 26px 28px 40px; flex: 1; }
.app-foot { text-align: center; font-size: 12.5px; color: var(--muted); padding: 18px; }
.app-foot a { color: var(--muted); }
.acting-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--orange-50); color: #9a3412;
  border-bottom: 1px solid #fed7aa; padding: 9px 28px; font-size: 13.5px;
}
.acting-bar form { margin-left: auto; }

/* ---------------- 페이지 머리 ---------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head-left { min-width: 0; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px 5px 9px; margin-bottom: 12px;
}
.back-btn:hover { text-decoration: none; border-color: var(--border-2); color: var(--text); }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.page-head h1 { font-size: 24px; font-weight: 800; }
.page-desc { color: var(--text-2); margin: 6px 0 0; font-size: 14.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- 카드/섹션 ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-size: 17px; font-weight: 750; }
.card-head .sub, .card-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.card-tight { padding: 0; overflow: hidden; }
.card-tight .card-head { padding: 18px 20px 0; }
.section-title { font-size: 15px; font-weight: 750; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ---------------- 버튼 ---------------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: inherit;
  background: var(--blue); color: #fff; border: 1px solid transparent; padding: 10px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer; line-height: 1.2; text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--blue-600); text-decoration: none; color: #fff; }
button:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; }
.btn-secondary, button.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.btn-secondary:hover, button.btn-secondary:hover { background: #f5f7fa; color: var(--text); }
.btn-light, button.btn-light { background: rgba(255,255,255,.85); color: var(--text); border-color: rgba(0,0,0,.08); }
.btn-light:hover { background: #fff; color: var(--text); }
.btn-ghost, button.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover, button.btn-ghost:hover { background: #eef1f6; color: var(--text); }
.btn-danger, button.btn-danger { background: var(--red); }
.btn-danger:hover, button.btn-danger:hover { background: #b91c1c; }
.btn-success, button.btn-success { background: var(--green); }
.btn-success:hover { background: #15803d; }
.btn-sm, button.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg, button.btn-lg { padding: 13px 22px; font-size: 15.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn { background: transparent; color: var(--text); padding: 8px; border-radius: 9px; }
.icon-btn:hover { background: #eef1f6; color: var(--text); }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 600; font-size: inherit; }
.link-btn:hover { background: none; color: var(--blue-600); text-decoration: underline; }

/* ---------------- 입력 ---------------- */
label { display: block; font-size: 13px; font-weight: 650; color: var(--text-2); margin-bottom: 14px; }
.field-hint { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 5px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=url], textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border-2); border-radius: 9px;
  font-size: 14.5px; font-family: inherit; background: #fff; color: var(--text); transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
input:disabled, textarea:disabled { background: #f4f6f9; color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--blue); vertical-align: -3px; margin: 0 6px 0 0; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; color: var(--text); font-size: 14px; }
.check input { margin-top: 3px; }
.input-inline { display: flex; gap: 8px; align-items: stretch; }
.input-inline input { margin-top: 0; flex: 1; }
.w-small { max-width: 140px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; flex-wrap: wrap; }

/* ---------------- 알림 ---------------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 11px; margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.alert .ic { margin-top: 1px; }
.alert-success { background: var(--green-50); color: #166534; border-color: #bbf7d0; }
.alert-error { background: var(--red-50); color: #991b1b; border-color: #fecaca; }
.alert-warn { background: var(--yellow-50); color: #854d0e; border-color: #fde68a; }
.alert-info { background: var(--blue-50); color: #1e3a8a; border-color: var(--blue-100); }
.alert a { font-weight: 700; }
/* 예전 클래스 호환 */
.error { background: var(--red-50); color: #991b1b; border: 1px solid #fecaca; padding: 11px 13px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.success { background: var(--green-50); color: #166534; border: 1px solid #bbf7d0; padding: 11px 13px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.legend { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 11px 14px; font-size: 13px; margin-bottom: 16px; }

/* ---------------- 배지 ---------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eef0f4; color: var(--text-2); white-space: nowrap; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef3c7; color: #854d0e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-blue { background: var(--blue-100); color: #1e40af; }
.badge-gray { background: #eef0f4; color: var(--text-2); }
.badge-violet { background: var(--violet-50); color: var(--violet); }

/* ---------------- 표 ---------------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: var(--surface); }
table.list th, table.list td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; text-align: left; vertical-align: middle; }
table.list th { background: #f8fafc; color: var(--muted); font-weight: 700; font-size: 12.5px; }
table.list tbody tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover td { background: #fafbfd; }
.card > table.list, .card .table-wrap { border-radius: 10px; }
.card-tight table.list th:first-child, .card-tight table.list td:first-child { padding-left: 20px; }
.card-tight table.list th:last-child, .card-tight table.list td:last-child { padding-right: 20px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.cell-title { font-weight: 700; color: var(--text); }
.cell-sub { font-size: 12.5px; color: var(--muted); }

/* ---------------- 홈 ---------------- */
.hello { margin-bottom: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; gap: 12px; align-items: center; }
.stat-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.tone-blue { background: var(--blue-50); color: var(--blue); }
.tone-green { background: var(--green-50); color: var(--green); }
.tone-yellow { background: var(--yellow-50); color: var(--yellow); }
.tone-violet { background: var(--violet-50); color: var(--violet); }
.tone-orange { background: var(--orange-50); color: var(--orange); }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 800; line-height: 1.2; }
.stat-sub { font-size: 12px; color: var(--muted); }

.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.type-card {
  display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; color: var(--text); box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s, border-color .12s;
}
.type-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--blue-100); color: var(--text); }
.type-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.type-title { font-weight: 800; font-size: 16px; }
.type-desc { font-size: 13px; color: var(--muted); flex: 1; }
.type-go { font-size: 13px; font-weight: 700; color: var(--blue); display: flex; align-items: center; gap: 4px; }

/* 원장 연결 히어로 */
.ledger-hero {
  position: relative; overflow: hidden; border-radius: 18px; padding: 26px; margin-bottom: 22px; color: #fff;
  background: radial-gradient(1200px 300px at 100% 0%, rgba(255,255,255,.18), transparent 60%), linear-gradient(135deg, #1d4ed8 0%, #4f46e5 55%, #7c3aed 100%);
  box-shadow: 0 12px 30px rgba(37, 99, 235, .25);
}
.ledger-hero .eyebrow { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.18); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 700; }
.ledger-hero h2 { font-size: 22px; font-weight: 800; margin: 12px 0 6px; line-height: 1.35; }
.ledger-hero .lead { opacity: .92; font-size: 14.5px; max-width: 640px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; align-items: center; }
.benefits { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.benefits li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.benefits .ic { background: rgba(255,255,255,.2); border-radius: 50%; padding: 3px; }
.hero-panel { background: #fff; color: var(--text); border-radius: 14px; padding: 18px; box-shadow: var(--shadow-lg); }
.hero-panel label { margin-bottom: 10px; }
.seg { display: flex; background: #f1f4f8; border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; background: transparent; color: var(--text-2); padding: 8px; font-size: 13px; border-radius: 8px; }
.seg button:hover { background: rgba(255,255,255,.6); color: var(--text); }
.seg button.on { background: #fff; color: var(--blue); box-shadow: var(--shadow); }
.reco { display: inline-flex; align-items: center; gap: 3px; background: var(--green-50); color: var(--green); font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 999px; margin-left: 4px; }
.how-to { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.how-to ol { margin: 6px 0 0; padding-left: 18px; }
.consent-gate { text-align: left; }
.consent-gate .gate-ic { width: 40px; height: 40px; border-radius: 11px; background: var(--violet-50); color: var(--violet); display: grid; place-items: center; margin-bottom: 10px; }
.ledger-status { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.ledger-status .big-ic { width: 46px; height: 46px; border-radius: 13px; background: var(--green-50); color: var(--green); display: grid; place-items: center; }

/* ---------------- 단계 표시 ---------------- */
.stepper { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px; box-shadow: var(--shadow); overflow-x: auto; }
.step { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 650; font-size: 13.5px; white-space: nowrap; padding: 4px 6px; border-radius: 8px; }
.step:hover { text-decoration: none; background: #f5f7fa; }
.step .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #eef0f4; color: var(--muted); font-size: 12.5px; font-weight: 800; }
.step.done { color: var(--text-2); }
.step.done .num { background: var(--green); color: #fff; }
.step.current { color: var(--blue); }
.step.current .num { background: var(--blue); color: #fff; box-shadow: 0 0 0 4px var(--blue-100); }
.step-line { flex: 1; min-width: 16px; height: 2px; background: var(--border); margin: 0 6px; }
.step-line.done { background: var(--green); }
.case-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; }
.next-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------------- 업로드 ---------------- */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.upload-slot { border: 2px dashed var(--border-2); border-radius: 14px; padding: 20px; text-align: center; background: var(--surface); }
.upload-slot .label { font-weight: 750; font-size: 14.5px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.upload-slot .sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.upload-slot .slot-ic { width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 12px; background: var(--blue-50); color: var(--blue); display: grid; place-items: center; }
.upload-slot.wide { grid-column: 1 / -1; }
.upload-slot textarea { text-align: left; }
.dropzone { position: relative; cursor: pointer; transition: background .12s, border-color .12s; }
.dropzone:hover { border-color: #b8c3d4; background: #fbfcfe; }
.dropzone.drag-over { border-color: var(--blue); background: var(--blue-50); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone .drop-hint { margin-top: 10px; font-size: 13px; color: var(--blue); font-weight: 700; }
.dropzone .file-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-50); color: #1e3a8a; border-radius: 999px; padding: 4px 6px 4px 11px; font-size: 12.5px; max-width: 100%; }
.file-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-chip .size { color: var(--muted); }
.file-chip button { background: transparent; color: var(--muted); padding: 0 5px; font-size: 15px; line-height: 1; border-radius: 50%; }
.file-chip button:hover { background: rgba(0,0,0,.06); color: var(--text); }
.file-chip.bad { background: #fee2e2; color: #991b1b; padding-right: 11px; }
.upload-slot textarea.drag-over { border-color: var(--blue); background: var(--blue-50); }
.help-icon { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: #e7eaf0; color: var(--text-2); font-size: 11px; font-weight: 800; cursor: help; }

/* ---------------- 검토 표 ---------------- */
#items-table input { margin-top: 0; padding: 6px 8px; font-size: 13.5px; border-radius: 7px; }
#items-table td { padding: 8px 6px; }
.new-row td { background: #fafbfd; }

/* ---------------- 탭 ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button { background: none; color: var(--muted); padding: 10px 14px; font-size: 14px; font-weight: 700; border-radius: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); background: none; text-decoration: none; }
.tabs .on { color: var(--blue); border-bottom-color: var(--blue); }
.pills { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.pills a { padding: 6px 13px; border-radius: 999px; background: #e9edf3; color: var(--text-2); font-size: 13px; font-weight: 700; }
.pills a:hover { text-decoration: none; background: #dfe4ec; }
.pills a.on { background: var(--text); color: #fff; }

/* 라디오 카드 */
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 14px; }
.radio-card { border: 1.5px solid var(--border); border-radius: 12px; padding: 14px 16px; background: #fff; cursor: pointer; font-weight: 700; color: var(--text); margin: 0; }
.radio-card span { display: block; color: var(--muted); font-size: 13px; font-weight: 500; margin-top: 4px; }
.radio-card:has(input:checked) { border-color: var(--blue); background: var(--blue-50); }

/* 설정 행(왼쪽 설명 + 오른쪽 입력) */
.setting-row { display: grid; grid-template-columns: 260px 1fr; gap: 24px; padding: 18px 0; border-top: 1px solid var(--border); }
.setting-row:first-of-type { border-top: 0; padding-top: 4px; }
.setting-row .s-title { font-weight: 750; font-size: 14.5px; }
.setting-row .s-desc { color: var(--muted); font-size: 13px; margin-top: 3px; }
.setting-row label:last-child { margin-bottom: 0; }

/* 빈 상태 */
.empty-state { text-align: center; padding: 34px 16px; }
.empty-ic { width: 54px; height: 54px; border-radius: 15px; background: #eef1f6; color: var(--muted); display: grid; place-items: center; margin: 0 auto 12px; }
.empty-title { font-weight: 750; font-size: 15px; }
.empty-desc { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.empty-action { margin-top: 14px; }

/* 약관 */
.terms-box { border: 1px solid var(--border); border-radius: 11px; background: #fbfcfe; max-height: 200px; overflow-y: auto; padding: 12px 14px; font-size: 13px; color: var(--text-2); margin: 6px 0 4px; }
.terms-box h4, .terms-doc h4 { font-size: 13.5px; margin: 12px 0 4px; color: var(--text); }
.terms-box h4:first-child { margin-top: 0; }
.terms-table { width: 100%; border-collapse: collapse; margin: 8px 0 10px; font-size: 13px; }
.terms-table th, .terms-table td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; vertical-align: top; }
.terms-table th { background: #f6f8fb; width: 120px; white-space: nowrap; }
.terms-meta { color: var(--muted); font-size: 12px; margin-top: 12px; }
.terms-doc { font-size: 14px; color: var(--text-2); }
.terms-doc h4 { font-size: 15px; margin-top: 18px; }
.agree-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 6px 0 16px; }
.agree-all { background: #f6f8fb; padding: 13px 14px; font-weight: 800; }
.agree-item { padding: 12px 14px; border-top: 1px solid var(--border); }
.agree-item .agree-row { display: flex; align-items: center; gap: 8px; }
.agree-item .agree-row label { margin: 0; flex: 1; font-weight: 600; color: var(--text); display: flex; align-items: center; }
.agree-item .toggle-doc { background: none; color: var(--muted); padding: 2px 4px; font-size: 12.5px; font-weight: 600; }
.agree-item .toggle-doc:hover { color: var(--text); background: none; text-decoration: underline; }
.tag-req { color: var(--blue); font-weight: 800; margin-right: 4px; }
.tag-opt { color: var(--muted); font-weight: 800; margin-right: 4px; }

/* ---------------- 로그인/가입 ---------------- */
.auth-body { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); }
.auth-side {
  background: linear-gradient(150deg, #1d4ed8 0%, #4338ca 60%, #6d28d9 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-side .brand { color: #fff; padding: 0; }
.auth-side .brand-mark { background: rgba(255,255,255,.2); }
.auth-side h2 { font-size: 30px; font-weight: 800; line-height: 1.3; margin-bottom: 14px; }
.auth-side p { opacity: .9; font-size: 15px; }
.auth-side .benefits li { font-size: 15px; }
.auth-main { display: flex; align-items: flex-start; justify-content: center; padding: 56px 24px; overflow-y: auto; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card.wide { max-width: 560px; }
.auth-card h1 { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin-bottom: 22px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 18px; }
.form-section { font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: .02em; margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------------- 설치 마법사(예전 화면) ---------------- */
.install-body { display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; }
.install-wrap { width: 100%; max-width: 560px; }
.install-wrap h1 { font-size: 22px; margin-bottom: 18px; font-weight: 800; }
.steps { display: flex; gap: 8px; margin-bottom: 16px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.steps .on { color: var(--blue); font-weight: 800; }
.card h2 { font-size: 17px; }
.summary { font-size: 14px; line-height: 1.8; }

/* ---------------- 모바일 ---------------- */
@media (max-width: 980px) {
  .stats, .type-grid { grid-template-columns: 1fr 1fr; }
  .hero-grid, .split { grid-template-columns: 1fr; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .setting-row { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 860px) {
  .shell { background: var(--bg); }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .sidebar-backdrop { display: none; }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 40; }
  .topbar { display: flex; align-items: center; gap: 8px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 12px; position: sticky; top: 0; z-index: 30; }
  .topbar-brand { font-weight: 800; color: var(--text); }
  .topbar-tenant { margin-left: auto; font-size: 13px; color: var(--muted); max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .content { padding: 18px 16px 32px; }
  .page-head h1 { font-size: 21px; }
  .acting-bar { padding: 9px 16px; }
  .auth-body { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-main { padding: 32px 16px; }
}
@media (max-width: 640px) {
  .grid-2, .upload-grid, .radio-cards, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 19px; }
  .type-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .type-card { padding: 14px; }
  .card { padding: 16px; }
  .card.card-tight { padding: 0; }
  .card-tight .card-head { padding: 14px 14px 0; }
  .table-wrap table.list { min-width: 560px; }
  table.list th { white-space: nowrap; }
  .hide-sm { display: none; }
  .next-bar .btn-lg, .next-bar button.btn-lg { width: 100%; }
  .ledger-hero { padding: 20px; }
  .ledger-hero h2 { font-size: 19px; }
  .step .lbl { display: none; }
  .step.current .lbl { display: inline; }
  table.list th, table.list td { padding: 10px; font-size: 13.5px; }
}
.radio-card span.badge { display: inline-flex; margin-top: 0; vertical-align: 1px; }

/* ---------------- 진행 표시 / 로딩 ---------------- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--blue-100); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; flex: none; }
.spinner.lg { width: 44px; height: 44px; border-width: 4px; }
.progress { background: #f6f8fb; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.progress-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 650; margin-bottom: 8px; }
.progress-top #ex-count { color: var(--muted); font-weight: 700; }
.progress-bar { height: 10px; background: #e6eaf0; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), #6366f1); border-radius: 999px; transition: width .35s ease; }
.file-progress { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.fp-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--border); }
.fp-row:first-child { border-top: 0; }
.fp-row form { margin: 0; }
.fp-main { flex: 1; min-width: 0; }
.fp-name { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-msg { font-size: 12.5px; color: var(--muted); }
.fp-row[data-state="error"] .fp-msg { color: var(--red); }
.fp-sum { font-size: 12.5px; margin-top: 2px; color: var(--muted); }
.fp-sum:empty { display: none; }
.fp-sum[data-sum="ai_done"] { color: #6d28d9; font-weight: 600; }
.fp-sum[data-sum="ai_done"]::before { content: "✦ "; }
.fp-sum[data-sum="ai_error"] { color: #b45309; }
.fp-row[data-state="processing"] { background: var(--blue-50); }
.fp-ic { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #eef0f4; }
.fp-row[data-state="processing"] .fp-ic { background: none; border: 2.5px solid var(--blue-100); border-top-color: var(--blue); animation: spin .8s linear infinite; }
.fp-row[data-state="done"] .fp-ic { background: var(--green); }
.fp-row[data-state="done"] .fp-ic::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.fp-row[data-state="error"] .fp-ic { background: var(--red); }
.fp-row[data-state="error"] .fp-ic::after { content: "!"; color: #fff; font-weight: 800; font-size: 13px; }
.fp-ai { background: #f8fafc; border-top: 1px dashed var(--border); padding: 10px 14px 10px 48px; font-size: 13px; color: var(--text-2); }
.loading-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, .45); display: grid; place-items: center; padding: 16px; }
.loading-box { background: #fff; border-radius: 16px; padding: 26px 28px; width: 100%; max-width: 380px; text-align: center; box-shadow: var(--shadow-lg); }
.loading-box .msg { font-weight: 750; font-size: 16px; margin-top: 14px; }
.loading-box .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.loading-box .progress-bar { margin-top: 14px; }
body.busy { cursor: progress; }
.flow-note { display: flex; gap: 10px; align-items: center; background: var(--blue-50); border: 1px solid var(--blue-100); color: #1e3a8a; border-radius: 12px; padding: 11px 14px; font-size: 13.5px; margin-bottom: 14px; }
[hidden] { display: none !important; }

/* ---------- 자료 올리기·판독 한 화면 ---------- */
.spinner.sm { width: 12px; height: 12px; border-width: 2px; vertical-align: -1px; }
.fc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.fc { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.fc[data-state="processing"], .fc[data-state="uploading"] { border-color: var(--blue-100); box-shadow: 0 0 0 3px var(--blue-50); }
.fc[data-state="error"] { border-color: #fecaca; }
.fc-thumb { display: flex; align-items: center; justify-content: center; height: 120px; background: #f1f4f9; overflow: hidden; }
.fc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fc-ext { font-weight: 800; font-size: 18px; color: var(--muted); letter-spacing: .04em; }
.fc-body { padding: 10px 12px 4px; flex: 1; min-width: 0; }
.fc-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-kind { font-size: 12px; color: var(--muted); }
.fc-sum { font-size: 12.5px; margin-top: 4px; color: var(--text-2); line-height: 1.45; word-break: break-all; }
.fc-sum:empty { display: none; }
.fc-sum[data-sum="ai_done"] { color: #6d28d9; font-weight: 600; }
.fc-sum[data-sum="ai_done"]::before { content: "✦ "; }
.fc-sum[data-sum="ai_error"], .fc-sum[data-sum="ai_skip"] { color: #b45309; }
.fc[data-state="error"] .fc-sum { color: var(--red); font-weight: 500; }
.fc-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 12px 10px; }
.fc-status { font-size: 12px; }
.fc-retry { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 8px; width: 28px; height: 26px; padding: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.fc-retry:hover { color: var(--blue); border-color: var(--blue-100); }
.fc[data-state="uploading"] .fc-retry, .fc[data-state="processing"] .fc-retry, .fc[data-state="pending"] .fc-retry, .fc:not([data-file]) .fc-retry { visibility: hidden; }

.lr-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.lr-f { display: flex; flex-direction: column; padding: 9px 12px; border-radius: 10px; background: var(--violet-50); }
.lr-f .k { font-size: 12px; color: var(--muted); }
.lr-f .v { font-weight: 700; word-break: break-all; }
.lr-f.empty { background: #f6f7f9; }
.lr-f.empty .v { color: #b6bcc8; font-weight: 500; }
.lr-counts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.lr-c { padding: 6px 12px; border-radius: 999px; background: #f1f4f9; font-size: 13.5px; }
.lr-c.ok { background: var(--green-50); color: #166534; }
.lr-c.warn { background: var(--yellow-50); color: #854d0e; }
.lr-c.bad { background: var(--red-50); color: #991b1b; }

.live-bar { position: sticky; bottom: 0; z-index: 20; margin: 22px -4px 0; padding: 12px 0 14px; background: linear-gradient(to top, var(--bg) 75%, rgba(244, 246, 250, 0)); }
.live-bar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px 10px 16px; box-shadow: var(--shadow-lg); flex-wrap: wrap; }
.lb-status { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); font-weight: 600; min-width: 0; }
@media (max-width: 640px) {
  .fc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fc-thumb { height: 92px; }
  .live-bar-in .btn-lg { width: 100%; }
}
.fc-sum { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 확인·수정 화면 ---------- */
.review-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.rs-item { display: flex; flex-direction: column; align-items: center; min-width: 84px; padding: 6px 12px; border-radius: 10px; background: #f1f4f9; }
.rs-item b { font-size: 22px; line-height: 1.2; }
.rs-item span { font-size: 12px; color: var(--muted); }
.rs-item.ok { background: var(--green-50); } .rs-item.ok b { color: #166534; }
.rs-item.warn { background: var(--yellow-50); } .rs-item.warn b { color: #a16207; }
.rs-msg { flex: 1; min-width: 220px; font-size: 14px; color: var(--text-2); padding-left: 6px; }
.items-table tr.row-check td { background: #fffbeb; }
.items-table.collapse-ok tr.row-ok { display: none; }
.full-vin { font-size: 11.5px; color: var(--muted); margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ev-cell { white-space: nowrap; }
.ev { display: inline-block; width: 40px; height: 40px; border-radius: 7px; overflow: hidden; border: 1px solid var(--border); margin-right: 4px; vertical-align: middle; background: #f1f4f9; }
.ev img { width: 100%; height: 100%; object-fit: cover; }
.ev:hover { border-color: var(--blue); }
.ev-file { width: auto; padding: 0 8px; line-height: 38px; font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none; }
label.is-empty input { border-color: #fcd34d; background: #fffdf3; }
.empty-tag { font-size: 11px; font-weight: 700; color: #a16207; background: var(--yellow-50); padding: 1px 6px; border-radius: 6px; margin-left: 4px; }
details.goods-card > summary { cursor: pointer; list-style: none; }
details.goods-card > summary::-webkit-details-marker { display: none; }
details.goods-card > summary::before { content: "▸ "; color: var(--muted); }
details.goods-card[open] > summary::before { content: "▾ "; }
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(10, 14, 22, .88); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 16px 16px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; cursor: zoom-in; }
.lightbox img.zoom { max-width: none; max-height: none; cursor: zoom-out; }
.lightbox .lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: #fff; }
.lightbox .lb-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox .lb-open { color: #c7d7ff; font-size: 14px; }
.lightbox .lb-x { background: rgba(255, 255, 255, .15); color: #fff; border: 0; width: 36px; height: 36px; border-radius: 50%; font-size: 22px; cursor: pointer; padding: 0; }
.lightbox:has(img.zoom) { overflow: auto; align-items: flex-start; justify-content: flex-start; }
@media (max-width: 640px) { .lr-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rs-item { min-width: 64px; } }
.lr-note { flex-basis: 100%; font-size: 13.5px; color: #1e3a8a; background: var(--blue-50); border-radius: 10px; padding: 8px 12px; }

/* ---------- 관세사에게 보내기 ---------- */
.att-head { margin: 14px 0 8px; }
.att-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.att { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; cursor: pointer; margin: 0; font-weight: 400; }
.att:has(input:checked) { border-color: var(--blue-100); background: var(--blue-50); }
.att input { width: auto; margin: 0; }
.att-thumb { width: 44px; height: 44px; border-radius: 7px; background: #f1f4f9; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 10.5px; font-weight: 800; color: var(--muted); flex: none; }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-body { display: flex; flex-direction: column; min-width: 0; }
.att-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-meta { font-size: 12px; color: var(--muted); }

/* v0.9 — 한 번에 올리고 바로 면장 */
.quick-drop { padding: 34px 20px; border-color: var(--blue); background: var(--blue-50); margin-bottom: 12px; }
.quick-drop .slot-ic { width: 54px; height: 54px; background: var(--surface); }
.more-slots { margin-bottom: 4px; }
.more-slots > summary { cursor: pointer; font-size: 13.5px; color: var(--muted); padding: 6px 2px; }
.quick-file { border: 2px solid #16a34a; background: var(--green-50); }
.qf-in { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.qf-ic { width: 52px; height: 52px; border-radius: 14px; background: #16a34a; color: #fff; display: grid; place-items: center; flex: none; }
.qf-text { flex: 1; min-width: 200px; }
.qf-title { font-weight: 800; font-size: 17px; }
.qf-name { font-size: 13.5px; color: var(--muted); word-break: break-all; }
.qf-warn { margin-top: 6px; font-size: 13.5px; color: #854d0e; background: var(--yellow-50); border-radius: 8px; padding: 6px 10px; }
.qf-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 640px) { .qf-btns, .qf-btns .btn-lg { width: 100%; } }

.paste-box { text-align: left; margin-bottom: 12px; }
.paste-box .label { justify-content: flex-start; }
