/* ═══════════════════════════════════════════════════════════
   TRAKR — HD Liquid Glass Morphism Design System
   ═══════════════════════════════════════════════════════════ */

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

/* ── Custom properties ─────────────────────────────────────── */
:root {
  --bg-base:       #04040f;
  --bg-deep:       #060614;
  --surface:       rgba(255,255,255,0.045);
  --surface-hover: rgba(255,255,255,0.075);
  --surface-active:rgba(255,255,255,0.10);
  --border:        rgba(255,255,255,0.08);
  --border-light:  rgba(255,255,255,0.14);
  --border-glow:   rgba(99,179,255,0.35);

  --primary:       #3b82f6;
  --primary-glow:  rgba(59,130,246,0.4);
  --secondary:     #8b5cf6;
  --secondary-glow:rgba(139,92,246,0.4);
  --accent:        #06b6d4;
  --accent-glow:   rgba(6,182,212,0.4);
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #38bdf8;

  --text-primary:  #f0f4ff;
  --text-secondary:rgba(240,244,255,0.55);
  --text-muted:    rgba(240,244,255,0.35);

  --sidebar-w: 260px;
  --topbar-h:  64px;
  --radius:    14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --blur:      24px;
  --blur-heavy:40px;

  --transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Animated background ────────────────────────────────────── */
.bg-scene {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 15% 40%, rgba(99,102,241,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 85% 15%, rgba(14,165,233,0.10) 0%, transparent 55%),
    radial-gradient(ellipse 50% 60% at 50% 90%, rgba(139,92,246,0.09) 0%, transparent 60%),
    linear-gradient(170deg, #04040f 0%, #060614 40%, #050510 100%);
}

.bg-scene::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle 1px at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 1px),
    radial-gradient(circle 1px at 60% 70%, rgba(255,255,255,0.08) 0%, transparent 1px),
    radial-gradient(circle 1px at 80% 20%, rgba(255,255,255,0.10) 0%, transparent 1px);
  background-size: 80px 80px, 60px 60px, 100px 100px;
  opacity: 0.5;
}

/* ── Layout shell ───────────────────────────────────────────── */
.app-shell {
  position: relative; z-index: 1;
  display: flex; min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex; flex-direction: column;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.06) 0%,
    rgba(255,255,255,0.03) 100%
  );
  backdrop-filter: blur(var(--blur-heavy)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur-heavy)) saturate(160%);
  border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; overflow-x: hidden;
}

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

.brand-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 15px; color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
  flex-shrink: 0;
}

.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 18px; letter-spacing: 0.04em;
  background: linear-gradient(90deg, var(--text-primary) 0%, var(--accent) 100%);
  background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

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

.nav-section {
  font-size: 10px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none; font-weight: 500;
  transition: var(--transition); position: relative;
  margin-bottom: 2px;
}

.nav-item i { font-size: 15px; width: 18px; text-align: center; }

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(59,130,246,0.18) 0%, rgba(59,130,246,0.05) 100%);
  color: var(--primary);
  border-left: 2px solid var(--primary);
  padding-left: 12px;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 20px; min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface);
}

.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-email { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 10px; color: var(--text-muted); text-transform: capitalize; }

/* ── Main content ───────────────────────────────────────────── */
.main-content {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  /* Prevent content from overflowing on mobile */
  overflow-x: hidden;
}

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center;
  padding: 0 32px; gap: 16px;
  background: rgba(4,4,15,0.6);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}

.topbar-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 17px; color: var(--text-primary);
}

.topbar-breadcrumb { color: var(--text-muted); font-size: 13px; }
.topbar-breadcrumb a { color: var(--primary); text-decoration: none; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

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

/* ── Glass cards ────────────────────────────────────────────── */
.glass {
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.07) 0%,
    rgba(255,255,255,0.025) 100%
  );
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset 0 -1px 0 rgba(0,0,0,0.2);
}

.glass-sm {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.card {
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.065) 0%,
    rgba(255,255,255,0.022) 100%
  );
  backdrop-filter: blur(var(--blur)) saturate(170%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.1);
  overflow: hidden;
}

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

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px; font-weight: 600; color: var(--text-primary);
}

.card-body { padding: 20px 22px; }

