/* ==========================================================================
   Smart Tool — Smart Laboratories UI & Motion System
   ========================================================================== */

:root {
  --brand-red: #e31e24;
  --brand-red-dark: #b91218;
  --brand-red-glow: rgba(227, 30, 36, 0.38);
  --brand-amber: #f59e0b;
  --brand-emerald: #10b981;
  --brand-cyan: #06b6d4;

  --bg-deep: #090b10;
  --bg-surface: rgba(17, 22, 34, 0.74);
  --bg-surface-strong: rgba(21, 27, 42, 0.92);
  --bg-elevated: rgba(255, 255, 255, 0.045);

  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --shadow-card: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html,
body {
  min-height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Animated Ambient Background
   ========================================================================== */

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(circle at 20% 20%, #17121b 0%, #090b10 55%, #06070b 100%);
}

.mesh-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(95px);
  opacity: 0.42;
  will-change: transform;
}

.orb-1 {
  width: 560px;
  height: 560px;
  top: -140px;
  left: -120px;
  background: radial-gradient(circle, rgba(227, 30, 36, 0.65), transparent 70%);
  animation: orbFloat1 18s ease-in-out infinite alternate;
}

.orb-2 {
  width: 520px;
  height: 520px;
  bottom: -160px;
  right: -100px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.32), transparent 70%);
  animation: orbFloat2 22s ease-in-out infinite alternate;
}

.orb-3 {
  width: 420px;
  height: 420px;
  top: 40%;
  left: 48%;
  background: radial-gradient(circle, rgba(244, 63, 94, 0.24), transparent 72%);
  animation: orbFloat3 25s ease-in-out infinite alternate;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 35%, transparent 85%);
}

/* Floating diagonal pill bars echoing the Smart Laboratories mark */
.floating-bars {
  position: absolute;
  inset: 0;
  opacity: 0.16;
}

.floating-bars .bar {
  position: absolute;
  width: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand-red), rgba(227, 30, 36, 0.05));
  transform: rotate(38deg);
  animation: barDrift 14s ease-in-out infinite;
}

.floating-bars .b1 { height: 140px; top: 14%; left: 10%; animation-delay: 0s; }
.floating-bars .b2 { height: 190px; top: 22%; left: 13%; animation-delay: -3s; }
.floating-bars .b3 { height: 110px; bottom: 18%; right: 12%; animation-delay: -5s; }
.floating-bars .b4 { height: 170px; bottom: 12%; right: 9%; animation-delay: -8s; }
.floating-bars .b5 { height: 95px; top: 18%; right: 24%; animation-delay: -11s; }

@keyframes orbFloat1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(90px, 60px) scale(1.12); }
}

@keyframes orbFloat2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-80px, -70px) scale(1.14); }
}

@keyframes orbFloat3 {
  0% { transform: translate(-50%, -50%) scale(0.95); }
  100% { transform: translate(-35%, -62%) scale(1.1); }
}

@keyframes barDrift {
  0%, 100% { transform: rotate(38deg) translateY(0px); opacity: 0.55; }
  50% { transform: rotate(38deg) translateY(-22px); opacity: 1; }
}

/* ==========================================================================
   Glass Surfaces & Buttons
   ========================================================================== */

.glass-card,
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-red) 0%, #c8141a 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 10px 26px rgba(227, 30, 36, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.22s var(--ease-spring), box-shadow 0.22s var(--ease-smooth), filter 0.2s;
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.22) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.55s ease;
}

.btn-primary:hover::after {
  transform: translateX(120%);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(227, 30, 36, 0.48);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary svg,
.btn-secondary svg,
.btn-ghost svg,
.btn-ghost-danger svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid var(--border-strong);
  transition: transform 0.22s var(--ease-spring), background 0.2s, border-color 0.2s;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.88rem;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.btn-ghost-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(227, 30, 36, 0.1);
  color: #fca5a5;
  font-size: 0.84rem;
  font-weight: 600;
  border: 1px solid rgba(227, 30, 36, 0.24);
  transition: all 0.2s;
}

.btn-ghost-danger:hover {
  background: rgba(227, 30, 36, 0.22);
  color: #fff;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 8px 13px;
  font-size: 0.82rem;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 14px;
  background: rgba(15, 20, 32, 0.94);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  animation: toastIn 0.35s var(--ease-spring) forwards;
}

