:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --success: #059669;
  --danger: #dc2626;
  --warn: #d97706;
  --sidebar-bg: #0f1c30;
  --sidebar-text: #cbd5e1;
  --ibk: #004c97;
  --nh: #009944;
  --woori: #0067ac;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: grid;
  place-items: center;
  letter-spacing: 0.5px;
}

.brand-title {
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}

.brand-sub {
  font-size: 11px;
  color: #94a3b8;
}

.mode-badge {
  margin: 14px 4px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.mode-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
}

.mode-badge.mode-codef .dot { background: #38bdf8; }
.mode-badge.mode-firmbanking .dot { background: #10b981; }
.mode-badge.mode-manual .dot { background: var(--sidebar-text); }

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  flex: 1;
}

.nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  padding: 11px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.active {
  background: #1d4ed8;
  color: #fff;
  font-weight: 600;
}

.nav-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
}

.nav-badge.warn { background: #f59e0b; }
.nav-badge.info { background: #0284c7; }

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.supported-pills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.vault-note {
  font-size: 11px;
  color: #94a3b8;
}

/* Main */
.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 24px 30px 48px;
  max-width: 1480px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.highlight-card {
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  border-color: #bfdbfe;
}

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

.card-header.wrap { flex-wrap: wrap; }
.card-header h3 { font-size: 15px; font-weight: 700; }

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 12px;
}

.section-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

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

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: -0.5px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.account-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-card.bank-IBK { border-top-color: var(--ibk); }
.account-card.bank-NH { border-top-color: var(--nh); }
.account-card.bank-WOORI { border-top-color: var(--woori); }

.acc-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.acc-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--text-muted);
}

.acc-name {
  font-weight: 700;
  font-size: 15px;
}