/* ── Stat cards ─────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 28px;
}

.stat-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.025) 100%);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transition: var(--transition);
}

.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--c1, var(--primary)) 0%, var(--c2, var(--secondary)) 100%);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.4); }

.stat-card.blue  { --c1: #3b82f6; --c2: #06b6d4; }
.stat-card.purple{ --c1: #8b5cf6; --c2: #ec4899; }
.stat-card.green { --c1: #10b981; --c2: #3b82f6; }
.stat-card.amber { --c1: #f59e0b; --c2: #ef4444; }

.stat-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 32px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-icon  { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 32px; opacity: 0.12; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; letter-spacing: 0.01em;
  border: none; cursor: pointer; text-decoration: none;
  transition: var(--transition); white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover {
  box-shadow: 0 6px 24px var(--primary-glow);
  filter: brightness(1.1);
  transform: translateY(-1px);
  color: #fff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-light); }

.btn-danger  { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover  { background: rgba(239,68,68,0.25); }

.btn-success { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.btn-success:hover { background: rgba(16,185,129,0.25); }

.btn-warning { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 26px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; transform: none; }

.btn-icon {
  padding: 8px; width: 34px; height: 34px; justify-content: center;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

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

.form-control {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px; font-family: inherit;
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

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

.form-control:focus {
  border-color: var(--primary);
  background: rgba(59,130,246,0.06);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

textarea.form-control { resize: vertical; min-height: 90px; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px; cursor: pointer;
}

select.form-control option { background: #0d0d20; color: var(--text-primary); }

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

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 11px 14px;
  text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.03); }

td { padding: 12px 14px; color: var(--text-primary); vertical-align: middle; }

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

/* ── Status badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.badge-invited  { background: rgba(59,130,246,0.12); color: var(--info); }
.badge-active   { background: rgba(16,185,129,0.12); color: var(--success); }
.badge-hired    { background: rgba(139,92,246,0.12); color: var(--secondary); }
.badge-rejected { background: rgba(239,68,68,0.12);  color: var(--danger); }
.badge-pending  { background: rgba(245,158,11,0.12); color: var(--warning); }
.badge-signed   { background: rgba(16,185,129,0.12); color: var(--success); }
.badge-emailed  { background: rgba(6,182,212,0.12);  color: var(--accent); }
.badge-archived { background: rgba(148,163,184,0.12); color: #94a3b8; }
.badge-scheduled{ background: rgba(59,130,246,0.12); color: var(--primary); }
.badge-completed{ background: rgba(16,185,129,0.12); color: var(--success); }
.badge-cancelled{ background: rgba(239,68,68,0.12);  color: var(--danger); }

/* ── Progress bar ───────────────────────────────────────────── */
.progress-wrap { margin-bottom: 6px; }
.progress-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-secondary); margin-bottom: 8px;
}
.progress-track {
  height: 6px; border-radius: 10px;
  background: rgba(255,255,255,0.08);
  overflow: hidden; position: relative;
}
.progress-fill {
  height: 100%; border-radius: 10px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: 0 0 12px var(--primary-glow);
  transition: width 0.6s ease;
}

/* Stage timeline */
.stage-timeline { display: flex; flex-direction: column; gap: 4px; }
.stage-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  transition: var(--transition);
}
.stage-item:hover { background: var(--surface); }
.stage-dot {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--border);
  font-size: 10px;
}
.stage-dot.done  { background: var(--success); border-color: var(--success); color: #fff; }
.stage-dot.active{ background: var(--primary); border-color: var(--primary); color: #fff; animation: pulse-dot 2s infinite; }
.stage-dot.pending{ background: transparent; }

@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.5); }
  50%     { box-shadow: 0 0 0 6px rgba(59,130,246,0); }
}

.stage-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.stage-name.done { color: var(--text-secondary); text-decoration: line-through; opacity: 0.7; }

/* Document checklist */
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.doc-item:hover { background: var(--surface-hover); }
.doc-check {
  width: 20px; height: 20px; border-radius: 5px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--border);
}
.doc-check.uploaded { background: var(--success); border-color: var(--success); color: #fff; }
.doc-check.pending  { background: rgba(245,158,11,0.1); border-color: var(--warning); }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.doc-desc { font-size: 11px; color: var(--text-muted); }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  background: linear-gradient(135deg, rgba(20,20,40,0.95) 0%, rgba(10,10,25,0.98) 100%);
  backdrop-filter: blur(40px) saturate(160%);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.12);
}

.modal-header {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: 'Space Grotesk', sans-serif; font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; padding: 4px; transition: var(--transition); }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 22px 26px; }
.modal-footer { padding: 16px 26px 22px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--border); }

