:root {
  color-scheme: light;
  --paper: #f3ecdf;
  --paper-deep: #ece1d0;
  --panel: rgba(255, 252, 246, 0.88);
  --ink: #1f1a14;
  --muted: #6f6458;
  --line: #dac9b2;
  --brand: #0f684f;
  --brand-soft: #d7eee6;
  --warn: #b97316;
  --warn-soft: #f8e7c8;
  --danger: #a33a2c;
  --danger-soft: #f7d8d2;
  --good: #16614b;
  --good-soft: #d6eee5;
  --neutral: #8b7f73;
  --neutral-soft: #ece4db;
  font-family:
    "Iowan Old Style",
    "Palatino Linotype",
    "Book Antiqua",
    Palatino,
    "Noto Serif SC",
    serif;
  line-height: 1.5;
  font-weight: 400;
  color: var(--ink);
  background:
    radial-gradient(circle at 0% 0%, rgba(237, 203, 137, 0.35), transparent 30%),
    linear-gradient(145deg, #f6f0e8 0%, #e8ddce 100%);
}

* {
  box-sizing: border-box;
}

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

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

a {
  color: inherit;
}

#app {
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 28px 24px;
  border-right: 1px solid rgba(96, 79, 53, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.92), rgba(243, 236, 223, 0.72)),
    radial-gradient(circle at top right, rgba(15, 104, 79, 0.1), transparent 32%);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 1.3rem;
}

.brand p {
  color: var(--muted);
  font-size: 0.95rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--brand), #194233);
  color: white;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-link {
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: 140ms ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--ink);
  background: rgba(15, 104, 79, 0.1);
}

.app-content {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 32px 12px;
}

.topbar h2,
.topbar p {
  margin: 0;
}

.page-body {
  padding: 0 32px 32px;
}

.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
}

.page-grid {
  display: grid;
  gap: 20px;
}

.panel {
  padding: 24px;
  border: 1px solid rgba(96, 79, 53, 0.16);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(92, 73, 48, 0.08);
  backdrop-filter: blur(14px);
}

.nested-panel {
  padding: 20px;
  background: rgba(255, 249, 241, 0.9);
}

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

.panel-heading.compact {
  align-items: center;
  margin-bottom: 16px;
}

.panel-heading h3,
.panel-heading h4 {
  margin: 4px 0 0;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.danger-button,
.inline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: 140ms ease;
}

.primary-button,
.ghost-button,
.danger-button {
  padding: 11px 18px;
}

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

.primary-button:hover {
  background: #0b5843;
}

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

.ghost-button:hover {
  background: rgba(255, 255, 255, 0.86);
}

.compact-button {
  padding: 10px 14px;
  white-space: nowrap;
}

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

.danger-button:hover {
  background: #8c2e21;
}

.inline-link {
  padding: 0;
  background: none;
  color: var(--brand);
}

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

.stats-grid,
.split-grid,
.toolbar-grid,
.form-grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

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

.toolbar-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 20px;
}

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

.form-grid.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-section + .form-section,
.danger-zone {
  margin-top: 24px;
}

.form-section h4,
.danger-zone h4 {
  margin-top: 0;
  margin-bottom: 16px;
}

.field,
.checkbox-field {
  display: grid;
  gap: 8px;
}

.inline-field-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

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

.action-field {
  align-self: end;
}

.table-form-stack {
  display: grid;
  gap: 10px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(31, 26, 20, 0.34);
  backdrop-filter: blur(6px);
  z-index: 20;
}

.modal-card {
  width: min(720px, 100%);
  padding: 24px;
  border: 1px solid rgba(96, 79, 53, 0.16);
  border-radius: 24px;
  background: rgba(255, 252, 246, 0.98);
  box-shadow: 0 24px 60px rgba(92, 73, 48, 0.18);
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.dtb-config-grid {
  align-items: stretch;
}

.dtb-selection-panel,
.dtb-action-panel {
  display: grid;
  gap: 14px;
}

.dtb-selection-panel {
  background:
    linear-gradient(180deg, rgba(255, 250, 243, 0.96), rgba(249, 241, 228, 0.92)),
    radial-gradient(circle at top right, rgba(15, 104, 79, 0.08), transparent 38%);
}

.dtb-action-panel {
  align-content: space-between;
  background:
    linear-gradient(145deg, rgba(215, 238, 230, 0.78), rgba(255, 252, 246, 0.94)),
    radial-gradient(circle at 80% 0%, rgba(15, 104, 79, 0.12), transparent 34%);
}

.selection-caption {
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.field span {
  color: var(--muted);
  font-size: 0.92rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(96, 79, 53, 0.18);
  background: rgba(255, 255, 255, 0.8);
}

.checkbox-field {
  align-items: center;
  grid-template-columns: auto 1fr;
}

.checkbox-field input {
  margin: 0;
}

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

.radio-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
}

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

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(96, 79, 53, 0.14);
  text-align: left;
  vertical-align: top;
}

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

.stat-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(96, 79, 53, 0.12);
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  margin-top: 8px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.key-value-list {
  display: grid;
  gap: 12px;
}

.key-value-list div {
  display: grid;
  gap: 4px;
}

.key-value-list dt {
  color: var(--muted);
  font-size: 0.88rem;
}

.key-value-list dd {
  margin: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.88rem;
}

.status-pill[data-tone="good"] {
  color: var(--good);
  background: var(--good-soft);
}

.status-pill[data-tone="warn"] {
  color: var(--warn);
  background: var(--warn-soft);
}

.status-pill[data-tone="danger"] {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-pill[data-tone="neutral"] {
  color: var(--neutral);
  background: var(--neutral-soft);
}

.notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  font-size: 0.96rem;
}

.notice[data-tone="success"] {
  color: var(--good);
  background: var(--good-soft);
}

.notice[data-tone="error"] {
  color: var(--danger);
  background: var(--danger-soft);
}

.diagnostic-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--danger);
  background: rgba(163, 58, 44, 0.08);
  white-space: pre-wrap;
}

.field-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.empty-state {
  padding: 28px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  text-align: center;
}

.danger-zone {
  padding-top: 20px;
  border-top: 1px dashed rgba(163, 58, 44, 0.3);
}

code {
  padding: 0.14rem 0.35rem;
  border-radius: 8px;
  background: rgba(30, 23, 16, 0.08);
}

@media (max-width: 1100px) {
  .stats-grid,
  .split-grid,
  .toolbar-grid,
  .form-grid.two-columns,
  .form-grid.three-columns,
  .inline-form-row {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(96, 79, 53, 0.18);
  }

  .page-body,
  .topbar {
    padding-left: 18px;
    padding-right: 18px;
  }
}
