:root {
  color-scheme: dark;
  --hp-panel: rgba(15, 23, 42, 0.72);
  --hp-border: rgba(51, 65, 85, 0.72);
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 75% -10%, rgba(37, 99, 235, 0.12), transparent 28rem),
    #020617;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
a,
input,
select,
textarea {
  transition-property: color, background-color, border-color, opacity, box-shadow, transform;
  transition-duration: 160ms;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #60a5fa !important;
  outline-offset: 2px;
}

input,
select,
textarea {
  min-height: 42px;
}

input::placeholder,
textarea::placeholder {
  color: #64748b;
}

.hp-skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  border-radius: 0.75rem;
  background: #fff;
  color: #0f172a;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  font-weight: 700;
}

.hp-skip-link:focus {
  top: 1rem;
}

.hp-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: min(18rem, calc(100vw - 3rem));
  transform: translateX(-100%);
  border-right: 1px solid rgba(51, 65, 85, 0.72);
  background: rgba(2, 6, 23, 0.96);
  box-shadow: 32px 0 70px -40px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(18px);
  transition: transform 220ms ease;
}

.hp-sidebar.is-open {
  transform: translateX(0);
}

.hp-nav-link {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  padding: 0.65rem 0.75rem;
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 500;
}

.hp-nav-link:hover {
  border-color: rgba(51, 65, 85, 0.6);
  background: rgba(15, 23, 42, 0.8);
  color: #f8fafc;
}

.hp-nav-link.is-active {
  border-color: rgba(59, 130, 246, 0.22);
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.2), rgba(37, 99, 235, 0.06));
  color: #dbeafe;
  box-shadow: inset 3px 0 #3b82f6;
}

.hp-icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(51, 65, 85, 0.78);
  border-radius: 0.75rem;
  color: #cbd5e1;
}

.hp-icon-button:hover {
  background: rgba(30, 41, 59, 0.8);
  color: #fff;
}

.hp-mobile-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: 64px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(51, 65, 85, 0.72);
  background: rgba(2, 6, 23, 0.88);
  padding: 0 1rem;
  backdrop-filter: blur(16px);
}

.hp-page-header {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.hp-page-header h1 {
  color: #f8fafc;
  font-size: clamp(1.55rem, 4vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.hp-page-header p {
  margin-top: 0.35rem;
  color: #94a3b8;
}

.hp-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.hp-page-actions > a,
.hp-page-actions > button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hp-page-actions .bg-white {
  background: #2563eb !important;
  color: #fff !important;
}

.hp-page-actions .bg-white:hover {
  background: #3b82f6 !important;
}

.hp-content [class*="bg-slate-900"][class*="border"] {
  box-shadow: 0 20px 55px -42px rgba(0, 0, 0, 0.95);
}

.hp-content table {
  border-collapse: separate;
  border-spacing: 0;
}

.hp-content tbody tr:last-child td {
  border-bottom: 0;
}

.hp-content pre,
.hp-content code {
  overflow-wrap: anywhere;
}

/* Dashboard server monitoring */
.hp-monitor-card,
.hp-monitor-panel {
  border: 1px solid rgba(51, 65, 85, 0.72);
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.72);
  box-shadow: 0 20px 55px -42px rgba(0, 0, 0, 0.95);
}

.hp-monitor-card {
  min-width: 0;
  padding: 1.25rem;
}

.hp-monitor-panel {
  min-width: 0;
  padding: 1.25rem;
}

.hp-monitor-label {
  color: #e2e8f0;
  font-size: 0.875rem;
  font-weight: 600;
}

.hp-monitor-context {
  margin-top: 0.25rem;
  color: #64748b;
  font-size: 0.7rem;
  line-height: 1.25rem;
}

.hp-live-status {
  display: inline-flex;
  min-height: 1.75rem;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.08);
  padding: 0.2rem 0.65rem;
  color: #6ee7b7;
  font-size: 0.7rem;
  font-weight: 600;
}

.hp-live-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45);
  animation: hp-live-pulse 2s infinite;
}

.hp-live-status.is-loading,
.hp-live-status.is-paused {
  border-color: rgba(100, 116, 139, 0.3);
  background: rgba(100, 116, 139, 0.1);
  color: #94a3b8;
}

.hp-live-status.is-warning {
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
}

.hp-live-status.is-error {
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.hp-live-status.is-loading .hp-live-dot,
.hp-live-status.is-paused .hp-live-dot,
.hp-live-status.is-error .hp-live-dot {
  animation: none;
}

.hp-monitor-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid rgba(51, 65, 85, 0.8);
  border-radius: 0.65rem;
  background: rgba(15, 23, 42, 0.65);
  padding: 0.45rem 0.75rem;
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 600;
}

.hp-monitor-button:hover {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(30, 41, 59, 0.9);
  color: #fff;
}

.hp-monitor-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.hp-donut {
  --hp-donut-color: #60a5fa;
  position: relative;
  width: min(9rem, 72%);
  margin: 1.1rem auto 0;
  aspect-ratio: 1;
}