/* ── Chat UI ────────────────────────────────────────────────── */
.chat-container {
  display: flex; flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 56px);
  min-height: 400px;
}

.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.msg-row {
  display: flex; gap: 10px; max-width: 75%; align-items: flex-end;
}
.msg-row.from-me { margin-left: auto; flex-direction: row-reverse; }

.msg-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}

.msg-bubble {
  padding: 10px 14px; border-radius: 16px;
  font-size: 13px; line-height: 1.5;
  position: relative;
}
.msg-row:not(.from-me) .msg-bubble {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-row.from-me .msg-bubble {
  background: linear-gradient(135deg, rgba(59,130,246,0.3) 0%, rgba(139,92,246,0.3) 100%);
  border: 1px solid rgba(99,130,246,0.3);
  border-bottom-right-radius: 4px;
}
.msg-time {
  font-size: 10px; color: var(--text-muted); margin-top: 4px; text-align: right;
}

.chat-input-bar {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-end;
}
.chat-input-bar textarea {
  flex: 1; min-height: 40px; max-height: 120px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary); font-size: 13px;
  padding: 10px 14px; font-family: inherit;
  resize: none; outline: none; transition: var(--transition);
}
.chat-input-bar textarea:focus { border-color: var(--primary); background: rgba(59,130,246,0.06); }
.chat-input-bar textarea::placeholder { color: var(--text-muted); }

/* ── Alerts / flashes ───────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
  transition: opacity 0.5s ease, transform 0.5s ease, margin 0.4s ease, padding 0.4s ease;
}
.alert.dismissing {
  opacity: 0;
  transform: translateY(-6px);
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.alert-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.25); color: var(--success); }
.alert-error   { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.25);  color: var(--danger); }
.alert-info    { background: rgba(56,189,248,0.12); border: 1px solid rgba(56,189,248,0.25); color: var(--info); }
.alert-warning { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.25); color: var(--warning); }

/* ── Upload zone ────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center; cursor: pointer;
  transition: var(--transition);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(59,130,246,0.05);
}
.upload-zone i  { font-size: 36px; color: var(--text-muted); margin-bottom: 12px; }
.upload-zone p  { color: var(--text-secondary); font-size: 13px; }
.upload-zone strong { color: var(--primary); }

/* ── PDF viewer ─────────────────────────────────────────────── */
.pdf-viewer-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
}
#pdf-canvas { width: 100%; display: block; }

/* ── Signature pad ──────────────────────────────────────────── */
.sig-pad-wrap {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden; position: relative;
  background: rgba(255,255,255,0.02);
}
#sig-canvas { display: block; width: 100%; cursor: crosshair; touch-action: none; }
.sig-pad-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; color: var(--text-muted); font-size: 13px;
  transition: opacity 0.3s;
}

/* ── Login page — Ultra HD Liquid Glass ─────────────────────── */
.login-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Animated ambient orb — upper-left blue */
.login-shell::before {
  content: '';
  position: fixed;
  width: 700px; height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(59,130,246,0.17) 0%, transparent 70%);
  top: -280px; left: -220px;
  animation: login-orb-a 14s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

/* Animated ambient orb — lower-right purple */
.login-shell::after {
  content: '';
  position: fixed;
  width: 620px; height: 620px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(139,92,246,0.14) 0%, transparent 70%);
  bottom: -220px; right: -180px;
  animation: login-orb-b 16s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes login-orb-a {
  from { transform: translate(0,  0) scale(1.00); }
  to   { transform: translate(70px, 50px) scale(1.12); }
}
@keyframes login-orb-b {
  from { transform: translate(0,  0) scale(1.00); }
  to   { transform: translate(-55px, -65px) scale(1.10); }
}

.login-card {
  width: 100%; max-width: 440px;
  position: relative; z-index: 1;

  /* Inner ambient light bloom baked into the base background */
  background:
    radial-gradient(ellipse 85% 52% at 50% 0%, rgba(120,155,255,0.10) 0%, rgba(175,130,255,0.03) 52%, transparent 100%),
    linear-gradient(155deg, rgba(255,255,255,0.11) 0%, rgba(255,255,255,0.033) 48%, rgba(255,255,255,0.077) 100%);

  backdrop-filter: blur(64px) saturate(230%) brightness(1.06);
  -webkit-backdrop-filter: blur(64px) saturate(230%) brightness(1.06);

  /* Asymmetric borders — bright top-left edge, dim bottom-right */
  border-top:    1px solid rgba(255,255,255,0.26);
  border-left:   1px solid rgba(255,255,255,0.16);
  border-right:  1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  border-radius: 28px;

  /* Deep layered shadows + colored ambient glow */
  box-shadow:
    0 64px 128px rgba(0,0,0,0.68),
    0 32px 64px  rgba(0,0,0,0.42),
    0 0 0 0.5px  rgba(255,255,255,0.09),
    0 0 140px    rgba(59,130,246,0.12),
    0 0 220px    rgba(139,92,246,0.08),
    inset 0 2px 0  rgba(255,255,255,0.24),
    inset 0 -1px 0 rgba(0,0,0,0.32),
    inset 1px 0 0  rgba(255,255,255,0.11),
    inset -1px 0 0 rgba(0,0,0,0.14);

  padding: 48px 42px;
  overflow: hidden;
}

