:root {
  color-scheme: dark;
  --app-icon-size: 92px;
  --table-width: 90vw;
  --bg: #111315;
  --panel: #181b1f;
  --line: #2a3037;
  --text: #eef2f6;
  --muted: #9aa4b2;
  --accent: #4f8cff;
  --accent-strong: #2f6fe5;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.portal-menu {
  position: absolute;
  left: 18px;
  top: 16px;
  z-index: 60;
}

.home-logo-button {
  position: relative;
  z-index: 20;
  width: 270px;
  height: 122px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent url("/assets/home-button.png") center center / 238% auto no-repeat;
  color: rgba(242, 248, 255, 0.94);
  text-decoration: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-shadow:
    0 0 9px rgba(92, 186, 255, 0.66),
    0 1px 8px rgba(0, 0, 0, 0.85);
  filter:
    hue-rotate(-34deg)
    saturate(0.82)
    brightness(1.04)
    drop-shadow(0 0 10px rgba(73, 163, 255, 0.26))
    drop-shadow(0 0 12px rgba(133, 98, 255, 0.1));
  transition: transform 160ms ease, filter 160ms ease;
  cursor: pointer;
}

.home-logo-button:hover {
  transform: translateY(-1px) scale(1.025);
  filter:
    hue-rotate(-34deg)
    saturate(0.9)
    brightness(1.08)
    drop-shadow(0 0 14px rgba(84, 178, 255, 0.36))
    drop-shadow(0 0 14px rgba(133, 98, 255, 0.16));
}

.home-logo-button:active {
  transform: translateY(0) scale(0.98);
}

.home-logo-button span {
  transform: translateY(-1px);
  pointer-events: none;
}

.portal-dropdown {
  position: absolute;
  left: 8px;
  top: 92px;
  width: min(284px, calc(100vw - 36px));
  padding: 14px;
  border: 1px solid rgba(111, 163, 255, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(11, 18, 36, 0.94), rgba(20, 11, 39, 0.92)),
    radial-gradient(circle at 20% 0%, rgba(68, 169, 255, 0.22), transparent 44%),
    radial-gradient(circle at 88% 18%, rgba(230, 74, 255, 0.16), transparent 38%);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.42),
    0 0 28px rgba(68, 153, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top left;
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    visibility 160ms ease;
  pointer-events: none;
}

.portal-menu:hover .portal-dropdown,
.portal-menu:focus-within .portal-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.portal-dropdown::before {
  content: "";
  position: absolute;
  left: 28px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-left: 1px solid rgba(111, 163, 255, 0.28);
  border-top: 1px solid rgba(111, 163, 255, 0.28);
  background: rgba(11, 18, 36, 0.94);
  transform: rotate(45deg);
}

.portal-primary-link,
.portal-section-title,
.portal-link-list a {
  position: relative;
  color: rgba(241, 247, 255, 0.94);
  text-decoration: none;
}

.portal-primary-link {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgba(114, 170, 255, 0.2);
  border-radius: 7px;
  background: linear-gradient(90deg, rgba(29, 54, 91, 0.58), rgba(49, 28, 80, 0.5));
  font-size: 13px;
  font-weight: 780;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-align: center;
}

.portal-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(154, 179, 219, 0.13);
}

.portal-section-title {
  display: flex;
  min-height: 36px;
  align-items: center;
  padding: 0 4px;
  color: rgba(240, 247, 255, 0.96);
  font-size: 18px;
  font-weight: 840;
  letter-spacing: 0.01em;
  text-shadow:
    0 0 9px rgba(91, 183, 255, 0.58),
    0 0 12px rgba(223, 71, 255, 0.3),
    0 1px 8px rgba(0, 0, 0, 0.85);
}

