:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --navy: #0f172a;
  --navy-light: #1e293b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-sub: #475569;
  --text-muted: #64748b;

  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #eff6ff;

  --emerald: #047857;
  --emerald-soft: #ecfdf5;
  --emerald-border: #a7f3d0;

  --amber: #b45309;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;

  --crimson: #b91c1c;
  --crimson-soft: #fef2f2;
  --crimson-border: #fecaca;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.center {
  text-align: center !important;
}

.hidden {
  display: none !important;
}

/* ==================== 상단 요약 바 ==================== */
.topbar {
  background: var(--navy);
  color: #f8fafc;
  border-bottom: 1px solid #1e293b;
}

.topbar-inner {
  max-width: 1380px;
  margin: 0 auto;
  padding: 13px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.45);
}

.brand-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin: 1px 0 0;
  font-size: 12px;
  color: #94a3b8;
}

.summary-pills {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.summary-pill {
  background: var(--navy-light);
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: #e2e8f0;
  font-size: 12.5px;
}

.summary-pill-btn {
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, transform 0.1s;
}

.summary-pill-btn:hover {
  border-color: #60a5fa;
  transform: translateY(-1px);
}

.summary-pill-warn.has-items {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.16);
}

.pill-label {
  color: #cbd5e1;
}

.pill-value {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
}

.pill-blue {
  color: #60a5fa;
}

.pill-amber {
  color: #fbbf24;
}

.pill-emerald {
  color: #34d399;
}

.pill-unit {
  color: #94a3b8;
  font-size: 11.5px;
}

/* ==================== 탭 메뉴 ==================== */
.subnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}

.subnav-inner {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.nav-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 13px 16px 11px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.nav-tab:hover {
  color: var(--primary);
  background: var(--surface-alt);
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.tab-badge {
  background: var(--amber);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}

/* ==================== 레이아웃 & 카드 ==================== */
.workspace {
  max-width: 1380px;
  margin: 0 auto;
  padding: 22px 24px 56px;
}

.split-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 20px;
  align-items: start;
}

.statements-grid {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 1080px) {
  .split-grid,
  .statements-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.card + .card {
  margin-top: 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.card-desc {
  margin: 4px 0 0;
  color: var(--text-sub);
  font-size: 12.5px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.section-desc {
  margin: 4px 0 0;
  color: var(--text-sub);
  font-size: 13px;
}

.subcard-title {
  margin: 0 0 12px;
  font-size: 14.5px;
  font-weight: 700;
}

.scope-chip {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ==================== 칩 / 버튼 / 입력 ==================== */
.sample-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.sample-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
  margin-right: 2px;
}

.chip {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.chip-warn {
  border-color: var(--amber-border);
  background: var(--amber-soft);
  color: var(--amber);
}

.chip-info {
  border-color: #bfdbfe;
  background: var(--primary-soft);
  color: var(--primary);
}

.input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

.input-sm {
  width: auto;
  padding: 6px 10px;
  font-size: 13px;
}

.account-select-wide {
  min-width: 240px;
}

.num-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
  width: 150px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-emerald {
  background: var(--emerald);
  color: #fff;
}

.btn-emerald:hover:not(:disabled) {
  background: #065f46;
}

.btn-secondary {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-alt);
}

.btn-danger {
  background: var(--crimson);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #991b1b;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-sub);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-alt);
  color: var(--text);
}

/* ==================== 배지 & 알림 ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge-posted {
  background: var(--emerald-soft);
  color: var(--emerald);
  border-color: var(--emerald-border);
}

.badge-draft {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #bfdbfe;
}

.badge-void {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.badge-review {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: var(--amber-border);
}

.badge-danger {
  background: var(--crimson-soft);
  color: var(--crimson);
  border-color: var(--crimson-border);
}

.badge-type {
  background: #f8fafc;
  color: #334155;
  border-color: #cbd5e1;
}

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
}

.alert-danger {
  background: var(--crimson-soft);
  color: var(--crimson);
  border-color: var(--crimson-border);
}

.alert-warn {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: var(--amber-border);
}

/* ==================== AI 채팅 스트림 ==================== */
.chat-stream {
  min-height: 360px;
  max-height: 520px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.empty-chat {
  margin: auto;
  text-align: center;
  max-width: 420px;
  color: var(--text-sub);
}

.empty-title {
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
}

.empty-sub {
  margin: 0;
  font-size: 12.5px;
}

.user-bubble {
  flex-shrink: 0;
  align-self: flex-end;
  max-width: 82%;
  background: var(--navy);
  color: #fff;
  padding: 9px 14px;
  border-radius: 14px 14px 3px 14px;
  font-size: 13.5px;
}

.ai-card {
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.ai-card-review {
  border-left: 4px solid #f59e0b;
}

.ai-card-needinfo {
  border-left: 4px solid var(--primary);
}

.ai-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.ai-reason {
  margin: 8px 0;
  padding: 8px 11px;
  background: var(--surface-alt);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-sub);
}

.ai-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.followup-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.question-list {
  margin: 6px 0;
  padding-left: 18px;
  color: var(--text);
  font-weight: 600;
}

.chat-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.composer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-sub);
}

.meta-hint {
  color: var(--text-muted);
  font-size: 12px;
}

.composer-row {
  display: flex;
  gap: 8px;
}

.composer-textarea {
  resize: vertical;
  min-height: 54px;
}

.composer-btn {
  white-space: nowrap;
  padding: 0 18px;
}

/* ==================== 수동 분개 폼 & 표 ==================== */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 4px;
}

.lines-table-wrap,
.table-wrap,
.table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 580px;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.55;
}

.table th,
.table td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface-alt);
  color: var(--text-sub);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0 1px 0 var(--border-strong);
}

