:root {
  color-scheme: light;
  --canvas: #f2f3ed;
  --paper: #fffefa;
  --ink: #252d29;
  --muted: #68736d;
  --line: #d8ddd4;
  --green: #28634d;
  --green-dark: #173d32;
  --yellow: #e4c95b;
  --red: #a43d32;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background-image: linear-gradient(135deg, transparent 72%, rgba(40, 99, 77, .06) 72%);
  }

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

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

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

  button:disabled {
    opacity: .55;
    cursor: wait;
  }

  button:focus-visible,
  .wordmark:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 2px;
  }

  button[hidden] {
    display: none;
  }

  [hidden] {
    display: none !important;
  }

  .app-shell {
    display: flex;
    width: min(100% - 48px, 1320px);
    min-height: 100vh;
    flex-direction: column;
    margin: 0 auto;
  }

  .app-header,
  .app-footer {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--line);
  }

  .wordmark {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: inherit;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
  }

  .wordmark-mark {
    display: grid;
    width: 36px;
    aspect-ratio: 1;
    place-items: center;
    color: var(--green-dark);
    font-family: Georgia, serif;
    font-size: 19px;
    background: var(--yellow);
    border-radius: 4px;
  }

  .account-actions {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  .identity-label,
  .eyebrow,
  .app-footer {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
  }

  .button-secondary {
    color: var(--green-dark);
    background: transparent;
    border-color: var(--line);
  }

  .button-secondary:hover {
    color: #fff;
    border-color: var(--green-dark);
  }

  .access-panel {
    display: flex;
    min-height: 62vh;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }

  .eyebrow {
    margin: 0 0 12px;
    color: var(--green);
  }

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

  h1 {
    margin-bottom: 12px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 42px;
    font-weight: 500;
    line-height: 1.08;
  }

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

  .session-message,
  .quiet-copy {
    color: var(--muted);
    line-height: 1.6;
  }

  .session-message[data-state="error"] {
    color: var(--red);
  }

  .primary-tabs {
    display: flex;
    min-height: 52px;
    gap: 28px;
    border-bottom: 1px solid var(--line);
  }

  .primary-tab {
    min-height: 52px;
    padding: 0 2px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
  }

  .primary-tab:hover {
    color: var(--ink);
    background: transparent;
    border-color: transparent;
  }

  .primary-tab[aria-selected="true"] {
    color: var(--green-dark);
    border-bottom-color: var(--green);
  }

  .view-panel {
    min-height: 58vh;
    padding: 34px 0 48px;
  }

  .home-panel {
    padding-top: 68px;
  }

  .home-panel h1 {
    font-size: 38px;
  }

  .database-heading,
  .table-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
  }

  .database-heading {
    margin-bottom: 26px;
  }

  .database-heading h1 {
    margin: 0;
    font-size: 32px;
  }

  .database-tabs {
    display: flex;
    gap: 24px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--line);
  }

  .database-tab {
    min-height: 42px;
    padding: 0 2px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
  }

  .database-tab:hover {
    color: var(--ink);
    background: transparent;
    border-color: transparent;
  }

  .database-tab[aria-selected="true"] {
    color: var(--green-dark);
    border-bottom-color: var(--green);
  }

  .database-view {
    min-width: 0;
  }

  .schema-intro {
    margin-bottom: 22px;
  }

  .schema-intro h2 {
    margin-bottom: 8px;
  }

  .schema-intro p,
  .schema-description {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
  }

  .schema-content {
    display: grid;
    gap: 22px;
  }

  .schema-entry {
    min-width: 0;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
  }

  .schema-entry-heading {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 7px;
  }

  .schema-entry-heading h3 {
    margin: 0;
    font-size: 16px;
  }

  .schema-entry-heading code,
  .schema-table code {
    color: var(--green-dark);
    font-size: 12px;
  }

  .schema-description {
    margin: 0 0 12px;
  }

  .schema-table-scroll {
    max-width: 100%;
    overflow-x: auto;
  }

  .schema-table {
    width: 100%;
    min-width: 580px;
    border-collapse: collapse;
    font-size: 12px;
  }

  .schema-table th,
  .schema-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
  }

  .schema-table thead th {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .5px;
    text-transform: uppercase;
    background: #f6f7f1;
  }

  .schema-column-name {
    width: 180px;
    color: var(--green-dark);
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
  }

  .schema-notes {
    margin-top: 12px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
  }

  .schema-notes h4 {
    margin: 0 0 5px;
    color: var(--ink);
    font-size: 12px;
  }

  .schema-notes ul {
    display: grid;
    gap: 4px;
    margin: 0;
    padding-left: 18px;
  }

  .database-layout {
    display: grid;
    grid-template-columns: 205px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }

  .table-navigation {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--line);
  }

  .table-nav-button {
    min-height: 42px;
    padding: 8px 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    background: transparent;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 0;
  }

  .table-nav-button:hover {
    color: var(--green-dark);
    background: rgba(40, 99, 77, .06);
    border-color: transparent;
  }

  .table-nav-button[aria-current="true"] {
    color: var(--green-dark);
    background: rgba(40, 99, 77, .08);
    border-left-color: var(--green);
  }

  .table-section {
    min-width: 0;
  }

  .table-heading {
    min-height: 42px;
    margin-bottom: 12px;
  }

  .table-count {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
  }

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

  .table-message[data-state="error"],
  .form-error {
    color: var(--red);
  }

  .table-scroll {
    max-width: 100%;
    overflow: auto;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--paper);
  }

  table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-size: 13px;
  }

  th,
  td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
  }

  th {
    position: sticky;
    top: 0;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .5px;
    text-transform: uppercase;
    background: #f6f7f1;
  }

  tbody tr:last-child td {
    border-bottom: 0;
  }

  tbody tr:hover {
    background: rgba(228, 201, 91, .08);
  }

  .actions-heading,
  .row-actions {
    min-width: 170px;
    white-space: nowrap;
  }

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

  .table-action {
    min-height: 30px;
    padding: 0 8px;
    color: var(--green-dark);
    font-size: 11px;
    background: transparent;
    border-color: var(--line);
  }

  .table-action:hover {
    color: #fff;
  }

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

  .danger-action:hover {
    color: #fff;
    background: var(--red);
    border-color: var(--red);
  }

  .empty-cell {
    padding: 28px 12px;
    color: var(--muted);
    text-align: center;
  }

  .record-dialog {
    width: min(680px, calc(100% - 32px));
    max-height: min(86vh, 900px);
    padding: 0;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 5px;
    box-shadow: 0 22px 60px rgba(23, 61, 50, .24);
  }

  .record-dialog::backdrop {
    background: rgba(18, 34, 27, .56);
  }

  .record-dialog form {
    max-height: min(86vh, 900px);
    overflow-y: auto;
    padding: 24px;
  }

  .dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
  }

  .icon-close {
    width: 36px;
    min-height: 36px;
    padding: 0;
    color: var(--ink);
    font-size: 22px;
    background: transparent;
    border-color: var(--line);
  }

  .icon-close:hover {
    color: #fff;
  }

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

  .form-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .full-field {
    grid-column: 1 / -1;
  }

  .form-field input,
  .form-field select,
  .form-field textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 3px;
  }

  .form-field textarea {
    min-height: 88px;
    resize: vertical;
  }

  .form-error {
    min-height: 20px;
    margin: 12px 0 0;
    font-size: 13px;
  }

  .dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  .app-footer {
    min-height: 52px;
    margin-top: auto;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    font-size: 10px;
  }

  @media (max-width: 760px) {
    .app-shell {
      width: min(100% - 32px, 1320px);
    }

    .database-layout {
      grid-template-columns: 1fr;
      gap: 18px;
    }

    .table-navigation {
      flex-direction: row;
      gap: 4px;
      overflow-x: auto;
      border-left: 0;
      border-bottom: 1px solid var(--line);
    }

    .table-nav-button {
      flex: 0 0 auto;
      border-bottom: 3px solid transparent;
      border-left: 0;
    }

    .table-nav-button[aria-current="true"] {
      border-bottom-color: var(--green);
      border-left-color: transparent;
    }
  }

  @media (max-width: 520px) {
    .app-header {
      min-height: 64px;
    }

    .identity-label {
      display: none;
    }

    .primary-tabs {
      gap: 20px;
    }

    .view-panel {
      padding-top: 24px;
    }

    .database-heading h1 {
      font-size: 27px;
    }

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

    .full-field {
      grid-column: auto;
    }

    .record-dialog form {
      padding: 18px;
    }
  }