/* =====================================================
   Phần Mềm Tính Lương — style.css
   UI/UX Pro Max — Dark Premium Glassmorphism
   ===================================================== */

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

:root {
  /* ── Core Backgrounds ── */
  --bg: #0a0e1a;
  --bg2: #111827;
  --bg3: #1e293b;
  --bg4: #334155;

  /* ── Glass Effect ── */
  --glass-bg: rgba(17, 24, 39, 0.6);
  --glass-bg-strong: rgba(17, 24, 39, 0.85);
  --glass-border: rgba(148, 163, 184, 0.08);
  --glass-border-hover: rgba(148, 163, 184, 0.15);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.03);

  /* ── Borders ── */
  --border: rgba(148, 163, 184, 0.1);
  --border-subtle: rgba(148, 163, 184, 0.06);

  /* ── Text ── */
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-accent: #a5b4fc;

  /* ── Accents ── */
  --accent: #6366f1;
  --accent2: #8b5cf6;
  --accent3: #06b6d4;

  /* ── Gradients ── */
  --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-secondary: linear-gradient(135deg, #8b5cf6, #06b6d4);
  --gradient-accent: linear-gradient(135deg, #6366f1, #06b6d4);
  --gradient-warm: linear-gradient(135deg, #f59e0b, #ef4444);
  --gradient-success: linear-gradient(135deg, #22c55e, #06b6d4);

  /* ── Status Colors ── */
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --orange: #f97316;

  /* ── Radius ── */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* ── Shadows ── */
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.02);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-glow-accent: 0 0 20px rgba(99, 102, 241, 0.15);
  --shadow-glow-green: 0 0 20px rgba(34, 197, 94, 0.15);

  /* ── Transitions ── */
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============ SCREENS ============ */
.screen { display: none; }
.screen.active { display: flex; }
.screen.hidden { display: none !important; }

/* ============ LOGIN ============ */
#screen-login {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

/* Animated gradient mesh background */
#screen-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(99, 102, 241, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 80% 60%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 90%, rgba(6, 182, 212, 0.06) 0%, transparent 50%);
  animation: meshPulse 12s ease-in-out infinite alternate;
}

@keyframes meshPulse {
  0% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
  100% { opacity: 0.9; transform: scale(0.98); }
}

.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.18;
  animation: float 10s ease-in-out infinite alternate;
}

.orb1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #6366f1, transparent 70%);
  top: -150px; left: -150px;
  animation-delay: 0s;
}
.orb2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #8b5cf6, transparent 70%);
  bottom: -100px; right: 5%;
  animation-delay: -4s;
}
.orb3 {
  width: 250px; height: 250px;
  background: radial-gradient(circle, #06b6d4, transparent 70%);
  top: 35%; right: 25%;
  animation-delay: -7s;
}

@keyframes float {
  0% { transform: translateY(0px) scale(1) rotate(0deg); }
  100% { transform: translateY(-40px) scale(1.08) rotate(3deg); }
}

.login-card {
  position: relative;
  z-index: 10;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  box-shadow:
    var(--glass-shadow),
    0 0 60px rgba(99, 102, 241, 0.06);
  animation: cardAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardAppear {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.logo-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 24px rgba(99, 102, 241, 0.4));
}

.login-logo h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-hint {
  text-align: center;
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ============ FIELDS ============ */
.field-group { display: flex; flex-direction: column; gap: 7px; }

.field-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.input-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  z-index: 1;
  pointer-events: none;
  opacity: 0.7;
}

.input-wrap input,
.input-wrap select {
  width: 100%;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 12px 14px 12px 42px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  backdrop-filter: blur(4px);
}

.input-wrap select {
  cursor: pointer;
  padding-right: 30px;
}

.input-wrap input:focus,
.input-wrap select:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), var(--shadow-glow-accent);
  background: rgba(30, 41, 59, 0.8);
}

.input-wrap input::placeholder { color: var(--text-muted); opacity: 0.6; }

