.panel-page {
  min-height: 100vh;
}

.panel-page [hidden] {
  display: none !important;
}

.panel-shell {
  width: min(1220px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 56px;
  position: relative;
  z-index: 1;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 46px;
}

.panel-brand,
.panel-logout,
.mini-btn,
.control-btn,
.status-pill {
  font-family: var(--font-mono);
}

.panel-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-heading);
}

.panel-brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(22, 232, 163, 0.6));
}

.panel-logout,
.mini-btn {
  color: var(--text-body);
  background: rgba(13, 30, 23, 0.82);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  padding: 10px 15px;
  cursor: pointer;
}

.mini-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.mini-btn.danger {
  color: #ff9f9f;
  border-color: rgba(255, 120, 120, 0.28);
}

.panel-logout:hover,
.mini-btn:hover {
  color: var(--emerald);
  border-color: rgba(22, 232, 163, 0.45);
}

.panel-card {
  width: min(620px, 100%);
  margin: 18vh auto 0;
  padding: 42px;
  text-align: center;
  background: linear-gradient(165deg, rgba(18, 41, 31, 0.78), rgba(5, 12, 9, 0.84));
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
}

.panel-card h1 {
  margin-top: 10px;
  color: var(--text-heading);
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
}

.panel-card p {
  max-width: 460px;
  margin: 16px auto 0;
}

.panel-card .btn {
  margin-top: 28px;
}

.panel-error {
  color: #ff8a8a;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.welcome-gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(22, 232, 163, 0.22), transparent 26%),
    radial-gradient(circle at 50% 50%, rgba(62, 167, 255, 0.1), transparent 44%),
    rgba(3, 5, 4, 0.96);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease), visibility 0.75s;
}

.welcome-gate.is-dismissing {
  opacity: 0;
  transform: scale(1.04);
  visibility: hidden;
  pointer-events: none;
}

.welcome-gate img {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 1px solid rgba(22, 232, 163, 0.48);
  box-shadow: 0 0 44px rgba(22, 232, 163, 0.38);
  animation: gate-avatar 1.2s var(--ease) both;
}

.welcome-gate h1 {
  color: var(--text-heading);
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 9vw, 5.4rem);
  line-height: 1;
  animation: gate-title 1s 0.18s var(--ease) both;
}

.gate-orbit {
  position: absolute;
  width: min(520px, 82vw);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(22, 232, 163, 0.18);
  animation: gate-spin 8s linear infinite;
}

