:root {
  --bg: #f3f6fb;
  --bg-accent: #eaf0f8;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --line: #d9e3f0;
  --line-strong: #c5d3e5;
  --text: #16212e;
  --muted: #617287;
  --heading: #0f1722;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --success: #15803d;
  --teal: #0f766e;
  --orange: #c2410c;
  --violet: #6d28d9;
  --gold: #b45309;
  --shadow: 0 18px 40px rgba(15, 23, 34, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.05), transparent 22%),
    linear-gradient(180deg, #f8fbff, var(--bg));
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
}

.hero,
.card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero {
  position: sticky;
  top: 24px;
  align-self: start;
  min-height: calc(100vh - 48px);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.04), transparent 28%),
    var(--panel);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
strong {
  color: var(--heading);
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 2.6vw, 3rem);
  line-height: 1.02;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.hero-copy,
.topbar-copy {
  color: var(--muted);
  line-height: 1.6;
}

.hero-card,
.hero-meter {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
}

.hero-card {
  padding: 18px;
}

.hero-card p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  display: grid;
  gap: 8px;
}

.hero-meter {
  padding: 18px;
  display: grid;
  gap: 4px;
}

.hero-meter-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.hero-meter strong {
  font-size: 1.15rem;
  color: var(--primary-strong);
}

.app {
  padding: 2px 0;
}

.card {
  padding: 22px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 13px 15px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

textarea {
  min-height: 55vh;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.55;
}

button {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

button:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
}

button.secondary {
  background: #eef4ff;
  border-color: #cfe0ff;
  color: var(--primary-strong);
}

button.secondary:hover {
  background: #e2ecff;
}

button.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

button.ghost:hover {
  background: #f8fbff;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#loginForm,
.editor-pane,
.file-pane,
.dashboard {
  display: grid;
  gap: 16px;
}

.topbar,
.section-head,
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-copy {
  margin-bottom: 0;
}

.status-grid,
.workspace {
  display: grid;
  gap: 16px;
}

.status-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.workspace {
  grid-template-columns: minmax(260px, 330px) 1fr;
}

.status-card {
  position: relative;
  min-height: 120px;
  overflow: hidden;
}

.status-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 4px;
  background: #dce6f4;
}

.accent-blue::before { background: #2563eb; }
.accent-green::before { background: #16a34a; }
.accent-cyan::before { background: #0891b2; }
.accent-gray::before { background: #64748b; }
.accent-orange::before { background: #ea580c; }
.accent-violet::before { background: #7c3aed; }
.accent-gold::before { background: #d97706; }

.mini span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mini strong {
  display: block;
  font-size: 1.15rem;
  line-height: 1.45;
  word-break: break-word;
}

.tree {
  display: grid;
  gap: 8px;
  max-height: 62vh;
  overflow: auto;
  padding-right: 4px;
}

.tree details {
  padding-left: 6px;
}

.tree summary {
  cursor: pointer;
  color: var(--muted);
}

.file-button {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  background: #f6faff;
  color: var(--text);
  border: 1px solid var(--line);
}

.file-button:hover {
  background: #edf5ff;
}

.path-field {
  gap: 10px;
}

.editor-shell {
  display: grid;
  gap: 14px;
}

.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #243041;
  border-radius: 14px;
  background: #1e1e1e;
}

.editor-topbar h3 {
  margin-bottom: 0;
  color: #d4d4d4;
}

.editor-label {
  margin-bottom: 6px;
  color: #6a9955;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.editor-topbar button {
  background: #0e639c;
}

.editor-topbar button:hover {
  background: #1177bb;
}

.editor-path-field {
  color: #9cdcfe;
}

.editor-path-field input {
  border-color: #2d2d30;
  background: #252526;
  color: #d4d4d4;
}

.editor-path-field input:focus {
  border-color: #0e639c;
  box-shadow: 0 0 0 4px rgba(14, 99, 156, 0.2);
}

.editor-frame {
  display: grid;
  grid-template-columns: 56px 1fr;
  border: 1px solid #2d2d30;
  border-radius: 14px;
  overflow: hidden;
  background: #1e1e1e;
}

.editor-gutter {
  display: grid;
  align-content: start;
  gap: 0;
  padding: 16px 10px;
  background: #252526;
  color: #858585;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  text-align: right;
  user-select: none;
}

.editor-surface {
  position: relative;
  min-height: 60vh;
  background: #1e1e1e;
}

.monaco-editor-host {
  position: absolute;
  inset: 0;
}

.editor-frame textarea {
  min-height: 60vh;
  border: 0;
  border-radius: 0;
  padding: 16px 18px;
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: Consolas, "Cascadia Code", "Courier New", monospace;
  font-size: 0.95rem;
  caret-color: #aeafad;
}

.editor-frame textarea:not(.fallback-visible) {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.editor-frame textarea.fallback-visible {
  position: relative;
  opacity: 1;
  pointer-events: auto;
}

.editor-frame textarea::placeholder {
  color: #6b7280;
}

.editor-frame textarea:focus {
  box-shadow: none;
}

.message {
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
}

.message.success {
  background: #eefbf3;
  border-color: #cdeed8;
  color: var(--success);
}

.message.error {
  background: #fff2f4;
  border-color: #f7d3d8;
  color: #c0263d;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 1420px) {
  .status-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .shell,
  .workspace,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    position: relative;
    top: auto;
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 14px;
  }

  .hero,
  .card {
    border-radius: 16px;
  }

  button {
    width: 100%;
  }

  .topbar-actions {
    width: 100%;
  }

  .editor-frame {
    grid-template-columns: 44px 1fr;
  }
}
