:root {
  --bg: #1e1e1e;
  --bg-elevated: #252526;
  --bg-editor: #1f1f1f;
  --bg-sidebar: #181818;
  --bg-activity: #333333;
  --bg-input: #3c3c3c;
  --bg-hover: #2a2d2e;
  --bg-selection: #094771;
  --line: #313131;
  --line-soft: #3f3f46;
  --text: #cccccc;
  --text-strong: #ffffff;
  --text-muted: #8f8f8f;
  --accent: #0e639c;
  --accent-strong: #1177bb;
  --success: #89d185;
  --danger: #f48771;
  --warning: #d7ba7d;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
  --font-ui: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --font-mono: Consolas, "Cascadia Code", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
}

body {
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.4;
}

.workbench {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg);
}

.main-shell {
  min-width: 0;
  display: grid;
  grid-template-rows: 34px 35px 1fr 190px 24px;
}

.titlebar,
.editor-tabs,
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.titlebar {
  background: #181818;
  border-bottom: 1px solid #111;
  padding: 0 14px;
  color: var(--text-muted);
  font-size: 12px;
}

.editor-tabs {
  gap: 1px;
  justify-content: flex-start;
  background: #252526;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.editor-tab {
  padding: 9px 14px;
  background: #252526;
  color: var(--text-muted);
  border-right: 1px solid var(--line);
  white-space: nowrap;
  border-top: 0;
  border-left: 0;
  border-bottom: 0;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.editor-tab:hover {
  background: #2a2d2e;
  color: var(--text);
}

.editor-tab.is-active {
  background: #1f1f1f;
  color: var(--text-strong);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.editor-surface {
  background: var(--bg-editor);
  padding: 16px;
  overflow: auto;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(14, 99, 156, 0.18), transparent 60%),
    linear-gradient(90deg, #1f1f1f, #252526);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: #4fc1ff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.05;
  font-weight: 600;
}

.hero-copy {
  margin: 10px 0 0;
  max-width: 720px;
  color: var(--text);
  font-size: 14px;
}

.hero-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  padding: 5px 8px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.04);
  color: var(--warning);
  font-family: var(--font-mono);
  font-size: 11px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 520px) 1fr;
  gap: 16px;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: grid;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-width: 0;
}

.form-panel,
.summary-panel,
.table-panel {
  padding: 14px;
}

.table-panel {
  grid-column: 1 / -1;
}

.panel-heading {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.panel-heading p {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.subsection {
  margin-top: 10px;
}

.budget-form {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.field-grid-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #454545;
  background: var(--bg-input);
  color: var(--text);
  padding: 9px 10px;
  font: inherit;
  border-radius: 2px;
}

textarea {
  min-height: 160px;
  resize: vertical;
  font-family: var(--font-mono);
}

input:focus,
select:focus,
textarea:focus {
  outline: 1px solid #007fd4;
  border-color: #007fd4;
}

.form-actions,
.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  border: 1px solid transparent;
  background: #0e639c;
  color: var(--text-strong);
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
  border-radius: 2px;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #3a3d41;
  color: var(--text);
  border-color: #4a4d52;
}

button.secondary:hover {
  background: #45494e;
}

button.small-button {
  padding: 6px 10px;
  font-size: 12px;
}

.status {
  margin: 10px 0 0;
  min-height: 18px;
  color: var(--text-muted);
  font-size: 12px;
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: var(--success);
}

.summary-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.summary-card {
  padding: 12px;
  border: 1px solid var(--line);
  background: #1e1e1e;
}

.summary-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
}

.summary-card strong {
  color: var(--text-strong);
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 600;
}

.table-wrap {
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  background: #1e1e1e;
}

.compact-table table {
  min-width: 720px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 12px;
}

thead th {
  position: sticky;
  top: 0;
  background: #252526;
  color: var(--text-muted);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px;
  border-top: 1px solid #2a2a2a;
  vertical-align: middle;
}

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

tbody td input {
  padding: 7px 8px;
}

.bottom-panel {
  display: grid;
  grid-template-rows: 35px 1fr;
  min-height: 170px;
  border-top: 1px solid var(--line);
  background: #181818;
}

.bottom-tabs {
  display: flex;
  gap: 1px;
  background: #202020;
  border-bottom: 1px solid var(--line);
}

.bottom-tab {
  background: #252526;
  color: var(--text-muted);
  border: 0;
  border-right: 1px solid var(--line);
  padding: 8px 14px;
  cursor: pointer;
}

.bottom-tab.is-active {
  background: #1e1e1e;
  color: var(--text-strong);
}

.bottom-content {
  min-height: 0;
  overflow: auto;
}

.bottom-view {
  display: none;
  padding: 10px 12px;
}

.bottom-view.is-active {
  display: block;
}

.message-list {
  display: grid;
  gap: 6px;
}

.message-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  background: #1f1f1f;
  border: 1px solid var(--line);
}

.message-badge,
.message-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.severity-error {
  border-left: 3px solid var(--danger);
}

.severity-warning {
  border-left: 3px solid var(--warning);
}

.severity-success {
  border-left: 3px solid var(--success);
}

.severity-info {
  border-left: 3px solid var(--accent);
}

.console-output {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #d4d4d4;
  white-space: pre-wrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}

.modal-panel {
  width: min(980px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--line-soft);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  padding: 16px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-header h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 20px;
}

.modal-copy {
  margin: 10px 0 14px;
  color: var(--text-muted);
}

.statusbar {
  background: var(--accent);
  color: #d6ecff;
  font-size: 12px;
  padding: 0 12px;
}

.statusbar-group {
  display: flex;
  gap: 12px;
}

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .main-shell {
    grid-template-rows: 34px 35px 1fr 190px 24px;
  }

  .editor-surface {
    padding: 10px;
  }

  .hero {
    flex-direction: column;
  }

  .field-grid,
  .field-grid-four,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .titlebar-path,
  .titlebar-actions {
    font-size: 11px;
  }
}