.btn-eye {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  opacity: 0.5;
  transition: opacity var(--transition);
}
.btn-eye:hover { opacity: 1; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background var(--transition);
  border-radius: inherit;
}
.btn:hover::after { background: rgba(255, 255, 255, 0.06); }
.btn:active::after { background: rgba(255, 255, 255, 0.1); }
.btn:active { transform: scale(0.98); }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.btn:disabled::after { display: none; }

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 2px 16px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--gradient-secondary);
  color: white;
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 2px 16px rgba(139, 92, 246, 0.3);
}
.btn-accent:hover:not(:disabled) {
  box-shadow: 0 4px 24px rgba(139, 92, 246, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--glass-bg);
  color: var(--text);
  border-color: var(--glass-border);
  backdrop-filter: blur(8px);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--glass-border-hover);
  background: rgba(30, 41, 59, 0.6);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--glass-border);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--glass-border-hover);
  background: rgba(30, 41, 59, 0.3);
}

.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 15px; font-weight: 600; }

.btn-spinner { display: none; }
.btn-spinner.visible { display: inline; }

/* ============ ALERTS ============ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  backdrop-filter: blur(8px);
}
.alert.hidden { display: none !important; }
.alert-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}
.alert-warning {
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.2);
  color: #eab308;
}
.alert-success {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

/* ============ APP LAYOUT ============ */
#screen-app {
  display: flex;
  height: 100vh;
  background: var(--bg);
  overflow: hidden;
}

.app-sidebar {
  width: 270px;
  background: var(--glass-bg-strong);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(1.1);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
}

.sidebar-brand {
  padding: 28px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-icon {
  font-size: 26px;
  filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.3));
}
.sidebar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.sidebar-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 1px;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0 16px 10px;
  opacity: 0.6;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  margin-bottom: 3px;
  position: relative;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(99, 102, 241, 0.06);
  color: var(--text);
}

.nav-item.active {
  background: rgba(99, 102, 241, 0.1);
  color: #a5b4fc;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--gradient-primary);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-info-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 0 4px;
  backdrop-filter: blur(8px);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-bottom: 6px;
}

.info-row:last-child { margin-bottom: 0; }

.info-row span { color: var(--text-muted); }
.info-row strong { color: var(--text); font-weight: 600; }

.side-hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 10px 0;
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--glass-border);
}

.status-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  background:
    radial-gradient(ellipse 50% 30% at 80% 10%, rgba(99, 102, 241, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse 40% 40% at 20% 80%, rgba(6, 182, 212, 0.02) 0%, transparent 50%),
    var(--bg);
}

.app-topbar {
  height: 64px;
  background: rgba(10, 14, 26, 0.75);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.app-topbar h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ============ MAIN ============ */
.app-main {
  padding: 32px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* ============ STEP CARDS ============ */
.step-card {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all var(--transition);
  backdrop-filter: blur(12px);
  position: relative;
}

.step-card:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow-glow-accent);
  transform: translateY(-1px);
}

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.step-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
  color: white;
}

.step-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.step-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.step-status { margin-left: auto; }

/* ============ TWO COL ============ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .two-col { grid-template-columns: 1fr; }
}

.btn-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============ SUCCESS ROW ============ */
.success-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(34, 197, 94, 0.06);
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  backdrop-filter: blur(8px);
}

.success-icon { font-size: 20px; }

/* ============ DROP ZONE ============ */
.drop-zone {
  border: 2px dashed var(--glass-border-hover);
  border-radius: var(--radius-lg);
  padding: 52px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: rgba(30, 41, 59, 0.3);
  position: relative;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 2px;
  background: transparent;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  transition: background var(--transition-slow);
  pointer-events: none;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: transparent;
  background: rgba(99, 102, 241, 0.04);
}

.drop-zone:hover::before, .drop-zone.drag-over::before {
  background: var(--gradient-primary);
}

.drop-zone:hover {
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.1);
}

.drop-icon { font-size: 48px; margin-bottom: 14px; opacity: 0.8; }
.drop-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.drop-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.drop-hint { font-size: 12px; color: var(--text-muted); margin-top: 12px; opacity: 0.6; }

