:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #686868;
  --line: #d9dfdc;
  --paper: #f7f8f4;
  --surface: #ffffff;
  --accent: #0b7f68;
  --danger: #b3261e;
  --soft: #edf4f1;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
}

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

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

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

input {
  min-height: 40px;
  padding: 0 12px;
}

textarea {
  min-height: 124px;
  padding: 12px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.shell {
  min-height: 100vh;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

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

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

h1 {
  margin-bottom: 24px;
  font-size: 30px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.login-form,
.key-form,
.secret-list,
.endpoint-list {
  display: grid;
  gap: 12px;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.remember-row input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.error {
  margin: 14px 0 0;
  color: var(--danger);
}

.page-error {
  margin: 0 0 18px;
  border: 1px solid #f0b8b3;
  border-radius: var(--radius);
  background: #fff6f5;
  padding: 12px;
}

.app-view {
  padding: 24px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.app-header h1 {
  margin-bottom: 0;
}

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

.ghost-button:hover {
  background: var(--soft);
  color: var(--ink);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  margin-bottom: 18px;
}

.status-strip div {
  min-width: 0;
  background: var(--surface);
  padding: 14px;
}

.status-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.status-strip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 4px;
}

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

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

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

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

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

.secret-row,
.endpoint-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.secret-row span,
.endpoint-row span {
  color: var(--muted);
  font-size: 13px;
}

.secret-row code,
.endpoint-row code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--soft);
  border-radius: var(--radius);
  padding: 10px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.new-key-box {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-weight: 700;
}

.danger-button {
  border-color: var(--danger);
  background: var(--danger);
}

.manifest-label {
  margin-top: 16px;
}

.manifest {
  min-height: 300px;
}

.llm-prompt {
  min-height: 300px;
}

.llm-subprompts {
  min-height: 420px;
}

@media (max-width: 860px) {
  .app-view {
    padding: 14px;
  }

  .grid,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .secret-row,
  .endpoint-row {
    grid-template-columns: 1fr;
  }
}
