:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef2f3;
  --line: #cfd8dc;
  --text: #162024;
  --muted: #5d6b72;
  --accent: #116149;
  --accent-2: #0c4f84;
  --danger: #9f1d28;
  --shadow: 0 1px 4px rgba(22, 32, 36, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button,
.upload-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-weight: 650;
  height: 36px;
  justify-content: center;
  padding: 0 12px;
  white-space: nowrap;
}

button:hover:not(:disabled),
.upload-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  min-height: 0;
}

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px 18px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  align-items: center;
  background: var(--accent);
  border-radius: 6px;
  color: #ffffff;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  height: 40px;
  justify-content: center;
  width: 48px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

#workspacePath {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.auth-form {
  align-items: end;
  display: flex;
  gap: 8px;
}

.auth-form label {
  display: grid;
  gap: 4px;
}

.auth-form span,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.auth-form input {
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 36px;
  min-width: 220px;
  padding: 0 10px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 42%) minmax(0, 1fr);
  min-height: 0;
}

.browser-pane,
.editor-pane {
  display: grid;
  min-height: 0;
}

.browser-pane {
  background: var(--surface);
  border-right: 1px solid var(--line);
  grid-template-rows: auto auto 1fr;
}

.editor-pane {
  background: #fbfcfc;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

.toolbar,
.editor-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  padding: 12px;
}

.toolbar {
  flex-wrap: wrap;
}

.upload-button {
  position: relative;
}

.upload-button input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.breadcrumbs {
  align-items: center;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 6px;
  min-height: 42px;
  overflow-x: auto;
  padding: 6px 12px;
}

.breadcrumbs button {
  height: 28px;
  padding: 0 8px;
}

.project-section {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding: 12px;
}

.project-section[hidden] {
  display: none;
}

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

.project-section-head h2 {
  font-size: 15px;
}

#projectSummary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.project-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.project-card,
.project-warning {
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.project-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
}

.project-warning {
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
}

.project-title-row {
  align-items: start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
}

.project-title-row h3 {
  font-size: 15px;
  line-height: 1.2;
  margin: 0;
  overflow-wrap: anywhere;
}

.project-title-row p {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.project-title-row button {
  flex: 0 0 auto;
  height: 30px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 5px 8px;
}

.status-badge.good {
  background: #e4f3ec;
  border-color: #9acbb6;
  color: #0d5a43;
}

.status-badge.warning {
  background: #fff4db;
  border-color: #dfbe72;
  color: #73510b;
}

.status-badge.danger {
  background: #ffe8eb;
  border-color: #e5a1aa;
  color: var(--danger);
}

.status-badge.info {
  background: #e8f1fb;
  border-color: #9bbbd9;
  color: var(--accent-2);
}

.project-meta {
  display: grid;
  gap: 6px;
  margin: 0;
}

.project-meta div {
  display: grid;
  gap: 4px;
  grid-template-columns: 58px minmax(0, 1fr);
}

.project-meta dt,
.project-meta dd,
.project-actions {
  font-size: 12px;
}

.project-meta dt {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.project-meta dd {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  margin: 0;
  overflow-wrap: anywhere;
}

.project-actions {
  color: var(--muted);
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
}

.table-frame {
  min-height: 0;
  overflow: auto;
}

table {
  border-collapse: collapse;
  font-size: 14px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  position: sticky;
  top: 0;
  text-transform: uppercase;
  z-index: 1;
}

tr {
  cursor: pointer;
}

tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

tr:hover td,
tr.selected td {
  background: #e7f3ef;
}

.name-cell {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 180px;
}

.type-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  height: 22px;
  justify-content: center;
  min-width: 42px;
  padding: 3px 8px;
}

.open-directory-button {
  font-size: 12px;
  height: 28px;
  margin-left: auto;
  padding: 0 8px;
}

.editor-head {
  justify-content: space-between;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.git-panel,
.deploy-panel {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding: 12px;
}

.git-panel[hidden],
.deploy-panel[hidden] {
  display: none;
}

.git-panel-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.git-panel-head h2 {
  font-size: 15px;
}

.git-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.git-actions button {
  height: 30px;
}

.git-plan-output {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  padding: 10px;
}

.git-plan-output p,
.git-plan-output ul {
  margin: 0;
}

.git-plan-output ul {
  padding-left: 18px;
}

.git-plan-output pre {
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  margin: 0;
  overflow-x: auto;
  padding: 8px;
}

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

.deploy-step {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(90px, 0.35fr) minmax(0, 1fr);
}

.deploy-step span:last-child {
  color: var(--text);
  overflow-wrap: anywhere;
}

.deploy-log-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
}

.deploy-log-list li {
  overflow-wrap: anywhere;
}

.git-plan-safe {
  color: var(--accent);
  font-weight: 800;
}

.git-plan-blocked {
  color: var(--danger);
  font-weight: 800;
}

.commit-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.commit-row input {
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 36px;
  min-width: 0;
  padding: 0 10px;
}

#deleteButton:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
}

#saveButton {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

#saveButton:hover:not(:disabled) {
  background: #0b523d;
  color: #ffffff;
}

#editor {
  background: #ffffff;
  border: 0;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.55;
  min-height: 0;
  outline: none;
  padding: 18px;
  resize: none;
  width: 100%;
}

#editor:disabled {
  background: #f8fafb;
  color: var(--muted);
}

.statusbar {
  align-items: center;
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 13px;
  gap: 12px;
  justify-content: space-between;
  min-height: 38px;
  padding: 8px 12px;
}

#dirtyText {
  color: var(--accent-2);
  font-weight: 700;
}

@media (max-width: 900px) {
  .topbar,
  .auth-form,
  .workspace {
    align-items: stretch;
    display: flex;
    flex-direction: column;
  }

  .workspace {
    min-height: 0;
  }

  .browser-pane {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    min-height: 42vh;
  }

  .editor-pane {
    min-height: 58vh;
  }

  .auth-form input {
    min-width: 0;
    width: 100%;
  }
}
