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

body {
  background: #f4f6f9;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ─── Login ────────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,.18);
}

.login-icon {
  font-size: 3.5rem;
  color: #7c3aed;
  margin-bottom: 1rem;
  line-height: 1;
}

.login-card h1 {
  font-size: 2rem;
  font-weight: 800;
  color: #1e1b4b;
  margin-bottom: .4rem;
}

.login-card .subtitle {
  color: #6b7280;
  font-size: .95rem;
  margin-bottom: 1.8rem;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #374151;
  border: 2px solid #d1d5db;
  padding: 12px 28px;
  border-radius: 10px;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
  justify-content: center;
}

.btn-google:hover {
  border-color: #4285F4;
  box-shadow: 0 2px 12px rgba(66,133,244,.25);
  color: #374151;
}

.google-svg { width: 20px; height: 20px; flex-shrink: 0; }

.login-note {
  margin-top: 1.4rem;
  font-size: .78rem;
  color: #9ca3af;
}

/* ─── Navbar ───────────────────────────────────────────────────── */
.app-nav {
  background: #1e1b4b;
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.app-nav .brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: #e0e7ff;
  letter-spacing: .5px;
}

.app-nav .brand i { color: #818cf8; }

.nav-user {
  font-size: .85rem;
  color: #c7d2fe;
}

.btn-logout {
  font-size: .8rem;
  padding: 5px 14px;
  border-radius: 8px;
  border: 1px solid #4f46e5;
  color: #c7d2fe;
  background: transparent;
  text-decoration: none;
  transition: background .2s;
}

.btn-logout:hover { background: #4f46e5; color: #fff; }

/* ─── Tabs ─────────────────────────────────────────────────────── */
.main-tabs {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 1.5rem;
}

.main-tabs .nav-link {
  color: #6b7280;
  font-weight: 500;
  border: none;
  padding: .9rem 1.2rem;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  transition: color .15s, border-color .15s;
}

.main-tabs .nav-link.active {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
  background: transparent;
}

.main-tabs .nav-link:hover:not(.active) { color: #374151; }

/* ─── Box container ────────────────────────────────────────────── */
.box-wrap { padding: 1.5rem; max-width: 1100px; margin: 0 auto; }

/* ─── Toolbar ──────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.toolbar-left { display: flex; align-items: center; gap: .6rem; flex: 1; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: .6rem; }

.toolbar .subtitle-text {
  font-size: .85rem;
  color: #6b7280;
}

/* ─── Search filter ────────────────────────────────────────────── */
.filter-input {
  max-width: 280px;
  font-size: .85rem;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  padding: 5px 12px;
}

.filter-input:focus { outline: none; border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,.1); }

/* ─── Progress ─────────────────────────────────────────────────── */
.scan-progress-wrap {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.2rem;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  color: #6b7280;
  margin-bottom: .5rem;
}

.progress { height: 6px; border-radius: 3px; background: #e5e7eb; }

.progress-bar {
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  border-radius: 3px;
  transition: width .3s ease;
}

/* ─── Actions bar ──────────────────────────────────────────────── */
.actions-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .6rem .8rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: .8rem;
  font-size: .85rem;
}

.selection-info { color: #6b7280; flex: 1; }

/* ─── Table ────────────────────────────────────────────────────── */
.table-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

.table {
  margin-bottom: 0;
  font-size: .875rem;
}

.table thead th {
  background: #f8fafc;
  color: #374151;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: .7rem 1rem;
  border-bottom: 2px solid #e5e7eb;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.table thead th:hover { background: #f1f5f9; }
.table thead th.sort-asc::after  { content: " ↑"; opacity: .6; }
.table thead th.sort-desc::after { content: " ↓"; opacity: .6; }

.table tbody tr { cursor: pointer; transition: background .1s; }
.table tbody tr:hover { background: #f5f3ff; }
.table tbody tr.selected { background: #ede9fe; }

.table td {
  padding: .55rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f3f4f6;
}

.table td.key-cell {
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-count {
  background: #ede9fe;
  color: #5b21b6;
  font-size: .75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.size-text { color: #6b7280; font-size: .82rem; }

/* ─── Empty state ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: #9ca3af;
}

.empty-state i { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p  { font-size: .9rem; }

/* ─── Toast container ──────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.toast-item {
  min-width: 280px;
  padding: .85rem 1.2rem;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .6rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  animation: slide-in .2s ease;
}

@keyframes slide-in {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.toast-success { background: #dcfce7; color: #166534; }
.toast-danger  { background: #fee2e2; color: #991b1b; }
.toast-info    { background: #dbeafe; color: #1e40af; }

/* ─── Buttons ──────────────────────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 500; font-size: .875rem; }

.btn-primary  { background: #4f46e5; border-color: #4f46e5; }
.btn-primary:hover { background: #4338ca; border-color: #4338ca; }

.btn-danger   { background: #dc2626; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* ─── Modal ────────────────────────────────────────────────────── */
.modal-header { border-bottom: 1px solid #fee2e2; }

/* ─── Responsive ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .box-wrap { padding: .8rem; }
  .table td.size-cell { display: none; }
}
