:root {
  --bg: #f2f6f8;
  --bg-deep: #e8eef2;
  --card: rgba(255, 255, 255, 0.78);
  --card-solid: #ffffff;
  --ink: #182129;
  --muted: #5d6975;
  --line: #ccd6df;
  --accent: #0f7f84;
  --accent-strong: #0a666d;
  --danger-bg: #fff1e9;
  --danger-line: #f5b68a;
  --danger-ink: #8b4418;
  --result-bg: #0f1720;
  --result-line: #27364a;
  --result-ink: #eaf4ff;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow: 0 18px 44px rgba(18, 38, 54, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Manrope", "IBM Plex Sans", "Segoe UI", sans-serif;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, #d8f0ef 0%, transparent 34%),
    radial-gradient(circle at 95% 10%, #fde7db 0%, transparent 32%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  position: relative;
}

.bg-shape {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  filter: blur(1px);
}

.bg-shape-one {
  width: 360px;
  height: 360px;
  border-radius: 50%;
  top: -180px;
  right: -120px;
  background: radial-gradient(circle, rgba(15, 127, 132, 0.16) 0%, rgba(15, 127, 132, 0) 70%);
}

.bg-shape-two {
  width: 420px;
  height: 420px;
  border-radius: 50%;
  bottom: -220px;
  left: -140px;
  background: radial-gradient(circle, rgba(255, 156, 101, 0.18) 0%, rgba(255, 156, 101, 0) 70%);
}

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 20px 34px;
  position: relative;
  z-index: 1;
}

.hero {
  border: 1px solid rgba(204, 214, 223, 0.8);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--card);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr auto;
  align-items: end;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 700;
}

.hero h1 {
  margin: 5px 0 0;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  line-height: 1.05;
}

.hero-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.role-switch {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.role-switch label {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.quick-metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 18px;
}

.metric-card {
  border: 1px solid rgba(204, 214, 223, 0.85);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  padding: 10px 12px;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.metric-value {
  margin-top: 4px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #122333;
}

.metric-meta {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.tab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.tab:hover {
  border-color: #8cb8bc;
}

.tab.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 127, 132, 0.32);
}

.admin-only {
  display: none;
}

.admin-only.visible {
  display: inline-block;
}

.panel {
  display: none;
  border: 1px solid rgba(204, 214, 223, 0.85);
  border-radius: var(--radius-lg);
  padding: 18px;
  background: var(--card);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.panel.active {
  display: block;
  animation: panel-in 0.24s ease;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-head {
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: #33414f;
  font-weight: 600;
}

.check-label {
  flex-direction: row;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card-solid);
  padding: 10px 12px;
  font-weight: 500;
}

input,
select,
button {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 11px;
  font: inherit;
  color: var(--ink);
  background: var(--card-solid);
}

input:disabled {
  background: #eef3f6;
  color: #6f7d89;
  cursor: not-allowed;
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid rgba(15, 127, 132, 0.35);
  outline-offset: 1px;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.primary-btn,
button[type="submit"] {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  border: 0;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(15, 127, 132, 0.3);
}

.primary-btn:hover,
button[type="submit"]:hover {
  filter: brightness(1.03);
}

.primary-btn:active,
button[type="submit"]:active {
  transform: translateY(1px);
}

.meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.91rem;
}

.admin-disabled {
  margin-bottom: 12px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-line);
  color: var(--danger-ink);
  border-radius: var(--radius-md);
  padding: 9px 10px;
}

.admin-actions {
  margin-top: 12px;
}

.result {
  margin: 14px 0 0;
  background: linear-gradient(165deg, var(--result-bg) 0%, #111f2d 100%);
  color: var(--result-ink);
  border: 1px solid var(--result-line);
  border-radius: 16px;
  padding: 12px;
  min-height: 180px;
  overflow-x: auto;
}

.result.is-loading {
  position: relative;
}

.result.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgba(255, 255, 255, 0) 8%, rgba(255, 255, 255, 0.07) 18%, rgba(255, 255, 255, 0) 33%);
  animation: loading-sheen 1s linear infinite;
  pointer-events: none;
}

.result.is-error {
  border-color: #8a4a31;
}

@keyframes loading-sheen {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

.summary-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 10px;
}

.summary-item {
  background: #182637;
  border: 1px solid #304861;
  border-radius: 10px;
  padding: 10px;
}

.summary-item .k {
  color: #afc7dc;
  font-size: 0.82rem;
}

.summary-item .v {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 3px;
}

.warn {
  margin: 8px 0;
  background: #3f2715;
  border: 1px solid #81512e;
  color: #ffd7b3;
  border-radius: 8px;
  padding: 8px 10px;
}

.list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.client-box {
  margin-top: 12px;
  background: #17283a;
  border: 1px solid #345374;
  border-radius: 10px;
  padding: 10px;
}

.client-title {
  font-size: 0.85rem;
  color: #b8cee1;
  margin-bottom: 6px;
}

.client-text {
  color: #f0f7ff;
  line-height: 1.4;
}

.copy-btn {
  margin-top: 8px;
  border: 1px solid #4f6f90;
  background: #21364c;
  color: #ebf5ff;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .role-switch {
    min-width: 0;
  }

  .panel {
    padding: 14px;
  }

  .quick-metrics {
    grid-template-columns: 1fr;
  }

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

  .check-label {
    min-height: 0;
  }
}
