:root {
  --dashboard-bg: #f3f6f8;
  --dashboard-surface: #ffffff;
  --dashboard-border: #dce3e8;
  --dashboard-text: #1f2933;
  --dashboard-muted: #6b7785;
  --dashboard-primary: #0f8fa5;
  --dashboard-primary-dark: #0d5f70;
  --dashboard-sidebar: #102a33;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 15px;
}

body {
  margin: 0;
  background: var(--dashboard-bg);
  color: var(--dashboard-text);
  font-family: Arial, Helvetica, sans-serif;
}

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

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

.dashboard-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  background: var(--dashboard-sidebar);
  color: #f8fbfc;
}

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

.dashboard-brand span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--dashboard-primary);
  font-weight: 800;
}

.dashboard-brand strong {
  font-size: 18px;
  line-height: 1.1;
}

.dashboard-nav {
  display: grid;
  gap: 6px;
}

.dashboard-nav a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 6px;
  color: #cfdee3;
  font-weight: 700;
}

.dashboard-nav a:hover,
.dashboard-nav a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.dashboard-nav a.active {
  box-shadow: inset 3px 0 0 var(--dashboard-primary);
}

.dashboard-main {
  min-width: 0;
}

.dashboard-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--dashboard-border);
  background: rgba(255, 255, 255, 0.96);
}

.dashboard-topbar strong {
  display: block;
  margin-top: 2px;
  font-size: 20px;
}

.topbar-kicker,
.eyebrow {
  color: var(--dashboard-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dashboard-content {
  padding: 28px 40px 48px 40px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-heading h1 {
  margin: 4px 0 6px;
  font-size: 32px;
  font-weight: 800;
}

.page-heading p {
  max-width: 720px;
  margin: 0;
  color: var(--dashboard-muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  font-weight: 800;
}

.button-primary {
  background: var(--dashboard-primary);
  color: #ffffff;
}

.button-secondary {
  border: 1px solid var(--dashboard-border);
  background: #ffffff;
  color: var(--dashboard-text);
}

.button-danger {
  background: #d92d20;
  color: #ffffff;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.dashboard-alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #ffd38a;
  border-radius: 6px;
  background: #fff7e6;
  color: #755100;
  font-weight: 700;
}

.dashboard-alert-success {
  border-color: #9bd9b0;
  background: #eefaf1;
  color: #176c32;
}

.dashboard-alert-info {
  border-color: #9ccfde;
  background: #edf9fc;
  color: var(--dashboard-primary-dark);
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card,
.dashboard-panel {
  border: 1px solid var(--dashboard-border);
  border-radius: 8px;
  background: var(--dashboard-surface);
}

.stat-card {
  display: block;
  padding: 18px;
}

.stat-card strong {
  display: block;
  font-size: 34px;
  line-height: 1;
}

.stat-card span {
  display: block;
  margin-top: 8px;
  color: var(--dashboard-muted);
  font-size: 14px;
  font-weight: 700;
}

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

.dashboard-panel {
  overflow: hidden;
}

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

.dashboard-panel__header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.dashboard-panel__header span {
  color: var(--dashboard-muted);
  font-size: 13px;
}

.dashboard-table {
  margin: 0;
}

.dashboard-table th {
  color: var(--dashboard-muted);
  font-size: 12px;
  text-transform: uppercase;
}

.dashboard-table td {
  vertical-align: middle;
}

.muted-text {
  display: inline-block;
  margin-right: 10px;
  color: var(--dashboard-muted);
  font-size: 13px;
}

.muted-block {
  display: block;
  margin-top: 4px;
  color: var(--dashboard-muted);
  font-size: 12px;
}

.table-actions {
  text-align: right;
  white-space: nowrap;
}

.table-actions a {
  margin-left: 10px;
  color: var(--dashboard-primary-dark);
  font-weight: 800;
}

.table-actions form {
  display: inline-flex;
  margin-left: 10px;
}

.table-actions .button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-badge-active {
  background: #e7f7ed;
  color: #14733a;
}

.status-badge-passive {
  background: #eef1f4;
  color: #5d6875;
}

.table-avatar {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  object-fit: cover;
}

.table-avatar-empty {
  background: #dce3e8;
  color: var(--dashboard-text);
  font-weight: 800;
}

.table-image-preview {
  display: block;
  width: 92px;
  height: 58px;
  border: 1px solid var(--dashboard-border);
  border-radius: 6px;
  object-fit: cover;
  background: #eef1f4;
}

.pool-image-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 58px;
  border: 1px dashed var(--dashboard-border);
  border-radius: 6px;
  color: var(--dashboard-muted);
  font-size: 12px;
  font-weight: 800;
}

.image-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

.image-preview-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--dashboard-border);
  border-radius: 8px;
  background: #f8fafb;
}

.image-preview-panel span {
  color: var(--dashboard-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.image-preview-panel img,
.delete-image-preview {
  width: 100%;
  border-radius: 6px;
  object-fit: cover;
  background: #eef1f4;
}

.image-preview-panel img {
  aspect-ratio: 16 / 10;
}

.image-preview-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 18px;
  border: 1px dashed var(--dashboard-border);
  border-radius: 6px;
  color: var(--dashboard-muted);
  text-align: center;
  font-weight: 700;
}

.delete-image-preview {
  max-width: 360px;
  aspect-ratio: 16 / 9;
}

.quick-actions {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.quick-actions a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--dashboard-border);
  border-radius: 6px;
  background: #f8fafb;
  font-weight: 800;
}

.quick-actions a:hover {
  border-color: var(--dashboard-primary);
  color: var(--dashboard-primary-dark);
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 800;
}

.empty-state p {
  margin: 0;
  color: var(--dashboard-muted);
}

.form-panel {
  padding: 20px;
}

.filter-panel {
  margin-bottom: 16px;
  padding: 16px;
}

.filter-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px auto;
  gap: 14px;
  align-items: end;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.pool-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 6px;
}

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

.form-field {
  display: grid;
  gap: 7px;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.form-field label {
  color: var(--dashboard-text);
  font-size: 13px;
  font-weight: 800;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--dashboard-border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--dashboard-text);
  font: inherit;
}

.form-field input,
.form-field select {
  height: 42px;
  padding: 0 11px;
}

.form-field textarea {
  min-height: 112px;
  padding: 10px 11px;
  resize: vertical;
}

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

.quill-editor {
  background: #ffffff;
}

.quill-editor .ql-editor {
  min-height: 360px;
  font-size: 15px;
  line-height: 1.65;
}

.quill-editor .ql-editor p,
.quill-editor .ql-editor h2,
.quill-editor .ql-editor h3,
.quill-editor .ql-editor ul,
.quill-editor .ql-editor ol {
  margin-bottom: 12px;
}

.quill-source-hidden {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--dashboard-primary);
  outline: 2px solid rgba(15, 143, 165, 0.14);
}