/* Prismatic shimmer line at the very top edge */
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 3%,
    rgba(99,179,255,0.88) 22%,
    rgba(255,255,255,1.00) 50%,
    rgba(167,139,250,0.88) 78%,
    transparent 97%
  );
  pointer-events: none;
  z-index: 5;
}

.login-logo {
  text-align: center; margin-bottom: 36px;
  position: relative; z-index: 1;
}

.login-logo-mark {
  width: 68px; height: 68px; border-radius: 20px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800; font-size: 26px; color: #fff;
  animation: logo-glow-pulse 3s ease-in-out infinite;
}

@keyframes logo-glow-pulse {
  0%, 100% {
    box-shadow:
      0 12px 40px rgba(59,130,246,0.55),
      0 0 0 0px  rgba(99,102,241,0.25),
      inset 0 1px 0 rgba(255,255,255,0.30);
  }
  50% {
    box-shadow:
      0 18px 52px rgba(59,130,246,0.72),
      0 0 0 10px rgba(99,102,241,0.09),
      inset 0 1px 0 rgba(255,255,255,0.40);
  }
}

.login-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 6px; letter-spacing: -0.01em;
  position: relative; z-index: 1;
}

.login-sub {
  font-size: 13.5px; color: var(--text-muted); line-height: 1.55;
  position: relative; z-index: 1;
}

/* Brand heading — gradient text for T.R.A.K.R title */
.login-heading.login-title-brand {
  background: linear-gradient(90deg, #e8eeff 0%, #38bdf8 58%, #06b6d4 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.14em;
  font-size: 28px;
}

/* Form elements sit above the inner-glow background layer */
.login-card .form-group { position: relative; z-index: 1; }
.login-card .form-label  { position: relative; z-index: 1; }
.login-card .alert       { position: relative; z-index: 1; }

.login-card .form-control {
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 2px 8px rgba(0,0,0,0.22);
  transition: var(--transition);
  position: relative; z-index: 1;
}

.login-card .form-control:focus {
  border-color: rgba(99,130,246,0.65);
  background: rgba(59,130,246,0.09);
  box-shadow:
    0 0 0 3px rgba(59,130,246,0.18),
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 2px 16px rgba(59,130,246,0.15);
}

/* Sign In / Activate button — vivid gradient with shimmer sweep */
.login-card .btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 50%, #8b5cf6 100%);
  box-shadow:
    0 8px 28px rgba(99,102,241,0.55),
    0 0 60px  rgba(59,130,246,0.18),
    inset 0 1px 0 rgba(255,255,255,0.26);
  border-radius: 12px;
  font-size: 15px;
  letter-spacing: 0.02em;
  padding: 14px 28px;
  position: relative; z-index: 1;
  overflow: hidden;
}

/* Shimmer sweep on hover */
.login-card .btn-primary::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: -120%;
  width: 60%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
  transform: skewX(-20deg);
  transition: left 0.55s ease;
  pointer-events: none;
}
.login-card .btn-primary:hover::after { left: 170%; }
.login-card .btn-primary:hover {
  box-shadow:
    0 14px 42px rgba(99,102,241,0.68),
    0 0 80px  rgba(59,130,246,0.24),
    inset 0 1px 0 rgba(255,255,255,0.32);
  transform: translateY(-2px);
  filter: brightness(1.08);
}

/* ── Invite URL ─────────────────────────────────────────────── */
.invite-url-box {
  display: flex; gap: 8px; align-items: center;
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.invite-url-box input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 12px; color: var(--text-secondary); font-family: monospace;
}

