/* ===== CSS VARIABLES ===== */
:root {
  --primary: #2856b4;
  --primary-dark: #1a3d7c;
  --primary-light: #4a8fd9;
  --primary-pale: #e8f0fc;
  --primary-glow: rgba(43, 86, 180, 0.18);
  --accent: #ff6535;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --text-primary: #0d1b3e;
  --text-secondary: #4a5568;
  --text-muted: #9ca3af;
  --bg-main: #f0f5fc;
  --bg-card: #ffffff;
  --border: #e2ecf8;
  --border-focus: #2856b4;
  --shadow-sm: 0 2px 8px rgba(43, 86, 180, 0.08);
  --shadow: 0 4px 20px rgba(43, 86, 180, 0.12);
  --shadow-lg: 0 8px 40px rgba(43, 86, 180, 0.2);
  --shadow-xl: 0 20px 60px rgba(43, 86, 180, 0.28);
  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.environment-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 7px 12px;
  color: #fff;
  background: repeating-linear-gradient(135deg, #b45309 0, #b45309 14px, #c2410c 14px, #c2410c 28px);
  box-shadow: 0 2px 10px rgba(124, 45, 18, 0.3);
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: center;
}
.environment-banner strong {
  padding: 2px 6px;
  border-radius: 4px;
  color: #9a3412;
  background: #fff7ed;
  font-size: 0.64rem;
  letter-spacing: 0.08em;
}
.test-environment .page-header { top: 34px; }
.main-body > .environment-banner {
  flex-shrink: 0;
  width: calc(100% + 40px);
  margin: -24px -20px 0;
}

/* ===========================
   MAIN PAGE
=========================== */
.main-body {
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 24px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}

.main-bg-circle {
  position: absolute;
  border-radius: 50%;
  animation: pulse-slow 6s ease-in-out infinite;
  pointer-events: none;
  opacity: 0.5;
}
.main-bg-circle.c1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(40, 86, 180, 0.06) 0%, transparent 70%);
  top: -100px; right: -100px;
  animation-delay: 0s;
}
.main-bg-circle.c2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(39, 174, 96, 0.04) 0%, transparent 70%);
  bottom: -80px; left: -80px;
  animation-delay: 3s;
}

@keyframes pulse-slow {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.12); opacity: 1; }
}

.main-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 44px;
  z-index: 1;
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: auto 0;
}

/* Logo */
.logo-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-logo {
  width: 220px;
  max-width: 80vw;
  animation: float 4s ease-in-out infinite;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.06));
}

.logo-glow {
  position: absolute;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(40, 86, 180, 0.03) 0%, transparent 65%);
  border-radius: 50%;
  animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
}

@keyframes glow-pulse {
  0%, 100% { transform: scale(0.85); opacity: 0.4; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* Menu Grid */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  width: 100%;
}

.menu-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 34px 20px 28px;
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

#btn-sales {
  background: linear-gradient(135deg, #2856b4, #1a3d7c);
  color: white;
  border: 1px solid rgba(40, 86, 180, 0.15);
  box-shadow: 0 8px 24px rgba(40, 86, 180, 0.18);
}
#btn-sales .menu-title {
  color: white;
}
#btn-sales .menu-subtitle {
  color: rgba(255, 255, 255, 0.78);
}
#btn-sales .menu-arrow {
  color: white;
  opacity: 0.6;
}

#btn-purchase {
  background: linear-gradient(135deg, #27ae60, #1e8449);
  color: white;
  border: 1px solid rgba(39, 174, 96, 0.15);
  box-shadow: 0 8px 24px rgba(39, 174, 96, 0.18);
}
#btn-purchase .menu-title {
  color: white;
}
#btn-purchase .menu-subtitle {
  color: rgba(255, 255, 255, 0.78);
}
#btn-purchase .menu-arrow {
  color: white;
  opacity: 0.6;
}

#btn-statistics {
  background: linear-gradient(135deg, #7b1fa2, #4a148c);
  color: white;
  border: 1px solid rgba(123, 31, 162, 0.18);
  box-shadow: 0 8px 24px rgba(123, 31, 162, 0.2);
}
#btn-statistics .menu-title { color: white; }
#btn-statistics .menu-subtitle { color: rgba(255, 255, 255, 0.78); }
#btn-statistics .menu-arrow { color: white; opacity: 0.6; }

#btn-item-statistics {
  background: linear-gradient(135deg, #0369a1, #075985);
  color: white;
  border: 1px solid rgba(3, 105, 161, 0.18);
  box-shadow: 0 8px 24px rgba(3, 105, 161, 0.2);
}
#btn-item-statistics .menu-title { color: white; }
#btn-item-statistics .menu-subtitle { color: rgba(255, 255, 255, 0.8); }
#btn-item-statistics .menu-arrow { color: white; opacity: 0.6; }
#btn-item-statistics .item-statistics-new { color: #075985; }

#btn-statements {
  background: linear-gradient(135deg, #0f766e, #115e59);
  color: white;
  border: 1px solid rgba(15, 118, 110, 0.18);
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.2);
}
#btn-statements .menu-title { color: white; }
#btn-statements .menu-subtitle { color: rgba(255, 255, 255, 0.78); }
#btn-statements .menu-arrow { color: white; opacity: 0.6; }

