/* ============================================================
   TrackBill — Admin UI Stylesheet (Tab Layout)
   ============================================================ */

/* ── Admin Shell ── */
.admin-shell {
  min-height: 100vh;
  background: #f0f4f8;
}

.admin-shell.hidden { display: none; }

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: #0f172a;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.topbar-sep {
  color: #334155;
  font-size: 18px;
}

.topbar-title {
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
}

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

.topbar-user {
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
}

.topbar-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #cbd5e1;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: auto;
  min-width: auto;
  transition: background 0.15s;
}

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

/* ── Tab Navigation ── */
.tab-nav {
  display: flex;
  gap: 0;
  background: #fff;
  border-bottom: 2px solid #e2e8f0;
  padding: 0 24px;
  position: sticky;
  top: 56px;
  z-index: 99;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  position: relative;
  background: none;
  border: none;
  border-radius: 0;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s;
  width: auto;
  min-width: auto;
}

.tab-btn:hover { color: #0f172a; }

.tab-btn.active {
  color: #2563eb;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 3px;
  background: #2563eb;
  border-radius: 3px 3px 0 0;
}

.tab-btn .tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  background: #ef4444;
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  padding: 0 5px;
}

/* ── Tab Content ── */
.tab-content-wrap {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 20px 24px 48px;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.1);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; }
.stat-icon.green  { background: #d1fae5; }
.stat-icon.purple { background: #ede9fe; }
.stat-icon.red    { background: #fee2e2; }

.stat-body {}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: #0f172a;
}

.stat-label {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
  font-weight: 500;
}

/* ── Stale Card ── */
.stale-card {
  background: #fff;
  border: 2px solid #fca5a5;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.08);
  margin-bottom: 20px;
}

.stale-card h2 { color: #991b1b; margin: 0; }
.stale-card .section-header { margin-bottom: 12px; }

/* ── Sub-tabs (within a tab) ── */
.sub-tabs {
  display: flex;
  gap: 0;
  background: #fff;
  border-radius: 12px 12px 0 0;
  border: 1px solid #e2e8f0;
  border-bottom: none;
  overflow: hidden;
  margin-bottom: 0;
}

.sub-tab {
  flex: 1;
  background: #f8fafc;
  border: none;
  border-right: 1px solid #e2e8f0;
  border-radius: 0;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  width: auto;
}

.sub-tab:last-child { border-right: none; }
.sub-tab:hover { background: #fff; color: #0f172a; }

.sub-tab.active {
  background: #fff;
  color: #2563eb;
  box-shadow: inset 0 -2px 0 #2563eb;
}

.sub-pane { display: none; }
.sub-pane.active { display: block; }

.sub-pane > .card:first-child {
  border-radius: 0 0 16px 16px;
  border-top: 1px solid #e2e8f0;
}

/* ── Result area ── */
.result-area {
  margin-top: 14px;
}

.result-area:empty { display: none; }

/* ── Field hint ── */
.field-hint {
  font-size: 13px;
  color: #2563eb;
  font-weight: 600;
  margin-top: 6px;
  min-height: 18px;
}

/* ── Log item (compact) ── */
.log-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  align-items: start;
  transition: background 0.15s;
}

.log-row:hover { background: #f8fafc; }
.log-row:last-child { border-bottom: none; }

.log-time {
  color: #94a3b8;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.log-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-detail b { font-weight: 700; }

.log-type {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.log-type.scan { background: #dbeafe; color: #1d4ed8; }
.log-type.init { background: #d1fae5; color: #166534; }
.log-type.manual { background: #fef3c7; color: #92400e; }
.log-type.delete { background: #fee2e2; color: #991b1b; }

/* ── Responsive ── */
@media (max-width: 860px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .tab-content-wrap {
    padding: 16px 12px 32px;
  }
  .topbar {
    padding: 0 14px;
  }
  .tab-nav {
    padding: 0 12px;
  }
  .tab-btn {
    padding: 12px 14px;
    font-size: 13px;
  }
  .log-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 520px) {
  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-card {
    padding: 14px;
    gap: 10px;
  }
  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  .stat-value { font-size: 22px; }
  .topbar-title { display: none; }
  .topbar-sep { display: none; }
}