.hp-donut-violet {
  --hp-donut-color: #a78bfa;
}

.hp-donut-cyan {
  --hp-donut-color: #22d3ee;
}

.hp-donut-amber {
  --hp-donut-color: #fbbf24;
}

.hp-donut.is-warning {
  --hp-donut-color: #f59e0b;
}

.hp-donut.is-critical {
  --hp-donut-color: #f87171;
}

.hp-donut.is-unavailable {
  --hp-donut-color: #475569;
}

.hp-donut svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.hp-donut circle {
  fill: none;
  stroke-width: 10;
}

.hp-donut-track {
  stroke: rgba(51, 65, 85, 0.58);
}

.hp-donut-value {
  stroke: var(--hp-donut-color);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--hp-donut-color) 40%, transparent));
  transition: stroke-dashoffset 700ms cubic-bezier(.22, .8, .35, 1), stroke 250ms ease;
}

.hp-donut-content {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.hp-donut-content strong {
  color: #f8fafc;
  font-size: clamp(1.45rem, 4vw, 1.9rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.hp-donut-content span {
  margin-top: 0.25rem;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 600;
}

.hp-history-chart {
  width: 100%;
  height: 15rem;
  overflow: hidden;
}

.hp-history-chart svg,
.hp-network-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hp-chart-grid {
  stroke: rgba(71, 85, 105, 0.32);
  stroke-width: 1;
}

.hp-chart-axis-label {
  fill: #64748b;
  font-family: inherit;
  font-size: 10px;
}

.hp-chart-area-cpu {
  fill: rgba(59, 130, 246, 0.1);
}

.hp-chart-line-cpu,
.hp-chart-line-memory,
.hp-network-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
  animation: hp-chart-draw 520ms ease-out both;
}

.hp-chart-line-cpu {
  stroke: #60a5fa;
}

.hp-chart-line-memory {
  stroke: #a78bfa;
}

.hp-chart-last-cpu {
  fill: #60a5fa;
}

.hp-chart-last-memory {
  fill: #a78bfa;
}

.hp-network-chart {
  width: 100%;
  height: 4rem;
  overflow: hidden;
  border-bottom: 1px solid rgba(51, 65, 85, 0.45);
}

.hp-network-area {
  fill: rgba(52, 211, 153, 0.1);
}

.hp-network-line {
  stroke: #34d399;
  stroke-width: 2;
}

.hp-network-chart.is-upload .hp-network-area {
  fill: rgba(34, 211, 238, 0.09);
}

.hp-network-chart.is-upload .hp-network-line {
  stroke: #22d3ee;
}

.hp-service-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid rgba(51, 65, 85, 0.55);
  border-radius: 0.7rem;
  background: rgba(2, 6, 23, 0.26);
  padding: 0.7rem 0.8rem;
}

.hp-service-name {
  min-width: 0;
  overflow: hidden;
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hp-service-state {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.35rem;
  color: #94a3b8;
  font-size: 0.68rem;
}

.hp-service-state::before {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: currentColor;
  content: '';
}

.hp-service-state.is-active {
  color: #34d399;
}

.hp-service-state.is-failed,
.hp-service-state.is-inactive {
  color: #f87171;
}

.hp-service-state.is-transitioning {
  color: #fbbf24;
}

.hp-system-label {
  color: #64748b;
  font-size: 0.7rem;
}

.hp-system-value {
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
  color: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 600;
}

.hp-refresh-spin {
  animation: hp-spin 800ms linear infinite;
}

@keyframes hp-live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

@keyframes hp-chart-draw {
  from { stroke-dasharray: 1; stroke-dashoffset: 1; }
  to { stroke-dasharray: 1; stroke-dashoffset: 0; }
}

@keyframes hp-spin {
  to { transform: rotate(360deg); }
}

[id^="modal"] > div {
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}

@media (min-width: 640px) {
  .hp-page-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }

  .hp-page-actions {
    justify-content: flex-end;
  }
}

@media (min-width: 1024px) {
  .hp-sidebar {
    transform: translateX(0);
  }
}

@media (max-width: 767px) {
  .hp-content table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .hp-content [class*="grid-cols-2"]:not(.sm\:grid-cols-2) {
    grid-template-columns: minmax(0, 1fr);
  }

  .hp-content .password-field {
    flex-wrap: wrap;
  }

  .hp-content .password-field input {
    min-width: 100%;
  }

  [id^="modal"] {
    align-items: flex-end;
    padding: 0;
  }

  [id^="modal"] > div {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    border-radius: 1.25rem 1.25rem 0 0;
    border-bottom: 0;
    padding: 1.25rem;
  }
}

@media (max-width: 639px) {
  .hp-page-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .hp-page-actions > :only-child {
    grid-column: 1 / -1;
  }

  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  .hp-monitor-button {
    flex: 1 1 auto;
  }

  .hp-history-chart {
    height: 12rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
