/* =============================================
   수성 입찰 공고 시스템 - Main Stylesheet v4.0
   White & Blue Professional Design System
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Noto+Sans+KR:wght@300;400;500;600;700;800&display=swap');

:root {
  /* ── Core Blue Palette ── */
  --primary:        #2563eb;
  --primary-dark:   #1d4ed8;
  --primary-deeper: #1e3a8a;
  --primary-light:  #3b82f6;
  --primary-pale:   #eff6ff;
  --primary-pale2:  #dbeafe;
  --primary-mid:    #bfdbfe;

  /* ── Semantic Colors ── */
  --success:        #10b981;
  --success-dark:   #059669;
  --success-bg:     #ecfdf5;
  --success-border: rgba(16,185,129,0.2);
  --warning:        #f59e0b;
  --warning-dark:   #d97706;
  --warning-bg:     #fffbeb;
  --warning-border: rgba(245,158,11,0.2);
  --danger:         #ef4444;
  --danger-dark:    #dc2626;
  --danger-bg:      #fef2f2;
  --danger-border:  rgba(239,68,68,0.2);
  --info:           #0ea5e9;
  --info-bg:        #f0f9ff;
  --info-border:    rgba(14,165,233,0.2);
  --purple:         #8b5cf6;
  --purple-bg:      #f5f3ff;
  --purple-border:  rgba(139,92,246,0.2);

  /* ── Neutral Grays ── */
  --gray-50:   #f9fafb;
  --gray-100:  #f3f4f6;
  --gray-200:  #e5e7eb;
  --gray-300:  #d1d5db;
  --gray-400:  #9ca3af;
  --gray-500:  #6b7280;
  --gray-600:  #4b5563;
  --gray-700:  #374151;
  --gray-800:  #1f2937;
  --gray-900:  #111827;

  /* ── Background & Surface ── */
  --bg-app:    #f4f7fb;
  --bg-white:  #ffffff;
  --bg-subtle: #f8fafc;
  --surface:   #ffffff;
  --surface-2: #f8fafc;

  /* ── Border (가시성 강화) ── */
  --border:       #cbd5e1;
  --border-light: #e2e8f0;
  --border-focus: #2563eb;

  /* ── Text ── */
  --text-primary:     #0f172a;
  --text-secondary:   #475569;
  --text-muted:       #94a3b8;
  --text-placeholder: #cbd5e1;

  /* ── Layout ── */
  --sidebar-width: 248px;
  --header-height: 58px;

  /* ── Radius ── */
  --radius-xs:   4px;
  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* ── Shadow ── */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 8px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 8px 20px rgba(0,0,0,0.07), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg: 0 16px 36px rgba(0,0,0,0.09), 0 4px 10px rgba(0,0,0,0.05);
  --shadow-xl: 0 24px 52px rgba(0,0,0,0.12), 0 8px 18px rgba(0,0,0,0.06);
  --shadow-blue: 0 4px 14px rgba(37,99,235,0.28);
  --shadow-blue-lg: 0 8px 28px rgba(37,99,235,0.35);

  /* ── Transition ── */
  --transition: all 0.17s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* =============================================
   LAYOUT
   ============================================= */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition-slow);
  box-shadow: 2px 0 8px rgba(0,0,0,0.03);
}

/* Sidebar Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 900;
  color: white;
  flex-shrink: 0;
  box-shadow: var(--shadow-blue);
  letter-spacing: -0.5px;
}

/* 이미지 로고 마크 (S 심볼 — 500x947 세로형) */
.logo-icon.logo-mark-img,
img.logo-mark-img {
  background: transparent !important;
  box-shadow: none !important;
  height: 40px; width: auto;
  object-fit: contain;
  padding: 0;
  border-radius: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.logo-text { display: flex; flex-direction: column; }
.logo-title {
  font-size: 13.5px; font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  line-height: 1.2;
}
.logo-sub {
  font-size: 9.5px; font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
  opacity: 0.8;
}

/* Sidebar Nav */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 10px; }

