:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #0f172a;
  --card-bg: rgba(15, 23, 42, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-lg: 14px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --glow-cyan: 0 0 20px rgba(6, 182, 212, 0.3);
  --glow-emerald: 0 0 20px rgba(16, 185, 129, 0.3);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

.app-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Toast Notification Banner */
.toast-notification {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: rgba(16, 185, 129, 0.92);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), var(--glow-emerald);
  backdrop-filter: blur(12px);
  animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
}

.toast-notification.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -20px);
}

@keyframes slideDown {
  0% { transform: translate(-50%, -30px); opacity: 0; }
  100% { transform: translate(-50%, 0); opacity: 1; }
}

.toast-icon {
  font-size: 24px;
}

.toast-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.toast-message {
  font-size: 13px;
  opacity: 0.95;
}

.toast-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  margin-left: 10px;
  opacity: 0.8;
}

.toast-close:hover {
  opacity: 1;
}

/* Sidebar */
.sidebar {
  width: 340px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  padding: 22px;
  gap: 20px;
  overflow-y: auto;
}

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

.brand-icon {
  font-size: 26px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: var(--glow-cyan);
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.version-tag {
  font-size: 11px;
  color: var(--text-muted);
}

/* Progress Clock Card */
.clock-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.clock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.clock-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--accent-cyan);
}

.clock-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
}

.clock-pulse-dot.running {
  background: var(--accent-rose);
  box-shadow: 0 0 10px var(--accent-rose);
  animation: pulse 1s infinite;
}

.clock-activity-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clock-digital-display {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.clock-footer {
  font-size: 11px;
  color: var(--text-muted);
}

/* 1-Minute Refresh Countdown */
.refresh-countdown-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.refresh-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.refresh-label {
  color: var(--text-muted);
}

.refresh-seconds {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-cyan);
}

.refresh-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.refresh-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
  transition: width 1s linear;
}

.refresh-controls {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.btn-micro {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-micro:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* Pipeline Nav Items */
.pipeline-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-header {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: var(--text-subtle);
  margin-bottom: 4px;
}

.stage-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.stage-item.completed {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.2);
}

.stage-item.running {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: var(--glow-cyan);
}

.stage-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.stage-item.completed .stage-badge {
  background: var(--accent-emerald);
  color: #fff;
}

.stage-item.running .stage-badge {
  background: var(--accent-cyan);
  color: #fff;
  animation: pulse 1s infinite;
}

.stage-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.stage-title {
  font-size: 13px;
  font-weight: 600;
}

.stage-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.duration-pill {
  font-size: 10px;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-muted);
}

.duration-pill.highlight {
  background: rgba(6, 182, 212, 0.18);
  color: var(--accent-cyan);
}

.timestamp-text {
  font-size: 10px;
  color: var(--text-subtle);
  font-family: var(--font-mono);
}

/* Option 7: Download Project (Action Stage) */
.stage-item.action-stage {
  cursor: pointer;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.28);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.stage-item.action-stage::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: #6366f1;
  opacity: 0.85;
  border-radius: 2px 0 0 2px;
}

.stage-item.action-stage:hover:not(.disabled) {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.55);
  transform: translateY(-1.5px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.stage-item.action-stage:active:not(.disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.18);
}

.stage-item.action-stage .action-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.4);
  font-size: 13px;
  transition: all 0.2s ease;
}

.stage-item.action-stage:hover:not(.disabled) .action-badge {
  background: #6366f1;
  color: #ffffff;
  border-color: #818cf8;
}

.stage-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.download-action-icon {
  font-size: 11px;
  color: #a5b4fc;
  margin-left: 6px;
  transition: transform 0.2s ease;
}

.stage-item.action-stage:hover:not(.disabled) .download-action-icon {
  transform: translateY(2px);
  color: #e0e7ff;
}

.duration-pill.action-pill {
  background: rgba(99, 102, 241, 0.18);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.32);
  font-weight: 500;
}

/* Preparing / Packaging State */
.stage-item.action-stage.preparing {
  background: rgba(6, 182, 212, 0.14);
  border-color: rgba(6, 182, 212, 0.55);
  cursor: wait;
}

.stage-item.action-stage.preparing::before {
  background: #06b6d4;
}

.stage-item.action-stage.preparing .action-badge {
  background: #06b6d4;
  color: #fff;
  animation: pulse 1s infinite;
}

.stage-item.action-stage.preparing .duration-pill {
  background: rgba(6, 182, 212, 0.22);
  color: #67e8f9;
  border-color: rgba(6, 182, 212, 0.45);
}

/* Disabled / Role-Restricted State (Viewers) */
.stage-item.action-stage.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.08);
}

.stage-item.action-stage.disabled::before {
  background: rgba(255, 255, 255, 0.2);
}

.stage-item.action-stage.disabled .action-badge {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-subtle);
  border-color: rgba(255, 255, 255, 0.1);
}

