:root {
  --bg-top: #eef3f6;
  --bg-bottom: #d4dee4;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(16, 24, 40, 0.11);
  --shadow: 0 24px 80px rgba(15, 30, 44, 0.16);
  --text: #112033;
  --muted: #617182;
  --accent: #0d5c63;
  --accent-strong: #093d42;
  --accent-soft: rgba(13, 92, 99, 0.12);
  --gold: #c19a5b;
  --success: #1f845a;
  --danger: #b94b4b;
  --font-display: "Manrope", sans-serif;
  --font-body: "IBM Plex Sans Thai", "Segoe UI", sans-serif;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-pill: 999px;
  --max-width: 1200px;
  --statusbar-h: 180px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(193, 154, 91, 0.24), transparent 25%),
    radial-gradient(circle at right 10% top 20%, rgba(13, 92, 99, 0.16), transparent 20%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 70%);
}

.page-shell {
  width: min(calc(100% - 32px), var(--max-width));
  margin: 0 auto;
  padding: 32px 0 calc(var(--statusbar-h) + var(--safe-bottom) + 24px);
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.9fr);
  gap: 24px;
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.72)),
    linear-gradient(135deg, rgba(13, 92, 99, 0.16), transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -40px -70px auto;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(13, 92, 99, 0.18), transparent 66%);
}

.eyebrow,
.section-label {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1,
.section-heading h2,
.portal-card h3 {
  margin: 0;
  font-family: var(--font-display);
}

.hero h1 {
  max-width: 10ch;
  font-size: clamp(2.6rem, 5vw, 4.9rem);
  line-height: 0.96;
}

.hero__content--wide {
  position: relative;
  z-index: 1;
}

.hero__headline {
  max-width: 16ch;
  margin: 18px 0 0;
  font: 700 clamp(1.05rem, 2vw, 1.2rem) / 1.45 var(--font-body);
  color: var(--accent-strong);
}

.hero__lead,
.section-note,
.portal-card p {
  color: var(--muted);
  line-height: 1.75;
}

.hero__lead {
  max-width: 58ch;
  margin: 16px 0 0;
  font-size: clamp(1rem, 2vw, 1.1rem);
}

.hero__side {
  position: relative;
  z-index: 1;
}

.hero__panel {
  height: 100%;
  padding: 22px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 247, 249, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.hero__panel-label {
  margin: 0 0 14px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-action,
.copy-button,
.portal-card__link {
  border: 0;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.quick-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(13, 92, 99, 0.12);
  border-radius: var(--radius-pill);
  color: var(--text);
  font: 600 0.92rem var(--font-body);
  background: rgba(255, 255, 255, 0.9);
}

.quick-action:hover,
.quick-action:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(8, 63, 68, 0.14);
}

.quick-action__icon {
  display: grid;
  place-items: center;
}

.quick-action__icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.hero__meta-item {
  padding: 14px 16px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 18px;
  background: rgba(13, 92, 99, 0.04);
}

.hero__meta-label,
.portal-card__eyebrow {
  display: block;
  margin-bottom: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.copy-button {
  min-height: 50px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  color: white;
  font: 700 0.96rem var(--font-body);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 16px 30px rgba(8, 63, 68, 0.24);
}

.copy-button:hover,
.copy-button:focus-visible,
.portal-card:hover .portal-card__link,
.portal-card__link:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(8, 63, 68, 0.22);
}

.dashboard-section {
  margin-top: 28px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.section-note {
  margin: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.search-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 0 18px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 36px rgba(15, 30, 44, 0.06);
  backdrop-filter: blur(16px);
}

.search-field svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font: 500 1rem var(--font-body);
}

.toolbar__summary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar__badge {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  color: var(--accent-strong);
  font-weight: 700;
  background: rgba(13, 92, 99, 0.1);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
}

.portal-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  min-height: 290px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 251, 0.88));
  box-shadow: 0 16px 48px rgba(15, 30, 44, 0.1);
  grid-column: span 6;
  transform: translateY(18px);
  opacity: 0;
  animation: card-enter 560ms ease forwards;
}

.portal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(13, 92, 99, 0.09), transparent 45%);
  opacity: 0;
  transition: opacity 180ms ease;
}

.portal-card:hover::before {
  opacity: 1;
}

.portal-card__icon {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--accent-strong);
  background: linear-gradient(135deg, rgba(13, 92, 99, 0.12), rgba(193, 154, 91, 0.18));
}

.portal-card__icon svg {
  width: 30px;
  height: 30px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.portal-card__body h3 {
  font-size: 1.5rem;
}

.portal-card__body p {
  margin: 10px 0 0;
}

.portal-card__link {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(13, 92, 99, 0.18);
  border-radius: var(--radius-pill);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  background: var(--panel-strong);
}

.portal-card__link svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.empty-state {
  padding: 28px;
  border: 1px dashed rgba(16, 24, 40, 0.16);
  border-radius: 24px;
  text-align: center;
  background: rgba(255, 255, 255, 0.66);
}

.empty-state h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.status-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(12px + var(--safe-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  background: rgba(7, 20, 32, 0.86);
  color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 40px rgba(5, 17, 29, 0.28);
  backdrop-filter: blur(16px);
  z-index: 50;
}

.status-bar__item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-bar__ports {
  flex-wrap: wrap;
  justify-content: end;
}

.status-bar__label {
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.port-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.port-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.95rem;
}

.statusbar-toggle {
  display: none;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 92px;
  min-width: 180px;
  padding: 14px 18px;
  border-radius: 16px;
  color: white;
  font-weight: 600;
  background: rgba(17, 24, 39, 0.92);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes card-enter {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 960px) {
  .hero,
  .status-bar {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: start;
  }

  .section-heading,
  .toolbar,
  .status-bar__ports {
    flex-direction: column;
    align-items: start;
  }

  .hero__meta {
    grid-template-columns: 1fr 1fr;
  }

  .portal-card {
    grid-column: span 12;
  }
}

@media (max-width: 768px) {
  :root {
    --statusbar-h: 84px;
  }

  .page-shell {
    padding-bottom: calc(var(--statusbar-h) + var(--safe-bottom) + 28px);
  }

  #serverBar,
  .server-bar,
  .statusbar {
    gap: 12px;
    padding: 16px 18px calc(16px + var(--safe-bottom));
  }

  #serverBar.is-collapsed,
  .server-bar.is-collapsed,
  .statusbar.is-collapsed {
    height: 56px;
    overflow: hidden;
    padding-top: 14px;
    padding-bottom: calc(14px + var(--safe-bottom));
  }

  .statusbar-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    padding: 8px 10px;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    z-index: 1;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(calc(100% - 20px), var(--max-width));
    padding-top: 20px;
  }

  .hero,
  .portal-card,
  .status-bar {
    padding: 20px;
  }

  .hero h1 {
    max-width: none;
  }

  .search-field,
  .toolbar__summary,
  .quick-actions,
  .hero__meta,
  .quick-action,
  .portal-card__link {
    width: 100%;
  }

  .toolbar__badge,
  .quick-action,
  .portal-card__link {
    justify-content: center;
  }

  .hero__meta {
    grid-template-columns: 1fr;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 84px;
    min-width: 0;
  }
}