.sidebar-section {
  padding: 16px 10px 5px;
  font-size: 9.5px; font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.1px;
  text-transform: uppercase;
}
.sidebar-section:first-child { padding-top: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: none; background: none;
  width: 100%; text-align: left;
  letter-spacing: -0.1px;
  position: relative;
}
.nav-item:hover {
  background: var(--primary-pale);
  color: var(--primary);
}
.nav-item.active {
  background: var(--primary-pale);
  color: var(--primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.nav-item.active .nav-icon { color: var(--primary); }
.nav-icon {
  font-size: 14px; width: 18px;
  text-align: center; flex-shrink: 0;
  color: var(--gray-400);
  transition: var(--transition);
}
.nav-item:hover .nav-icon { color: var(--primary); }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 9.5px; font-weight: 700;
  padding: 2px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
  line-height: 1.3;
}
.nav-badge.blue { background: var(--primary); }

/* Sidebar Footer */
.sidebar-footer {
  padding: 10px 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.engine-status-mini {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-sm);
  font-size: 11px; color: var(--success); font-weight: 500;
}
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50% { opacity: 0.8; transform: scale(0.9); box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

.tenant-info {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}
.tenant-info:hover { border-color: var(--primary-pale2); background: var(--primary-pale); }
.tenant-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white;
  flex-shrink: 0;
}
.tenant-name { font-size: 12px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.tenant-plan {
  font-size: 10px; color: var(--primary);
  background: var(--primary-pale);
  padding: 1px 6px; border-radius: 4px;
  display: inline-block; margin-top: 2px;
  font-weight: 600;
}

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

/* ── Top Header ── */
.top-header {
  height: var(--header-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 12px;
  position: sticky; top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.header-title { display: flex; flex-direction: column; }
.header-title h1 {
  font-size: 15px; font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.3px;
}
.header-title span { font-size: 11px; color: var(--text-muted); margin-top: 1px; font-weight: 400; }
.header-spacer { flex: 1; }

.header-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  width: 230px;
  transition: var(--transition);
}
.header-search:focus-within {
  border-color: var(--primary);
  background: var(--bg-white);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}
.header-search input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 13px;
  width: 100%; font-family: inherit;
}
.header-search input::placeholder { color: var(--text-muted); }
.search-icon { color: var(--text-muted); font-size: 13px; }

.header-btn {
  width: 34px; height: 34px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary);
  transition: var(--transition);
  position: relative; font-size: 15px;
  flex-shrink: 0;
}
.header-btn:hover {
  background: var(--primary-pale);
  border-color: var(--primary-pale2);
  color: var(--primary);
  transform: translateY(-1px);
}
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px;
  background: var(--danger); border-radius: 50%;
  border: 1.5px solid white;
}

.header-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white;
  flex-shrink: 0;
  box-shadow: var(--shadow-blue);
  transition: var(--transition);
}
.header-avatar:hover { transform: scale(1.05); }
/* 대시보드 그라데이션 헤더 안의 아바타 - 흰색 배경 */
.dash-hello .header-avatar,
.dash-hello-actions .header-avatar {
  background: rgba(255,255,255,.22);
  border: 1.5px solid rgba(255,255,255,.4);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  font-size: 13px;
}
.dash-hello .header-avatar:hover,
.dash-hello-actions .header-avatar:hover {
  background: rgba(255,255,255,.35);
  transform: scale(1.08);
}
/* 배너(pl-banner, si-banner) 안의 아바타 */
.pl-banner .header-avatar,
.si-banner .header-avatar {
  background: rgba(255,255,255,.22);
  border: 1.5px solid rgba(255,255,255,.4);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  font-size: 13px;
}
.pl-banner .header-avatar:hover,
.si-banner .header-avatar:hover {
  background: rgba(255,255,255,.35);
  transform: scale(1.08);
}

/* user-avatar (announcements 등) */
.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white;
  flex-shrink: 0;
  box-shadow: var(--shadow-blue);
  transition: var(--transition);
}
.user-avatar:hover { transform: scale(1.05); }

/* ── Page Content ── */
.page-content { padding: 22px 24px; flex: 1; }

/* ── Page Header ── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px; gap: 16px;
}
.page-header-left { display: flex; flex-direction: column; gap: 3px; }
.page-header-title {
  font-size: 19px; font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.page-header-sub { font-size: 13px; color: var(--text-muted); font-weight: 400; }
.page-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* =============================================
   CARDS & CONTAINERS
   ============================================= */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}