.toast.toast-success { border-left: 4px solid var(--brand-emerald); }
.toast.toast-error { border-left: 4px solid var(--brand-red); }
.toast.toast-info { border-left: 4px solid var(--brand-cyan); }

.toast.leaving {
  animation: toastOut 0.28s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(30px) scale(0.95); }
}

/* ==========================================================================
   Login View
   ========================================================================== */

.login-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.login-view.active {
  display: flex;
}

.login-view.exiting {
  animation: viewExit 0.45s var(--ease-spring) forwards;
}

@keyframes viewExit {
  to { opacity: 0; transform: scale(0.97) translateY(-12px); }
}

.login-wrapper {
  width: 100%;
  max-width: 1120px;
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 48px;
  align-items: center;
}

.reveal-left {
  animation: slideUpFade 0.75s var(--ease-spring) both;
}

.reveal-right {
  animation: slideUpFade 0.85s var(--ease-spring) 0.1s both;
}

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

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(227, 30, 36, 0.12);
  border: 1px solid rgba(227, 30, 36, 0.28);
  color: #fda4af;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 20px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-red);
  box-shadow: 0 0 0 0 rgba(227, 30, 36, 0.75);
  animation: pulseRing 2s infinite;
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(227, 30, 36, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(227, 30, 36, 0); }
  100% { box-shadow: 0 0 0 0 rgba(227, 30, 36, 0); }
}

.showcase-title {
  font-size: clamp(2.2rem, 4.2vw, 3.35rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, #ffffff 10%, #ff6b70 55%, var(--brand-red) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.showcase-subtitle {
  font-size: 1.03rem;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 32px;
}

.feature-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.28s var(--ease-spring), border-color 0.25s, background 0.25s;
}

.feature-item:hover {
  transform: translateX(6px);
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(227, 30, 36, 0.35);
}

.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(227, 30, 36, 0.14);
  color: #ff6b70;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.feature-icon svg {
  width: 20px;
  height: 20px;
}

.feature-item strong {
  display: block;
  font-size: 0.94rem;
  font-weight: 600;
  margin-bottom: 3px;
}

.feature-item span {
  display: block;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

/* Login Card */
.login-card {
  border-radius: var(--radius-xl);
  padding: 36px 34px;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--brand-red), #ff6b70, transparent);
}

.login-card.shake {
  animation: cardShake 0.42s ease;
}

@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.login-logo-box {
  background: #ffffff;
  border-radius: 16px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
}

.login-logo {
  max-height: 54px;
  width: auto;
  object-fit: contain;
}

.login-header h2 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 22px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 7px;
}

.input-field {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(9, 12, 19, 0.72);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus-within {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(227, 30, 36, 0.18);
}

.field-icon {
  width: 18px;
  height: 18px;
  margin-left: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.input-field input {
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.94rem;
  font-family: inherit;
}

.icon-btn {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
  display: grid;
  place-items: center;
  transition: color 0.2s;
}

.icon-btn:hover {
  color: var(--text-primary);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.login-error {
  min-height: 18px;
  font-size: 0.83rem;
  color: #fda4af;
  font-weight: 500;
}

.btn-login {
  width: 100%;
  padding: 13px 20px;
  font-size: 0.95rem;
  border-radius: 12px;
}

.btn-login .btn-arrow {
  transition: transform 0.22s var(--ease-spring);
}

.btn-login:hover .btn-arrow {
  transform: translateX(4px);
}

.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-login.loading .btn-text,
.btn-login.loading .btn-arrow {
  display: none;
}

.btn-login.loading .btn-spinner {
  display: inline-block;
}

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

.login-hint {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--border-subtle);
}

.hint-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.hint-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hint-chip {
  padding: 6px 11px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-family: "JetBrains Mono", monospace;
  transition: all 0.2s;
}

.hint-chip:hover {
  background: rgba(227, 30, 36, 0.14);
  border-color: rgba(227, 30, 36, 0.4);
  color: #fff;
  transform: translateY(-1px);
}

/* ==========================================================================
   Main App Workspace
   ========================================================================== */

.app-view {
  position: relative;
  z-index: 1;
  display: none;
  min-height: 100vh;
  padding: 18px 24px 56px;
  max-width: 1440px;
  margin: 0 auto;
}

.app-view.active {
  display: block;
  animation: appEnter 0.55s var(--ease-spring) both;
}

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

/* Topbar */
.topbar {
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  position: sticky;
  top: 14px;
  z-index: 40;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-chip {
  background: #ffffff;
  border-radius: 10px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-chip img {
  height: 28px;
  width: auto;
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.tool-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--border-subtle);
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(227, 30, 36, 0.14);
  color: #fff;
  border: 1px solid rgba(227, 30, 36, 0.36);
  font-size: 0.86rem;
  font-weight: 600;
}

.nav-pill svg {
  width: 16px;
  height: 16px;
  color: #ff6b70;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  font-size: 0.76rem;
  font-weight: 600;
}

.shield-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-emerald);
  box-shadow: 0 0 8px var(--brand-emerald);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 11px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-red), #7f1d1d);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.84rem;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.84rem;
  font-weight: 600;
}