/* ============ FILE LIST ============ */
.file-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
  transition: border-color var(--transition);
}

.file-item:hover { border-color: var(--glass-border-hover); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.file-icon { font-size: 20px; }

.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta { font-size: 12px; color: var(--text-muted); }

.file-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  opacity: 0.3;
  transition: all var(--transition);
  padding: 4px;
}
.file-remove:hover { opacity: 1; color: var(--red); }

/* ============ MAPPING ============ */
.mapping-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.mapping-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 16px;
}

.mapping-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.mapping-row select {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.mapping-row select:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ============ SYNC AREA ============ */
.sync-ready {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.sync-stats-preview {
  font-size: 14px;
  color: var(--text-muted);
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  width: 100%;
  line-height: 1.8;
  backdrop-filter: blur(8px);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
}

.progress-bar-wrap {
  height: 8px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.progress-bar {
  height: 100%;
  background: var(--gradient-accent);
  border-radius: 6px;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.sync-counters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.counter {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  backdrop-filter: blur(8px);
  transition: all var(--transition);
}

.counter:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-1px);
}

.counter-found { border-color: rgba(34, 197, 94, 0.15); background: rgba(34, 197, 94, 0.04); }
.counter-notfound { border-color: rgba(234, 179, 8, 0.15); background: rgba(234, 179, 8, 0.04); }
.counter-pending { border-color: rgba(99, 102, 241, 0.15); background: rgba(99, 102, 241, 0.04); }

.counter-icon { font-size: 22px; }
.counter-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.counter-val {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.counter-found .counter-val { color: var(--green); }
.counter-notfound .counter-val { color: var(--yellow); }

.sync-log {
  margin-top: 12px;
  background: rgba(10, 14, 26, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  max-height: 160px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}

.log-line { animation: fadeIn 0.2s ease; }
.log-ok { color: var(--green); }
.log-warn { color: var(--yellow); }
.log-err { color: var(--red); }
.log-info { color: var(--text-accent); }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============ DONE BANNER ============ */
.done-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(34, 197, 94, 0.06);
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: var(--radius);
  padding: 20px 24px;
  backdrop-filter: blur(8px);
}

.done-icon { font-size: 36px; }
.done-banner strong { font-size: 16px; color: var(--text); }
.done-banner p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ============ EXPORT BUTTONS ============ */
.export-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.export-btn {
  flex: 1;
  min-width: 240px;
  text-align: left;
  gap: 16px;
  justify-content: flex-start;
  padding: 20px 24px;
  border-radius: var(--radius);
}

.export-btn span { font-size: 28px; flex-shrink: 0; }
.export-btn strong { display: block; font-size: 15px; }
.export-btn small { font-size: 12px; opacity: 0.6; margin-top: 2px; display: block; }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
  padding: 20px;
}

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

.modal-card {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  max-width: 700px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow), 0 0 60px rgba(99, 102, 241, 0.06);
  animation: modalIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(-16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }

.btn-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-close:hover { background: rgba(239, 68, 68, 0.1); color: var(--red); }

.modal-body {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: flex-end;
}

/* ============ REPORT TABLE ============ */
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.report-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(30, 41, 59, 0.6);
}

.report-table tr:last-child td { border-bottom: none; }
.report-table tr:hover td { background: rgba(99, 102, 241, 0.03); }

/* ============ VIEWS ============ */
.app-view {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: viewFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

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

.view-title-group { flex: 1; }
.view-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.view-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

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

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  opacity: 0.4;
}

.search-wrap input {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px 8px 36px;
  font-size: 13px;
  width: 240px;
  outline: none;
  transition: all var(--transition);
  backdrop-filter: blur(4px);
}

.search-wrap input:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: rgba(30, 41, 59, 0.7);
}

/* ============ DATA TABLE ============ */
.results-table-container {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 600px;
  position: relative;
  backdrop-filter: blur(8px);
}

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

.data-table thead th {
  position: sticky;
  top: 0;
  background: rgba(30, 41, 59, 0.95);
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--glass-border);
  z-index: 10;
  backdrop-filter: blur(8px);
}

