:root {
  --pn-amber-500: #f59e0b;
  --pn-amber-600: #d97706;
  --pn-slate-950: #0b1120;
  --pn-slate-900: #0f172a;
  --pn-slate-800: #1e293b;
  --pn-slate-700: #334155;
  --pn-slate-600: #475569;
  --pn-slate-500: #64748b;
  --pn-slate-200: #e2e8f0;
  --pn-slate-100: #f1f5f9;
  --pn-white: #ffffff;
  --pn-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

body {
  background: #f8fafc;
  font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--pn-slate-900);
}

#container {
  background: #f8fafc;
}

#main {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 20px 24px 40px;
}

main.content {
  flex: 1;
}

.change-form main.content,
.add-form main.content {
  background: var(--pn-white);
  border-radius: 18px;
  border: 1px solid var(--pn-slate-200);
  box-shadow: var(--pn-shadow);
  padding: 20px 24px 28px;
}

.change-form #content,
.add-form #content {
  background: transparent;
}

.change-form #content > h1,
.add-form #content > h1 {
  margin-top: 0;
  font-size: 22px;
}

.change-form #content > h2,
.add-form #content > h2 {
  margin-top: 6px;
  color: var(--pn-slate-500);
  font-weight: 500;
}

#header {
  background: var(--pn-slate-950);
  color: var(--pn-white);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#header a:link,
#header a:visited {
  color: var(--pn-white);
}

#content {
  padding: 0;
}

#content-main {
  width: 100%;
}

.pn-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pn-brand__mark {
  background: linear-gradient(135deg, var(--pn-amber-500), #f97316);
  color: var(--pn-slate-950);
  font-weight: 700;
  font-size: 14px;
  height: 36px;
  width: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pn-brand__name {
  font-weight: 600;
  font-size: 16px;
}

.pn-brand__meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.pn-dashboard {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.pn-hero {
  background: radial-gradient(circle at top right, rgba(245, 158, 11, 0.2), transparent 55%),
    linear-gradient(135deg, var(--pn-slate-900), var(--pn-slate-800));
  color: var(--pn-white);
  padding: 28px 32px;
  border-radius: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: var(--pn-shadow);
}

.pn-hero h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.pn-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
}

.pn-hero__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pn-chip {
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.pn-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pn-btn {
  background: var(--pn-amber-500);
  color: var(--pn-slate-950);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 8px 16px rgba(245, 158, 11, 0.2);
}

.pn-btn:hover {
  background: var(--pn-amber-600);
}

.pn-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.pn-card {
  background: var(--pn-white);
  border-radius: 16px;
  padding: 18px 20px;
  border: 1px solid var(--pn-slate-200);
  box-shadow: var(--pn-shadow);
}

.pn-card h2 {
  margin: 0 0 16px;
  font-size: 16px;
}

.pn-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.pn-card__header h2 {
  margin-bottom: 6px;
}

.pn-card__hint {
  margin: 0;
  font-size: 12px;
  color: var(--pn-slate-500);
}

.pn-card__label {
  color: var(--pn-slate-600);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pn-card__value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 8px;
}

.pn-card__meta {
  color: var(--pn-slate-500);
  font-size: 12px;
  margin-top: 6px;
}

.pn-card--wide {
  grid-column: span 2;
}

.pn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

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

.pn-metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.pn-metric__label {
  font-size: 12px;
  color: var(--pn-slate-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pn-metric__value {
  font-size: 18px;
  font-weight: 600;
}

.pn-subtitle {
  font-size: 13px;
  color: var(--pn-slate-600);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pn-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pn-list li {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--pn-slate-700);
}

.pn-list__value {
  font-weight: 600;
}

.pn-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pn-table th,
.pn-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--pn-slate-100);
  text-align: left;
}

.pn-table th {
  text-transform: uppercase;
  font-size: 11px;
  color: var(--pn-slate-500);
  letter-spacing: 0.05em;
}

.pn-table--monitor table {
  border-collapse: separate;
  border-spacing: 0 10px;
}

.pn-table--monitor thead th {
  padding: 8px 10px;
}

.pn-table--monitor tbody tr {
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px var(--pn-slate-100);
}

.pn-table--monitor tbody td {
  border-bottom: none;
  padding: 12px 10px;
}

.pn-table--monitor tbody td:first-child {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.pn-table--monitor tbody td:last-child {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

.pn-device {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pn-device__name {
  font-weight: 600;
  color: var(--pn-slate-900);
}

.pn-device__meta {
  font-size: 11px;
  color: var(--pn-slate-500);
}

.pn-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.pn-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  display: inline-block;
}

.pn-status--online {
  background: #dcfce7;
  color: #166534;
}

.pn-status--online::before {
  background: #16a34a;
}

.pn-status--offline {
  background: #e2e8f0;
  color: #475569;
}

.pn-status--offline::before {
  background: #94a3b8;
}

.pn-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.pn-badge--success {
  background: #dcfce7;
  color: #166534;
}

.pn-badge--danger {
  background: #fee2e2;
  color: #991b1b;
}

.pn-badge--muted {
  background: var(--pn-slate-100);
  color: var(--pn-slate-600);
}

.pn-link {
  color: var(--pn-amber-600);
  text-decoration: none;
  font-weight: 600;
}

.pn-health {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pn-health li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--pn-slate-700);
}

.pn-apps .module {
  border: 1px solid var(--pn-slate-100);
  border-radius: 12px;
  box-shadow: none;
}

.pn-app-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pn-app {
  border: 1px solid var(--pn-slate-200);
  border-radius: 14px;
  padding: 12px;
  background: var(--pn-white);
}

.pn-app__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pn-app__title {
  font-weight: 600;
  color: var(--pn-slate-900);
  text-decoration: none;
}

.pn-app__models {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pn-app__model {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid var(--pn-slate-100);
  border-radius: 12px;
  padding: 8px 10px;
}

.pn-app__link {
  color: var(--pn-slate-800);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}

.pn-app__link--disabled {
  color: var(--pn-slate-500);
  font-weight: 500;
}

.pn-app__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pn-app__pill {
  background: var(--pn-slate-100);
  color: var(--pn-slate-600);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  text-decoration: none;
  font-weight: 600;
}

.pn-app__pill--disabled {
  opacity: 0.5;
}

#nav-sidebar {
  background: var(--pn-slate-950);
  color: var(--pn-slate-100);
  border-right: 1px solid var(--pn-slate-800);
  padding: 16px;
  width: 260px;
  flex: 0 0 260px;
  left: 0;
  margin-left: 0;
  visibility: visible;
}

#main > #nav-sidebar {
  visibility: visible;
  margin-left: 0;
}

#main.shifted > #nav-sidebar {
  margin-left: 0;
  visibility: visible;
}

#main > #nav-sidebar + main.content {
  max-width: calc(100% - 260px);
}

#nav-sidebar input#nav-filter {
  background: var(--pn-slate-800);
  border: 1px solid var(--pn-slate-700);
  color: #e2e8f0;
  caret-color: var(--pn-amber-500);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 16px;
}

