:root {
  --bg: #f2efe8;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: #ffffff;
  --text: #12211c;
  --muted: #5f6d67;
  --line: rgba(18, 33, 28, 0.12);
  --brand: #1e6b52;
  --brand-strong: #14503d;
  --danger: #a93b32;
  --shadow: 0 20px 50px rgba(18, 33, 28, 0.12);
  --font: "Avenir Next", "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(circle at top left, rgba(30, 107, 82, 0.12), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.45), transparent 40%),
    var(--bg);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(18, 33, 28, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 33, 28, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 78%);
}

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

code,
pre {
  font-family: "SFMono-Regular", "JetBrains Mono", monospace;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

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

.page-shell,
.auth-screen {
  position: relative;
  z-index: 1;
}

.auth-screen {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.auth-card {
  width: min(520px, 100%);
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.auth-copy {
  margin-bottom: 1.5rem;
}

.auth-copy h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  margin-bottom: 0.65rem;
}

.auth-copy p:last-child {
  color: var(--muted);
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.page-shell {
  padding: 1.5rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

.topbar h1 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.session-pill {
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: rgba(30, 107, 82, 0.1);
  color: var(--brand-strong);
  font-size: 0.95rem;
}

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

.panel,
.detail-panel {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.panel-header > :first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.search-form {
  display: flex;
  flex: 0 1 34rem;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: nowrap;
  min-width: min(100%, 34rem);
}

.search-form input {
  flex: 1 1 auto;
  min-width: 0;
}

.search-form .button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel-strong);
}

.data-table th,
.data-table td {
  padding: 0.95rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.data-table th {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.panel-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding-top: 1rem;
}

.pagination-controls {
  display: flex;
  gap: 0.75rem;
}

.detail-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.detail-grid div,
.code-panel {
  padding: 0.9rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.detail-grid dt {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.detail-grid dd {
  margin: 0;
  line-height: 1.5;
}

.code-header {
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.code-panel pre {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.92rem;
}

.field,
.toggle {
  display: grid;
  gap: 0.5rem;
}

.field span,
.toggle span {
  font-size: 0.88rem;
  font-weight: 600;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}

textarea {
  resize: vertical;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.button.primary {
  background: var(--brand);
  color: #fff;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--line);
  color: var(--text);
}

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

.button.small {
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
}

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

.feedback {
  padding: 0.85rem 1rem;
  border-radius: 14px;
}

.feedback.error {
  background: rgba(169, 59, 50, 0.1);
  color: var(--danger);
}

.empty-state {
  padding: 2rem;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 18px;
  margin-top: 1rem;
}

.modal {
  width: min(760px, calc(100vw - 2rem));
  border: none;
  padding: 0;
  border-radius: 28px;
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(18, 33, 28, 0.4);
}

.modal.compact {
  width: min(480px, calc(100vw - 2rem));
}

.editor-form,
.modal form {
  padding: 1.5rem;
}

.modal-header,
.modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.modal-header {
  margin-bottom: 1rem;
}

.modal-footer {
  margin-top: 1rem;
}

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

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

.modal-copy {
  color: var(--muted);
  line-height: 1.6;
}

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

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

@media (max-width: 720px) {
  .page-shell {
    padding: 1rem;
  }

  .topbar,
  .panel-header,
  .panel-footer,
  .modal-header,
  .modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions,
  .pagination-controls {
    width: 100%;
  }

  .button {
    width: 100%;
  }

  .search-form {
    flex-wrap: wrap;
    min-width: 0;
  }
}