#btn-notices {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: white;
  border: 1px solid rgba(234, 88, 12, 0.18);
  box-shadow: 0 8px 24px rgba(194, 65, 12, 0.2);
}
#btn-notices .menu-title { color: white; }
#btn-notices .menu-subtitle { color: rgba(255, 255, 255, 0.8); }
#btn-notices .menu-arrow { color: white; opacity: 0.6; }
.menu-new-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #c2410c;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

#btn-unpaid {
  background: linear-gradient(135deg, #8e44ad, #5e3370);
  color: white;
  border: 1px solid rgba(142, 68, 173, 0.15);
  box-shadow: 0 8px 24px rgba(142, 68, 173, 0.18);
}
#btn-unpaid .menu-title { color: white; }
#btn-unpaid .menu-subtitle { color: rgba(255, 255, 255, 0.78); }
#btn-unpaid .menu-arrow { color: white; opacity: 0.6; }

.menu-card:hover {
  transform: translateY(-8px) scale(1.02);
}
#btn-sales:hover {
  box-shadow: 0 16px 36px rgba(40, 86, 180, 0.32);
  border-color: rgba(255,255,255,0.25);
}
#btn-purchase:hover {
  box-shadow: 0 16px 36px rgba(39, 174, 96, 0.32);
  border-color: rgba(255,255,255,0.25);
}
#btn-statistics:hover {
  box-shadow: 0 16px 36px rgba(123, 31, 162, 0.34);
  border-color: rgba(255,255,255,0.25);
}
#btn-item-statistics:hover {
  box-shadow: 0 16px 36px rgba(3, 105, 161, 0.34);
  border-color: rgba(255,255,255,0.25);
}
#btn-statements:hover {
  box-shadow: 0 16px 36px rgba(15, 118, 110, 0.34);
  border-color: rgba(255,255,255,0.25);
}
#btn-notices:hover {
  box-shadow: 0 16px 36px rgba(194, 65, 12, 0.34);
  border-color: rgba(255,255,255,0.25);
}
#btn-unpaid:hover {
  box-shadow: 0 16px 36px rgba(142, 68, 173, 0.32);
  border-color: rgba(255,255,255,0.25);
}

.menu-card:active { transform: translateY(-2px) scale(0.99); }

.menu-icon { font-size: 2.8rem; margin-bottom: 4px; }
.menu-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; }
.menu-subtitle { font-size: 0.72rem; font-weight: 400; }
.menu-arrow {
  margin-top: 10px;
  font-size: 0.9rem;
  transition: var(--transition);
}
.menu-card:hover .menu-arrow {
  opacity: 1;
  transform: translateX(5px);
}

.footer-tagline {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: center;
}

/* ===========================
   INNER PAGES - HEADER
=========================== */
.page-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 24px rgba(43, 86, 180, 0.45);
  min-height: 60px;
}

.btn-back {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition);
  text-decoration: none;
  flex-shrink: 0;
}

.btn-back:hover {
  background: rgba(255,255,255,0.28);
  transform: scale(1.08);
}

.header-brand { display: inline-flex; align-items: center; flex-shrink: 0; text-decoration: none; border-radius: 6px; }
.header-brand:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.header-logo { display: block; width: 113px; height: 36px; object-fit: contain; }

.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: white;
  flex: 1;
  letter-spacing: -0.01em;
}

/* ===========================
   INNER PAGES - BODY
=========================== */
.page-body {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 14px 100px;
}

/* ===========================
   UNPAID ALERT
=========================== */
.alert-unpaid {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  color: white;
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  box-shadow: 0 6px 24px rgba(231, 76, 60, 0.38);
  animation: alert-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes alert-in {
  0% { transform: translateY(-12px) scale(0.95); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.alert-icon { font-size: 1.6rem; flex-shrink: 0; }

.alert-label { font-size: 0.72rem; opacity: 0.85; font-weight: 400; margin-bottom: 2px; }
.alert-amount { font-size: 1.35rem; font-weight: 900; letter-spacing: -0.03em; }

/* ===========================
   FORM CARDS
=========================== */
.form-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  border: 1px solid var(--border);
}

.section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-left: 4px;
}

/* ===========================
   FORM INPUTS
=========================== */
.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  background: #f8faff;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  background: white;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder { color: var(--text-muted); font-weight: 400; }

/* Company Picker */
.company-picker {
  position: relative;
  margin-top: 8px;
}

.company-picker-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8faff;
  color: var(--primary-dark);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.company-picker-toggle:hover,
.company-picker.open .company-picker-toggle {
  border-color: var(--primary-light);
  background: var(--primary-pale);
}

.company-picker-count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.company-picker-arrow {
  margin-left: 8px;
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.company-picker.open .company-picker-arrow { transform: rotate(180deg); }

.company-picker-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  box-shadow: 0 14px 32px rgba(30, 64, 175, 0.16);
}

.company-picker-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--text-color);
  font-size: 0.82rem;
}

.company-picker-close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
}

.company-picker-search {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.82rem;
}

.company-picker-search:focus { border-color: var(--border-focus); }

.company-picker-list {
  max-height: 230px;
  margin-top: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.company-picker-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #eef2f7;
}

.company-picker-row:last-child { border-bottom: 0; }

.company-picker-select {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
  gap: 8px;
  padding: 10px 8px;
  border: 0;
  background: transparent;
  color: var(--text-color);
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  text-align: left;
}