.acc-balance {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.acc-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.acc-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.two-col-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.span-2 { grid-column: span 2; }

/* Badges & Pills */
.bank-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.bank-ibk, .bank-badge-IBK { background: var(--ibk); color: #fff; }
.bank-nh, .bank-badge-NH { background: var(--nh); color: #fff; }
.bank-woori, .bank-badge-WOORI { background: var(--woori); color: #fff; }

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

.status-PENDING { background: #fef3c7; color: #92400e; }
.status-APPROVED { background: #dbeafe; color: #1e40af; }
.status-EXPORTED { background: #ede9fe; color: #5b21b6; }
.status-EXECUTED { background: #d1fae5; color: #065f46; }
.status-REJECTED { background: #fee2e2; color: #991b1b; }
.status-ACTIVE { background: #d1fae5; color: #065f46; }
.status-EXPIRING_SOON { background: #fef3c7; color: #92400e; }
.status-EXPIRED { background: #fee2e2; color: #991b1b; }

.pill-info {
  background: #dbeafe;
  color: #1e40af;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
}

.tx-in { color: #059669; font-weight: 700; }
.tx-out { color: #dc2626; font-weight: 700; }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.four-col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

/* Ledger & Tax Invoice Styles */
.category-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cat-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cat-row-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.cat-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}

.cat-fill {
  height: 100%;
  border-radius: 99px;
  background: #2563eb;
}

.cat-fill.out { background: #ef4444; }
.cat-fill.in { background: #10b981; }

.tax-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.tax-mini-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px;
}

.tax-mini-box .label { font-size: 11px; color: var(--text-muted); }
.tax-mini-box .val { font-size: 16px; font-weight: 800; margin-top: 3px; }

.items-section {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

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

.items-table td { padding: 6px; }
.items-table input { padding: 6px 8px; font-size: 12px; }

.inv-totals-bar {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  padding-top: 10px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.inv-totals-bar .total strong {
  font-size: 16px;
  color: var(--primary);
}

.inline-select {
  padding: 4px 6px !important;
  font-size: 12px !important;
  max-width: 155px;
}

.status-NTS_SENT { background: #d1fae5; color: #065f46; }
.status-DRAFT { background: #e2e8f0; color: #334155; }
.status-CANCELLED { background: #fee2e2; color: #991b1b; }
.dir-SALES { background: #fee2e2; color: #b91c1c; }
.dir-PURCHASE { background: #dbeafe; color: #1d4ed8; }

/* 국세청 표준 전자세금계산서 출력 양식 */
.nts-invoice {
  border: 2px solid #dc2626;
  padding: 18px;
  background: #fff;
  color: #111827;
}
.nts-invoice.buyer-copy { border-color: #1d4ed8; }
.nts-invoice.buyer-copy .nts-title,
.nts-invoice.buyer-copy .nts-table th { color: #1d4ed8; border-color: #93c5fd; }
.nts-invoice.buyer-copy .nts-table td { border-color: #93c5fd; }

.nts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.nts-title {
  font-size: 20px;
  font-weight: 800;
  color: #dc2626;
  letter-spacing: 2px;
}
.nts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 10px;
}
.nts-table th, .nts-table td {
  border: 1px solid #fca5a5;
  padding: 6px 8px;
}
.nts-table th {
  background: #fef2f2;
  color: #991b1b;
  font-weight: 700;
  text-align: center;
}
.nts-invoice.buyer-copy .nts-table th { background: #eff6ff; color: #1e40af; }

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field.grow { flex: 1; min-width: 180px; }

.form-field label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="url"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

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

.mono-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.checkbox-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chk-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  background: #f8fafc;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 6px; }

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

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

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }

.btn-danger { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.btn-danger:hover { background: #fecaca; }

.btn-ghost { background: transparent; color: #475569; }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filter-btns {
  display: flex;
  gap: 6px;
}

.filter-inline {
  display: flex;
  gap: 8px;
}

.filter-inline select {
  width: auto;
  padding: 6px 10px;
}

.period-presets {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.chip {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 99px;
  padding: 4px 11px;
  font-size: 12px;
  cursor: pointer;
  color: #334155;
}

.chip:hover { background: #e2e8f0; }

.tx-summary-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
}

.summary-chip .label { font-size: 12px; color: var(--text-muted); }
.summary-chip .val { font-size: 17px; font-weight: 800; margin-top: 2px; }

.tx-page-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: 12px; }
.tx-page-controls[hidden] { display: none; }
.tx-page-controls button[aria-disabled="true"] { cursor: default; opacity: 0.55; background: var(--surface); }
.tx-page-controls button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Tables */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  color: #475569;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}

.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table th.num, .data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sub-cell {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.action-cell {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* Bulk Export & Security Banner */
.helper-text {
  font-size: 13px;
  color: #475569;
  margin-bottom: 14px;
}

.bank-guide-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #1e3a8a;
  margin: 12px 0;
}

.bulk-btn-row {
  display: flex;
  justify-content: flex-end;
}

.security-banner {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 13px;
}

/* Cert List */
.cert-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.cert-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cert-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.cert-meta-row {
  font-size: 12px;
  color: #475569;
  display: flex;
  justify-content: space-between;
}

.cert-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

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

.modal-body { padding: 20px; }

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tx-import-dialog {
  margin: auto;
  width: min(calc(100% - 24px), 760px);
  max-width: none;
  border: 0;
}

.tx-import-dialog::backdrop { background: rgba(15, 23, 42, 0.55); }
.tx-import-dialog .modal-body { display: grid; gap: 14px; }
.tx-import-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.tx-import-control-row { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.tx-import-status, .tx-import-scope { color: var(--text-muted); font-size: 13px; overflow-wrap: anywhere; }
.tx-import-error { color: var(--danger); font-size: 13px; }
.tx-import-dialog input[aria-invalid="true"], .tx-import-dialog select[aria-invalid="true"] { border-color: var(--danger); }
.tx-import-dialog button:focus-visible, .tx-import-table:focus-visible, #btnTxImport:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.tx-import-dialog button:disabled { cursor: default; opacity: 0.55; }
.tx-import-dialog button[aria-busy="true"] { cursor: progress; }
.tx-import-control-row[hidden], .tx-import-preview[hidden] { display: none; }
.tx-import-preview { display: grid; gap: 10px; border-top: 1px solid var(--border); padding-top: 14px; }
.tx-import-preview .sub-cell:empty { display: none; }
.tx-import-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tx-import-counts div { padding: 8px 12px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px; }
.tx-import-counts dt { font-size: 12px; color: var(--text-muted); }
.tx-import-counts dd { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tx-import-warnings { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 8px 30px; font-size: 13px; }
.tx-import-table { border: 1px solid var(--border); border-radius: 8px; max-height: 15rem; }
.tx-import-table thead { position: sticky; top: 0; }
.tx-import-table .data-table { min-width: 520px; }
.tx-import-table time, .tx-import-table td.num { white-space: nowrap; }
.tx-import-table td:nth-child(2) { max-width: 22rem; overflow-wrap: anywhere; }

@media (max-width: 580px) {
  .tx-import-fields { grid-template-columns: minmax(0, 1fr); }
  .tx-import-counts div { padding-inline: 8px; }
}

.inquiry-dialog {
  margin: auto;
  width: min(calc(100% - 32px), 520px);
  border: 0;
}

.inquiry-dialog::backdrop { background: rgba(15, 23, 42, 0.55); }
.inquiry-dialog .modal-body { display: grid; gap: 12px; }

.inquiry-account-info,
.inquiry-secret-field,
.inquiry-account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inquiry-account-info { margin-bottom: 12px; }
.inquiry-account-info .helper-text { margin: 0; }
.inquiry-status { flex-basis: 100%; }
.inquiry-status:empty { display: none; }
.inquiry-secret-field input { flex: 1; min-width: 8em; }
.inquiry-public-key { resize: none; }
.inquiry-error { color: var(--danger); font-size: 13px; margin-block: 8px; }
.inquiry-button[aria-busy="true"],
.inquiry-dialog button[aria-busy="true"] { cursor: progress; opacity: 0.75; }
.inquiry-button:focus-visible,
.inquiry-dialog button:focus-visible,
#codefInquirySettings button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#codefInquirySettings { margin-bottom: 16px; }

/* Receipt */
.receipt-paper {
  border: 2px solid #0f172a;
  padding: 24px;
  background: #fff;
}

.receipt-title {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 3px;
  padding-bottom: 14px;
  border-bottom: 2px solid #0f172a;
  margin-bottom: 18px;
}

.receipt-table {
  width: 100%;
  border-collapse: collapse;
}

.receipt-table th, .receipt-table td {
  border: 1px solid #cbd5e1;
  padding: 9px 12px;
  font-size: 13px;
}

.receipt-table th {
  background: #f8fafc;
  width: 34%;
  text-align: left;
  color: #334155;
}

.receipt-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: #475569;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
  max-width: 420px;
}

.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }

.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 28, 48, 0.92);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px 26px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
}

.login-error {
  margin-top: 8px;
  font-size: 12px;
  color: #dc2626;
  font-weight: 600;
}

.hidden,
:root:not(.manual-mode) [data-manual-only],
:root:not(.bank-inquiry-mode) [data-bank-inquiry],
.manual-mode [data-automatic-only] {
  display: none !important;
}

#btnExportHometax[aria-busy="true"] {
  cursor: progress;
  opacity: 0.75;
}

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

.export-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

@media (max-width: 1120px) {
  .kpi-grid, .account-cards-grid, .two-col-grid {
    grid-template-columns: 1fr;
  }
  .form-grid.four-col, .form-grid.three-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .span-2 { grid-column: span 1; }
  .tx-summary-bar { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .sidebar { position: static; width: 100%; height: auto; }
  .app-shell { flex-direction: column; }
  .main-content { margin-left: 0; padding: 16px; }
}

@media print {
  .sidebar, .topbar, .no-print, .toast-container, .filter-bar, .period-presets, .export-actions {
    display: none !important;
  }
  .main-content { margin: 0; padding: 0; }
  .modal-overlay {
    position: static;
    background: none;
    padding: 0;
  }
  .modal { box-shadow: none; max-width: 100%; }
}