.table tfoot td {
  background: #f1f5f9;
  font-weight: 800;
  border-top: 2px solid var(--border-strong);
}

.lines-edit-table td {
  padding: 6px;
}

.col-act {
  width: 48px;
  text-align: center !important;
}

.lines-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 12px;
  gap: 8px;
}

.int-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.balance-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  margin-bottom: 12px;
}

.balance-bar.is-ok {
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
}

.balance-bar.is-bad {
  background: var(--crimson-soft);
  border-color: var(--crimson-border);
}

.balance-cell {
  display: flex;
  flex-direction: column;
  font-size: 11.5px;
  color: var(--text-sub);
}

.balance-cell strong {
  font-size: 13.5px;
  color: var(--text);
}

.balance-bar.is-ok .balance-state {
  color: var(--emerald);
}

.balance-bar.is-bad .balance-state {
  color: var(--crimson);
}

/* ==================== 초안 대기 & 분개장 카드 ==================== */
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-pill {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text-sub);
  padding: 6px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.filter-pill.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px 16px;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-inline label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-sub);
  white-space: nowrap;
}

.cards-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.entry-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 18px;
  box-shadow: var(--shadow-sm);
}

.entry-card.is-review {
  border-left: 4px solid #f59e0b;
}

.entry-card.is-void {
  opacity: 0.78;
  background: #fafafa;
}

.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.entry-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.entry-id {
  font-weight: 800;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
}

.entry-date {
  font-weight: 600;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
}

.entry-desc {
  font-weight: 700;
  font-size: 14.5px;
}

.source-quote {
  margin: 6px 0 10px;
  padding: 7px 11px;
  background: var(--surface-alt);
  border-left: 3px solid #94a3b8;
  font-size: 12.5px;
  color: var(--text-sub);
}

.immutable-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==================== 원장 KPI & T계정 ==================== */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.kpi-box span {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.kpi-box strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.t-account-card {
  margin-bottom: 16px;
}

.t-header {
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--navy);
}

.t-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 150px;
}

.t-side {
  padding: 12px 16px;
}

.t-side-left {
  border-right: 2px solid var(--navy);
}

.t-side-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.t-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--border);
}

.t-foot {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 2px solid var(--border-strong);
  display: flex;
  justify-content: space-between;
  font-weight: 800;
}

/* ==================== 시산표 & 재무제표 ==================== */
.segmented {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}

.seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  white-space: nowrap;
}

/* 15e 항목 I: 세무 실무 탭(10번) 하위 메뉴 가로 줄바꿈 탭 구조 */
.vat-header {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 12px;
}