.data-table tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
  white-space: nowrap;
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover td {
  background: rgba(99, 102, 241, 0.04);
}

.row-success td { background: rgba(34, 197, 94, 0.03); }
.row-error td { background: rgba(239, 68, 68, 0.03); }

.cell-highlight-success {
  color: var(--green) !important;
  font-weight: 600;
}

.cell-highlight-error {
  color: var(--yellow) !important;
  font-weight: 600;
}

.empty-state {
  padding: 80px 0;
  text-align: center;
  color: var(--text-muted);
  background: rgba(17, 24, 39, 0.5);
  border: 1px dashed var(--glass-border-hover);
  border-radius: var(--radius);
}

.empty-state.hidden { display: none; }

.empty-icon { font-size: 48px; display: block; margin-bottom: 16px; opacity: 0.25; }

/* ============ UTILS ============ */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }
.text-red { color: var(--red); }
.text-sm { font-size: 13px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.breadcrumb a { text-decoration: none; color: var(--text-accent); }
.breadcrumb a:hover { text-decoration: underline; }

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.history-card {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  backdrop-filter: blur(8px);
}

.history-card:hover {
  border-color: rgba(99, 102, 241, 0.25);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow-accent);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.history-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
}

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

.history-stats {
  display: flex;
  gap: 10px;
  margin: 8px 0;
}

.h-stat {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
}

.btn-delete-history {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  opacity: 0;
  transition: all 0.2s;
  border-radius: var(--radius-sm);
}

.advanced-toggle {
  display: inline-block;
  cursor: pointer;
  color: var(--text-accent);
  font-size: 13px;
  margin: 12px 0;
  transition: opacity 0.2s;
  user-select: none;
}
.advanced-toggle:hover { opacity: 0.8; text-decoration: underline; }

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0.7;
}

.mb-16 { margin-bottom: 16px; }

.history-card:hover .btn-delete-history { opacity: 1; }
.btn-delete-history:hover { color: var(--red); background: rgba(239, 68, 68, 0.1); }


/* ============ PHASE 2-4 STYLES ============ */

/* Navigation Step Status */
.nav-item .step-icon {
  margin-left: auto;
  font-size: 12px;
}

.nav-item.step-completed .step-icon { color: var(--green); }
.nav-item.step-unavailable {
  opacity: 0.5;
  pointer-events: auto;
}

.nav-blocked-alert {
  margin: 0 32px;
  margin-top: 8px;
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  backdrop-filter: blur(8px);
  transition: all var(--transition);
}

.summary-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.summary-card .card-icon { font-size: 26px; margin-bottom: 10px; }
.summary-card .card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.summary-card .card-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* Profit Filters */
.profit-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-select, .filter-date {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.filter-select:focus, .filter-date:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 0;
}

.pagination button {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.pagination button:hover { border-color: rgba(99, 102, 241, 0.3); background: rgba(99, 102, 241, 0.06); }
.pagination button.active {
  background: var(--gradient-primary);
  border-color: rgba(99, 102, 241, 0.3);
  color: white;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}
.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }

.pagination .page-info {
  font-size: 13px;
  color: var(--text-muted);
}

/* Salary Config Grid */
.salary-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.salary-config-item {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(8px);
}

.salary-config-item h5 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.cfg-input {
  width: 100%;
  background: rgba(10, 14, 26, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.cfg-input:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Chart Container */
.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
  margin-top: 12px;
}

/* Profit row coloring */
.row-profit-positive td { background: rgba(34, 197, 94, 0.04) !important; }
.row-profit-negative td { background: rgba(239, 68, 68, 0.04) !important; }

/* Salary History List */
.salary-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--transition);
  background: rgba(17, 24, 39, 0.4);
}

.salary-history-item:hover {
  background: rgba(99, 102, 241, 0.05);
  border-color: rgba(99, 102, 241, 0.2);
  transform: translateX(4px);
}