.portal-link-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.portal-link-list a {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(121, 160, 221, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(219, 231, 250, 0.9);
  font-size: 13px;
  font-weight: 720;
}

.portal-primary-link:hover,
.portal-section-title:hover,
.portal-link-list a:hover {
  border-color: rgba(128, 195, 255, 0.5);
  color: #ffffff;
  background: linear-gradient(90deg, rgba(33, 88, 146, 0.5), rgba(82, 40, 128, 0.42));
  box-shadow: 0 0 16px rgba(82, 170, 255, 0.18);
}

.main-page {
  min-height: 100vh;
  overflow: hidden;
  background: #020514 url("/assets/main-bg.png") center center / cover no-repeat;
}

.documentation-page {
  min-height: 100vh;
  overflow: hidden;
  background: #03051a url("/assets/documentation-bg.png") center center / cover no-repeat;
}

.documentation-page.docs-content-route {
  overflow-y: auto;
}

.documentation-stage {
  position: relative;
  width: 100vw;
  min-height: 100vh;
}

.documentation-section-button {
  background-image: url("/assets/db-button.png");
  filter:
    hue-rotate(34deg)
    saturate(1.28)
    drop-shadow(0 0 20px rgba(119, 78, 255, 0.68))
    drop-shadow(0 0 18px rgba(0, 174, 255, 0.28));
}

.documentation-section-button:hover {
  filter:
    hue-rotate(34deg)
    saturate(1.45)
    drop-shadow(0 0 26px rgba(152, 96, 255, 0.82))
    drop-shadow(0 0 22px rgba(0, 174, 255, 0.38));
}

.documentation-apps-button {
  left: var(--docs-apps-button-x, 0vw);
  top: var(--docs-apps-button-y, 23.1vh);
  width: min(var(--docs-apps-button-width, 35.9vw), 1100px);
  font-size: clamp(12px, var(--docs-apps-button-font-size, 1.05vw), 34px);
}

.documentation-google-button {
  left: var(--docs-google-button-x, 0vw);
  top: var(--docs-google-button-y, 40.4vh);
  width: min(var(--docs-google-button-width, 35.9vw), 1100px);
  font-size: clamp(12px, var(--docs-google-button-font-size, 1.05vw), 34px);
}

.docs-content-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow-x: hidden;
  background: #02030c;
}

.docs-content-page img {
  display: block;
  width: 100vw;
  height: auto;
}

.main-stage {
  position: relative;
  width: 100vw;
  min-height: 100vh;
}

.main-image-button {
  position: absolute;
  aspect-ratio: 760 / 320;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background-color: transparent;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  color: #ffffff;
  text-decoration: none;
  font-size: clamp(12px, var(--main-button-font-size, 1.12vw), 30px);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-shadow:
    0 0 10px rgba(86, 172, 255, 0.95),
    0 0 18px rgba(228, 58, 255, 0.7),
    0 2px 10px rgba(0, 0, 0, 0.95);
  filter: drop-shadow(0 0 18px rgba(44, 123, 255, 0.5));
  transition: transform 160ms ease, filter 160ms ease;
  touch-action: none;
  user-select: none;
  pointer-events: none;
}

.main-db-button {
  left: var(--main-apps-button-x, 20vw);
  top: var(--main-apps-button-y, 30vh);
  width: min(var(--main-apps-button-width, 22.3vw), 662px);
  background-image: url("/assets/db-button.png");
  font-size: clamp(12px, var(--main-apps-button-font-size, 0.8vw), 30px);
}

.main-center-button {
  left: var(--main-center-button-x, 38.1vw);
  top: var(--main-center-button-y, 29.7vh);
  width: min(var(--main-center-button-width, 23.6vw), 680px);
  background-image: url("/assets/center-button.png");
  font-family: inherit;
  font-size: clamp(12px, var(--main-center-button-font-size, 0.8vw), 30px);
}

.settings-mode .main-image-button span {
  cursor: grab;
}

.main-image-button:hover,
.main-image-button:has(span:hover) {
  transform: translateY(-2px) scale(1.018);
  filter:
    drop-shadow(0 0 22px rgba(61, 153, 255, 0.72))
    drop-shadow(0 0 20px rgba(240, 45, 255, 0.36));
}

.main-image-button:active,
.main-image-button:has(span:active) {
  transform: translateY(0) scale(0.992);
}

.main-image-button span {
  position: absolute;
  inset: 29% 20% 28%;
  display: grid;
  place-items: center;
  transform: translateY(-2%);
  pointer-events: auto;
  cursor: pointer;
}

.main-image-button.is-dragging span {
  cursor: grabbing;
  transition: none;
}

.main-settings-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 6;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(89, 149, 255, 0.32);
  border-radius: 5px;
  background: linear-gradient(90deg, rgba(7, 19, 43, 0.72), rgba(24, 8, 45, 0.68));
  color: rgba(219, 232, 255, 0.78);
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  box-shadow:
    0 0 14px rgba(52, 126, 255, 0.24),
    inset 0 0 10px rgba(218, 61, 255, 0.08);
  cursor: pointer;
}

.main-settings-toggle:hover,
.main-settings-toggle[aria-expanded="true"] {
  color: #ffffff;
  border-color: rgba(110, 174, 255, 0.62);
  box-shadow:
    0 0 18px rgba(52, 126, 255, 0.42),
    0 0 16px rgba(221, 54, 255, 0.18),
    inset 0 0 12px rgba(218, 61, 255, 0.12);
}