/* ── Misc helpers ───────────────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.mt-1   { margin-top: 4px; }
.mt-2   { margin-top: 8px; }
.mt-3   { margin-top: 12px; }
.mt-4   { margin-top: 16px; }
.mb-4   { margin-bottom: 16px; }
.mb-6   { margin-bottom: 24px; }
.text-sm{ font-size: 12px; }
.text-xs{ font-size: 11px; }
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-primary-c{ color: var(--primary); }
.font-heading  { font-family: 'Space Grotesk', sans-serif; }
.font-bold     { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full        { width: 100%; }
.hidden        { display: none !important; }

.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 4px;
}
.section-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; }

.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* Scrollbar global */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Ultra HD Liquid Glass Morphism (chat card) ─────────────── */
.card.ultra-glass {
  background: linear-gradient(
    155deg,
    rgba(255,255,255,0.10) 0%,
    rgba(255,255,255,0.030) 45%,
    rgba(255,255,255,0.072) 100%
  );
  backdrop-filter: blur(64px) saturate(220%) brightness(1.07);
  -webkit-backdrop-filter: blur(64px) saturate(220%) brightness(1.07);
  border-top: 1px solid rgba(255,255,255,0.22);
  border-left: 1px solid rgba(255,255,255,0.14);
  border-right: 1px solid rgba(255,255,255,0.07);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  border-radius: 22px;
  box-shadow:
    0 52px 100px rgba(0,0,0,0.58),
    0 24px 50px rgba(0,0,0,0.32),
    0 0 0 0.5px rgba(255,255,255,0.07),
    0 0 140px rgba(59,130,246,0.07),
    inset 0 2px 0 rgba(255,255,255,0.20),
    inset 0 -1px 0 rgba(0,0,0,0.28),
    inset 1px 0 0 rgba(255,255,255,0.09),
    inset -1px 0 0 rgba(0,0,0,0.12);
  position: relative;
}

/* Prismatic shimmer line at top edge */
.card.ultra-glass::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 4%,
    rgba(99,179,255,0.80) 22%,
    rgba(255,255,255,0.98) 50%,
    rgba(167,139,250,0.80) 78%,
    transparent 96%
  );
  pointer-events: none;
  z-index: 5;
}

/* Ambient inner light bloom from top */
.card.ultra-glass::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 52%;
  background: radial-gradient(
    ellipse 80% 48% at 50% 0%,
    rgba(120,160,255,0.075) 0%,
    rgba(180,130,255,0.025) 55%,
    transparent 100%
  );
  pointer-events: none;
  border-radius: 22px 22px 0 0;
}

/* Card-header inside ultra glass */
.card.ultra-glass .card-header {
  background: rgba(255,255,255,0.022);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: relative; z-index: 1;
}