.card-sm { padding: 14px 16px; }
.card-lg { padding: 26px; }
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: 13.5px; font-weight: 700;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 7px;
  letter-spacing: -0.2px;
}
.card-title .icon { color: var(--primary); font-size: 14px; }
.card-subtitle { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* Section Card with accent */
.card-accent {
  border-top: 3px solid var(--primary);
}
.card-accent-success { border-top: 3px solid var(--success); }
.card-accent-warning { border-top: 3px solid var(--warning); }
.card-accent-danger  { border-top: 3px solid var(--danger); }

/* =============================================
   STAT WIDGETS
   ============================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2.5px;
  background: transparent;
  transition: var(--transition);
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary-pale2);
}
.stat-card:hover::after { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-card-inner { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.stat-icon.primary { background: var(--primary-pale); color: var(--primary); }
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.danger  { background: var(--danger-bg);  color: var(--danger); }
.stat-icon.info    { background: var(--info-bg);    color: var(--info); }
.stat-icon.purple  { background: var(--purple-bg);  color: var(--purple); }

.stat-body { flex: 1; min-width: 0; }
.stat-value {
  font-size: 24px; font-weight: 800;
  color: var(--text-primary);
  line-height: 1; margin-bottom: 4px;
  letter-spacing: -0.5px;
}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-trend {
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 3px;
  margin-top: 7px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}
.stat-trend.up   { color: var(--success); background: var(--success-bg); }
.stat-trend.down { color: var(--danger);  background: var(--danger-bg); }
.stat-trend.neutral { color: var(--text-muted); background: var(--gray-100); }

/* =============================================
   GRID LAYOUTS
   ============================================= */
.grid-2     { display: grid; grid-template-columns: 1fr 1fr;          gap: 18px; }
.grid-3     { display: grid; grid-template-columns: 1fr 1fr 1fr;      gap: 18px; }
.grid-4     { display: grid; grid-template-columns: repeat(4, 1fr);   gap: 14px; }
.grid-70-30 { display: grid; grid-template-columns: 1.8fr 1fr;        gap: 18px; }
.grid-60-40 { display: grid; grid-template-columns: 1.5fr 1fr;        gap: 18px; }
.grid-65-35 { display: grid; grid-template-columns: 1.85fr 1fr;       gap: 18px; }

/* =============================================
   BADGES & TAGS
   ============================================= */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.1px;
}
.badge-primary  { background: var(--primary-pale);  color: var(--primary);     border: 1px solid var(--primary-mid); }
.badge-success  { background: var(--success-bg);    color: var(--success);     border: 1px solid var(--success-border); }
.badge-warning  { background: var(--warning-bg);    color: var(--warning-dark);border: 1px solid var(--warning-border); }
.badge-danger   { background: var(--danger-bg);     color: var(--danger-dark); border: 1px solid var(--danger-border); }
.badge-info     { background: var(--info-bg);       color: var(--info);        border: 1px solid var(--info-border); }
.badge-purple   { background: var(--purple-bg);     color: var(--purple);      border: 1px solid var(--purple-border); }
.badge-neutral  { background: var(--gray-100);      color: var(--gray-500);    border: 1px solid var(--gray-200); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px; font-weight: 500;
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}
.tag-blue {
  background: var(--primary-pale);
  color: var(--primary-dark);
  border-color: var(--primary-pale2);
}
.tag-green {
  background: var(--success-bg);
  color: var(--success-dark);
  border-color: var(--success-border);
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  transition: var(--transition);
  text-decoration: none; white-space: nowrap;
  letter-spacing: -0.1px;
  line-height: 1.4;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: var(--shadow-blue);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-deeper));
  transform: translateY(-1px);
  box-shadow: var(--shadow-blue-lg);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-white);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-pale);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--text-primary); }

.btn-success { background: var(--success); color: white; box-shadow: 0 2px 8px rgba(16,185,129,0.25); }
.btn-success:hover { background: var(--success-dark); transform: translateY(-1px); }

.btn-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: white; }

.btn-sm  { padding: 5px 11px; font-size: 12px; }
.btn-xs  { padding: 3px 8px;  font-size: 11px; }
.btn-lg  { padding: 11px 22px; font-size: 14px; }
.btn-xl  { padding: 13px 30px; font-size: 15px; border-radius: 10px; }
.btn-icon { padding: 7px; aspect-ratio: 1; }
.btn-icon-sm { padding: 5px; aspect-ratio: 1; }
.btn-full { width: 100%; justify-content: center; }

