* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f6f7f9;
  color: #18202b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.sidenav {
  background: #111827;
  color: #f9fafb;
  padding: 20px 16px;
}

.logo {
  align-items: center;
  display: flex;
  gap: 10px;
  font-weight: 700;
  margin-bottom: 24px;
}

.logo-icon,
.brand-mark {
  align-items: center;
  background: #2dd4bf;
  border-radius: 6px;
  color: #042f2e;
  display: inline-flex;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.sidenav-section {
  margin: 18px 0;
}

.sidenav-section-label {
  color: #9ca3af;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.sidenav-section-links {
  display: grid;
  gap: 4px;
}

.sidenav-link,
.workspace-link {
  border-radius: 6px;
  display: block;
  font-weight: 600;
  padding: 9px 10px;
}

.sidenav-link.active {
  background: #374151;
}

.sidenav-logout-form {
  margin-top: 28px;
}

.sidenav-logout-form button,
.auth-panel button {
  background: #0f766e;
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 10px 12px;
  width: 100%;
}

.app-main {
  min-width: 0;
  padding: 28px 32px;
}

.workspace-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
}

.workspace-link {
  background: #fff;
  border: 1px solid #d7dde5;
  color: #334155;
}

.workspace-link.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}

.page-header,
.auth-panel,
.error-page,
.filter-bar,
.form-panel,
.table-panel,
.detail-grid {
  background: #fff;
  border: 1px solid #d7dde5;
  border-radius: 8px;
  padding: 26px;
}

.page-header-row,
.button-row,
.form-actions,
.category-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.page-header h1,
.auth-panel h1,
.error-page h1 {
  font-size: 30px;
  letter-spacing: 0;
  margin: 0 0 10px;
}

.eyebrow,
.route-name {
  color: #64748b;
  margin: 0 0 8px;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.auth-panel {
  width: min(420px, calc(100vw - 32px));
}

.auth-panel label {
  display: block;
  font-weight: 700;
  margin: 18px 0 6px;
}

.auth-panel input {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  display: block;
  font: inherit;
  margin-bottom: 14px;
  padding: 10px 12px;
  width: 100%;
}

.flash-error {
  background: #fee2e2;
  border-radius: 6px;
  color: #991b1b;
  padding: 10px 12px;
}

.button,
.filter-bar button,
.form-panel button,
.danger-zone button,
.table-panel button,
.form-actions button {
  background: #0f766e;
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  padding: 10px 12px;
}

.button.secondary {
  background: #e2e8f0;
  color: #0f172a;
}

.danger-zone button.danger {
  background: #b91c1c;
}

button.danger {
  background: #b91c1c;
}

.filter-bar {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
}

.filter-bar label,
.form-panel label {
  color: #334155;
  display: grid;
  font-size: 14px;
  font-weight: 700;
  gap: 6px;
}

.filter-bar input,
.filter-bar select,
.form-panel input,
.form-panel select,
.form-panel textarea {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #111827;
  font: inherit;
  min-height: 40px;
  min-width: 150px;
  padding: 8px 10px;
}

.form-panel textarea {
  min-height: 96px;
}

.form-panel {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  max-width: 720px;
}

.checkbox-row {
  align-items: center;
  display: flex !important;
  flex-direction: row;
  font-weight: 600 !important;
}

.checkbox-row input {
  min-height: auto;
  min-width: auto;
}

.checkbox-row.compact {
  min-height: 40px;
}

.table-panel {
  margin-top: 18px;
  overflow-x: auto;
}

.table-panel h2 {
  font-size: 18px;
  margin: 0 0 14px;
}

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

.data-table th,
.data-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: #475569;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.category-group + .category-group {
  border-top: 1px solid #e2e8f0;
}

.category-row {
  padding: 12px 0;
}

.category-row.child {
  padding-left: 24px;
}

.record-title {
  color: #0f766e;
  font-weight: 800;
}

.text-link,
.muted,
.empty-state {
  color: #64748b;
}

.detail-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 18px;
}

.detail-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  display: grid;
  gap: 4px;
  padding: 14px;
}

.detail-item.wide {
  grid-column: 1 / -1;
}

.detail-item span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.danger-zone {
  justify-content: flex-start;
  margin-top: 18px;
}

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

  .sidenav {
    position: static;
  }

  .app-main {
    padding: 20px 16px;
  }
}