.main-controls {
  position: fixed;
  right: 18px;
  bottom: 56px;
  z-index: 5;
  width: min(360px, calc(100vw - 36px));
  max-height: min(78vh, 720px);
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(96, 148, 255, 0.34);
  border-radius: 8px;
  background: rgba(5, 9, 22, 0.72);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
}

.main-controls[hidden],
.main-control-section[hidden] {
  display: none;
}

.main-control-section {
  display: grid;
  gap: 10px;
}

.main-control-section h2 {
  margin: 0;
  color: rgba(238, 242, 246, 0.9);
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-controls label {
  display: grid;
  gap: 6px;
  color: rgba(238, 242, 246, 0.72);
  font-size: 12px;
}

.main-control-picker {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(96, 148, 255, 0.2);
}

.main-controls input,
.main-controls select {
  min-height: 34px;
  border: 1px solid rgba(96, 148, 255, 0.3);
  border-radius: 6px;
  background: rgba(4, 8, 18, 0.72);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
}

.main-controls select {
  cursor: pointer;
}

.main-controls input[type="range"] {
  padding: 0;
  accent-color: #4f8cff;
}

.main-control-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.main-control-actions .button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.shell {
  width: min(98vw, calc(100vw - 40px));
  margin: 0 auto;
  padding: 32px 0;
}

.dashboard-page .shell {
  padding-top: 138px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 0;
  font-size: 32px;
  font-weight: 700;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--accent-strong);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.button.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.button:disabled {
  opacity: 0.55;
  cursor: default;
}

.settings {
  display: grid;
  grid-template-columns: minmax(220px, 360px);
  gap: 12px;
  margin-bottom: 14px;
}

.naming-templates-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr)) auto;
  align-items: end;
  gap: 12px;
  margin: -10px 0 14px auto;
  max-width: 980px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.naming-templates-panel[hidden] {
  display: none;
}

.template-tabs {
  display: flex;
  gap: 8px;
  grid-column: 1 / -1;
}

.template-tab.active {
  border-color: rgba(80, 139, 249, 0.72);
  background: rgba(80, 139, 249, 0.16);
  color: var(--text);
}

.naming-templates-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.naming-templates-panel textarea {
  min-height: 76px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11161b;
  color: var(--text);
  padding: 8px 10px;
  font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.naming-templates-panel input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11161b;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
}

.naming-template-actions {
  display: grid;
  gap: 8px;
  min-width: 120px;
}

.settings label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.settings input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.settings-panel {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.settings-panel[hidden] {
  display: none;
}

.settings-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.settings-panel input,
.settings-panel select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11161b;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
}

.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  user-select: none;
}

.toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.toolbar-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
}

.toolbar-control select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0 8px;
  font: inherit;
}

.table-wrap {
  width: min(var(--table-width), calc(100vw - 40px));
  margin: 0 auto;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  min-width: 1500px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

a {
  color: #7fb0ff;
}

.url-link {
  display: block;
  max-width: 360px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.url-cell {
  min-width: 240px;
  max-width: 380px;
}

.url-cell-test_link {
  width: 468px;
  min-width: 442px;
  max-width: 481px;
}

.url-cell-test_link .url-link {
  max-width: 445px;
}

.url-cell-config_link .url-link {
  max-width: 356px;
}

.url-cell-config_link {
  width: 378px;
  min-width: 359px;
  max-width: 378px;
}

.url-cell-test_confluence_url .url-link {
  max-width: 421px;
}

.url-cell-test_confluence_url {
  width: 442px;
  min-width: 421px;
  max-width: 455px;
}

.app-icon {
  display: block;
  width: var(--app-icon-size);
  height: var(--app-icon-size);
  border-radius: 8px;
  background: #242a31;
  object-fit: cover;
}

.empty-icon {
  border: 1px solid var(--line);
  opacity: 0.35;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.truncate {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.naming-cell {
  min-width: 190px;
  max-width: 250px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.countries-cell {
  min-width: 190px;
  max-width: 250px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.status {
  font-weight: 700;
}

.status-alive {
  color: #66d48f;
}

.status-awaiting_test_app,
.status-waiting_for_tester,
.status-testing,
.status-failure_confirmation {
  color: #f2c96d;
}

.status-dead,
.status-manual_removed {
  color: #ff7d7d;
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 24px, 1180px);
    padding: 20px 0;
  }

  .topbar,
  .settings,
  .naming-templates-panel {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  h1 {
    font-size: 26px;
  }
}
