/* Fonts load from index.html <link> — never @import here (blocks whole CSS if Google is slow). */

/* ===== CSS VARIABLES (TEMA) ===== */
:root,
[data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.1);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b8;
  --text-muted: #6a6a82;
  --accent-1: #7c3aed;
  --accent-2: #4f46e5;
  --accent-3: #06b6d4;
  --accent-glow: rgba(124, 58, 237, 0.3);
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="light"] {
  --bg-primary: #f4f4f9;
  --bg-secondary: #e8e8f0;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-hover: rgba(255, 255, 255, 0.9);
  --border-glass: rgba(0, 0, 0, 0.06);
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #8a8aaa;
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font, system-ui, sans-serif);
  background: var(--bg-primary, #0a0a0f);
  color: var(--text-primary, #f0f0f5);
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ===== ANIMIRANA POZADINA ===== */
.bg-animation {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-animation .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  animation: float 20s infinite ease-in-out;
}

.bg-animation .orb:nth-child(1) {
  width: 400px;
  height: 400px;
  background: var(--accent-1);
  top: -10%;
  left: -10%;
}

.bg-animation .orb:nth-child(2) {
  width: 300px;
  height: 300px;
  background: var(--accent-2);
  bottom: -10%;
  right: -10%;
  animation-delay: -5s;
}

.bg-animation .orb:nth-child(3) {
  width: 250px;
  height: 250px;
  background: var(--accent-3);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -10s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(50px, -30px) scale(1.1); }
  50% { transform: translate(-20px, 40px) scale(0.9); }
  75% { transform: translate(30px, -20px) scale(1.05); }
}

.bg-animation .orb:nth-child(3) {
  animation-name: float-center;
}

@keyframes float-center {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-45%, -55%) scale(1.08); }
}

/* ===== LAYOUT ===== */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px 60px;
}

/* ===== HEADER ===== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.app-header .logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-header .logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.app-header h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-header .version {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-glass);
  -webkit-text-fill-color: var(--text-muted);
  margin-left: 8px;
}

.app-header .header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.page-intro {
  margin-bottom: 8px;
}

.page-intro .headline {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.page-intro .lede {
  color: var(--text-secondary);
  max-width: 62ch;
}

/* ===== TEMA ===== */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 30px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(10px);
  font-family: var(--font);
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-1);
  transform: scale(1.02);
}

.theme-toggle .icon {
  font-size: 18px;
}

.lang-btn.active {
  border-color: var(--accent-1) !important;
  color: var(--accent-1) !important;
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ===== GLASS CARD ===== */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glass);
  padding: 24px 28px;
  transition: all var(--transition);
}

.glass-card:hover {
  border-color: rgba(124, 58, 237, 0.2);
}

.provision-panel {
  margin-top: 20px;
}

.provision-panel[hidden] {
  display: none !important;
}

/* ===== GRID MODULA ===== */
.modules-grid,
.modules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.module-card,
.module-btn {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  color: inherit;
}

.module-btn {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glass);
  padding: 24px 28px;
  transition: all var(--transition);
}

.module-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  border-color: rgba(124, 58, 237, 0.25);
}

.module-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.module-btn .card-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, var(--accent-glow), transparent 70%);
  opacity: 0;
  transition: opacity 0.6s;
  pointer-events: none;
}

.module-btn:hover .card-glow {
  opacity: 0.15;
}

.module-number,
.module-index {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(124, 58, 237, 0.12);
  padding: 2px 12px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 10px;
}

.module-card h3,
.module-btn .module-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  display: block;
}

.module-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  display: block;
}