#nav-sidebar input#nav-filter::placeholder {
  color: rgba(226, 232, 240, 0.55);
}

#nav-sidebar input#nav-filter.no-results {
  background: #7f1d1d;
  border-color: #b91c1c;
  color: #fff;
}

.pn-side__brand {
  font-weight: 700;
  color: var(--pn-amber-500);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  margin-bottom: 14px;
}

.pn-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pn-side__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pn-side__title {
  color: rgba(148, 163, 184, 0.85);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pn-side__items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pn-side__item {
  border-radius: 10px;
}

.pn-side__link {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--pn-slate-100);
  text-decoration: none;
  background: var(--pn-slate-900);
  border: 1px solid var(--pn-slate-800);
  font-weight: 500;
  font-size: 13px;
}

.pn-side__link--disabled {
  color: rgba(148, 163, 184, 0.6);
}

.pn-side__item.is-active .pn-side__link {
  border-color: rgba(245, 158, 11, 0.55);
  color: var(--pn-amber-500);
  background: rgba(245, 158, 11, 0.08);
}

.pn-side__link:hover {
  border-color: rgba(245, 158, 11, 0.35);
}

.toggle-nav-sidebar {
  background: var(--pn-slate-950);
  border: 1px solid var(--pn-slate-800);
  border-radius: 10px;
  display: none;
}

.module,
.inline-group {
  border-radius: 14px;
  border: 1px solid var(--pn-slate-200);
  box-shadow: var(--pn-shadow);
}

.module h2,
.module caption {
  background: var(--pn-slate-100);
  color: var(--pn-slate-800);
  border-radius: 14px 14px 0 0;
}

.module.aligned,
fieldset.module {
  padding: 16px 18px 6px;
  background: var(--pn-white);
}

.form-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--pn-slate-100);
}

.form-row:last-child {
  border-bottom: none;
}