.salary-history-item .sh-info { flex: 1; }
.salary-history-item .sh-date { font-size: 13px; color: var(--text-muted); }
.salary-history-item .sh-file { font-size: 14px; font-weight: 500; }
.salary-history-item .sh-profit { font-size: 13px; color: var(--green); }
.salary-history-item .sh-actions { display: flex; gap: 8px; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  opacity: 0.5;
  transition: all var(--transition);
  border-radius: 6px;
}
.btn-icon:hover { opacity: 1; background: rgba(148, 163, 184, 0.08); }
.btn-icon.danger:hover { color: var(--red); background: rgba(239, 68, 68, 0.08); }

/* Status dot colors */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green); box-shadow: 0 0 6px rgba(34, 197, 94, 0.4); }
.dot-red { background: var(--red); box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
.dot-yellow { background: var(--yellow); box-shadow: 0 0 6px rgba(234, 179, 8, 0.4); }

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ========== QUICK TEST SKU ========== */
.quick-test-panel {
  margin-top: 20px;
  padding: 24px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  animation: qt-slide-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.quick-test-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gradient-accent);
  opacity: 0.5;
}

@keyframes qt-slide-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.quick-test-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.quick-test-icon {
  font-size: 28px;
  line-height: 1;
}

.quick-test-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.quick-test-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.quick-test-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.quick-test-field {
  flex: 1;
  min-width: 140px;
  margin-bottom: 0 !important;
}

.qt-field-facility {
  flex: 1.2;
}

.qt-field-facility .field-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0.6;
}

.qt-result-detail code {
  background: rgba(30, 41, 59, 0.8);
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace;
  color: var(--text-accent);
  border: 1px solid var(--glass-border);
}

.quick-test-field label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.quick-test-field .input-wrap {
  height: 40px;
}

.quick-test-field .filter-select {
  width: 100%;
  height: 40px;
  background: rgba(30, 41, 59, 0.6);
  color: var(--text);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 14px;
}

/* Result display */
.quick-test-result {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  animation: qt-fade-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 4px solid transparent;
  backdrop-filter: blur(8px);
}

@keyframes qt-fade-in {
  from { opacity: 0; transform: scale(0.96) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.qt-success {
  background: rgba(34, 197, 94, 0.06);
  border-left-color: var(--green);
}

.qt-notfound {
  background: rgba(234, 179, 8, 0.06);
  border-left-color: var(--yellow);
}

.qt-error {
  background: rgba(239, 68, 68, 0.06);
  border-left-color: var(--red);
  color: var(--red);
}

.qt-loading {
  background: rgba(99, 102, 241, 0.06);
  border-left-color: var(--accent);
  color: var(--text-muted);
}

.qt-spinner {
  display: inline-block;
  animation: qt-spin 1s linear infinite;
}

@keyframes qt-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.qt-result-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.qt-result-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

.qt-result-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.qt-success .qt-result-price {
  color: var(--green);
}

.qt-notfound .qt-result-price {
  color: var(--yellow);
}

.qt-result-detail {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.qt-result-detail strong {
  color: var(--text);
}

.qt-result-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0.6;
}

/* History */
.quick-test-history {
  margin-top: 18px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}

.quick-test-history h5 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  opacity: 0.6;
}

.qt-hist-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr 0.8fr;
  gap: 8px;
  padding: 7px 12px;
  font-size: 12px;
  border-radius: 8px;
  transition: background var(--transition);
  align-items: center;
}

.qt-hist-row:hover {
  background: rgba(99, 102, 241, 0.04);
}

.qt-hist-ok {
  color: var(--text);
}

.qt-hist-fail {
  color: var(--text-muted);
}

.qt-hist-sku {
  font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.qt-hist-wh {
  color: var(--text-accent);
}

.qt-hist-price {
  font-weight: 600;
  text-align: right;
}

.qt-hist-ok .qt-hist-price {
  color: var(--green);
}

.qt-hist-fail .qt-hist-price {
  color: var(--yellow);
}

.qt-hist-time {
  text-align: right;
  color: var(--text-muted);
  font-size: 11px;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.25);
}

/* ============ SELECTION ============ */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: #fff;
}