.module-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.green {
  background: #22c55e;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}

.status-dot.yellow {
  background: #eab308;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.4);
}

.status-dot.red {
  background: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.status-dot.pulse {
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ===== DUGMAD ===== */
.btn,
.ai-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary,
.ai-send {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover,
.ai-send:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-primary:active,
.ai-send:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--accent-1);
}

.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.ai-send:disabled,
.btn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

/* ===== AI STATUS BAR ===== */
.ai-status-bar {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 14px 20px;
  margin: 0 0 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-status-bar .provider-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.provider-badge {
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent-1);
  border: 1px solid rgba(124, 58, 237, 0.2);
}

.provider-badge.active-ollama {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.2);
}

.provider-badge.active-cloud {
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
  border-color: rgba(6, 182, 212, 0.2);
}

.response-time {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.hw-widget {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color var(--transition), background var(--transition);
}

.hw-widget:hover {
  border-color: rgba(124, 58, 237, 0.35);
  background: var(--bg-card-hover);
}

.hw-widget-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.hw-widget .hw-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.hw-widget .hw-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.hw-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.hw-dot.ok { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.45); }
.hw-dot.warn { background: #eab308; box-shadow: 0 0 8px rgba(234, 179, 8, 0.4); }
.hw-dot.busy { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.45); }
.hw-dot.turbo { background: var(--accent-3); box-shadow: 0 0 8px var(--accent-glow); }

.hw-turbo-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.hw-turbo-toggle input {
  accent-color: var(--accent-3);
  width: 16px;
  height: 16px;
}

.hw-turbo-row {
  margin: 12px 0 4px;
}

.profile-segment {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.profile-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.profile-option:has(input:checked) {
  border-color: rgba(124, 58, 237, 0.45);
  background: rgba(124, 58, 237, 0.12);
  color: var(--text-primary);
}

.profile-option input {
  accent-color: var(--accent-1);
}

.hw-modal {
  max-width: 520px;
}

.hw-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px 14px;
  margin: 12px 0;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  color: var(--text-secondary);
}

.hw-summary-k {
  display: inline-block;
  min-width: 88px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hw-models-title {
  margin: 20px 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.hw-model-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.hw-model-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color var(--transition), background var(--transition);
}

.hw-model-item:hover {
  background: var(--bg-card-hover);
}

.hw-model-item.is-selected {
  border-color: rgba(6, 182, 212, 0.45);
  background: rgba(6, 182, 212, 0.1);
}

.hw-model-item .badge-rec {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.25);
  white-space: nowrap;
}

.hw-model-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.hw-override-hint {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
}

/* Auto Model Manager — NMQ gold (not purple) */
.amm-panel {
  margin: 16px 0 12px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(201, 168, 76, 0.28);
  background: linear-gradient(160deg, rgba(201, 168, 76, 0.08), rgba(10, 10, 10, 0.35));
}

.amm-title {
  margin: 0 0 8px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--nmq-gold, #C9A84C);
}

.amm-hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--nmq-muted, #9a9080);
}

.amm-rec-card {
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid rgba(201, 168, 76, 0.22);
  background: rgba(0, 0, 0, 0.25);
}

.amm-rec-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--nmq-gold, #C9A84C);
  margin-bottom: 4px;
}

.amm-rec-model {
  display: block;
  font-size: 13px;
  color: var(--nmq-text, #f0ebe0);
  word-break: break-all;
}

.amm-rec-reason {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--nmq-muted, #9a9080);
}

.amm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.amm-btn {
  background: rgba(201, 168, 76, 0.18) !important;
  border: 1px solid rgba(201, 168, 76, 0.45) !important;
  color: var(--nmq-gold-bright, #E8D48B) !important;
}

.amm-btn:hover {
  background: rgba(201, 168, 76, 0.28) !important;
}

.amm-input:focus {
  outline: none;
  border-color: rgba(201, 168, 76, 0.55);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.15);
}

.amm-progress {
  margin-top: 10px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.amm-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--nmq-gold-dim, #8A7030), var(--nmq-gold, #C9A84C));
  transition: width 0.35s ease;
}

.amm-soft-note {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--nmq-muted, #9a9080);
}

.hw-profile-suggest {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.hw-profile-suggest-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  font-size: 12px;
  color: var(--text-secondary);
}

.hw-profile-suggest-item.is-active {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.08);
}

.hw-profile-suggest-item code {
  font-size: 11px;
  color: var(--text-primary);
}

.hw-ollama-pull {
  margin: 10px 0 12px;
}

.hw-ollama-pull-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.hw-ollama-pull-row .project-name {
  flex: 1;
  min-width: 180px;
}

.hw-quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.hw-quick-pick {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-glass);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition), background var(--transition);
}

