:root {
  --bg: #0b1220;
  --bg-2: #121a2b;
  --text: #edf2ff;
  --muted: #9aa9c5;
  --card: rgba(15, 23, 42, 0.78);
  --border: rgba(125, 154, 206, 0.28);
  --accent: #9f1d21;
  --accent-hover: #8a181c;
  --accent-soft: rgba(159, 29, 33, 0.38);
  --error: #ff7b7b;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at 15% 20%, #3a1f2d 0%, transparent 35%),
    radial-gradient(circle at 85% 80%, #1a3f3d 0%, transparent 32%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
}

.page {
  min-height: 100%;
  padding: 1.25rem;
}

.shell {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);
}

.shell-wide {
  width: 100%;
}

.shell-narrow {
  max-width: 760px;
  margin: 0 auto;
}

.brand {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.logo {
  width: min(190px, 52vw);
  height: auto;
  display: block;
  filter: drop-shadow(0 7px 18px rgba(0, 0, 0, 0.35));
}

.page-title {
  margin: 0;
  text-align: center;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.page-subtitle {
  margin: 0.35rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  margin-top: 1rem;
}

.content-column {
  width: 100%;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.form-column {
  width: 100%;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.button-link {
  display: inline-block;
  text-decoration: none;
  border-radius: 10px;
  padding: 0.7rem 0.95rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  transition: background-color 0.18s ease, transform 0.12s ease;
}

.button-link:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.form {
  display: grid;
  gap: 0.75rem;
}

.form label {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-size: 0.95rem;
  color: #c9d6ef;
}

.required-symbol {
  color: #fb7185;
  font-weight: 800;
}

.tooltip-symbol {
  width: 0.9rem;
  height: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: transparent;
  color: #f6c9ca;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: help;
  vertical-align: middle;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
}

.tooltip-symbol:hover {
  border-color: #c7373c;
  color: #fff;
}

.tooltip-symbol::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 0.48rem);
  left: 50%;
  transform: translateX(-50%) translateY(0.18rem);
  min-width: 15rem;
  max-width: 21rem;
  padding: 0.58rem 0.7rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: normal;
  text-align: left;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 24;
}

.tooltip-symbol::before {
  content: "";
  position: absolute;
  top: calc(100% + 0.18rem);
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 24;
}

.tooltip-symbol:hover::after,
.tooltip-symbol:hover::before,
.tooltip-symbol:focus-visible::after,
.tooltip-symbol:focus-visible::before {
  opacity: 1;
}

.tooltip-symbol:hover::after,
.tooltip-symbol:focus-visible::after {
  transform: translateX(-50%) translateY(0);
}

.form input {
  padding: 0.7rem 0.82rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  color: var(--text);
  background: rgba(8, 16, 32, 0.75);
}

.form select {
  padding: 0.7rem 0.82rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  color: var(--text);
  background: rgba(8, 16, 32, 0.75);
}

.form textarea {
  min-height: 112px;
  resize: vertical;
  padding: 0.7rem 0.82rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.4;
  color: var(--text);
  background: rgba(8, 16, 32, 0.75);
}

.form input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.form textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.form select:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

/* Keep browser autofill fields visually consistent with dark theme. */
.form input:-webkit-autofill,
.form input:-webkit-autofill:hover,
.form input:-webkit-autofill:focus,
.form textarea:-webkit-autofill,
.form textarea:-webkit-autofill:hover,
.form textarea:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0px 1000px rgba(8, 16, 32, 0.95) inset;
  box-shadow: 0 0 0px 1000px rgba(8, 16, 32, 0.95) inset;
  border: 1px solid var(--border);
  transition: background-color 600000s 0s, color 600000s 0s;
}

.form button[type="submit"] {
  margin-top: 0.6rem;
  border: none;
  border-radius: 10px;
  padding: 0.78rem 0.95rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.12s ease;
}

.form button[type="submit"]:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.error {
  min-height: 1.25rem;
  margin: 0.25rem 0 0;
  color: var(--error);
  font-size: 0.9rem;
}

.welcome-shell {
  text-align: center;
}

.debug-area {
  margin-top: 1rem;
  border: 1px dashed rgba(254, 215, 170, 0.45);
  background: rgba(120, 53, 15, 0.2);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}

.debug-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fdba74;
}

.debug-actions {
  margin-top: 0.55rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.debug-btn {
  border: 1px solid rgba(251, 146, 60, 0.55);
  background: rgba(124, 45, 18, 0.65);
  color: #ffedd5;
  border-radius: 8px;
  padding: 0.38rem 0.62rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.debug-btn:hover:not(:disabled) {
  background: rgba(154, 52, 18, 0.78);
}

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 1rem;
  background: rgba(8, 16, 32, 0.72);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  border-bottom: 1px solid rgba(125, 154, 206, 0.2);
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.7rem;
  font-size: 0.9rem;
  color: var(--text);
}

th {
  position: sticky;
  top: 0;
  background: rgba(12, 22, 40, 0.96);
  z-index: 1;
  font-weight: 700;
}

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

@media (max-width: 640px) {
  .shell {
    padding: 1.4rem;
    border-radius: 14px;
  }

  .form-column {
    max-width: 100%;
  }

  .content-column {
    max-width: 100%;
  }
}