.user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Tool Hero */
.tool-hero {
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}

.tool-hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(227, 30, 36, 0.18), transparent 70%);
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #ff6b70;
  margin-bottom: 6px;
}

.hero-copy h1 {
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.hero-copy p {
  color: var(--text-secondary);
  font-size: 0.93rem;
  max-width: 720px;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  z-index: 1;
}

/* Dropzone */
.dropzone {
  position: relative;
  border-radius: var(--radius-xl);
  padding: 58px 28px;
  text-align: center;
  border: 2px dashed rgba(255, 255, 255, 0.18);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.28s var(--ease-spring), border-color 0.25s, background 0.25s;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--brand-red);
  background: rgba(227, 30, 36, 0.08);
  transform: translateY(-3px) scale(1.005);
}

.dropzone-pulse {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(227, 30, 36, 0.14), transparent 70%);
  pointer-events: none;
  animation: dropPulse 3.5s ease-in-out infinite;
}

@keyframes dropPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.95); opacity: 0.5; }
  50% { transform: translate(-50%, -50%) scale(1.25); opacity: 1; }
}

.dropzone-content {
  position: relative;
  z-index: 1;
}

.upload-icon-ring {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(227, 30, 36, 0.22), rgba(227, 30, 36, 0.06));
  border: 1px solid rgba(227, 30, 36, 0.38);
  display: grid;
  place-items: center;
  color: #ff6b70;
  transition: transform 0.35s var(--ease-spring);
}

.dropzone:hover .upload-icon-ring,
.dropzone.drag-over .upload-icon-ring {
  transform: translateY(-6px) scale(1.06);
}

.upload-icon-ring svg {
  width: 30px;
  height: 30px;
}

.dropzone h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.dropzone p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 18px;
}

.browse-link {
  color: #ff6b70;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.format-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.format-tags span {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
}

/* Processing Section */
.processing-section {
  border-radius: var(--radius-xl);
  padding: 56px 28px;
  text-align: center;
}

.loader-orbit {
  width: 68px;
  height: 68px;
  margin: 0 auto 20px;
  position: relative;
}

.orbit-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--brand-red);
  border-right-color: #ff6b70;
  animation: spin 0.9s linear infinite;
}

.orbit-core {
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--brand-red), transparent);
  animation: pulseRing 1.5s infinite;
}

.processing-section h3 {
  font-size: 1.18rem;
  margin-bottom: 6px;
}

.processing-section p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 18px;
}

.progress-track {
  max-width: 380px;
  height: 7px;
  margin: 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-red), #ff6b70);
  transition: width 0.25s ease;
}

/* ==========================================================================
   Results Dashboard
   ========================================================================== */

.results-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: appEnter 0.45s var(--ease-spring) both;
}

