:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  --bg-dark: #090d16;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(23, 32, 54, 0.85);
  --bg-input: rgba(15, 23, 42, 0.65);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-highlight: rgba(99, 102, 241, 0.4);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.35);
  
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.2);
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(30, 41, 59, 0.5) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(59, 130, 246, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

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

.logo-badge {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
}

h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

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

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

/* Premium Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  user-select: none;
  outline: none;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn:active {
  transform: scale(0.97);
}

.btn .icon {
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #60a5fa 0%, #1d4ed8 100%);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-primary:focus-visible {
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-secondary:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-close:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
  transform: rotate(90deg);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--border-highlight), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-md);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  margin: 6px 0 2px 0;
  letter-spacing: -0.02em;
}

.stat-desc {
  font-size: 12px;
  color: var(--text-dim);
}

/* Toolbar Panel */
.toolbar-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 11px 16px 11px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.search-box input:focus {
  border-color: var(--accent);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Panel Card */
.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.mt-6 {
  margin-top: 24px;
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
}

.badge-info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #60a5fa;
}

.badge-success {
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.badge-warning {
  background: var(--warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.badge-danger {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.badge-rad {
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  font-weight: 600;
}

.badge-3dtiles {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-weight: 600;
}

.tag {
  display: inline-block;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  margin-right: 6px;
  margin-top: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #ffffff;
  transform: translateY(-1px);
}

.group-header td {
  background-color: rgba(30, 41, 59, 0.7);
  border-bottom: 2px solid rgba(99, 102, 241, 0.3);
  padding: 12px 16px;
  font-weight: 600;
  color: #e2e8f0;
}

.group-header:hover {
  background-color: rgba(30, 41, 59, 0.8) !important;
}

/* Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

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

th {
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid var(--border-color);
}

.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.sortable-th:hover {
  color: var(--primary);
}

.sort-icon {
  font-size: 11px;
  margin-left: 4px;
  color: var(--text-dim);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background-color: var(--bg-card-hover);
}

.scene-title {
  font-weight: 600;
  color: #ffffff;
  font-size: 14px;
}

.scene-id-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.url-link {
  display: inline-block;
  max-width: 440px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #60a5fa;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 12px;
  transition: color 0.15s ease;
}

.url-link:hover {
  text-decoration: underline;
  color: #93c5fd;
}

.asset-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.actions-cell {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Alert Message */
.alert-message {
  min-height: 0;
  margin-bottom: 16px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: 13px;
  transition: all 0.3s;
}

.alert-message:not(:empty) {
  padding: 12px 16px;
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* Build Tabs */
.tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: transparent;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* Builds Grid */
.builds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.build-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.build-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

.build-card-title-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.build-scene-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.build-revision {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.build-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.build-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.build-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.build-message {
  color: #bfdbfe;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.build-percent {
  color: var(--text-main);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  box-shadow: 0 0 12px var(--primary-glow);
}

.progress-bar-fill.success {
  background: var(--success);
}
.progress-bar-fill.failed {
  background: var(--danger);
}

.build-timing {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-top: 4px;
}

.build-timing-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.build-timing-label {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.build-timing-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.build-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.build-message {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.build-percent {
  flex: 0 0 auto;
  color: #bfdbfe;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Dialog Modals */
.modal-dialog {
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #0d1322;
  color: var(--text-main);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  width: min(640px, 94vw);
  margin: auto;
  overflow: hidden;
}

.modal-dialog::backdrop {
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(8px);
}

#createDialog {
  max-height: 94vh;
}

#createDialog form {
  display: flex;
  max-height: 94vh;
  flex-direction: column;
}

#createDialog .modal-header,
#createDialog .modal-footer {
  flex: none;
}

#createDialog .modal-body {
  min-height: 0;
  overflow-y: auto;
}

.delete-progress-dialog {
  width: min(520px, 92vw);
}

.delete-progress-summary {
  display: flex;
  align-items: center;
  gap: 14px;
}

.delete-progress-summary strong {
  display: block;
  color: var(--text-main);
  font-size: 14px;
}

.delete-progress-summary p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.delete-progress-spinner {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 3px solid rgba(245, 158, 11, 0.18);
  border-top-color: #fbbf24;
  border-radius: 50%;
  animation: delete-spin 0.8s linear infinite;
}

.delete-progress-spinner.success {
  border: 0;
  animation: none;
  background: var(--success-bg);
}

.delete-progress-spinner.success::after,
.delete-progress-spinner.failed::after {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
}

.delete-progress-spinner.success::after {
  content: "✓";
  color: #34d399;
}

.delete-progress-spinner.failed {
  border: 0;
  animation: none;
  background: var(--danger-bg);
}

.delete-progress-spinner.failed::after {
  content: "!";
  color: #f87171;
}

.delete-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
}

.delete-progress-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f59e0b, #fb7185);
  transition: width 0.25s ease;
}

.delete-progress-fill.indeterminate {
  width: 42%;
  animation: delete-progress-slide 1.25s ease-in-out infinite;
}

.delete-progress-fill.success {
  width: 100%;
  background: var(--success);
}

.delete-progress-fill.failed {
  width: 100%;
  background: var(--danger);
}

.delete-progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 11px;
}

.delete-progress-meta strong {
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.delete-progress-warning {
  border-left-color: var(--warning);
}

@keyframes delete-spin {
  to { transform: rotate(360deg); }
}

@keyframes delete-progress-slide {
  0% { transform: translateX(-110%); }
  50% { transform: translateX(85%); }
  100% { transform: translateX(240%); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.6);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.4);
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.category-picker {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 8px;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.category-chip {
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.category-chip:hover,
.category-chip.is-active {
  border-color: rgba(59, 130, 246, 0.55);
  color: #dbeafe;
  background: rgba(37, 99, 235, 0.18);
}

.login-body {
  min-height: 100vh;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.login-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.login-kicker {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #38bdf8;
  font-weight: 700;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-submit {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.login-error {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: #fecaca;
  font-size: 12px;
}

.field-hint {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.45;
}

#tilesConfigPanel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.source-file-picker {
  position: relative;
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.7);
}

.source-file-input {
  position: absolute;
  width: 1px !important;
  height: 1px;
  padding: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.source-file-button {
  flex: none;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(30, 41, 59, 0.9);
  color: var(--text-main) !important;
  cursor: pointer;
  font-size: 12px !important;
  font-weight: 600;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.source-file-button:hover {
  border-color: rgba(56, 189, 248, 0.5);
  color: #ffffff !important;
}

.source-file-summary {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-file-clear {
  flex: none;
  border: 0;
  background: transparent;
  color: #93c5fd;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.source-file-picker.is-disabled {
  opacity: 0.62;
}

.source-file-picker.is-disabled .source-file-button,
.source-file-picker.is-disabled .source-file-clear {
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 640px) {
  .category-picker {
    grid-template-columns: 1fr;
  }
}

.upload-source-group {
  gap: 8px;
}

.upload-selection-hint {
  color: var(--text-dim);
  font-size: 12px;
}

.upload-queue {
  padding: 14px;
  border: 1px solid rgba(59, 130, 246, 0.24);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.52);
}

.upload-queue-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 12px;
}

.upload-queue-header strong {
  color: var(--text-main);
  font-size: 13px;
}

.upload-queue-summary {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
}

.upload-queue-percent {
  flex: none;
  color: #93c5fd;
  font-family: var(--font-mono);
  font-weight: 600;
}

.upload-total-track,
.upload-file-track {
  overflow: hidden;
  border-radius: var(--radius-full);
  background: rgba(148, 163, 184, 0.15);
}

.upload-total-track {
  height: 7px;
  margin-bottom: 12px;
}

.upload-total-fill,
.upload-file-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 120ms linear;
}

.upload-queue-list {
  display: flex;
  max-height: 216px;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.upload-file-row {
  padding: 9px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(9, 13, 22, 0.38);
}

.upload-file-row.is-uploading {
  border-color: rgba(56, 189, 248, 0.34);
}

.upload-file-row.is-complete {
  border-color: rgba(16, 185, 129, 0.28);
}

.upload-file-row.is-failed {
  border-color: rgba(239, 68, 68, 0.38);
  background: rgba(127, 29, 29, 0.08);
}

.upload-file-main,
.upload-file-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.upload-file-name {
  overflow: hidden;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-status {
  flex: none;
  color: var(--text-muted);
  font-size: 11px;
}

.upload-file-row.is-uploading .upload-file-status { color: #7dd3fc; }
.upload-file-row.is-complete .upload-file-status { color: #6ee7b7; }
.upload-file-row.is-failed .upload-file-status { color: #fca5a5; }

.upload-file-meta {
  margin-top: 4px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
}

.upload-file-track {
  height: 4px;
  margin-top: 7px;
}

.upload-file-row.is-complete .upload-file-fill {
  background: var(--success);
}

.upload-file-row.is-failed .upload-file-fill {
  background: var(--danger);
}

.upload-error {
  margin-top: 6px;
  color: #fca5a5;
  font-size: 11px;
  line-height: 1.45;
}

.form-group select option {
  background: #0f172a;
  color: var(--text-main);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(15, 23, 42, 0.95);
}

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

.form-row {
  display: flex;
  gap: 16px;
}

.form-group.half {
  flex: 1;
}

.checkbox-group {
  margin-top: 4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-main);
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.info-tip {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(30, 41, 59, 0.4);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
  line-height: 1.6;
}

.modal-code {
  background: rgba(10, 15, 29, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  max-height: 380px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #a5b4fc;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

/* File System Browser Item Styling */
.fs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-main);
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.fs-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(2px);
}

.fs-item-icon {
  font-size: 16px;
  color: #38bdf8;
}

/* Responsive */
@media (max-width: 768px) {
  main {
    padding: 16px 12px;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-actions {
    width: 100%;
  }
  .header-actions .btn {
    flex: 1;
    justify-content: center;
  }
  .form-row {
    flex-direction: column;
  }
}