.aligned label {
  color: var(--pn-slate-600);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.aligned .help,
.help {
  color: var(--pn-slate-500);
  font-size: 12px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="tel"],
select,
textarea {
  border-radius: 10px;
  border: 1px solid var(--pn-slate-200);
  padding: 8px 10px;
  background: var(--pn-white);
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.readonly {
  color: var(--pn-slate-700);
  background: var(--pn-slate-100);
  border-radius: 8px;
  padding: 6px 8px;
}

.errornote,
.errorlist {
  border-radius: 10px;
}

.aligned .form-row .readonly {
  margin-top: 6px;
}

.submit-row {
  background: var(--pn-white);
  border-radius: 12px;
  border: 1px solid var(--pn-slate-200);
  padding: 12px;
}

.submit-row input.default,
.submit-row input.default:visited {
  background: var(--pn-amber-500);
  border: none;
  color: var(--pn-slate-950);
  border-radius: 10px;
  font-weight: 600;
}

#changelist-form .actions {
  background: var(--pn-slate-100);
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid var(--pn-slate-200);
}

.related-widget-wrapper-link {
  background: var(--pn-slate-100);
  border-radius: 8px;
  padding: 6px 8px;
}

.breadcrumbs {
  background: var(--pn-white);
  border: 1px solid var(--pn-slate-200);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

#changelist table {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--pn-slate-200);
}

#changelist table thead th {
  background: var(--pn-slate-100);
  color: var(--pn-slate-600);
}

#changelist table tbody tr:hover {
  background: #f8fafc;
}

.object-tools a {
  background: var(--pn-amber-500);
  color: var(--pn-slate-950);
  border-radius: 10px;
  padding: 6px 12px;
  text-decoration: none;
  font-weight: 600;
}

.submit-row {
  background: var(--pn-slate-100);
  border-radius: 12px;
  border: 1px solid var(--pn-slate-200);
}

@media (max-width: 900px) {
  .pn-card--wide {
    grid-column: span 1;
  }
  .pn-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  #main {
    flex-direction: column;
    padding: 16px;
  }
  #nav-sidebar {
    width: 100%;
    position: static;
    margin-bottom: 16px;
  }
  #main > #nav-sidebar + main.content {
    max-width: 100%;
  }
  .toggle-nav-sidebar {
    display: flex;
  }
}

/* Dark theme overrides (force always-dark admin) */
:root {
  --pn-slate-200: #1f2a44;
  --pn-slate-100: #111827;
  --pn-shadow: 0 12px 30px rgba(2, 6, 23, 0.45);
}

html {
  color-scheme: dark;
}

body,
#container {
  background: var(--pn-slate-950) !important;
  color: #e2e8f0;
}

main.content {
  background: var(--pn-slate-900);
  border: 1px solid var(--pn-slate-800);
}

.change-form main.content,
.add-form main.content {
  background: var(--pn-slate-900);
  border: 1px solid var(--pn-slate-800);
}

#content {
  color: #e2e8f0;
}

#content > h1,
#content > h2 {
  color: #e2e8f0;
}

.pn-card {
  background: var(--pn-slate-900);
  border-color: var(--pn-slate-800);
}

.pn-card__label,
.pn-card__hint,
.pn-card__meta,
.pn-subtitle,
.pn-metric__label {
  color: #94a3b8;
}

.pn-list li {
  color: #e2e8f0;
}

.pn-table th,
.pn-table td {
  border-bottom-color: var(--pn-slate-800);
}

.pn-table--monitor tbody tr {
  background: #0b1324;
  box-shadow: inset 0 0 0 1px var(--pn-slate-800);
}

.pn-device__name {
  color: #e2e8f0;
}

.pn-status--offline {
  background: var(--pn-slate-800);
  color: #cbd5f5;
}

.pn-badge--muted {
  background: var(--pn-slate-800);
  color: #cbd5f5;
}

.pn-health li {
  color: #e2e8f0;
}

.pn-apps .module,
.pn-app {
  border-color: var(--pn-slate-800);
  background: var(--pn-slate-900);
}

.pn-app__model {
  background: #0b1324;
  border-color: var(--pn-slate-800);
}

.pn-app__title,
.pn-app__link {
  color: #e2e8f0;
}

.pn-app__pill {
  background: var(--pn-slate-800);
  color: #cbd5f5;
}

.module,
.inline-group {
  border-color: var(--pn-slate-800);
}

.module h2,
.module caption {
  background: var(--pn-slate-800);
  color: #e2e8f0;
}

.module.aligned,
fieldset.module {
  background: var(--pn-slate-900);
}

.form-row {
  border-bottom-color: var(--pn-slate-800);
}

.aligned label {
  color: #94a3b8;
}

.aligned .help,
.help {
  color: #94a3b8;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="tel"],
select,
textarea {
  background: #0b1324;
  border-color: var(--pn-slate-800);
  color: #e2e8f0;
}

.readonly {
  background: var(--pn-slate-800);
  color: #e2e8f0;
}

.submit-row,
#changelist-form .actions,
.breadcrumbs,
#changelist table {
  background: var(--pn-slate-900);
  border-color: var(--pn-slate-800);
}

#changelist table thead th {
  background: var(--pn-slate-800);
  color: #94a3b8;
}

#changelist table tbody tr:hover {
  background: #0b1324;
}

.related-widget-wrapper-link {
  background: var(--pn-slate-800);
}

.theme-toggle {
  display: none !important;
}
