:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --panel: #ffffff;
  --panel-soft: #f8faf8;
  --text: #17211b;
  --muted: #5d6b63;
  --border: #d8e1dc;
  --accent: #176b5b;
  --accent-strong: #0e4f43;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(25, 46, 35, 0.14);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(23, 107, 91, 0.12), transparent 36%),
    var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
}

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

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.15);
}

input {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 58vh;
  resize: vertical;
  padding: 16px;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  line-height: 1.58;
  tab-size: 2;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e5f2ee;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.login-panel h1,
.sidebar h1,
.editor h2 {
  margin: 12px 0 0;
  line-height: 1.15;
}

.stack {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.app-grid {
  width: 100%;
  align-self: stretch;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
}

.sidebar,
.editor {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 36px rgba(25, 46, 35, 0.08);
}

.sidebar {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: calc(100vh - 64px);
}

.sidebar-header,
.editor-header,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.quiet-button,
.secondary-button {
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--border);
}

.quiet-button:hover,
.secondary-button:hover {
  background: #edf4f1;
}

.file-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
}

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

.file-list button {
  width: 100%;
  min-height: 44px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.file-list button:hover,
.file-list button.active {
  background: #eaf5f1;
  border-color: rgba(23, 107, 91, 0.5);
}

.file-list .delete-file-button {
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--danger);
  text-align: center;
}

.file-list .delete-file-button:hover {
  background: #fff0ed;
  border-color: rgba(180, 35, 24, 0.5);
}

.editor {
  min-width: 0;
  padding: 20px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.file-name-label,
.editor-label {
  color: var(--muted);
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

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

.status-row a {
  color: var(--accent-strong);
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .editor-header,
  .status-row {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-header button,
  .status-row a {
    width: 100%;
    text-align: center;
  }

  textarea {
    min-height: 48vh;
  }
}