.form-field span,
.validation-summary {
  color: #b42318;
  font-size: 13px;
  font-weight: 700;
}

.form-field-check {
  align-content: end;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 70px;
}

.form-field-check input {
  width: 18px;
  height: 18px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.delete-summary {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--dashboard-border);
  border-radius: 6px;
  background: #f8fafb;
}

.delete-summary strong {
  font-size: 20px;
}

.delete-summary span {
  color: var(--dashboard-muted);
}

.relation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.relation-grid div {
  padding: 14px;
  border: 1px solid var(--dashboard-border);
  border-radius: 6px;
}

.relation-grid strong,
.relation-grid span {
  display: block;
}

.relation-grid strong {
  font-size: 24px;
}

.relation-grid span {
  color: var(--dashboard-muted);
  font-size: 13px;
  font-weight: 700;
}

.detail-section {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.detail-section h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.detail-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--dashboard-border);
}

.detail-tab {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--dashboard-border);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #eef1f4;
  color: var(--dashboard-muted);
  font-weight: 800;
}

.detail-tab.is-active {
  background: #ffffff;
  color: var(--dashboard-text);
}

.html-preview,
.raw-json-preview {
  padding: 14px;
  border: 1px solid var(--dashboard-border);
  border-radius: 6px;
  background: #f8fafb;
}

.raw-json-preview {
  overflow: auto;
  max-height: 420px;
}

.raw-json-preview pre {
  margin: 0;
  white-space: pre-wrap;
}

.pool-image-preview {
  display: grid;
  gap: 10px;
}

.pool-image-preview img {
  display: block;
  width: min(520px, 100%);
  aspect-ratio: 16 / 9;
  border: 1px solid var(--dashboard-border);
  border-radius: 8px;
  object-fit: cover;
  background: #eef1f4;
}

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

  .dashboard-sidebar {
    position: static;
    height: auto;
  }

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

  .dashboard-content {
    padding: 28px 24px 48px 24px;
  }

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

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

@media (max-width: 560px) {
  .dashboard-topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

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

  .page-heading {
    display: block;
  }

  .page-heading h1 {
    font-size: 26px;
  }

  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .empty-state {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .relation-grid,
  .image-form-layout,
  .filter-form {
    grid-template-columns: 1fr;
  }

  .form-actions {
    justify-content: flex-start;
  }
}