/* =============================================
   FORMS
   ============================================= */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}
.form-label-lg { font-size: 13px; }
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
  line-height: 1.5;
}
.form-control:hover { border-color: var(--gray-300); }
.form-control:focus { border-color: var(--primary); background: var(--bg-white); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-control::placeholder { color: var(--text-muted); }
.form-control.error { border-color: var(--danger); }
.form-control.success { border-color: var(--success); }

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  appearance: none;
}
textarea.form-control { resize: vertical; min-height: 80px; line-height: 1.6; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr;     gap: 13px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 13px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; }

/* =============================================
   PROGRESS BARS
   ============================================= */
.progress-bar-wrap { display: flex; align-items: center; gap: 10px; }
.progress-bar {
  flex: 1; height: 5px;
  background: var(--gray-100);
  border-radius: var(--radius-full); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: var(--radius-full);
  transition: width 0.7s cubic-bezier(.4,0,.2,1);
}
.progress-fill.primary { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.progress-fill.success { background: linear-gradient(90deg, var(--success), #34d399); }
.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.progress-fill.danger  { background: linear-gradient(90deg, var(--danger), #f87171); }
.progress-fill.info    { background: linear-gradient(90deg, var(--info), #38bdf8); }
.progress-label { font-size: 12px; font-weight: 600; color: var(--text-primary); min-width: 30px; text-align: right; }

/* =============================================
   TABLES
   ============================================= */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead { background: var(--gray-50); }
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px; color: var(--text-secondary);
  vertical-align: middle; background: var(--bg-white);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--gray-50); }
.td-main  { color: var(--text-primary) !important; font-weight: 500; }
.td-link  { color: var(--primary) !important; font-weight: 500; cursor: pointer; }
.td-link:hover { text-decoration: underline; }

/* Sortable headers */
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--primary); }

/* =============================================
   TABS
   ============================================= */
.tab-nav {
  display: flex; gap: 0;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab-btn {
  padding: 9px 16px;
  border: none; background: none;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: var(--transition); margin-bottom: -1.5px;
  font-family: inherit; white-space: nowrap;
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
  background: linear-gradient(180deg, transparent, var(--primary-pale));
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* =============================================
   MODALS
   ============================================= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  width: 100%; max-width: 520px;
  max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-lg { max-width: 720px; }
.modal-sm { max-width: 400px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.3px; }
.modal-close {
  width: 28px; height: 28px;
  background: var(--gray-100); border: none;
  border-radius: 6px; cursor: pointer; color: var(--gray-400);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: var(--transition);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* =============================================
   OPPORTUNITY CARDS
   ============================================= */
.opp-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.opp-card:hover {
  border-color: var(--primary-pale2);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.opp-card.top-pick {
  border-color: var(--primary-pale2);
}
.opp-card.top-pick::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}
.opp-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.opp-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); line-height: 1.4; margin-bottom: 3px; }
.opp-org { font-size: 12px; color: var(--text-muted); }
.opp-score {
  flex-shrink: 0;
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800;
  border: 2.5px solid;
}
.opp-score.high { border-color: var(--success); color: var(--success); background: var(--success-bg); }
.opp-score.mid  { border-color: var(--warning); color: var(--warning-dark); background: var(--warning-bg); }
.opp-score.low  { border-color: var(--gray-300); color: var(--gray-400); background: var(--gray-50); }
.opp-score span { font-size: 8px; font-weight: 500; }
.opp-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 9px; }
.opp-meta-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); }
.opp-meta-item strong { color: var(--text-secondary); font-weight: 500; }
.opp-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.opp-footer { display: flex; align-items: center; justify-content: space-between; }
.deadline-badge { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; }
.deadline-badge.urgent { color: var(--danger); }
.deadline-badge.soon   { color: var(--warning-dark); }
.deadline-badge.normal { color: var(--text-muted); }

/* =============================================
   ALERT / NOTIFICATION
   ============================================= */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 3px solid;
  margin-bottom: 14px;
}
.alert-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.alert-text { font-size: 13px; line-height: 1.55; flex: 1; }
.alert-title { font-weight: 600; margin-bottom: 2px; }
.alert-info    { background: var(--info-bg);    border-color: var(--info);    color: var(--info); }
.alert-success { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning); color: var(--warning-dark); }
.alert-danger  { background: var(--danger-bg);  border-color: var(--danger);  color: var(--danger-dark); }
.alert-text .alert-title { color: inherit; }
.alert-text p { color: var(--text-secondary); margin-top: 3px; }

