@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #09090b;
  --bg-accent: rgba(214, 214, 220, 0.12);
  --surface: rgba(17, 17, 20, 0.88);
  --surface-border: rgba(216, 44, 44, 0.24);
  --text: #ededf2;
  --muted: #a7a9b3;
  --primary: #d22828;
  --primary-strong: #8c0909;
  --primary-soft: rgba(210, 40, 40, 0.14);
  --danger-soft: rgba(126, 17, 17, 0.3);
  --danger: #ff6b6b;
  --success-soft: rgba(214, 214, 220, 0.14);
  --success: #f0f1f4;
  --shadow-soft: 0 20px 50px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 16px 34px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.18), transparent 24%),
    radial-gradient(circle at 65% 55%, rgba(210, 40, 40, 0.2), transparent 28%),
    radial-gradient(circle at 15% 18%, rgba(200, 203, 211, 0.12), transparent 22%),
    linear-gradient(180deg, #0c0c10 0%, #09090b 42%, #120909 100%);
}

.app-container {
  width: min(100% - 2rem, 1680px);
  margin-inline: auto;
  padding-inline: 0;
}

a {
  color: var(--text);
}

body,
.surface,
.table,
.table td,
.table th,
.navbar,
.navbar-brand,
.nav-link,
.btn,
.form-control,
.form-select,
.form-control:focus,
.form-select:focus {
  color: var(--text);
}

.text-muted {
  color: var(--muted) !important;
}

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

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  padding: 85px 0 2.5rem; /* padding for fixed header */
}

.app-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.app-footer {
  padding: 0 0 1.5rem;
}

.app-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.surface {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
}

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

.surface h1,
.surface h2,
.surface h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.page-hero {
  padding: 1.75rem;
}

.hero-grid,
.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 1.5rem;
}

.hero-card {
  padding: 2rem;
}

.hero-side {
  display: grid;
  gap: 1.5rem;
}

.info-card {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.display-title {
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 1.04;
  max-width: 12ch;
  margin: 0.35rem 0 0.8rem;
}

.hero-copy,
.caption-text {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #ff8b8b;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-actions,
.hero-pills,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-actions {
  margin-top: 1.4rem;
}

.hero-pills {
  margin-top: 1rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  background: rgba(227, 231, 239, 0.1);
  color: #d5d8df;
  font-size: 0.86rem;
  font-weight: 700;
}

.pill-tonal {
  background: var(--primary-soft);
  color: var(--primary);
}

.pill-success {
  background: var(--success-soft);
  color: var(--success);
}

.pill-muted {
  background: rgba(148, 152, 163, 0.14);
  color: var(--muted);
}

.code-block,
.code-inline {
  display: inline-flex;
  align-items: center;
  border-radius: 14px;
  background: #111216;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.88rem;
}

.code-block {
  padding: 0.95rem 1rem;
  width: fit-content;
}

.code-inline {
  padding: 0.35rem 0.6rem;
}

.simple-list {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
  line-height: 1.8;
}

.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 260px);
}

.auth-card {
  width: min(100%, 520px);
  padding: 2rem;
}

.auth-title {
  margin: 0.35rem 0 0.6rem;
  font-size: 2.1rem;
}

.auth-form {
  margin-top: 1.5rem;
}

.auth-footer-note {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.2rem;
}

.dashboard-grid {
  display: grid;
  gap: 1.5rem;
}

.plugin-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
}

.assignment-grid {
  align-items: start;
}