.gate-orbit span {
  position: absolute;
  left: calc(50% - 4px);
  top: calc(50% - 4px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 18px rgba(22, 232, 163, 0.9);
  transform: rotate(var(--dot-angle)) translateX(calc((min(520px, 82vw) / 2) - 1px));
}

.gate-orbit span:nth-child(1) { --dot-angle: -90deg; }
.gate-orbit span:nth-child(2) { --dot-angle: 22deg; background: var(--teal); }
.gate-orbit span:nth-child(3) { --dot-angle: 148deg; background: var(--blue); }

@keyframes gate-spin { to { transform: rotate(360deg); } }
@keyframes gate-avatar {
  from { opacity: 0; transform: translateY(14px) scale(0.84); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes gate-title {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-dashboard {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 18px;
  padding-top: 34px;
}

.panel-sidebar,
.panel-main,
.panel-view,
.welcome-hero,
.server-hero,
.metric-card,
.panel-tile,
.media-card,
.ai-response,
.settings-strip,
.docker-row {
  border: 1px solid var(--surface-border);
  background: linear-gradient(165deg, rgba(18, 41, 31, 0.7), rgba(6, 14, 10, 0.82));
  backdrop-filter: blur(14px);
}

.panel-sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  padding: 16px;
  border-radius: var(--radius-md);
}

.server-switcher {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(22, 232, 163, 0.06);
  border: 1px solid rgba(22, 232, 163, 0.16);
}

.server-switcher strong,
.server-switcher small {
  display: block;
}

.server-switcher strong {
  color: var(--text-heading);
  font-family: var(--font-display);
  line-height: 1.2;
}

.server-switcher small {
  margin-top: 2px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.server-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 16px rgba(22, 232, 163, 0.7);
  flex: 0 0 auto;
}

.panel-nav {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.panel-nav button,
.panel-nav a {
  appearance: none;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-body);
  background: transparent;
  font: 500 0.82rem/1.2 var(--font-mono);
  text-align: left;
  cursor: pointer;
}

.panel-nav button:hover,
.panel-nav button.is-active,
.panel-nav a:hover {
  color: var(--emerald);
  border-color: rgba(22, 232, 163, 0.22);
  background: rgba(22, 232, 163, 0.08);
}

.panel-main {
  min-width: 0;
  min-height: 660px;
  padding: 18px;
  border-radius: var(--radius-lg);
}

.panel-view {
  display: none;
  min-height: 624px;
  padding: 0;
  border: 0;
  background: none;
  backdrop-filter: none;
}

.panel-view.is-active {
  display: block;
}

.welcome-hero,
.server-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 24px;
  border-radius: var(--radius-md);
}

.welcome-hero {
  background:
    linear-gradient(165deg, rgba(18, 41, 31, 0.76), rgba(6, 14, 10, 0.86)),
    radial-gradient(circle at 82% 18%, rgba(22, 232, 163, 0.16), transparent 34%);
}

.welcome-copy h1,
.panel-section-head h2 {
  margin: 8px 0 0;
  color: var(--text-heading);
  font-family: var(--font-display);
  line-height: 1.08;
}

.welcome-copy h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
}

.welcome-copy p {
  margin: 12px 0 0;
  max-width: 620px;
}

.welcome-user {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: 128px;
  color: var(--text-heading);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.welcome-user img {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 1px solid rgba(22, 232, 163, 0.35);
  box-shadow: 0 0 26px rgba(22, 232, 163, 0.22);
}

.server-hero {
  margin-top: 16px;
}

.overview-status strong {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.server-actions {
  display: grid;
  gap: 10px;
  min-width: 170px;
}

.control-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: rgba(13, 30, 23, 0.78);
  color: var(--text-body);
  font-size: 0.8rem;
  cursor: pointer;
}

.control-btn:disabled {
  cursor: not-allowed;
  opacity: 0.82;
}

.control-btn.primary {
  color: #04140e;
  background: linear-gradient(135deg, var(--emerald), var(--teal));
  border-color: rgba(22, 232, 163, 0.5);
}

.overview-grid,
.panel-grid,
.media-grid,
.docker-list {
  display: grid;
  gap: 14px;
}

.overview-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

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

.metric-card,
.panel-tile {
  min-width: 0;
  min-height: 154px;
  padding: 22px;
  border-radius: var(--radius-md);
}

.metric-card strong,
.server-hero strong,
.panel-tile strong,
.empty-state strong,
.docker-name strong {
  display: block;
  color: var(--text-heading);
  font-family: var(--font-display);
  line-height: 1.12;
}

.metric-card strong,
.panel-tile strong {
  font-size: 1.35rem;
  overflow-wrap: anywhere;
}

.metric-card p,
.server-hero p,
.panel-tile p,
.empty-state p {
  margin: 10px 0 0;
}

.panel-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.section-actions {
  display: flex;
  justify-content: end;
  gap: 8px;
  flex-wrap: wrap;
}

.exaroton-panel {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.docker-head {
  margin-top: 24px;
}

.panel-label {
  display: block;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--teal);
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  color: var(--emerald);
  border: 1px solid rgba(22, 232, 163, 0.25);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
}

.media-grid {
  display: block;
  column-count: 3;
  column-gap: 14px;
}

.media-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 14px;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
  background: rgba(3, 12, 8, 0.58);
  break-inside: avoid;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.media-card.is-selected {
  border-color: rgba(22, 232, 163, 0.58);
  box-shadow: 0 0 0 1px rgba(22, 232, 163, 0.18), 0 18px 50px rgba(22, 232, 163, 0.08);
}

.media-preview {
  display: grid;
  place-items: center;
  max-height: 320px;
  background: rgba(1, 6, 4, 0.72);
}

.media-preview:has(audio),
.media-preview:has(.file-chip) {
  min-height: 116px;
  padding: 12px;
}

.media-preview-btn {
  appearance: none;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.media-preview img,
.media-preview video {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

.media-preview audio {
  width: calc(100% - 20px);
}

.media-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  padding: 11px 12px 8px;
}

.media-select {
  grid-row: span 2;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
}

.media-select input {
  position: absolute;
  inset: 0;
  width: 22px;
  height: 22px;
  opacity: 0;
  cursor: pointer;
}

.media-check {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(22, 232, 163, 0.28);
  border-radius: 6px;
  background: rgba(1, 6, 4, 0.76);
}

.media-select input:checked + .media-check {
  border-color: rgba(22, 232, 163, 0.8);
  background:
    linear-gradient(135deg, rgba(22, 232, 163, 0.95), rgba(36, 211, 194, 0.95));
  box-shadow: 0 0 18px rgba(22, 232, 163, 0.24);
}

.media-select input:checked + .media-check::after {
  content: "";
  display: block;
  width: 8px;
  height: 4px;
  margin: 5px auto 0;
  border-left: 2px solid #03130d;
  border-bottom: 2px solid #03130d;
  transform: rotate(-45deg);
}

.media-meta strong,
.media-meta span,
.docker-name span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-meta strong {
  color: var(--text-heading);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.media-meta span,
.docker-name span {
  margin-top: 3px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.media-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 12px 12px;
}

.media-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(22, 232, 163, 0.2);
  border-radius: 999px;
  background: rgba(13, 30, 23, 0.72);
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  cursor: pointer;
}

.media-action:hover,
.media-preview-btn:hover + img {
  color: var(--text-heading);
  border-color: rgba(22, 232, 163, 0.42);
}

.media-action.danger {
  color: #ff9f9f;
  border-color: rgba(255, 120, 120, 0.28);
}

.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 58px 22px 22px;
  background: rgba(1, 6, 4, 0.88);
  backdrop-filter: blur(12px);
}

.media-viewer[hidden] {
  display: none;
}

.media-viewer img {
  max-width: min(100%, 1280px);
  max-height: calc(100vh - 96px);
  border-radius: var(--radius-sm);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
  object-fit: contain;
}

.media-viewer-close {
  position: fixed;
  top: 18px;
  right: 22px;
  appearance: none;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid rgba(22, 232, 163, 0.26);
  border-radius: 999px;
  background: rgba(13, 30, 23, 0.86);
  color: var(--text-heading);
  font-family: var(--font-mono);
  cursor: pointer;
}

.viewer-open {
  overflow: hidden;
}

.file-chip {
  display: inline-flex;
  color: var(--emerald);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  border: 1px solid rgba(22, 232, 163, 0.25);
  border-radius: 999px;
  padding: 8px 12px;
}

.media-more {
  margin-top: 16px;
}

.media-loader {
  min-height: 44px;
  margin-top: 16px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-align: center;
}

.ai-box {
  display: grid;
  gap: 12px;
}

.ai-box textarea,
.ai-response,
.settings-form input,
.settings-form select {
  width: 100%;
  color: var(--text-body);
  background: rgba(1, 6, 4, 0.58);
  border: 1px solid rgba(22, 232, 163, 0.14);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
}

.ai-box textarea {
  min-height: 160px;
  padding: 14px;
  resize: vertical;
}

.settings-form {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  background: linear-gradient(165deg, rgba(18, 41, 31, 0.7), rgba(6, 14, 10, 0.82));
}

.settings-stack {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.settings-card {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  background: linear-gradient(165deg, rgba(18, 41, 31, 0.54), rgba(6, 14, 10, 0.78));
  overflow: hidden;
}

.settings-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.settings-card summary::-webkit-details-marker {
  display: none;
}

.settings-card summary strong {
  display: block;
  color: var(--text-heading);
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.settings-card .panel-label {
  margin-bottom: 6px;
}

.settings-card .settings-form {
  margin: 0 16px 16px;
}

.hosting-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 16px 18px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  background: rgba(2, 12, 8, 0.48);
}

.hosting-actions .settings-note {
  flex: 1 1 260px;
}

.form-field {
  min-width: 0;
}

.form-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.settings-form input,
.settings-form select {
  appearance: none;
  min-height: 42px;
  padding: 10px 12px;
}

.settings-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.form-actions {
  align-self: end;
}

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

.cloudflare-settings .form-actions {
  grid-column: 1 / -1;
  justify-content: start;
}

.ai-box .control-btn {
  width: max-content;
  min-width: 120px;
}

.ai-response {
  min-height: 160px;
  margin-top: 14px;
  padding: 14px;
  white-space: pre-wrap;
}

.settings-strip {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 10px 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.settings-strip span {
  color: var(--text-dim);
}

.settings-strip strong {
  color: var(--text-heading);
}

.docker-list {
  margin-top: 16px;
}

.docker-row {
  grid-template-columns: minmax(180px, 1fr) minmax(130px, auto) auto;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius-sm);
}

.docker-name {
  min-width: 0;
}

.docker-name strong {
  font-size: 1rem;
}

.docker-actions {
  display: flex;
  gap: 8px;
  justify-content: end;
  flex-wrap: wrap;
}

.docker-actions .mini-btn {
  padding: 8px 11px;
  font-size: 0.72rem;
}

.empty-state {
  display: grid;
  place-content: center;
  min-height: 190px;
  text-align: center;
}

.empty-state strong {
  font-size: 1.25rem;
}

@media (max-width: 900px) {
  .panel-dashboard,
  .welcome-hero,
  .server-hero {
    grid-template-columns: 1fr;
  }

  .panel-sidebar {
    position: static;
  }

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

  .panel-nav button,
  .panel-nav a {
    justify-content: center;
    text-align: center;
  }

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

@media (max-width: 760px) {
  .panel-shell {
    width: min(100% - 32px, 1220px);
    padding-top: 22px;
  }

  .panel-main {
    min-height: auto;
    padding: 14px;
  }

  .panel-view {
    min-height: auto;
  }

  .panel-card {
    margin-top: 13vh;
    padding: 32px 24px;
  }

  .overview-grid,
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .media-grid {
    column-count: 2;
  }

  .settings-strip,
  .docker-row,
  .settings-form {
    grid-template-columns: 1fr;
  }

  .docker-actions {
    justify-content: start;
  }

  .section-actions {
    justify-content: start;
  }
}

@media (max-width: 520px) {
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-nav,
  .server-actions,
  .media-grid {
    grid-template-columns: 1fr;
  }

  .media-grid {
    column-count: 1;
  }

  .welcome-hero,
  .server-hero,
  .metric-card,
  .panel-tile {
    padding: 20px;
  }
}
