:root {
  --bg: #f5f5f1;
  --surface: #ffffff;
  --surface-muted: #ecece5;
  --ink: #191b1f;
  --muted: #62686f;
  --line: #d9dbd2;
  --accent: #17a668;
  --accent-strong: #0b6b43;
  --danger: #ba2d2d;
  --focus: #2563eb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

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

button,
select {
  min-height: 44px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #111513;
  color: #f7f8f3;
  padding: 20px 16px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 20px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--accent);
  color: #07110b;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.panel p,
.schema-help h4,
.schema-help p {
  margin: 0;
}

.brand h1 {
  font-size: 16px;
}

.brand p {
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.type-nav {
  display: grid;
  gap: 4px;
}

.type-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
}

.type-button[aria-current="true"] {
  background: rgba(23, 166, 104, 0.18);
  color: #ffffff;
}

@media (hover: hover) {
  .type-button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
  }
}

.workspace {
  padding: 28px;
  min-width: 0;
}

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

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar h2 {
  font-size: 32px;
  letter-spacing: 0;
}

.topbar-actions,
.editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.ghost-button,
.icon-button {
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: pointer;
  padding: 0 14px;
}

.primary-button {
  background: var(--accent);
  color: #07110b;
  border-color: var(--accent);
  font-weight: 800;
}

.ghost-button,
.icon-button {
  background: var(--surface);
  color: var(--ink);
}

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

.icon-button {
  width: 44px;
  padding: 0;
  font-size: 20px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

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

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

.summary-card strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.78fr) minmax(460px, 1.22fr);
  gap: 18px;
  align-items: start;
}

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

.list-panel {
  overflow: hidden;
}

.editor-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
}

.editor-panel > .panel-header {
  margin: -18px -18px 0;
}

.panel-header h3 {
  font-size: 18px;
}

.panel-header p {
  color: var(--muted);
  font-size: 13px;
}

.entry-list {
  display: grid;
  max-height: calc(100vh - 230px);
  overflow-y: auto;
}

.entry-row {
  display: grid;
  gap: 6px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 14px 18px;
  text-align: left;
  cursor: pointer;
}

.entry-row[aria-selected="true"] {
  background: #ecf8f1;
}

.entry-row strong {
  font-size: 15px;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--surface-muted);
}

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

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  font-size: 16px;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 28%, transparent);
  outline-offset: 1px;
}

.schema-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  border-radius: 8px;
  padding: 12px;
}

.schema-help h4 {
  font-size: 15px;
}

.schema-help p {
  color: var(--muted);
  font-size: 13px;
}

.form-message {
  min-height: 22px;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 700;
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  .type-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (prefers-reduced-motion: no-preference) {
  .type-button,
  .primary-button,
  .ghost-button,
  .icon-button,
  .entry-row {
    transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
  }
}