.hw-quick-pick:hover {
  border-color: rgba(6, 182, 212, 0.45);
  background: rgba(6, 182, 212, 0.08);
}

.hw-quick-pick small {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 2px;
}

.mt-16 { margin-top: 16px; }

/* ===== AI INTELLIGENCE PANEL ===== */
.ai-intelligence-panel {
  margin-bottom: 8px;
}

.ai-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.ai-meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.ai-meta code {
  font-family: 'IBM Plex Mono', Consolas, monospace;
  font-size: 0.85em;
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 6px;
}

.toolbar-actions,
.provision-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.provision-form {
  flex-direction: column;
  align-items: stretch;
}

.ai-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.deploy-guides {
  margin: 12px 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.deploy-guides summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}

.deploy-guide-card {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--text-muted) 25%, transparent);
}

.deploy-guide-card h4 {
  margin: 0 0 4px;
  color: var(--text-primary);
}

.deploy-guide-card ol {
  margin: 6px 0 0;
  padding-left: 1.2rem;
}

.provision-result,
#provider-live-indicator,
#ai-tools-result {
  color: var(--text-secondary);
  font-size: 0.9rem;
  white-space: pre-wrap;
  margin-top: 8px;
}

.ai-output,
#system-logs {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 14px;
  font-family: 'IBM Plex Mono', Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  max-height: 280px;
  overflow: auto;
  color: var(--text-secondary);
  margin-top: 12px;
  white-space: pre-wrap;
}

[data-theme="light"] .ai-output,
[data-theme="light"] #system-logs {
  background: rgba(0, 0, 0, 0.04);
}

.stats-wrap {
  overflow-x: auto;
}

/* ===== MODAL ===== */
.modal-overlay,
#keysModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.active,
#keysModal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  color: var(--text-primary);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-close,
#closeKeysModal {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  padding: 4px 12px;
  border-radius: 8px;
}

.modal-close:hover,
#closeKeysModal:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.key-field {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  background: var(--bg-card);
}

.key-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.key-field small {
  color: var(--text-muted);
  font-size: 0.8rem;
}

#keysStatus {
  margin-left: 12px;
  font-size: 0.9rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== TABELE ===== */
table,
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table th,
.stats-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-glass);
}

table td,
.stats-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

table tr:hover td,
.stats-table tr:hover td {
  background: var(--bg-card);
}

/* ===== FORM ===== */
input,
textarea,
select,
.project-name {
  font-family: var(--font);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  transition: all var(--transition);
  width: 100%;
  font-size: 14px;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type="password"] {
  letter-spacing: 2px;
}

/* ===== STATUS FOOTER ===== */
.status {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 100;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(16px);
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow-glass);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: min(90vw, 520px);
  text-align: center;
}

.status.is-active {
  transform: translateX(-50%) translateY(0);
}

/* ===== AMBIENCE & DELIGHT ===== */
.particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}

.bg-animation::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(124, 58, 237, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 58, 237, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black, transparent);
}

[data-theme="light"] .bg-animation::after {
  background-image:
    linear-gradient(rgba(79, 70, 229, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 70, 229, 0.05) 1px, transparent 1px);
}

.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.12), transparent 65%);
  mix-blend-mode: screen;
  transition: opacity 0.3s;
}

[data-theme="light"] .cursor-glow {
  background: radial-gradient(circle, rgba(79, 70, 229, 0.08), transparent 65%);
  mix-blend-mode: multiply;
}

.greeting-bar {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: -12px 0 20px;
  letter-spacing: 0.02em;
  animation: fadeSlideIn 0.7s ease both;
}

.shimmer-text {
  background: linear-gradient(
    110deg,
    var(--text-primary) 0%,
    var(--accent-3) 35%,
    var(--accent-1) 50%,
    var(--text-primary) 65%
  );
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 6s linear infinite;
}

@keyframes shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 220% center; }
}

/* Critical: class display:flex/grid must never beat HTML [hidden] */
[hidden] {
  display: none !important;
}

.page-loading .app-container {
  /* Never hide UI permanently — old opacity:0 left Electron stuck on background only */
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: none;
}

.app-container {
  opacity: 1 !important;
  visibility: visible !important;
}