/* =============================================
   TIMELINE / ACTIVITY
   ============================================= */
.timeline { display: flex; flex-direction: column; }
.timeline-item {
  display: flex; gap: 13px;
  padding: 9px 0;
  position: relative;
}
.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 13px; top: 35px;
  width: 1.5px; bottom: 0;
  background: var(--border);
}
.timeline-dot {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; z-index: 1; border: 1.5px solid;
}
.timeline-dot.primary { background: var(--primary-pale);  border-color: var(--primary-pale2); color: var(--primary); }
.timeline-dot.success { background: var(--success-bg);    border-color: var(--success-border); color: var(--success); }
.timeline-dot.info    { background: var(--info-bg);       border-color: var(--info-border);    color: var(--info); }
.timeline-dot.warning { background: var(--warning-bg);    border-color: var(--warning-border); color: var(--warning-dark); }
.timeline-dot.danger  { background: var(--danger-bg);     border-color: var(--danger-border);  color: var(--danger); }
.timeline-content { flex: 1; }
.timeline-text { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.timeline-text strong { color: var(--text-primary); font-weight: 600; }
.timeline-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* =============================================
   SCORE RING
   ============================================= */
.score-ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.score-ring {
  position: relative; width: 88px; height: 88px;
  display: flex; align-items: center; justify-content: center;
}
.score-ring svg { position: absolute; top: 0; left: 0; transform: rotate(-90deg); }
.score-ring-value { font-size: 21px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.score-ring-label { font-size: 11px; color: var(--text-muted); }

/* =============================================
   STEP WIZARD
   ============================================= */
.step-wizard { display: flex; align-items: center; gap: 0; margin-bottom: 26px; overflow-x: auto; }
.step-item { display: flex; align-items: center; flex: 1; min-width: 0; }
.step-item:last-child .step-line { display: none; }
.step-circle {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
  border: 2px solid var(--border);
  color: var(--text-muted); background: var(--bg-white);
  transition: var(--transition-slow);
}
.step-item.active .step-circle { border-color: var(--primary); color: var(--primary); background: var(--primary-pale); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.step-item.done .step-circle { border-color: var(--success); color: white; background: var(--success); }
.step-info { margin-left: 9px; min-width: 0; }
.step-num { font-size: 10px; color: var(--text-muted); }
.step-name { font-size: 12px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-item.active .step-name { color: var(--primary); }
.step-item.done .step-name { color: var(--success); }
.step-line { flex: 1; height: 1.5px; background: var(--border); margin: 0 10px; }
.step-item.done .step-line { background: var(--success); }
.step-item.active .step-line { background: var(--primary-pale2); }

/* =============================================
   UPLOAD ZONES
   ============================================= */
.upload-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 30px 22px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--gray-50);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-pale);
}
.upload-icon { font-size: 30px; margin-bottom: 10px; }
.upload-text { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.upload-hint { font-size: 12px; color: var(--text-muted); }

/* =============================================
   FILTER PANEL
   ============================================= */
.filter-panel {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-label { font-size: 12px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.filter-chip {
  padding: 4px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 500;
  cursor: pointer; color: var(--text-secondary);
  background: var(--bg-white);
  transition: var(--transition);
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-pale); }
.filter-chip.active { border-color: var(--primary); color: var(--primary); background: var(--primary-pale); font-weight: 600; }
.filter-select {
  padding: 5px 11px;
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px; cursor: pointer; outline: none;
  font-family: inherit;
  transition: var(--transition);
}
.filter-select:focus { border-color: var(--primary); }

/* =============================================
   TOGGLE / CHECKBOX
   ============================================= */
.check-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
}
.check-item:hover { background: var(--gray-50); }
.check-item input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }
.check-label { font-size: 13px; color: var(--text-secondary); }
.check-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.toggle-switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--gray-200); border-radius: 20px;
  cursor: pointer; transition: 0.25s;
}
.toggle-slider:before {
  content: ''; position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: white; border-radius: 50%;
  transition: 0.25s;
  box-shadow: var(--shadow-xs);
}
input:checked + .toggle-slider { background: var(--primary); }
input:checked + .toggle-slider:before { transform: translateX(16px); }

