:root {
  --pbi-bg: #f5f6f8;
  --pbi-surface: #ffffff;
  --pbi-surface-alt: #f0f2f5;
  --pbi-border: #d9dde5;
  --pbi-text: #1f2328;
  --pbi-muted: #52627d;
  --pbi-accent: #f2c811;
  --pbi-accent-deep: #c79f00;
  --pbi-accent-soft: #fff6cf;
  --pbi-night: #16325c;
  --pbi-night-deep: #0f2442;
  --pbi-success: #22a06b;
  --pbi-danger: #d1242f;
  --pbi-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --pbi-radius-lg: 24px;
  --pbi-radius-md: 18px;
  --pbi-radius-sm: 12px;
  --primary: var(--pbi-night);
  --secondary: var(--pbi-night-deep);
  --accent: var(--pbi-accent);
  --primary-fg: #ffffff;
  --body-bg: var(--pbi-bg);
  --body-fg: var(--pbi-text);
  --body-quiet-color: var(--pbi-muted);
  --body-medium-color: var(--pbi-muted);
  --header-color: #ffffff;
  --header-branding-color: #ffffff;
  --header-bg: var(--pbi-night-deep);
  --header-link-color: #ffffff;
  --breadcrumbs-fg: var(--pbi-night);
  --breadcrumbs-link-fg: var(--pbi-night);
  --breadcrumbs-bg: transparent;
  --link-fg: var(--pbi-night);
  --link-hover-color: #0b1d37;
  --link-selected-fg: var(--pbi-night);
  --hairline-color: var(--pbi-border);
  --border-color: var(--pbi-border);
  --button-fg: #ffffff;
  --button-bg: var(--pbi-night);
  --button-hover-bg: var(--pbi-night-deep);
  --default-button-bg: linear-gradient(135deg, var(--pbi-accent) 0%, #ffd84c 100%);
  --default-button-hover-bg: linear-gradient(135deg, #ffd84c 0%, #ffe388 100%);
  --default-button-fg: #342800;
  --selected-bg: #e8eef8;
  --selected-row: #f2f6fb;
  --close-button-bg: var(--pbi-night);
  --close-button-hover-bg: var(--pbi-night-deep);
  --message-success-bg: #edf8f2;
  --message-warning-bg: #fff8dd;
  --message-error-bg: #fff0f1;
  --darkened-bg: #e7edf6;
}

body {
  background:
    radial-gradient(circle at top left, rgba(242, 200, 17, 0.18), transparent 30%),
    linear-gradient(180deg, #fafbfc 0%, var(--pbi-bg) 100%);
  color: var(--pbi-text);
}

a,
a:link,
a:visited {
  color: var(--pbi-night);
}

a:hover {
  color: var(--link-hover-color);
}

body,
input,
button,
select,
textarea {
  font-family: "Segoe UI", "Aptos", Tahoma, Geneva, Verdana, sans-serif;
}

#container {
  min-width: 0;
}

#header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  color: var(--pbi-text);
  border-bottom: 1px solid rgba(217, 221, 229, 0.8);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(14px);
}

#header a:link,
#header a:visited,
#user-tools,
#user-tools a,
#site-name a,
#site-name a:link,
#site-name a:visited {
  color: var(--pbi-night);
}

#site-name a {
  font-weight: 800;
}

#content {
  padding: 24px 24px 40px;
}

div.breadcrumbs {
  margin: 18px 24px 0;
  background: transparent;
  color: var(--pbi-muted);
  border: none;
  padding: 0;
}

div.breadcrumbs a {
  color: var(--pbi-muted);
}

#nav-sidebar {
  background: linear-gradient(180deg, #f4f8ff 0%, #ffffff 100%);
  border-right: 1px solid var(--pbi-border);
}

#nav-sidebar .current-model,
#nav-sidebar .current-app .section,
#nav-sidebar .current-app .section:link,
#nav-sidebar .current-app .section:visited {
  background: #eef4ff;
  color: var(--pbi-night) !important;
  border-radius: 10px;
}

#nav-sidebar a:link,
#nav-sidebar a:visited {
  color: var(--pbi-night);
}