.control-bar {
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.file-meta-pill {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-badge {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(227, 30, 36, 0.16);
  border: 1px solid rgba(227, 30, 36, 0.35);
  color: #ff8589;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
}

.file-name {
  font-weight: 700;
  font-size: 0.94rem;
}

.file-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.config-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.compact-select {
  background: rgba(9, 12, 19, 0.85);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
}

.compact-select:focus {
  border-color: var(--brand-red);
}

/* Toggle Switches */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.toggle-switch input {
  display: none;
}

.toggle-switch .slider {
  width: 36px;
  height: 20px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
}

.toggle-switch .slider::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.22s var(--ease-spring);
}

.toggle-switch input:checked + .slider {
  background: var(--brand-red);
}

.toggle-switch input:checked + .slider::after {
  transform: translateX(16px);
}

/* KPI Strip */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.kpi-card {
  border-radius: var(--radius-md);
  padding: 18px 20px;
  transition: transform 0.24s var(--ease-spring), border-color 0.24s;
}

.kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.kpi-highlight {
  background: linear-gradient(135deg, rgba(227, 30, 36, 0.16), rgba(17, 22, 34, 0.85));
  border-color: rgba(227, 30, 36, 0.34);
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.kpi-foot {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Depot Toolbar */
.depot-toolbar {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-search {
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(9, 12, 19, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0 12px;
}

.toolbar-search svg {
  width: 17px;
  height: 17px;
  color: var(--text-muted);
}

.toolbar-search input {
  width: 100%;
  padding: 10px 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
}

.toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* Depot Cards Grid */
.depot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.depot-card {
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--bg-surface);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0;
  transform: translateY(16px);
  animation: cardReveal 0.45s var(--ease-spring) forwards;
  transition: transform 0.25s var(--ease-spring), border-color 0.25s, box-shadow 0.25s;
}

.depot-card:hover {
  transform: translateY(-4px);
  border-color: rgba(227, 30, 36, 0.42);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

@keyframes cardReveal {
  to { opacity: 1; transform: translateY(0); }
}

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

.depot-code-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(227, 30, 36, 0.16);
  border: 1px solid rgba(227, 30, 36, 0.35);
  color: #ff8589;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.84rem;
  font-weight: 700;
}

.depot-state-tag {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.depot-billing-pill {
  text-align: right;
}

.depot-billing-pill .num {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.depot-billing-pill .lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.mini-stat {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mini-stat .val {
  display: block;
  font-weight: 700;
  font-size: 0.94rem;
  font-variant-numeric: tabular-nums;
}

.mini-stat .key {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.depot-bar-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.depot-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-red), #fb7185);
  transition: width 0.6s var(--ease-spring);
}

.depot-card-actions {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.btn-preview {
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-preview:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-dl-csv {
  padding: 9px 10px;
  border-radius: 9px;
  background: rgba(227, 30, 36, 0.18);
  color: #fecaca;
  border: 1px solid rgba(227, 30, 36, 0.4);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-dl-csv:hover {
  background: var(--brand-red);
  color: #fff;
}

.btn-dl-xlsx {
  padding: 9px 10px;
  border-radius: 9px;
  background: rgba(16, 185, 129, 0.14);
  color: #a7f3d0;
  border: 1px solid rgba(16, 185, 129, 0.34);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-dl-xlsx:hover {
  background: var(--brand-emerald);
  color: #06281e;
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 46px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  color: var(--text-secondary);
}

/* ==========================================================================
   Preview Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 6, 11, 0.76);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
  animation: fadeIn 0.22s ease both;
}

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

.modal-dialog {
  width: 100%;
  max-width: 1080px;
  max-height: 86vh;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(13, 17, 27, 0.96);
  animation: modalPop 0.32s var(--ease-spring) both;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ff8589;
  margin-bottom: 4px;
}

.modal-header h3 {
  font-size: 1.15rem;
}

.modal-header p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-close {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  font-size: 1rem;
  transition: all 0.2s;
}

.icon-close:hover {
  background: rgba(227, 30, 36, 0.24);
  color: #fff;
}

.modal-filter-row {
  padding: 12px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-filter-row input {
  min-width: 240px;
  flex: 1;
  max-width: 380px;
  padding: 8px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.modal-filter-row input:focus {
  border-color: var(--brand-red);
}

.legend-pills {
  display: flex;
  gap: 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot-green,
.dot-red {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.dot-green { background: var(--brand-emerald); }
.dot-red { background: var(--brand-red); }

.modal-table-wrap {
  overflow: auto;
  flex: 1;
}

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

.preview-table th {
  position: sticky;
  top: 0;
  background: #181e2e;
  color: #f1f5f9;
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.preview-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  white-space: nowrap;
}

.preview-table tr.row-active td {
  background: rgba(16, 185, 129, 0.08);
  color: #ecfdf5;
}

.preview-table tr.row-closed td,
.preview-table tr.row-negative td {
  background: rgba(227, 30, 36, 0.11);
  color: #fecaca;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 960px) {
  .login-wrapper {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tool-hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .app-view {
    padding: 12px 12px 40px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-left,
  .topbar-right {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .privacy-badge,
  .user-details {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .depot-card-actions {
    grid-template-columns: 1fr;
  }
}