.vat-subnav {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px;
  width: 100%;
  background: #f1f5f9;
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.vat-subnav .seg-btn {
  white-space: nowrap !important;
  flex: 0 0 auto;
  padding: 7px 14px;
  font-size: 13px;
  line-height: 1.3;
}

.seg-btn.active {
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.verify-banner {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.verify-ok {
  background: var(--emerald-soft);
  color: var(--emerald);
  border: 1px solid var(--emerald-border);
}

.verify-bad {
  background: var(--crimson-soft);
  color: var(--crimson);
  border: 1px solid var(--crimson-border);
}

.tb-account-link {
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.stmt-section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-sub);
  background: var(--surface-alt);
  padding: 6px 10px;
  margin: 12px 0 4px;
  border-radius: 5px;
}

.stmt-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13.5px;
}

.stmt-row.indent {
  padding-left: 24px;
  color: var(--text-sub);
  font-size: 12.5px;
}

.stmt-row.highlight {
  background: #f8fafc;
  font-weight: 800;
  border-top: 1px solid var(--border-strong);
  border-bottom: 2px solid var(--border-strong);
}

.stmt-row.net-income {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  font-size: 14.5px;
  border-radius: 6px;
  margin-top: 8px;
}

.empty-box {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
}

/* ==================== 모달 & 토스트 ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 16px;
}

.modal-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 22px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.modal-wide {
  max-width: 720px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.btn-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body-note {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-sub);
  background: var(--surface-alt);
  padding: 10px 12px;
  border-radius: 6px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.edit-balance-summary {
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: calc(100vw - 32px);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  box-sizing: border-box;
}

.toast {
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  max-width: min(480px, calc(100vw - 40px));
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  box-sizing: border-box;
  pointer-events: auto;
}

@media (max-width: 640px) {
  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
    align-items: stretch;
    max-width: calc(100vw - 32px);
  }
  .toast {
    max-width: 100%;
  }
}

.toast-error {
  background: var(--crimson);
}

.toast-ok {
  background: var(--emerald);
}

/* ==================== 5단계: 결산 마감 패널 ==================== */
.close-panel {
  margin-top: 20px;
  border-top: 3px solid var(--primary);
}

.close-form-bar {
  background: var(--surface-alt);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.closing-entries-box {
  margin-top: 12px;
}

.closing-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  background: var(--primary-soft);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}


/* ==================== 7단계: 사업자 프로필 · 설정 화면 ==================== */
.profile-summary-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-mods-line {
  font-size: 12.5px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.checkbox-row label,
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

.mini-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  background: var(--surface-alt);
}

.row-void {
  opacity: 0.55;
}

.btn-toggle-acc,
.btn-del-rule,
.btn-gen-rec {
  white-space: nowrap;
}

/* 8단계 보조원장 서브탭 */
.subledger-subnav-btn {
  font-weight: 600;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.subledger-subnav-btn.active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}


/* ==================== 전체 AI 어시스턴트 패널 (Step 15b) ==================== */
@media (min-width: 1161px) {
  body:not(.assistant-hidden) .workspace {
    margin-right: 360px;
    transition: margin-right 0.2s ease;
  }
}

@media (max-width: 1160px) {
  body:not(.assistant-hidden) .workspace {
    margin-right: 0 !important;
  }
  .top-header, .summary-bar, .nav-tabs {
    position: relative;
    z-index: 1010;
  }
  .global-assistant-panel {
    top: 95px !important;
    z-index: 999;
  }
}

.global-assistant-panel {
  position: fixed;
  right: 0;
  top: 50px;
  bottom: 0;
  width: 360px;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  box-shadow: -3px 0 12px rgba(15, 23, 42, 0.06);
  transition: transform 0.25s ease;
}

.global-assistant-panel.collapsed {
  transform: translateX(315px);
}

.global-assistant-panel.collapsed .assistant-quick-chips,
.global-assistant-panel.collapsed .assistant-messages,
.global-assistant-panel.collapsed .assistant-form {
  display: none !important;
}

.assistant-header {
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.assistant-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.assistant-icon {
  font-size: 16px;
}

.assistant-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.assistant-quick-chips {
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border);
}

.assistant-quick-chip {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s ease;
}

.assistant-quick-chip:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fcfdfe;
}

.assistant-msg-row {
  display: flex;
  width: 100%;
}

.assistant-msg-user {
  justify-content: flex-end;
}

.assistant-msg-agent {
  justify-content: flex-start;
}