#nav-sidebar tr.current-model,
#nav-sidebar .current-model {
  box-shadow: inset 4px 0 0 var(--pbi-night);
}

.pbi-shell {
  display: grid;
  gap: 24px;
}

.pbi-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 24px;
  padding: 28px;
  border-radius: var(--pbi-radius-lg);
  background: linear-gradient(135deg, var(--pbi-night-deep) 0%, var(--pbi-night) 100%);
  color: #fff;
  box-shadow: var(--pbi-shadow);
}

.pbi-hero::after {
  content: "";
  position: absolute;
  inset: auto -90px -90px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 200, 17, 0.34), rgba(242, 200, 17, 0));
}

.pbi-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff7cf;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pbi-hero h1,
.pbi-section-title {
  margin: 0;
  letter-spacing: -0.03em;
}

.pbi-hero h1 {
  margin-top: 16px;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1;
}

.pbi-hero p {
  margin: 14px 0 0;
  max-width: 720px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.7;
}

.pbi-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.pbi-button,
.button,
input[type="submit"],
input[type="button"],
.submit-row input,
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px;
  border: none;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.pbi-button:hover,
.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
.submit-row input:hover,
a.button:hover {
  transform: translateY(-2px);
}

.pbi-button-primary,
.button,
input[type="submit"],
input[type="button"],
.submit-row input,
a.button {
  background: linear-gradient(135deg, var(--pbi-accent) 0%, #ffd84c 100%);
  color: #342800 !important;
  box-shadow: 0 14px 28px rgba(242, 200, 17, 0.28);
}

.pbi-button-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.pbi-hero-side {
  display: grid;
  gap: 14px;
  align-content: start;
}

.pbi-mini-card,
.pbi-card,
.pbi-panel,
.module,
.inline-group,
#content-related,
#changelist-filter {
  background: var(--pbi-surface);
  border: 1px solid var(--pbi-border);
  border-radius: var(--pbi-radius-md);
  box-shadow: var(--pbi-shadow);
}

.pbi-mini-card {
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.06) 100%);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: none;
}

.pbi-mini-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.8rem;
}

.module caption,
.inline-group h2 {
  background: linear-gradient(135deg, var(--pbi-night-deep) 0%, var(--pbi-night) 100%);
  color: #ffffff !important;
}

.module caption a,
.module caption a:link,
.module caption a:visited,
.module h2,
.module h3,
.inline-group h2,
.inline-group h2 a,
.inline-group h2 a:link,
.inline-group h2 a:visited,
#content h1,
#content h2.object-name,
.breadcrumbs + #content-title h1 {
  color: #ffffff !important;
}

.dashboard .module,
.app-list .module {
  overflow: hidden;
  border-radius: 0;
}

.dashboard .module table,
.app-list .module table {
  width: 100%;
}

.dashboard .module caption a,
.dashboard .module h2,
.dashboard .module h3,
.app-list .module caption a,
.app-list .module h2,
.app-list .module h3,
.app-list .app-name,
.app-list .model-name {
  color: #ffffff !important;
}

.dashboard .module tbody tr:nth-child(odd),
.app-list .module tbody tr:nth-child(odd) {
  background: #f7faff;
}

.dashboard .module tbody tr:hover,
.app-list .module tbody tr:hover {
  background: #edf4ff;
}

#changelist table thead th,
#changelist table thead th a:link,
#changelist table thead th a:visited,
#changelist table tbody td,
#changelist table tbody th,
.results th,
.results td {
  color: var(--pbi-night) !important;
}

#changelist table thead th,
.results thead th {
  background: #eef4ff;
}

.object-tools a:link,
.object-tools a:visited,
.addlink,
.changelink,
.submit-row a.deletelink,
button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  background: var(--pbi-night) !important;
  color: #ffffff !important;
  border-color: var(--pbi-night-deep) !important;
}

.addlink,
.addlink:link,
.addlink:visited,
.changelink,
.changelink:link,
.changelink:visited {
  background: transparent !important;
  color: var(--pbi-night) !important;
  border: none !important;
  box-shadow: none !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
}

.object-tools a:hover,
.addlink:hover,
.changelink:hover,
.submit-row a.deletelink:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
input[type="reset"]:hover {
  background: var(--pbi-night-deep) !important;
}