body:not(.page-loading) .app-container {
  animation: none;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.stagger-item {
  opacity: 0;
  animation: cardRise 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes cardRise {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.module-btn {
  transform-style: preserve-3d;
}

.module-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--rx, 50%) var(--ry, 50%), rgba(167, 139, 250, 0.25), transparent 55%);
  opacity: 0;
  transition: opacity 0.45s;
  pointer-events: none;
}

.module-btn:active::after {
  opacity: 1;
}

.logo-icon {
  animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ===== TOAST ===== */
.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  font-size: 0.88rem;
  color: var(--text-primary);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toastIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
  border-left: 3px solid var(--accent-1);
}

.toast.success { border-left-color: #22c55e; }
.toast.error { border-left-color: #ef4444; }
.toast.info { border-left-color: var(--accent-3); }

.toast.leaving {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(24px) scale(0.95); }
}

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.tracker-modal {
  max-width: 920px;
}

.tracker-result-body {
  max-height: 70vh;
  overflow-y: auto;
}

.tracker-section {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.tracker-section h3,
.tracker-section h4 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
}

.tracker-section pre,
.tracker-raw {
  white-space: pre-wrap;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.tracker-cat-list {
  margin: 0.4rem 0 0 1rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.importance-high { color: #22c55e; }
.importance-medium { color: #eab308; }
.importance-low { color: var(--text-muted); }

.trend-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

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

.trend-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  max-height: 120px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  background: var(--bg-card);
}

.trend-checkboxes label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.trend-agent-card {
  background: var(--bg-card);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 12px;
  border-left: 4px solid var(--accent-1);
}

.trend-agent-card h4 {
  margin: 0 0 8px;
}

.trend-agent-body {
  white-space: pre-wrap;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-2);
}

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

/* ===== RESPONSIVE ===== */
@media (prefers-reduced-motion: reduce) {
  .shimmer-text,
  .stagger-item,
  .logo-icon,
  .bg-animation .orb,
  .cursor-glow {
    animation: none !important;
  }

  .stagger-item {
    opacity: 1;
  }
}

/* ===== AGENT ACTIVITY STREAM ===== */
.activity-stream {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}

.activity-event {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border-left: 3px solid var(--accent, #6366f1);
  font-size: 0.8rem;
  line-height: 1.4;
  animation: fadeSlideIn 0.25s ease;
}

.activity-event[data-type="planning"]  { border-color: #a78bfa; }
.activity-event[data-type="thinking"]  { border-color: #60a5fa; }
.activity-event[data-type="coding"]    { border-color: #34d399; }
.activity-event[data-type="testing"]   { border-color: #fbbf24; }
.activity-event[data-type="tool_call"] { border-color: #f472b6; }
.activity-event[data-type="waiting_approval"] { border-color: #f59e0b; }
.activity-event[data-type="done"]      { border-color: #10b981; }
.activity-event[data-type="error"]     { border-color: #ef4444; }

.activity-type-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.85;
  white-space: nowrap;
  min-width: 80px;
}

.activity-ts {
  opacity: 0.4;
  font-size: 0.68rem;
  white-space: nowrap;
  margin-left: auto;
}

.activity-detail {
  flex: 1;
  opacity: 0.85;
  word-break: break-word;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

[data-theme="light"] .activity-event {
  background: rgba(0,0,0,0.04);
}

/* ===== ONE-CLICK DEPLOY ===== */
.one-click-deploy-wrap {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 14px 16px;
}

[data-theme="light"] .one-click-deploy-wrap {
  background: rgba(0,0,0,0.03);
}

@media (max-width: 768px) {
  .app-container { padding: 16px; }
  .app-header { flex-direction: column; align-items: flex-start; }
  .app-header .header-actions { width: 100%; }
  .modules-grid,
  .modules { grid-template-columns: 1fr; }
  .ai-status-bar { flex-direction: column; align-items: stretch; }
  .modal-content { padding: 20px; }
}

@media (max-width: 480px) {
  .app-header h1 { font-size: 20px; }
  .btn,
  .ai-send { font-size: 13px; padding: 8px 16px; }
  .glass-card,
  .module-btn { padding: 18px; }
}