.assignment-header {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.assignment-current,
.assignment-panel,
.metric-card {
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(23, 23, 27, 0.88);
  box-shadow: var(--shadow-card);
}

.assignment-current {
  padding: 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.55rem;
}

.assignment-label,
.metric-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.assignment-selector {
  padding: 1.15rem 1.2rem;
}

.assignment-selector-row {
  display: flex;
  gap: 0.75rem;
  align-items: end;
}

.assignment-selector-row .form-select {
  flex: 1;
}

.assignment-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.metric-card {
  padding: 1rem 1.1rem;
}

.metric-card strong {
  display: block;
  margin-top: 0.45rem;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  letter-spacing: -0.04em;
}

.assignment-panel {
  padding: 1.1rem;
}

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

.assignment-card-list {
  display: grid;
  gap: 0.9rem;
}

.assignment-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.05rem;
  border-radius: 18px;
  background: rgba(31, 31, 36, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.assignment-card-active {
  background: linear-gradient(135deg, rgba(214, 214, 220, 0.08), rgba(210, 40, 40, 0.08));
}

.assignment-card-disabled {
  opacity: 0.88;
}

.assignment-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.assignment-card-body strong {
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.assignment-card-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.assignment-card-action {
  width: 160px;
}

.material-table {
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.table {
  margin-bottom: 0;
}

.table > :not(caption) > * > * {
  border-color: rgba(255, 255, 255, 0.08);
  padding: 0.9rem 1rem;
  vertical-align: middle;
}

.table thead th {
  background: rgba(27, 27, 31, 0.95);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table tbody tr:hover {
  background: rgba(210, 40, 40, 0.08);
}

.table tbody tr,
.table tbody td,
.table tbody td strong,
.table tbody td code,
.metric-card strong,
.assignment-card-body strong {
  color: var(--text);
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(30, 30, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.subheading {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
}

.empty-state {
  padding: 1.2rem;
  border-radius: 18px;
  background: rgba(24, 24, 28, 0.9);
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.14);
}

.form-label {
  margin-bottom: 0.45rem;
  color: #d1d4dc;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.form-control,
.form-select {
  min-height: 52px;
  border-radius: 16px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 20, 24, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  padding: 0.85rem 1rem;
}

.form-control:focus,
.form-select:focus {
  color: var(--text);
  border-color: rgba(255, 108, 108, 0.42);
  box-shadow: 0 0 0 4px rgba(210, 40, 40, 0.14);
}

textarea.form-control {
  min-height: 180px;
}

.form-control::placeholder {
  color: #7f8390;
}

.form-select option {
  color: var(--text);
  background: #15161a;
}

.form-control-large {
  min-height: 280px;
}

.btn {
  border-radius: 16px;
  font-weight: 700;
  padding: 0.8rem 1.1rem;
  border-width: 1px;
}

.btn-sm {
  border-radius: 14px;
  padding: 0.55rem 0.85rem;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #ff5959, var(--primary), var(--primary-strong));
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(210, 40, 40, 0.24);
}

.btn-primary:hover,
.btn-primary:focus {
  color: #fff;
  background: linear-gradient(135deg, #ff6c6c, var(--primary), var(--primary-strong));
}

.btn-outline-secondary {
  color: #d8dae1;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.btn-outline-danger {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.24);
  background: rgba(126, 17, 17, 0.18);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-danger:hover,
.btn-outline-danger:focus {
  color: #fff;
  transform: translateY(-1px);
}

.app-alert {
  border: none;
  border-radius: 18px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-card);
}

.alert-success {
  background: var(--success-soft);
  color: var(--success);
}

.alert-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.alert-info,
.alert-warning {
  background: rgba(214, 214, 220, 0.12);
  color: #f0f1f4;
}

.diagnostics-surface {
  display: grid;
  gap: 1.25rem;
}

.diagnostics-copy {
  max-width: 64ch;
}

.diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.diagnostic-card {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  min-height: 100%;
}

.diagnostic-card strong {
  color: #f4f5f7;
}

.diagnostic-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.diagnostic-card .btn {
  margin-top: auto;
}

.diagnostic-builder {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.diagnostic-result {
  display: grid;
  gap: 1rem;
  padding: 1.1rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 11, 14, 0.72);
}

.diagnostic-result-success {
  box-shadow: inset 0 0 0 1px rgba(88, 201, 131, 0.12);
}

.diagnostic-result-error {
  box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.14);
}

.diagnostic-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.diagnostic-result-header h3 {
  margin: 0.2rem 0 0;
  font-size: 1.12rem;
}

.diagnostic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.diagnostic-preview {
  margin: 0;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #f0f1f4;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 26rem;
  overflow: auto;
  font-size: 0.9rem;
}

.maintenance-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.maintenance-toolbar form {
  margin: 0;
}

.maintenance-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.maintenance-card {
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.maintenance-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.7rem;
}

.maintenance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.maintenance-panel {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.maintenance-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.maintenance-list {
  display: grid;
  gap: 0.65rem;
}

.maintenance-item {
  padding: 0.85rem;
  border-radius: 14px;
  background: rgba(9, 9, 11, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.maintenance-item strong {
  display: block;
}

.maintenance-item p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.maintenance-cleanup-summary {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.tier-form {
  margin: 0;
}

.tier-select {
  min-width: 120px;
}

.text-danger,
.field-validation-error,
.validation-summary-errors,
.validation-summary-errors ul {
  color: #ff8d8d !important;
}

@media (max-width: 991.98px) {
  .hero-grid,
  .split-grid,
  .plugin-admin-grid {
    grid-template-columns: 1fr;
  }

  .assignment-header,
  .assignment-metrics,
  .diagnostic-result-header {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .app-container {
    width: min(100% - 1rem, 100%);
  }

  .app-main {
    padding-top: 1.4rem;
  }

  .surface,
  .auth-card,
  .hero-card,
  .page-hero {
    padding: 1.25rem;
  }

  .display-title {
    font-size: 2.2rem;
  }

  .table-responsive {
    border-radius: 18px;
  }

  .assignment-selector-row,
  .assignment-card,
  .diagnostic-result-header {
    grid-template-columns: 1fr;
  }

  .assignment-selector-row {
    display: grid;
  }

  .assignment-card-action {
    width: 100%;
  }

  .list-row,
  .action-row,
  .hero-actions,
  .hero-pills,
  .diagnostic-meta,
  .maintenance-toolbar,
  .maintenance-panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .btn,
  .btn-sm {
    width: 100%;
  }

  .action-row .btn,
  .action-row form,
  .action-row a {
    width: 100%;
  }

  .material-table {
    border: none;
    background: transparent;
    overflow: visible;
  }

  .material-table table,
  .material-table thead,
  .material-table tbody,
  .material-table th,
  .material-table td,
  .material-table tr {
    display: block;
    width: 100%;
  }

  .material-table thead {
    display: none;
  }

  .material-table tbody {
    display: grid;
    gap: 0.9rem;
  }

  .material-table tbody tr {
    padding: 1rem;
    border-radius: 18px;
    background: rgba(23, 23, 27, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-card);
  }

  .material-table tbody td {
    padding: 0.4rem 0;
    border: 0;
    white-space: normal;
  }

  .material-table tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.35rem;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .material-table tbody td.action-row {
    padding-top: 0.85rem;
  }
}