/* Message bubbles — received */
.card.ultra-glass .msg-row:not(.from-me) .msg-bubble {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.11);
  box-shadow:
    0 2px 14px rgba(0,0,0,0.28),
    inset 0 1px 0 rgba(255,255,255,0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* Message bubbles — sent (from-me) */
.card.ultra-glass .msg-row.from-me .msg-bubble {
  background: linear-gradient(
    140deg,
    rgba(59,130,246,0.30) 0%,
    rgba(99,102,241,0.22) 50%,
    rgba(139,92,246,0.28) 100%
  );
  border: 1px solid rgba(99,130,246,0.30);
  box-shadow:
    0 2px 14px rgba(59,130,246,0.22),
    0 0 24px rgba(59,130,246,0.10),
    inset 0 1.5px 0 rgba(255,255,255,0.20),
    inset 0 -1px 0 rgba(0,0,0,0.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* Input bar */
.card.ultra-glass .chat-input-bar {
  background: rgba(0,0,0,0.20);
  border-top: 1px solid rgba(255,255,255,0.08);
  position: relative; z-index: 1;
}

.card.ultra-glass .chat-input-bar textarea {
  background: rgba(255,255,255,0.052);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.card.ultra-glass .chat-input-bar textarea:focus {
  border-color: rgba(99,130,246,0.55);
  background: rgba(59,130,246,0.08);
  box-shadow:
    0 0 0 3px rgba(59,130,246,0.14),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

/* Ended/archived footer inside ultra glass */
.card.ultra-glass .chat-ended-footer {
  background: rgba(0,0,0,0.16);
  border-top: 1px solid rgba(255,255,255,0.07);
  position: relative; z-index: 1;
}

/* ── Two-column layout utility (replaces inline grids) ──────── */
.two-col-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

/* ── Responsive ─────────────────────────────────────────────── */

/* 1100 px — large tablet / small laptop */
@media (max-width: 1100px) {
  .two-col-layout { grid-template-columns: 1fr 280px; }
  .stat-value { font-size: 28px; }
  .page-body { padding: 24px 24px; }
}

/* 900 px — sidebar becomes drawer */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: -100%; z-index: 100;
    transition: left 0.28s ease;
    box-shadow: 4px 0 40px rgba(0,0,0,0.5);
  }
  .sidebar.open { left: 0; }
  /* Dim overlay when sidebar is open */
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 99;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
  }
  .sidebar-backdrop.show { display: block; }

  .page-body { padding: 20px 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* 768 px — phone landscape / small tablet */
@media (max-width: 768px) {
  /* Auth pages */
  .login-shell { padding: 16px; align-items: flex-start; padding-top: 40px; }
  .login-card  { padding: 34px 26px; border-radius: 22px; }
  .login-heading { font-size: 20px; }
  .login-logo-mark { width: 56px; height: 56px; font-size: 21px; border-radius: 17px; }
  .login-card .form-control { padding: 11px 14px; font-size: 14px; }
  :root { --topbar-h: auto; }

  /* Topbar */
  .topbar {
    height: auto;
    min-height: 56px;
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .topbar > div:not(.topbar-actions) { flex: 1; min-width: 0; }
  .topbar-title { font-size: 15px; }
  .topbar-breadcrumb { display: none; }
  .topbar-actions {
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 4px;
  }
  .topbar-actions .btn { font-size: 12px; padding: 6px 11px; }
  .topbar-actions .btn-sm { font-size: 11px; padding: 5px 9px; }

  /* Two-column → single column */
  .two-col-layout { grid-template-columns: 1fr; }

  /* Page body */
  .page-body { padding: 14px 12px; }

  /* Stat grid: 2×2 */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }
  .stat-value { font-size: 26px; }
  .stat-card  { padding: 16px 18px; }

  /* Modals: near-full-screen */
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .modal {
    max-width: 100%;
    border-radius: 20px 20px 14px 14px;
    max-height: 92vh;
  }
  .modal-header  { padding: 16px 18px 14px; }
  .modal-body    { padding: 14px 18px; }
  .modal-footer  { padding: 12px 18px 16px; gap: 8px; flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; justify-content: center; }

  /* Chat */
  .chat-container {
    height: calc(100dvh - 160px);
    min-height: 320px;
  }
  .msg-row { max-width: 88%; }

  /* Invite URL box */
  .invite-url-box { flex-wrap: wrap; }
  .invite-url-box input { min-width: 0; flex-basis: 100%; }

  /* Doc items */
  .doc-item { flex-wrap: wrap; }
  .doc-item > .doc-info { flex: 1 1 60%; min-width: 0; }

  /* Filter bar on candidates page */
  .filter-bar { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; }
  .filter-search-form { width: 100%; }
  .filter-search-form input[name="q"] { max-width: none !important; flex: 1; min-width: 0; }
  .filter-search-form .btn { flex-shrink: 0; }

  /* Card headers */
  .card-header { padding: 14px 16px 12px; flex-wrap: wrap; gap: 8px; }
  .card-body   { padding: 14px 16px; }
}

/* 480 px — phone portrait */
@media (max-width: 480px) {
  .pct-display { font-size: 26px !important; }
  /* Stat grid stays 2×2 but tighter */
  .stat-card  { padding: 12px 14px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 10px; }
  .stat-icon  { font-size: 24px; right: 12px; }

  /* Chat messages nearly full width */
  .msg-row { max-width: 92%; }

  /* Page: tighter still */
  .page-body { padding: 10px; }

  /* Tables: horizontal scroll with gradient hint */
  .table-wrap {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap::after {
    content: '';
    position: absolute; top: 0; right: 0; bottom: 0; width: 24px;
    background: linear-gradient(to right, transparent, rgba(4,4,15,0.8));
    pointer-events: none; border-radius: 0 var(--radius) var(--radius) 0;
  }
  table { min-width: 480px; }

  /* Filter pills: wrap tightly */
  .filter-pills { gap: 4px !important; }
  .filter-pills a { padding: 5px 10px !important; font-size: 12px !important; }

  /* Modal: full-width slide-up */
  .modal-overlay { padding: 0 0 0; align-items: flex-end; }
  .modal { border-radius: 20px 20px 0 0; max-height: 95vh; }

  /* Buttons */
  .btn-lg { padding: 10px 20px; font-size: 14px; }
}
