:root {
  color-scheme: light;
  --paper: #f7f3eb;
  --card: #fffaf1;
  --ink: #26332e;
  --muted: #6e756d;
  --forest: #315c48;
  --forest-dark: #244534;
  --line: #e3d9c8;
  --danger: #a54735;
  --sage: #dfe8d8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

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

h1, h2 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.05;
}

h1 {
  margin-bottom: 12px;
  font-size: 42px;
}

h2 {
  margin-bottom: 6px;
  font-size: 32px;
}

h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

button, input, select, textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

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

input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
}

textarea {
  resize: vertical;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.hidden {
  display: none !important;
}

.auth-card {
  width: min(480px, calc(100vw - 40px));
  margin: 10vh auto;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 18px 50px rgba(45, 38, 26, 0.08);
}

.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

aside {
  display: flex;
  position: sticky;
  top: 0;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: #efe7d8;
}

main {
  padding: 28px;
}

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

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

.wide-left {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.stats div {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.stats strong {
  display: block;
  font-size: 28px;
}

.stats span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.stack {
  display: grid;
  gap: 14px;
}

.compact {
  gap: 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 18px;
}

.primary {
  padding: 0 16px;
  color: white;
  background: var(--forest);
  font-weight: 750;
}

.primary:hover {
  background: var(--forest-dark);
}

.danger {
  padding: 0 14px;
  color: white;
  background: var(--danger);
  font-weight: 750;
}

.secondary {
  padding: 0 14px;
  color: var(--forest);
  border: 1px solid var(--forest);
  background: transparent;
  font-weight: 700;
}

.text-button {
  min-height: auto;
  padding: 0;
  color: var(--forest);
  background: transparent;
  font-weight: 800;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--forest);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.error {
  min-height: 20px;
  color: var(--danger);
  font-weight: 650;
}

.vault-list {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.vault-button {
  width: 100%;
  padding: 12px;
  text-align: left;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.72);
}

.vault-button.active {
  border-color: var(--forest);
  background: var(--sage);
}

.list {
  display: grid;
  gap: 10px;
}

.tall {
  max-height: 540px;
  overflow: auto;
  padding-right: 2px;
}

.item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.item-button {
  width: 100%;
  min-height: auto;
  text-align: left;
}

.item-button:hover {
  border-color: var(--forest);
}

.item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 780;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--forest);
  background: var(--sage);
  font-size: 12px;
  font-weight: 800;
}

.pill.failed {
  color: var(--danger);
  background: #f4ddd6;
}

.copyable {
  word-break: break-all;
  color: var(--forest);
  font-weight: 700;
}

.mini {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.status {
  margin-top: 18px;
  min-height: 22px;
}

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

  aside {
    position: static;
    height: auto;
  }

  .grid, .wide-left, .inline-form, .stats {
    grid-template-columns: 1fr;
  }
}