.actions button,
.actions button.button,
.actions .button,
.actions input[type="submit"],
.actions input[type="button"] {
  color: #ffffff !important;
}

.addlink:hover,
.changelink:hover {
  background: transparent !important;
  color: var(--pbi-night-deep) !important;
}

.selector h2,
.selector-chosen h2 {
  background: #eef4ff !important;
  color: var(--pbi-night) !important;
}


.messagelist .success {
  background: #edf4ff;
  border: 1px solid #c6d6ef;
  color: var(--pbi-night);
}

.pbi-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}

.pbi-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.pbi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--pbi-accent) 0%, var(--pbi-night) 100%);
}

.pbi-card:hover,
.pbi-panel:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 44px rgba(15, 23, 42, 0.11);
}

.pbi-card h3,
.pbi-label {
  margin: 0;
  color: var(--pbi-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pbi-card-value {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-top: 14px;
}

.pbi-card-value strong {
  font-size: clamp(2rem, 3vw, 2.8rem);
  line-height: 1;
}

.pbi-trend {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--pbi-accent-soft);
  color: var(--pbi-night);
  font-size: 12px;
  font-weight: 700;
}

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

.pbi-panel {
  padding: 20px;
}

.pbi-chart {
  position: relative;
  height: 320px;
}

.pbi-chart canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.pbi-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.pbi-panel-header p {
  margin: 6px 0 0;
  color: var(--pbi-muted);
}

.pbi-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--pbi-surface-alt);
  color: var(--pbi-muted);
  font-size: 12px;
  font-weight: 700;
}

.pbi-table-wrap {
  overflow-x: auto;
}

.pbi-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 540px;
}

.pbi-table thead {
  background: var(--pbi-surface-alt);
}

.pbi-table th,
.pbi-table td {
  padding: 14px 12px;
  text-align: left;
}

.pbi-table th {
  color: var(--pbi-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pbi-table td {
  border-top: 1px solid var(--pbi-border);
}

.pbi-table tbody tr:hover {
  background: #f2f6fb;
}

.pbi-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
}

.pbi-status-active {
  background: rgba(34, 160, 107, 0.12);
  color: #176e4a;
}

.pbi-status-inactive {
  background: rgba(209, 36, 47, 0.12);
  color: #9f1c24;
}

.pbi-form {
  padding: 24px;
}

.pbi-form-row {
  margin-bottom: 18px;
}

.pbi-form-row label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--pbi-text);
}

#content input[type="text"],
#content input[type="email"],
#content input[type="number"],
#content input[type="password"],
#content textarea,
#content select {
  width: 100%;
  max-width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--pbi-border);
  border-radius: 14px;
  box-sizing: border-box;
  background: #fff;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

#content textarea {
  min-height: 120px;
}

#content input:focus,
#content textarea:focus,
#content select:focus {
  border-color: var(--pbi-accent);
  box-shadow: 0 0 0 4px rgba(242, 200, 17, 0.2);
  outline: none;
}

#content input[type="checkbox"] {
  transform: scale(1.15);
  accent-color: var(--pbi-accent-deep);
}

.pbi-empty {
  padding: 28px;
  text-align: center;
  color: var(--pbi-muted);
}

[data-animate] {
  opacity: 0;
  transform: translateY(18px);
  animation: pbi-rise 500ms ease forwards;
}

[data-animate="2"] {
  animation-delay: 90ms;
}

[data-animate="3"] {
  animation-delay: 180ms;
}

[data-animate="4"] {
  animation-delay: 270ms;
}

@keyframes pbi-rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .pbi-hero,
  .pbi-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  #content {
    padding: 18px 14px 28px;
  }

  div.breadcrumbs {
    margin: 14px 14px 0;
  }

  .pbi-hero,
  .pbi-card,
  .pbi-panel,
  .pbi-form {
    padding: 18px;
    border-radius: 18px;
  }

  .pbi-actions {
    flex-direction: column;
  }

  .pbi-chart {
    height: 240px;
  }

  .pbi-button,
  .button,
  input[type="submit"],
  input[type="button"],
  .submit-row input,
  a.button {
    width: 100%;
  }
}