/* =============================================
   KEYWORD CHIPS
   ============================================= */
.keyword-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.keyword-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px 4px 11px;
  background: var(--primary-pale);
  border: 1.5px solid var(--primary-pale2);
  border-radius: var(--radius-full);
  font-size: 12px; color: var(--primary); font-weight: 500;
}
.keyword-chip .remove { cursor: pointer; font-size: 13px; color: var(--text-muted); line-height: 1; }
.keyword-chip .remove:hover { color: var(--danger); }

/* =============================================
   TOAST
   ============================================= */
#toast-container {
  position: fixed; bottom: 22px; right: 22px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  display: flex; align-items: center; gap: 10px;
  min-width: 250px; max-width: 360px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 13px; color: var(--text-secondary);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--primary); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 52px 22px; text-align: center;
}
.empty-icon { font-size: 46px; margin-bottom: 13px; opacity: 0.3; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
.empty-desc { font-size: 13px; color: var(--text-muted); max-width: 280px; line-height: 1.6; }

/* =============================================
   DIVIDER & UTILITY
   ============================================= */
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.divider-v { width: 1px; background: var(--border); margin: 0 8px; align-self: stretch; }

.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.flex-center  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-end     { display: flex; align-items: center; justify-content: flex-end; }
.items-start  { align-items: flex-start; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.shrink-0     { flex-shrink: 0; }
.gap-4  { gap: 4px; }  .gap-6  { gap: 6px; }  .gap-8  { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-14 { gap: 14px; }
.gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.mt-4  { margin-top: 4px; }  .mt-6  { margin-top: 6px; }
.mt-8  { margin-top: 8px; }  .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }  .mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; } .mb-24 { margin-bottom: 24px; }
.p-0 { padding: 0; }

.text-xs  { font-size: 11px; }
.text-sm  { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg  { font-size: 16px; }
.text-xl  { font-size: 18px; }
.text-2xl { font-size: 22px; }
.text-3xl { font-size: 28px; }
.text-muted     { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-primary-c { color: var(--text-primary) !important; }
.text-blue      { color: var(--primary) !important; }
.text-success   { color: var(--success) !important; }
.text-warning   { color: var(--warning-dark) !important; }
.text-danger    { color: var(--danger) !important; }
.text-info      { color: var(--info) !important; }
.fw-400 { font-weight: 400; } .fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rounded-full { border-radius: var(--radius-full); }
.cursor-pointer { cursor: pointer; }

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-bg {
  min-height: 100vh;
  background: #ffffff;
  display: flex; align-items: stretch;
}
.login-left {
  flex: 1;
  background: linear-gradient(145deg, var(--primary-deeper) 0%, var(--primary) 55%, var(--primary-light) 100%);
  display: flex; flex-direction: column;
  padding: 52px 56px;
  position: relative; overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute; top: -130px; right: -90px;
  width: 440px; height: 440px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.login-left::after {
  content: '';
  position: absolute; bottom: -110px; left: -70px;
  width: 340px; height: 340px; border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.login-right {
  width: 460px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 50px;
  background: #ffffff;
  border-left: 1px solid var(--border);
}
.login-card { width: 100%; }

/* =============================================
   CHART CONTAINERS
   ============================================= */
.chart-container { position: relative; }
.chart-container canvas { max-height: 100% !important; }

/* =============================================
   HIGHLIGHT BANNER (AI Insight)
   ============================================= */
.highlight-banner {
  background: linear-gradient(135deg, var(--primary-pale) 0%, var(--info-bg) 100%);
  border: 1.5px solid var(--primary-pale2);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  cursor: pointer;
  transition: var(--transition);
}
.highlight-banner:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.highlight-banner-icon {
  width: 38px; height: 38px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  box-shadow: var(--shadow-blue);
}
.highlight-banner-title { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.highlight-banner-text { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.highlight-banner-text strong { color: var(--text-primary); font-weight: 600; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1280px) {
  .grid-70-30, .grid-60-40, .grid-65-35 { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .login-left { display: none; }
  .login-right { width: 100%; border-left: none; }
}
@media (max-width: 600px) {
  .page-content { padding: 14px 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .header-search { display: none; }
  .page-header { flex-direction: column; align-items: flex-start; }
}