.duration-pill.restricted-pill {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* System Status */
.system-status-box {
  margin-top: auto;
  padding: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
}

.status-dot.pulsing {
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.btn-notify {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 6px 10px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-notify:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-cyan);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.project-headline h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.board-dim-pill {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.header-actions {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-outline {
  background: transparent;
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
}

.btn-outline:hover {
  background: rgba(6, 182, 212, 0.1);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card.full-width {
  grid-column: 1 / -1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.badge-live {
  font-size: 11px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  padding: 2px 8px;
  border-radius: 999px;
}

.badge-history {
  font-size: 11px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
}

.badge-terminal {
  font-size: 11px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
}

/* History Table */
.history-table-container {
  max-height: 230px;
  overflow-y: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.history-table th {
  text-align: left;
  color: var(--text-subtle);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
}

.history-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.status-chip {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.status-chip.success {
  background: rgba(16, 185, 129, 0.18);
  color: var(--accent-emerald);
}

.status-chip.running {
  background: rgba(6, 182, 212, 0.18);
  color: var(--accent-cyan);
}

/* Image Preview */
.image-viewer-container {
  flex: 1;
  background: #000;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  max-height: 250px;
  overflow: hidden;
}

.image-viewer-container img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.preview-tabs {
  display: flex;
  gap: 6px;
}

.tab-btn {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: var(--accent-cyan);
}

/* Config Form */
.config-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.form-group input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text-main);
  font-size: 13px;
  font-family: var(--font-mono);
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

/* Terminal Body */
.terminal-body {
  background: #050811;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.log-line.info { color: var(--accent-cyan); }
.log-line.success { color: var(--accent-emerald); }
.log-line.error { color: var(--accent-rose); }

/* Deliverables Grid */
.deliverables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.deliverable-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  gap: 12px;
}

.deliverable-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.deliverable-item.highlight-item {
  border-color: rgba(6, 182, 212, 0.3);
  background: rgba(6, 182, 212, 0.04);
}

.file-icon {
  font-size: 24px;
}

.deliverable-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.file-name {
  font-size: 13px;
  font-weight: 600;
}

.file-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.file-action {
  font-size: 12px;
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Project Selector in Top Header */
.project-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
}

.project-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}

.project-select:hover, .project-select:focus {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
}

.project-select option {
  background: #111827;
  color: #fff;
}

/* Hierarchy Tree Explorer */
.hierarchy-card {
  margin-top: 8px;
}

.header-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hierarchy-board-title {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.badge-hierarchy {
  font-size: 11px;
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.25);
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.hierarchy-container {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  max-height: 480px;
  overflow-y: auto;
}

.tree-root {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}

.tree-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.tree-row.folder {
  color: #93c5fd;
  font-weight: 600;
}

.tree-row.file {
  color: #cbd5e1;
}

.tree-row.link {
  color: #a78bfa;
}

.tree-icon {
  font-size: 13px;
  min-width: 16px;
  text-align: center;
}

.tree-name {
  flex: 1;
}

.tree-name a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}

.tree-name a:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}

.tree-size {
  font-size: 10px;
  color: var(--text-muted);
}

.tree-link-target {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

.tree-children {
  margin-left: 18px;
  border-left: 1px dashed rgba(255, 255, 255, 0.1);
  padding-left: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ============================================================
   User Session & Authentication Styles
   ============================================================ */

.user-session-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  padding: 2px 6px;
}

.user-avatar-icon {
  font-size: 14px;
}

.username-text {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.role-badge {
  font-size: 9px;
  text-transform: uppercase;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.role-badge.role-admin {
  background: rgba(255, 0, 85, 0.15);
  color: #ff3366;
  border-color: rgba(255, 0, 85, 0.3);
}

.role-badge.role-operator {
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent-green);
  border-color: rgba(0, 255, 136, 0.3);
}

.role-badge.role-viewer {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.2);
}

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

.btn-danger {
  background: rgba(255, 51, 102, 0.15);
  border: 1px solid rgba(255, 51, 102, 0.4);
  color: #ff5577;
}

.btn-danger:hover {
  background: rgba(255, 51, 102, 0.3);
  color: #ffffff;
}

.btn-logout:hover {
  border-color: #ff3366;
  color: #ff3366;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 15, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.2s ease;
}

.modal-backdrop.hidden {
  display: none !important;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 240, 255, 0.1);
  width: 90%;
  max-width: 440px;
  padding: 28px;
  position: relative;
  animation: modalFadeIn 0.25s ease-out;
}

.modal-card-large {
  max-width: 780px;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 14px;
}

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

.modal-icon {
  font-size: 26px;
}

.modal-brand h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}

.modal-close:hover {
  color: #ffffff;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.input-field {
  background: rgba(10, 14, 25, 0.8);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-main);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.select-field {
  cursor: pointer;
}

.modal-actions {
  margin-top: 8px;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 10px;
}

.form-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 8px;
}

.form-alert.hidden {
  display: none;
}

.error-alert {
  background: rgba(255, 51, 102, 0.15);
  border: 1px solid rgba(255, 51, 102, 0.4);
  color: #ff6688;
}

.success-alert {
  background: rgba(0, 255, 136, 0.15);
  border: 1px solid rgba(0, 255, 136, 0.4);
  color: var(--accent-green);
}

.login-footer-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
}

.login-footer-hint code {
  color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 4px;
  border-radius: 3px;
}

/* User Management Grid & Table */
.user-mgmt-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
}

@media (max-width: 700px) {
  .user-mgmt-grid {
    grid-template-columns: 1fr;
  }
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title-row h4, .add-user-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 12px 0;
}

.user-count-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.user-table-wrapper {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: rgba(10, 14, 25, 0.4);
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.user-table th, .user-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-table th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.user-table td code {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.table-actions {
  display: flex;
  gap: 6px;
}

.add-user-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.add-user-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}


