:root {
  --bg: #0d0e12;
  --card: #14161d;
  --input: #090a0f;
  --border: #222634;
  --border-focus: #3b82f6;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 1.25rem;
}

.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.75rem;
}

.auth-header h2 {
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
}

.auth-header p {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.775rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: #1e2230;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #2a2f42;
}

.btn-danger {
  background: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
  border-color: rgba(220, 38, 38, 0.3);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.error-banner {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #fca5a5;
  padding: 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.app-container {
  max-width: 1150px;
  margin: 0 auto;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
}

.nav-brand h1 {
  font-size: 1.15rem;
  font-weight: 600;
}

.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

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

.card-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
}

.code-editor-container {
  display: flex;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 6px;
  height: 360px;
}

.line-numbers {
  width: 44px;
  background: #0f1016;
  border-right: 1px solid var(--border);
  color: #4b5563;
  font-family: var(--mono);
  font-size: 0.825rem;
  line-height: 1.45rem;
  padding: 0.6rem 0.35rem;
  text-align: right;
  user-select: none;
  overflow: hidden;
}

textarea#script-content {
  flex: 1;
  background: transparent;
  border: none;
  color: #a7f3d0;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.45rem;
  padding: 0.6rem;
  resize: none;
  white-space: pre;
}

.script-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.85rem;
}

.script-card {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}

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

.script-card-title {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: #60a5fa;
}

.script-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: #1e2230;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.toast.success { border-left: 4px solid #22c55e; }
.toast.error { border-left: 4px solid var(--danger); }
