/* === Auth Gate === */
.auth-gate {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.auth-card {
  background: var(--bg-card);
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  border: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.auth-card .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--accent-primary);
}

.auth-card h2 {
  font-size: 24px;
  color: var(--text-primary);
}

.auth-card p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.auth-card input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  margin-bottom: 16px;
  outline: none;
}

.auth-card input:focus {
  border-color: var(--text-accent);
}

.auth-card button {
  width: 100%;
  padding: 12px;
}

.auth-error {
  color: #ef4444;
  margin-top: 12px;
  font-size: var(--font-size-sm);
}

/* === Admin Specifics === */
.admin-grid {
  grid-template-columns: 1fr;
}

.badge {
  background: var(--text-accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  margin-left: 8px;
}

.bl-select {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  font-size: 13px;
}

.bl-select:focus {
  border-color: var(--text-accent);
}

.bl-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg-secondary);
}

.action-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Tabs */
.admin-tab {
  display: none;
}

.admin-tab.active-tab {
  display: block !important;
}

.sidebar-nav li[data-target] {
  cursor: pointer;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-container table th,
.table-container table td {
  white-space: nowrap;
}

/* Sticky Action Column */
.table-container {
  position: relative;
}

.bl-table th:last-child,
.bl-table td:last-child {
  position: sticky;
  right: 0;
  background-color: var(--bg-card);
  z-index: 10;
}

.bl-table th:last-child {
  z-index: 11;
}

.bl-table th:last-child::before,
.bl-table td:last-child::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -5px;
  width: 5px;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.05), transparent);
  pointer-events: none;
}

/* === Sidebar & Responsive Layout === */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-header);
  color: white;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.logo-icon {
  font-size: 24px;
  color: var(--accent-primary, #10b981);
}

.logo-text h1 {
  font-size: 20px;
  margin: 0;
  color: white;
}

.logo-text .subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

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

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.2s;
}

.sidebar-nav li:hover a,
.sidebar-nav li.active a {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column !important;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .sidebar-nav ul {
    display: flex;
    flex-wrap: wrap;
  }
}