/* ==========================================================================
   SettleFlow (정산플로우) - Design System & UI Styling
   Theme: Vibrant Clean Light Mode & Soft Slate / Premium Indigo Glass
   ========================================================================== */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Color Palette - Bright Modern Light Theme */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-hover: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(226, 232, 240, 0.8);
  --glass-border-glow: rgba(99, 102, 241, 0.4);

  /* Primary & Accent Colors */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: rgba(79, 70, 229, 0.08);
  
  --sales-color: #059669; /* 매출 (Sales / Emerald Green) */
  --sales-light: #ecfdf5;
  --sales-border: #a7f3d0;

  --purchase-color: #e11d48; /* 매입 (Purchase / Rose Pink) */
  --purchase-light: #fff1f2;
  --purchase-border: #fecdd3;

  --warning: #d97706; /* 미수/미지급 경고 (Amber) */
  --warning-light: #fffbeb;
  --warning-border: #fde68a;

  --info: #0284c7;
  --info-light: #f0f9ff;

  /* Neutral Typography & Surface Colors */
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --border-color: #e2e8f0;
  --divider-color: #f1f5f9;

  /* Typography */
  --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Elevated Soft Shadows */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.12);
  --glow-primary: 0 4px 14px rgba(79, 70, 229, 0.25);

  /* Layout Constants */
  --sidebar-width: 260px;
  --header-height: 70px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Background Ambient Soft Light Orbs */
.ambient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.45;
  animation: floatOrb 22s infinite ease-in-out alternate;
}

.blob-1 {
  width: 550px;
  height: 550px;
  background: #c7d2fe;
  top: -120px;
  right: -100px;
}

.blob-2 {
  width: 480px;
  height: 480px;
  background: #a7f3d0;
  bottom: -120px;
  left: -100px;
  animation-delay: -8s;
}

.blob-3 {
  width: 380px;
  height: 380px;
  background: #fbcfe8;
  top: 35%;
  left: 45%;
  animation-delay: -14s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(50px, -30px) scale(1.08); }
  100% { transform: translate(-30px, 50px) scale(0.92); }
}

/* AUTHENTICATION */
.auth-container {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.1);
  animation: authFadeIn 0.5s ease-out;
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand-header {
  text-align: center;
  margin-bottom: 32px;
}

.brand-logo-large {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  color: #1e1b4b;
  margin-bottom: 8px;
}

.brand-icon-box {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary) 0%, #0284c7 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  box-shadow: var(--glow-primary);
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  font-size: 1.1rem;
  pointer-events: none;
  transition: var(--transition-fast);
}

.form-input {
  width: 100%;
  padding: 12px 14px 12px 44px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  transition: var(--transition-fast);
  outline: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.form-input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
  color: var(--primary);
}

.password-toggle {
  position: absolute;
  right: 14px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  transition: var(--transition-fast);
}
.password-toggle:hover {
  color: var(--text-main);
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  font-size: 0.85rem;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
}

.custom-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  border-radius: 4px;
}

.forgot-link {
  color: var(--primary);
  font-weight: 600;
  transition: var(--transition-fast);
}
.forgot-link:hover {
  text-decoration: underline;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--glow-primary);
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
}

.demo-accounts {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px dashed var(--border-color);
}

.demo-title {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  text-align: center;
  font-weight: 600;
}

.demo-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.chip-btn {
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  transition: var(--transition-fast);
}

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

/* APP LAYOUT */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 10;
}

.app-container.hidden {
  display: none !important;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: #0f172a;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: var(--transition-normal);
  color: #fff;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
}

.sidebar-logo span {
  color: #818cf8;
}

.nav-section {
  padding: 20px 14px 10px;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 12px 10px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: #94a3b8;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.92rem;
  transition: var(--transition-fast);
}

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

.nav-item.active a {
  background: rgba(99, 102, 241, 0.2);
  color: #fff;
  border: 1px solid rgba(99, 102, 241, 0.4);
  font-weight: 600;
}

.nav-item.active a i {
  color: #818cf8;
}

.nav-item i {
  font-size: 1.15rem;
  width: 20px;
  text-align: center;
  transition: var(--transition-fast);
}

.badge-count {
  margin-left: auto;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.badge-count.sales { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-count.purchase { background: rgba(244, 63, 94, 0.2); color: #fb7185; }
.badge-count.warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
}

.user-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.user-details {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 0.75rem;
  color: #94a3b8;
}

.btn-logout {
  color: #94a3b8;
  font-size: 1.1rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}
.btn-logout:hover {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.15);
}

.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-header {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-search {
  position: relative;
  width: 280px;
}

.header-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.header-search input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  outline: none;
}

.header-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  position: relative;
  transition: var(--transition-fast);
}

.icon-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.noti-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--purchase-color);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--purchase-color);
}

.btn-action-primary {
  padding: 9px 16px;
  background: linear-gradient(135deg, var(--primary), #4338ca);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--glow-primary);
  transition: var(--transition-fast);
}
.btn-action-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
}

