/* ARC Design System & Core Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Color Palette - Refined Dark Obsidian / Charcoal */
  --bg-app: #090b0e;
  --bg-surface-1: #11141b;
  --bg-surface-2: #171b24;
  --bg-surface-3: #1f2533;
  --bg-surface-hover: #262e3f;
  
  --border-subtle: #1e2433;
  --border-default: #2a3347;
  --border-focus: #6366f1;
  --border-highlight: rgba(99, 102, 241, 0.4);

  --text-primary: #f3f5f9;
  --text-secondary: #9aa5b8;
  --text-muted: #626e82;
  --text-inverse: #090b0e;

  /* Accents */
  --accent-primary: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-surface: rgba(99, 102, 241, 0.12);
  --accent-text: #a5b4fc;

  /* Functional Status */
  --status-locked: #f59e0b;
  --status-locked-bg: rgba(245, 158, 11, 0.12);
  --status-locked-border: rgba(245, 158, 11, 0.35);

  --status-success: #10b981;
  --status-success-bg: rgba(16, 185, 129, 0.12);

  --status-danger: #ef4444;
  --status-danger-bg: rgba(239, 68, 68, 0.12);

  --status-info: #38bdf8;
  --status-info-bg: rgba(56, 189, 248, 0.12);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px -1px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px -2px rgba(99, 102, 241, 0.3);

  /* Dimensions */
  --topbar-height: 56px;
  --left-panel-width: 320px;
  --right-panel-width: 360px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;
}

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

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Button & Control primitives */
button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  border: 1px solid transparent;
  outline: none;
  user-select: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background-color: var(--bg-surface-2);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-focus);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background-color: var(--bg-surface-2);
  color: var(--text-primary);
}

.btn-danger {
  background-color: var(--status-danger-bg);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover:not(:disabled) {
  background-color: #ef4444;
  color: #ffffff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-3);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  letter-spacing: 0.02em;
}

.badge-accent {
  background-color: var(--accent-surface);
  color: var(--accent-text);
  border-color: rgba(99, 102, 241, 0.3);
}

.badge-locked {
  background-color: var(--status-locked-bg);
  color: var(--status-locked);
  border-color: var(--status-locked-border);
}

.badge-level {
  font-family: var(--font-mono);
  font-weight: 600;
  background-color: #1e1b4b;
  color: #c7d2fe;
  border-color: #4338ca;
}

/* Modals & Backdrop */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 580px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-surface-2);
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-input, .form-textarea, .form-select {
  background-color: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color 0.15s ease;
  width: 100%;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-surface);
}
.form-textarea {
  min-height: 80px;
  resize: vertical;
}

/* Utility Helpers */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-2 { display: flex; gap: 8px; align-items: center; }
.flex-gap-3 { display: flex; gap: 12px; align-items: center; }
.flex-1 { flex: 1; }
.text-muted { color: var(--text-muted); }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.font-mono { font-family: var(--font-mono); }