.company-picker-select:hover { background: var(--primary-pale); }
.company-picker-name { overflow: hidden; flex: 1; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.company-picker-select small { flex-shrink: 0; color: var(--text-muted); font-size: 0.68rem; }

.company-picker-edit {
  flex-shrink: 0;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  color: var(--primary);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.company-picker-edit:hover { border-color: var(--primary); background: var(--primary-pale); }
.company-picker-empty { padding: 24px 10px; color: var(--text-muted); font-size: 0.78rem; text-align: center; }
.company-picker-hint { margin: 8px 2px 0; color: var(--text-muted); font-size: 0.68rem; line-height: 1.45; }
/* ===========================
   CALC ROWS
=========================== */
.calc-card {
  background: #f8faff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: var(--transition);
}

.calc-card:focus-within {
  border-color: var(--primary-light);
  background: white;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.calc-card-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.calc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calc-input {
  flex: 1;
  min-width: 72px;
  padding: 9px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  background: white;
  transition: var(--transition);
  outline: none;
  text-align: right;
}

.calc-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.calc-op { font-size: 1rem; font-weight: 800; color: var(--primary); flex-shrink: 0; }

.calc-result {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 90px;
  text-align: right;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Commission */
.calc-card.commission-card {
  background: linear-gradient(135deg, #fff4f0, #fff8f5);
  border-color: #ffd5c2;
}

.calc-card.commission-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 101, 53, 0.15);
}

.calc-card.commission-card .calc-card-label { color: #c0392b; }
.calc-input.commission-input { max-width: 88px; }
.calc-result.commission-result { background: linear-gradient(135deg, var(--accent), #e05030); }

/* ===========================
   TOTAL CARD
=========================== */
.total-card {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.total-card::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(255,255,255,0.1), transparent 70%);
  border-radius: 50%;
}

.total-label { font-size: 0.9rem; font-weight: 700; color: rgba(255,255,255,0.8); }
.total-right { display: flex; align-items: baseline; gap: 4px; }
.total-amount { font-size: 1.8rem; font-weight: 900; color: white; letter-spacing: -0.03em; }
.total-unit { font-size: 0.95rem; font-weight: 500; color: rgba(255,255,255,0.75); }

/* ===========================
   SAVE BUTTON
=========================== */
.btn-save {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
}

.btn-save::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: var(--transition);
}

.btn-save:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-save:hover::before { opacity: 1; }
.btn-save:active { transform: translateY(0); }
.btn-save:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

/* ===========================
   RECORDS SECTION
=========================== */
.records-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

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

.records-title { font-size: 0.95rem; font-weight: 700; }

.records-count {
  background: var(--primary-pale);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.records-search {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.88rem;
  background: #f8faff;
  outline: none;
  transition: var(--transition);
  margin-bottom: 14px;
}

/* ===========================
   STATISTICS PAGE
=========================== */
.statistics-page { max-width: 1100px; }

.statistics-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 18px;
}

.statistics-filter .form-group { margin-bottom: 0; }
.statistics-comparison {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}
.statistics-comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.statistics-compare-card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #f8faff; }
.statistics-compare-card:first-child { border-top: 4px solid var(--primary); }
.statistics-compare-card:last-child { border-top: 4px solid var(--success); }
.statistics-compare-name { margin-bottom: 12px; overflow: hidden; color: var(--text-primary); font-size: 1rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.statistics-compare-metrics { display: grid; gap: 8px; }
.statistics-compare-metric { display: flex; justify-content: space-between; gap: 12px; color: var(--text-secondary); font-size: 0.78rem; }
.statistics-compare-metric strong { color: var(--text-primary); text-align: right; }
.statistics-comparison-result { margin-top: 12px; padding: 11px 13px; border-radius: var(--radius-sm); background: #eef2ff; color: #3730a3; font-size: 0.8rem; font-weight: 700; text-align: center; }

.monthly-summary-card {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.4fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 18px;
}

.monthly-summary-filter,
.monthly-summary-total {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 15px;
}

.monthly-summary-filter .form-label { margin-bottom: 7px; }
.summary-period-select { margin-bottom: 12px; }
.summary-date-label { display: block; }
.monthly-summary-total { display: flex; flex-direction: column; justify-content: center; gap: 3px; color: #fff; }
.monthly-summary-total > span { font-size: 0.8rem; opacity: 0.92; }
.monthly-summary-total strong { font-size: 1.35rem; }
.monthly-summary-total small { opacity: 0.85; }
.sales-summary-total { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.purchase-summary-total { background: linear-gradient(135deg, #d97706, #f59e0b); }

.statement-modal { z-index: 1200; padding: 20px; overflow-y: auto; }
.statement-modal-content { width: min(980px, 100%); max-height: none; margin: auto; background: #fff; border-radius: 18px; padding: 22px; box-shadow: var(--shadow-xl); }
.statement-preview { border: 3px solid #111827; background: #fff; color: #111827; padding: 30px; }
.statement-title { font-size: 2rem; letter-spacing: 0.35em; text-align: center; padding: 4px 0 24px; border-bottom: 3px solid #111827; }
.statement-issued { color: #4b5563; text-align: right; padding: 18px 0; }
.statement-party-table, .statement-items-table { width: 100%; border-collapse: collapse; }
.statement-party-table th, .statement-party-table td, .statement-items-table th, .statement-items-table td { border: 1px solid #111827; padding: 14px; }
.statement-party-table th { width: 110px; background: #f8fafc; font-weight: 500; text-align: center; }
.statement-party-table td { font-size: 1.08rem; }
.statement-supplier-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 18px; }
.statement-supplier-details span:nth-last-child(-n+2) { grid-column: 1 / -1; }
.statement-supplier-details b { margin-right: 5px; color: #4b5563; font-size: 0.8em; }
.statement-summary { display: flex; justify-content: space-between; align-items: center; margin: 18px 0; padding: 24px; border: 3px solid #111827; background: #f8fafc; font-size: 1.15rem; }
.statement-summary strong { color: #1769aa; font-size: 1.65rem; }
.statement-items-table th { background: #f8fafc; color: #4b5563; font-weight: 500; }
.statement-items-table { margin-top: 20px; }
.statement-items-table th:first-child, .statement-items-table td:first-child { width: 36%; text-align: center; }
.statement-items-table th:nth-child(2), .statement-items-table td:nth-child(2) { width: 22%; text-align: center; }
.statement-items-table th:nth-child(3), .statement-items-table td:nth-child(3),
.statement-items-table th:last-child, .statement-items-table td:last-child { width: 21%; text-align: center; }
.statement-breakdown { margin-top: 24px; padding: 14px 0; border-top: 1px dashed #9ca3af; border-bottom: 1px dashed #9ca3af; }
.statement-breakdown > div { display: flex; justify-content: space-between; gap: 20px; padding: 7px 4px; color: #4b5563; }
.statement-breakdown strong { color: #111827; text-align: right; font-weight: 500; }
.statement-grand-total { display: flex; justify-content: space-between; align-items: center; padding: 22px 4px 6px; font-size: 1.25rem; }
.statement-grand-total strong { color: #1769aa; font-size: 1.65rem; }
.statement-memo { margin-top: 18px; color: #4b5563; }
.statement-footer { margin-top: 20px; color: #6b7280; text-align: right; font-size: 0.8rem; }
.statement-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.statement-modal-actions .btn-pay, .statement-modal-actions .btn-save { width: auto; padding: 10px 18px; }
.statement-text-card pre { margin-top: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; color: #334155; font: 0.84rem/1.65 'Noto Sans KR', sans-serif; white-space: pre-wrap; overflow-wrap: anywhere; }
.statement-image-preview-modal { z-index: 1400; padding: 14px; overflow: auto; }
.statement-image-preview-content { width: min(900px, 100%); margin: auto; padding: 16px; border-radius: 12px; background: #fff; }
.statement-image-preview-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.statement-image-preview-scroll { max-height: 72vh; overflow: auto; border: 1px solid var(--border); background: #e5e7eb; }
.statement-image-preview-scroll img { display: block; width: 100%; height: auto; }
.statement-image-preview-content > .btn-save { width: 100%; margin-top: 12px; padding: 10px; }

/* Inner-page button system: simple neutral outlined controls */
body:not(.main-body) button,
body:not(.main-body) .btn-back {
  background: #f7f7f7 !important;
  color: #111111 !important;
  border: 2px solid #7a7a7a !important;
  border-radius: 5px !important;
  box-shadow: none !important;
  font-family: inherit;
  font-weight: 500;
  text-shadow: none !important;
  transition: background-color 0.15s ease, border-color 0.15s ease !important;
}

body:not(.main-body) button:hover,
body:not(.main-body) .btn-back:hover {
  background: #ededed !important;
  border-color: #4f4f4f !important;
  color: #000000 !important;
  transform: none !important;
  box-shadow: none !important;
}

body:not(.main-body) button:active,
body:not(.main-body) .btn-back:active {
  background: #e2e2e2 !important;
  transform: none !important;
}

body:not(.main-body) button:disabled {
  background: #eeeeee !important;
  color: #999999 !important;
  border-color: #b8b8b8 !important;
  opacity: 0.75;
}

body:not(.main-body) .company-picker-toggle {
  background: #f8faff !important;
  color: var(--primary-dark) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
}
body:not(.main-body) .company-picker-toggle:hover,
body:not(.main-body) .company-picker.open .company-picker-toggle {
  background: var(--primary-pale) !important;
  border-color: var(--primary-light) !important;
}
body:not(.main-body) .company-picker-select,
body:not(.main-body) .company-picker-close {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
}
body:not(.main-body) .company-picker-select:hover { background: var(--primary-pale) !important; }

@media (max-width: 520px) {
  .monthly-summary-card { grid-template-columns: 1fr; }
  .statement-modal { padding: 8px; }
  .statement-modal-content { padding: 12px; }
  .statement-preview { padding: 14px; overflow-x: auto; }
  .statement-title { font-size: 1.35rem; }
  .statement-summary { padding: 16px; }
  .statement-summary strong { font-size: 1.2rem; }
  .statement-items-table { min-width: 650px; }
  .statement-supplier-details { grid-template-columns: 1fr; min-width: 310px; font-size: 0.88rem !important; }
  .statement-supplier-details span:nth-last-child(-n+2) { grid-column: auto; }
}

.statistics-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.statistics-total-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  border-radius: var(--radius);
  color: #fff;
  padding: 17px;
  box-shadow: var(--shadow-sm);
}

.statistics-total-card span { font-size: 0.78rem; opacity: 0.9; }
.statistics-total-card strong { font-size: 1.15rem; overflow-wrap: anywhere; }
.statistics-total-card strong span { font-size: inherit; opacity: 1; }
.sales-total-card { background: linear-gradient(135deg, #2856b4, #1a3d7c); }
.purchase-total-card { background: linear-gradient(135deg, #27ae60, #1e8449); }
.net-total-card { background: linear-gradient(135deg, #7b1fa2, #4a148c); }
.net-total-card.negative { background: linear-gradient(135deg, #e74c3c, #b71c1c); }

.statistics-table-wrap { overflow-x: auto; }
.statistics-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.statistics-table th,
.statistics-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.statistics-table thead th { color: var(--text-secondary); background: #f7f9fc; font-size: 0.76rem; }
.statistics-table th:first-child,
.statistics-table td:first-child { text-align: left; }
.statistics-table tbody th { color: var(--text-primary); }
.amount-sales { color: var(--primary); font-weight: 700; }
.amount-purchase { color: var(--success); font-weight: 700; }
.amount-net { color: #7b1fa2; font-weight: 800; }
.amount-net.negative { color: var(--danger); }
.statistics-empty { color: var(--text-muted); text-align: center !important; padding: 36px 12px !important; }

@media (max-width: 620px) {
  .statistics-filter { grid-template-columns: 1fr; }
  .statistics-totals { grid-template-columns: 1fr; }
  .statistics-total-card { flex-direction: row; justify-content: space-between; align-items: center; }
  .statistics-comparison-grid { grid-template-columns: 1fr; }
}

.records-search:focus {
  border-color: var(--border-focus);
  background: white;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Record Item */
.record-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.record-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.record-item:last-child { margin-bottom: 0; }

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

.record-company { font-weight: 700; font-size: 0.9rem; }
.record-date { font-size: 0.72rem; color: var(--text-muted); }

.record-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.record-detail { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.5; }
.record-total { font-size: 1rem; font-weight: 700; color: var(--primary); }

.record-memo { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

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

.btn-delete {
  padding: 4px 12px;
  background: transparent;
  border: 1.5px solid #ffbdbd;
  color: var(--danger);
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  transition: var(--transition);
}

.btn-delete:hover { background: var(--danger); color: white; border-color: var(--danger); }

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-icon { font-size: 2.8rem; margin-bottom: 10px; }
.empty-text { font-size: 0.85rem; }

/* ===========================
   LOADING
=========================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===========================
   TOAST
=========================== */
.toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #111827;
  color: white;
  padding: 12px 22px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  animation: toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), toast-out 0.3s ease 2.7s forwards;
  pointer-events: none;
  white-space: nowrap;
}

.toast.success { background: linear-gradient(135deg, #27ae60, #1e8449); }
.toast.error { background: linear-gradient(135deg, #e74c3c, #c0392b); }

@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(8px); }
}

/* ===========================
   MODAL & FAB
=========================== */
.fab-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  box-shadow: 0 4px 16px rgba(43, 86, 180, 0.4);
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: var(--transition);
}

.fab-btn:hover {
  transform: scale(1.08) translateY(-4px);
  box-shadow: 0 8px 24px rgba(43, 86, 180, 0.5);
}

.fab-btn:active {
  transform: scale(0.95);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 27, 62, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end; /* Mobile friendly bottom sheet style */
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Modal Content (Form Card overrides) */
.modal-content {
  background: var(--bg-main);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 -8px 30px rgba(0,0,0,0.15);
}

@media (min-width: 680px) {
  .modal-overlay {
    align-items: center;
  }
  .modal-content {
    border-radius: var(--radius-lg);
    max-height: 85vh;
  }
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

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

.modal-header .section-title {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.modal-header .section-title::after {
  display: none;
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
}

.btn-close-modal:hover {
  color: var(--danger);
  transform: rotate(90deg);
}

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 480px) {
  .menu-grid { gap: 12px; }
  .menu-card { padding: 26px 14px 22px; }
  .menu-icon { font-size: 2.2rem; }
  .menu-title { font-size: 1.3rem; }
  .main-logo { width: 190px; }
  .total-amount { font-size: 1.5rem; }
  .calc-input { min-width: 58px; font-size: 0.88rem; }
  .calc-result { min-width: 78px; font-size: 0.82rem; }
  .fab-btn { right: 16px; bottom: 16px; width: 50px; height: 50px; font-size: 1.5rem; }
  .record-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .record-actions button { width: 100% !important; min-height: 40px; margin: 0 !important; padding: 8px 10px !important; font-size: 0.78rem !important; white-space: nowrap; }
  .statement-text-card .record-actions { grid-template-columns: 1fr; }
  .statement-text-card pre { padding: 12px; font-size: 0.78rem; line-height: 1.55; }
  .statement-modal-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .statement-modal-actions button { width: 100% !important; }
}

@media (max-width: 360px) {
  .calc-row { gap: 5px; }
  .calc-op { font-size: 0.85rem; }
}
.admin-user-card { margin-bottom: 12px; }
.admin-access-label { margin-top: 3px; color: var(--text-muted); font-size: 0.72rem; }
.admin-role-badge { display: inline-flex; margin-left: 5px; padding: 2px 7px; border-radius: 999px; background: #e2e8f0; color: #475569; font-size: 0.68rem; font-weight: 700; vertical-align: middle; }
.admin-role-badge.role-owner { background: #fef3c7; color: #92400e; }
.admin-role-badge.role-operator { background: #dbeafe; color: #1d4ed8; }
.btn-admin-action { padding: 4px 12px; border: 1.5px solid #93c5fd; border-radius: var(--radius-xs); background: transparent; color: #2563eb; font-family: 'Noto Sans KR', sans-serif; font-size: 0.72rem; cursor: pointer; transition: var(--transition); }
.btn-admin-action:hover { border-color: #2563eb; background: #2563eb; color: white; }
.btn-admin-action.btn-role { border-color: #a7f3d0; color: #047857; }
.btn-admin-action.btn-role:hover { border-color: #059669; background: #059669; color: white; }
.admin-password-modal { max-width: 420px; }
.admin-password-modal .auth-input { margin-bottom: 4px; }
.admin-password-modal .btn-save { width: 100%; margin-top: 12px; }
.profile-card { max-width: 620px; margin: 0 auto; }
.profile-card .form-group { margin-bottom: 14px; }
.profile-card label { display: block; margin-bottom: 6px; color: var(--text-secondary); font-size: 0.8rem; font-weight: 600; }
.profile-card .auth-input { width: 100%; margin: 0; }
.profile-card input[readonly] { background: #f1f5f9; color: var(--text-muted); }
.profile-divider { margin: 26px 0 6px; padding-top: 20px; border-top: 1px solid var(--border); font-weight: 700; }
.profile-help { margin-bottom: 14px; color: var(--text-muted); font-size: 0.76rem; }
.profile-save-button { width: 100%; margin-top: 10px; padding: 12px; }
.admin-user-details { display: grid; gap: 7px; margin-top: 10px; }
.admin-user-details > div { display: flex; justify-content: space-between; gap: 16px; font-size: 0.8rem; }
.admin-user-details span { color: var(--text-muted); }
.admin-user-details strong { text-align: right; overflow-wrap: anywhere; }
.admin-usage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
.admin-usage-grid span { padding: 8px; border: 1px solid var(--border); border-radius: 6px; background: #f8fafc; text-align: center; font-size: 0.75rem; }
@media (max-width: 480px) {
  .admin-usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-user-details > div { flex-direction: column; gap: 2px; }
  .admin-user-details strong { text-align: left; }
}
/* ===========================
   TABS & NOTEPAD
=========================== */
.nav-tabs {
  display: flex;
  background: white;
  border-radius: var(--radius-lg);
  padding: 6px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.nav-item {
  flex: 1;
  text-align: center;
  padding: 12px 0;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius);
  transition: var(--transition);
}

.nav-item.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(43, 86, 180, 0.2);
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Calculator Textarea */
.calc-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-family: inherit;
  font-size: 1rem;
  min-height: 80px;
  resize: vertical;
  transition: var(--transition);
}

.calc-textarea:focus {
  border-color: var(--border-focus);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.calc-preview {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--primary-dark);
  font-weight: 600;
  background: var(--primary-pale);
  padding: 8px 12px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 8px;
}

.calc-preview::before {
  content: '';
  display: none;
}

/* Notepad */
.note-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.note-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.note-content {
  white-space: pre-wrap;
  line-height: 1.5;
  color: var(--text-color);
}


/* Auth styles */
.auth-card { max-width: 400px; margin: 40px auto; background: white; border-radius: 16px; padding: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.auth-input { width: 100%; padding: 12px; margin-bottom: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 1rem; transition: border 0.2s; }
.auth-input:focus { border-color: #3b82f6; outline: none; }

/* Welcome Bar */
.user-welcome-bar { display: flex; justify-content: space-between; align-items: center; background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(10px); padding: 12px 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 24px; border: 1px solid rgba(255, 255, 255, 0.4); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { font-size: 1.2rem; background: #e0e7ff; padding: 6px; border-radius: 50%; color: #3b82f6; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; }
.user-name { font-size: 1.1rem; font-weight: 600; color: #1e293b; }
.btn-logout { background: #f87171; color: white; border: none; padding: 8px 16px; border-radius: 8px; font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: all 0.2s ease; }
.btn-logout:hover { background: #ef4444; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3); }
.user-top-actions { display: flex; align-items: center; gap: 7px; }
.btn-profile-small { display: inline-flex; align-items: center; justify-content: center; padding: 7px 10px; border: 1px solid #94a3b8; border-radius: 7px; background: rgba(255,255,255,0.8); color: #334155; font-size: 0.75rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn-profile-small:hover { background: #f1f5f9; border-color: #64748b; }
@media (max-width: 480px) {
  .user-welcome-bar { padding: 10px 12px; gap: 8px; }
  .user-info { min-width: 0; }
  .user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-top-actions { gap: 5px; flex-shrink: 0; }
  .btn-profile-small, .btn-logout { padding: 7px 8px; font-size: 0.7rem; }
}
.hometax-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-decoration: none;
}

.statement-list-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.statement-list-filter label {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.statement-list-filter .form-control {
  max-width: 180px;
}

.statement-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  margin-right: 7px;
  border-radius: 999px;
  background: var(--primary-pale);
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 800;
}

.statement-type-badge.purchase {
  background: #fff7ed;
  color: #c2410c;
}

.statement-text-card.statement-focused {
  outline: 3px solid var(--primary);
  box-shadow: 0 8px 24px rgba(43, 86, 180, 0.18);
}

.unpaid-ledger {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.unpaid-ledger-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: #f8fafc;
}

.unpaid-ledger-header span {
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 800;
}

.unpaid-allocation-summary,
.unpaid-allocation-item-amounts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.unpaid-allocation-summary {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.unpaid-allocation-summary span,
.unpaid-allocation-item-amounts span {
  padding: 10px 6px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.unpaid-allocation-summary span + span,
.unpaid-allocation-item-amounts span + span {
  border-left: 1px solid #edf0f4;
}

.unpaid-allocation-summary strong,
.unpaid-allocation-item-amounts strong {
  display: block;
  margin-top: 3px;
  color: var(--text-color);
  font-size: 0.82rem;
}

.unpaid-allocation-summary span:last-child strong,
.unpaid-allocation-item-amounts span:last-child strong {
  color: var(--danger);
}

.unpaid-ledger-section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 11px 12px 7px;
  color: var(--text-color);
  font-size: 0.8rem;
  font-weight: 800;
}

.unpaid-ledger-section-title small {
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 500;
}

.unpaid-allocation-item {
  margin: 0 10px 8px;
  overflow: hidden;
  border: 1px solid #e5e9ef;
  border-radius: 8px;
  background: #fff;
}

.unpaid-allocation-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 9px 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.unpaid-status {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
}

.unpaid-status.paid { background: #dcfce7; color: #15803d; }
.unpaid-status.partial { background: #fef3c7; color: #b45309; }
.unpaid-status.unpaid { background: #fee2e2; color: #b91c1c; }

.unpaid-allocation-item-detail {
  padding: 5px 9px 9px;
  color: var(--text-color);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.45;
  white-space: pre-wrap;
}

.unpaid-allocation-item-amounts {
  border-top: 1px solid #edf0f4;
  background: #f8fafc;
}

.unpaid-payment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-top: 1px solid #edf0f4;
  font-size: 0.76rem;
}

.unpaid-payment-row div strong,
.unpaid-payment-row div small {
  display: block;
}

.unpaid-payment-row div small {
  margin-top: 2px;
  color: var(--text-muted);
}

.unpaid-payment-row > strong {
  color: var(--success);
  white-space: nowrap;
}

/* ===========================
   RELEASE NOTICES
=========================== */
.notice-page { max-width: 760px; }
.notice-logout { padding: 4px 8px; width: auto; font-size: 0.8rem; margin-left: auto; }

.release-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
  padding: 26px;
  overflow: hidden;
  position: relative;
  color: white;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #1a3d7c 0%, #2856b4 60%, #4a8fd9 100%);
  box-shadow: var(--shadow-lg);
}

.release-hero::after {
  content: '';
  position: absolute;
  right: -50px;
  bottom: -80px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
}

.release-hero > * { position: relative; z-index: 1; }
.release-eyebrow {
  display: block;
  margin-bottom: 7px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}
.release-hero h2 { font-size: 1.35rem; letter-spacing: -0.04em; }
.release-hero p { margin-top: 7px; color: rgba(255, 255, 255, 0.78); font-size: 0.82rem; line-height: 1.55; }
.release-current-version { flex-shrink: 0; text-align: right; }
.release-current-version strong { display: block; font-size: 2rem; line-height: 1; letter-spacing: -0.05em; }
.release-current-version span {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  font-size: 0.68rem;
  font-weight: 700;
}

.release-guide {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
  padding: 12px 14px;
  color: #6b4f16;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  background: #fffbeb;
  font-size: 0.76rem;
  line-height: 1.55;
}

.release-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 4px 14px;
}
.release-section-heading span { color: var(--primary); font-size: 0.64rem; font-weight: 800; letter-spacing: 0.13em; }
.release-section-heading h2 { margin-top: 2px; font-size: 1.25rem; letter-spacing: -0.04em; }
.release-section-heading > strong { color: var(--text-muted); font-size: 0.72rem; }
.release-list { display: grid; gap: 14px; }
.release-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 210px;
  padding: 34px 20px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}
.release-empty-icon { margin-bottom: 12px; font-size: 2rem; }
.release-empty strong { color: var(--text-primary); font-size: 0.9rem; }
.release-empty p { margin-top: 6px; color: var(--text-muted); font-size: 0.72rem; line-height: 1.5; }

.release-card {
  padding: 21px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: white;
  box-shadow: var(--shadow-sm);
}
.release-card.latest { border-color: #b9cff4; box-shadow: 0 8px 28px rgba(40, 86, 180, 0.12); }
.release-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.release-version-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 6px; }
.release-version { color: var(--primary); font-size: 1.02rem; }
.release-status,
.release-latest-badge { padding: 4px 7px; border-radius: 999px; font-size: 0.62rem; font-weight: 800; }
.release-status.testing { color: #b45309; background: #fef3c7; }
.release-status.production { color: #15803d; background: #dcfce7; }
.release-latest-badge { color: #1d4ed8; background: #dbeafe; }
.release-card-heading h3 { font-size: 1.08rem; letter-spacing: -0.03em; }
.release-date { flex-shrink: 0; padding-top: 3px; color: var(--text-muted); font-size: 0.7rem; }
.release-summary { margin-top: 10px; color: var(--text-secondary); font-size: 0.79rem; line-height: 1.6; }
.release-changes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 16px; }
.release-change-group { padding: 13px; border-radius: var(--radius-sm); background: #f8fafc; }
.release-change-label { margin-bottom: 8px; font-size: 0.72rem; }
.release-change-label.feature { color: #1d4ed8; }
.release-change-label.improvement { color: #047857; }
.release-change-label.fix { color: #b45309; }
.release-change-list { display: grid; gap: 7px; padding-left: 16px; color: var(--text-secondary); }
.release-change-list li { padding-left: 1px; font-size: 0.73rem; line-height: 1.5; }
.release-change-list li::marker { color: #94a3b8; }

@media (max-width: 520px) {
  .release-hero { align-items: flex-start; padding: 21px 18px; }
  .release-current-version strong { font-size: 1.55rem; }
  .release-hero p { max-width: 220px; }
  .release-card { padding: 17px 15px; }
  .release-card-header { flex-direction: column; gap: 4px; }
  .release-date { order: -1; }
  .release-changes { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .release-hero { flex-direction: column; gap: 16px; }
  .release-current-version { text-align: left; }
}

/* ===========================
   ITEM STATISTICS
=========================== */
.item-statistics-page { max-width: 760px; }
.item-statistics-logout { padding: 4px 8px; width: auto; font-size: 0.8rem; margin-left: auto; }
.item-statistics-filter-card {
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid #cfe6f5;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #ffffff, #f3f9fd);
  box-shadow: var(--shadow);
}
.item-statistics-filter-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.item-statistics-filter-heading > div > span {
  color: #0369a1;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}
.item-statistics-filter-heading h2 { margin-top: 3px; font-size: 1.15rem; letter-spacing: -0.04em; }
.first-item-badge {
  flex-shrink: 0;
  padding: 5px 8px;
  border-radius: 999px;
  color: #075985;
  background: #e0f2fe;
  font-size: 0.66rem;
  font-weight: 800;
}
.item-statistics-date-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 9px;
}
.item-statistics-date-separator { padding-bottom: 19px; color: var(--text-muted); font-weight: 800; }
.item-statistics-search-button { width: 100%; margin-top: 2px; }
.item-statistics-help {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.5;
  text-align: center;
}
.item-statistics-result-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 0 3px 12px;
}
.item-statistics-result-heading > div > span { color: var(--text-muted); font-size: 0.7rem; }
.item-statistics-result-heading h2 { margin-top: 3px; font-size: 1.2rem; letter-spacing: -0.04em; }
.item-statistics-result-heading h2 strong { color: #0369a1; }
.item-statistics-result-heading > span { color: var(--text-muted); font-size: 0.72rem; font-weight: 700; }
.item-statistics-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.item-statistics-summary-card {
  min-width: 0;
  padding: 16px 14px;
  border-radius: var(--radius);
  color: white;
  box-shadow: var(--shadow-sm);
}
.item-statistics-summary-card.sale { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.item-statistics-summary-card.purchase { background: linear-gradient(135deg, #16a34a, #15803d); }
.item-statistics-summary-card.net { background: linear-gradient(135deg, #475569, #334155); }
.item-statistics-summary-card.net.negative { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.item-statistics-summary-card > span { display: block; color: rgba(255,255,255,0.78); font-size: 0.68rem; }
.item-statistics-summary-card > strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: clamp(0.95rem, 3vw, 1.3rem);
  letter-spacing: -0.05em;
}
.item-statistics-summary-card small { display: block; margin-top: 5px; color: rgba(255,255,255,0.7); font-size: 0.63rem; }
.item-statistics-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 18px;
}
.item-statistics-metrics article {
  min-width: 0;
  padding: 12px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  text-align: center;
}
.item-statistics-metrics span { display: block; color: var(--text-muted); font-size: 0.62rem; }
.item-statistics-metrics strong { display: block; margin-top: 5px; overflow-wrap: anywhere; color: var(--text-primary); font-size: 0.78rem; }
.item-statistics-records { padding-bottom: 10px; }
.item-statistics-record {
  padding: 13px 2px;
  border-top: 1px solid var(--border);
}
.item-statistics-record:first-child { border-top: 0; }
.item-statistics-record-top,
.item-statistics-record-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.item-statistics-record-top > div { display: flex; align-items: center; gap: 7px; min-width: 0; }
.item-statistics-record-top strong { overflow: hidden; font-size: 0.82rem; text-overflow: ellipsis; white-space: nowrap; }
.item-statistics-record-top time { flex-shrink: 0; color: var(--text-muted); font-size: 0.68rem; }
.item-statistics-type { padding: 3px 7px; border-radius: 999px; font-size: 0.62rem; font-weight: 800; }
.item-statistics-type.sale { color: #1d4ed8; background: #dbeafe; }
.item-statistics-type.purchase { color: #15803d; background: #dcfce7; }
.item-statistics-expression {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-secondary);
  background: #f8fafc;
  font-size: 0.73rem;
  line-height: 1.5;
}
.item-statistics-record-bottom { color: var(--text-muted); font-size: 0.7rem; }
.item-statistics-record-bottom strong { flex-shrink: 0; color: var(--text-primary); font-size: 0.82rem; }
.item-statistics-intro,
.item-statistics-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 30px 18px;
  border: 1px dashed #bfdbfe;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  background: rgba(255,255,255,0.72);
  text-align: center;
}
.item-statistics-intro > span,
.item-statistics-empty > span { margin-bottom: 12px; font-size: 2rem; }
.item-statistics-intro strong,
.item-statistics-empty strong { font-size: 0.9rem; }
.item-statistics-intro p,
.item-statistics-empty p { margin-top: 6px; color: var(--text-muted); font-size: 0.72rem; line-height: 1.55; }

@media (max-width: 560px) {
  .item-statistics-filter-card { padding: 19px 15px; }
  .item-statistics-summary-grid { grid-template-columns: 1fr 1fr; }
  .item-statistics-summary-card.net { grid-column: 1 / -1; }
  .item-statistics-metrics { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .item-statistics-date-grid { grid-template-columns: 1fr; gap: 0; }
  .item-statistics-date-separator { display: none; }
  .item-statistics-result-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
}

/* 거래명세서 목록 '더 보기' */
.statements-load-more {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--primary-pale);
  color: var(--primary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.statements-load-more:disabled { opacity: 0.6; cursor: default; }