.assistant-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.assistant-bubble-user {
  background: var(--primary);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.assistant-bubble-agent {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border-bottom-left-radius: 2px;
}

.assistant-result-card,
.assistant-advice-card {
  margin-top: 8px;
  padding: 8px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 12px;
}

.assistant-table {
  margin-top: 6px;
  font-size: 12px;
}

.assistant-metrics-grid {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.assistant-metric-chip {
  display: flex;
  justify-content: space-between;
  padding: 3px 6px;
  background: #ffffff;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.assistant-action-tip {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.assistant-form {
  padding: 8px 12px;
  background: #ffffff;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
}

.assistant-input {
  flex: 1;
}

/* 테두리 반짝임 하이라이트 애니메이션 */
@keyframes pulseHighlight {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    outline: 3px solid #2563eb;
  }
  50% {
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
    outline: 3px solid #3b82f6;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    outline: 3px solid transparent;
  }
}

.pulse-highlight {
  animation: pulseHighlight 1.5s ease-in-out 2 !important;
  transition: all 0.2s ease-in-out;
}

/* 15c단계: 랜딩 페이지 오버레이 및 컴포넌트 */
.landing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.landing-overlay.hidden {
  display: none !important;
}

.landing-container {
  background: #ffffff;
  border-radius: 16px;
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  border: 1px solid #cbd5e1;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.landing-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.landing-badge {
  display: inline-block;
  padding: 6px 14px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
  border-radius: 9999px;
  border: 1px solid #bfdbfe;
}

.landing-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.landing-desc {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: #475569;
  max-width: 720px;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 10px;
}

.btn-landing {
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.feature-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}

.feature-icon {
  font-size: 30px;
}

.feature-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.feature-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #475569;
}

/* 15c단계 C: 다크/라이트 테마 지원 */
[data-theme="dark"], body.theme-dark {
  --bg: #0b0f19;
  --surface: #131b2e;
  --surface-alt: #1a243b;
  --border: #24304f;
  --border-strong: #33436b;
  --text: #f1f5f9;
  --text-sub: #cbd5e1;
  --text-muted: #94a3b8;
}

[data-theme="dark"] .landing-container, body.theme-dark .landing-container {
  background: #131b2e;
  border-color: #24304f;
  color: #f1f5f9;
}

[data-theme="dark"] .landing-title, body.theme-dark .landing-title,
[data-theme="dark"] .feature-title, body.theme-dark .feature-title {
  color: #f8fafc;
}

[data-theme="dark"] .feature-card, body.theme-dark .feature-card {
  background: #1a243b;
  border-color: #24304f;
}

[data-theme="dark"] .landing-desc, body.theme-dark .landing-desc,
[data-theme="dark"] .feature-body, body.theme-dark .feature-body {
  color: #cbd5e1;
}

[data-theme="dark"] .card, body.theme-dark .card {
  background: #131b2e;
  border-color: #24304f;
}

[data-theme="dark"] .table-data th, body.theme-dark .table-data th {
  background: #1a243b;
  color: #e2e8f0;
}

[data-theme="dark"] .table-data td, body.theme-dark .table-data td {
  border-color: #24304f;
  color: #f1f5f9;
}

/* 15c단계 F: 전 화면 가독성(대비·폰트·줄간격·금액우측정렬) & 모바일 폭 대응 */
body {
  font-size: 14.5px;
  line-height: 1.6;
}

.num, td.num, th.num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 600;
}

@media (max-width: 768px) {
  .topbar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px;
  }

  .brand {
    justify-content: space-between;
  }

  .brand-sub {
    font-size: 11px;
    line-height: 1.4;
  }

  .summary-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }

  .summary-pill {
    flex: 1 1 calc(50% - 6px);
    min-width: 130px;
  }

  .subnav-inner {
    overflow-x: auto;
    white-space: nowrap;
    padding: 6px 12px;
    -webkit-overflow-scrolling: touch;
  }

  .split-grid {
    grid-template-columns: 1fr !important;
  }

  .landing-container {
    padding: 24px 16px;
  }

  .landing-title {
    font-size: 22px;
  }

  .landing-features-grid {
    grid-template-columns: 1fr !important;
  }

  .global-assistant-panel {
    width: 100% !important;
    max-width: 100vw !important;
    right: 0 !important;
    bottom: 0 !important;
    max-height: 60vh !important;
  }
}