.content-body {
  padding: 28px;
  flex: 1;
}

.page-view {
  display: none;
  animation: viewFadeIn 0.3s ease-out;
}

.page-view.active {
  display: block;
}

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

/* SEARCH TOOLBAR WITH DATE RANGE & COMPANY SEARCH */
.company-search-toolbar {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.search-filters-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.date-range-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.date-input-custom {
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  outline: none;
}

.date-input-custom:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.company-keyword-input {
  padding: 8px 14px 8px 36px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  width: 220px;
  color: var(--text-main);
}

.company-keyword-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* COMPANY BOX GRID & CARDS */
.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.company-card-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: default;
  position: relative;
  overflow: hidden;
}

.company-card-box:hover {
  box-shadow: 0 6px 18px -2px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}

.company-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--divider-color);
}

.company-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.company-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
}

.company-icon-badge.sales { background: var(--sales-light); color: var(--sales-color); border: 1px solid var(--sales-border); }
.company-icon-badge.vendor { background: var(--purchase-light); color: var(--purchase-color); border: 1px solid var(--purchase-border); }

.company-card-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}

.company-card-bizno {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.company-card-body {
  margin-bottom: 18px;
}

.company-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.company-stat-label {
  color: var(--text-muted);
}

.company-stat-val {
  font-family: var(--font-mono);
  font-weight: 700;
}

.company-total-amount {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-mono);
  margin-top: 6px;
  text-align: right;
}

.company-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
}

.btn-open-company-detail {
  padding: 8px 14px;
  background: var(--primary-light);
  border: 1px solid rgba(79, 70, 229, 0.2);
  color: var(--primary);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-open-company-detail:hover {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  transform: translateY(-1px);
}

/* STAT CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.stat-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-icon-wrapper {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stat-icon-wrapper.sales { background: var(--sales-light); color: var(--sales-color); border: 1px solid var(--sales-border); }
.stat-icon-wrapper.purchase { background: var(--purchase-light); color: var(--purchase-color); border: 1px solid var(--purchase-border); }
.stat-icon-wrapper.balance { background: var(--primary-light); color: var(--primary); border: 1px solid rgba(79, 70, 229, 0.2); }
.stat-icon-wrapper.unsettled { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.stat-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.trend-up { color: var(--sales-color); font-weight: 700; }
.trend-down { color: var(--purchase-color); font-weight: 700; }

/* PANELS & TABLES */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.panel-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--divider-color);
}

.panel-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

.quick-summary-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.summary-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

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

.company-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
}

.company-badge.sales { background: var(--sales-light); color: var(--sales-color); border: 1px solid var(--sales-border); }
.company-badge.purchase { background: var(--purchase-light); color: var(--purchase-color); border: 1px solid var(--purchase-border); }

.company-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
}

.company-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.summary-amount {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-custom {
  padding: 8px 14px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.select-custom:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--divider-color);
  color: #1e293b;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: var(--transition-fast);
  background: #ffffff;
}

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

.font-num {
  font-family: var(--font-mono);
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.status-pill.completed {
  background: var(--sales-light);
  color: var(--sales-color);
  border: 1px solid var(--sales-border);
}

.status-pill.pending {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.status-pill.overdue {
  background: var(--purchase-light);
  color: var(--purchase-color);
  border: 1px solid var(--purchase-border);
}

.status-pill.offset {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.3);
}

.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.btn-sm-action {
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  transition: var(--transition-fast);
}

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

/* MODALS & EXCEL UPLOAD STYLING */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-fast);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 100%;
  max-width: 640px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(0.95);
  transition: var(--transition-fast);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-modal {
  color: var(--text-dim);
  font-size: 1.2rem;
  padding: 4px;
}

.btn-close-modal:hover {
  color: #0f172a;
}

.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}

/* EXCEL UPLOAD DROPZONE */
.excel-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  background: #f8fafc;
  transition: var(--transition-fast);
  cursor: pointer;
  position: relative;
  margin-bottom: 16px;
}

.excel-dropzone:hover, .excel-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.excel-dropzone i {
  font-size: 2.5rem;
  color: #10b981;
  margin-bottom: 8px;
}

.excel-drop-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}

.excel-drop-subtext {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.btn-download-sample {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid rgba(79, 70, 229, 0.2);
  transition: var(--transition-fast);
}

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

.excel-preview-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 14px;
}

.excel-preview-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.excel-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.excel-preview-table th {
  background: #e2e8f0;
  color: #475569;
  padding: 6px 8px;
  text-align: left;
}

.excel-preview-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-footer {
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.btn-secondary {
  padding: 10px 18px;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  background: #ffffff;
  border: 1px solid var(--primary);
  color: #0f172a;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media print {
  body * {
    visibility: hidden;
  }
  .printable-area, .printable-area * {
    visibility: visible;
  }
  .printable-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff !important;
    color: #000 !important;
  }
}
