:root {
  --refresh-blue: #4f7cff;
  --refresh-blue-dark: #315dcc;
  --refresh-orange: #ff9b52;
  --refresh-ink: #172033;
  --refresh-muted: #657189;
  --refresh-line: #e1e6ef;
  --refresh-bg: #f4f6fb;
  --refresh-card: rgba(255, 255, 255, 0.96);
  --refresh-shadow: 0 24px 70px rgba(25, 42, 78, 0.1);
}

html {
  scroll-behavior: smooth;
  background: var(--refresh-bg);
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  color: #fff;
  background: rgba(79, 124, 255, 0.68);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(79, 124, 255, 0.38) !important;
  outline-offset: 3px;
}

/* Legal and license documents */
body:has(.legal),
body:has(.license-wrap) {
  background:
    radial-gradient(circle at 12% 7%, rgba(79, 124, 255, 0.13), transparent 26rem),
    radial-gradient(circle at 92% 88%, rgba(255, 155, 82, 0.11), transparent 24rem),
    var(--refresh-bg);
  background-attachment: fixed;
  color: var(--refresh-ink);
}

.legal,
.license-wrap {
  width: min(1040px, calc(100% - 40px));
  max-width: none;
  padding: 52px 0 88px;
}

.legal nav {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 16px;
  padding: 6px;
  border: 1px solid rgba(222, 228, 238, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 24px rgba(27, 43, 76, 0.05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.legal nav a {
  margin: 0;
  padding: 9px 13px;
  border-radius: 9px;
  color: #526079;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.legal nav a:hover {
  color: var(--refresh-blue-dark);
  background: #eef3ff;
}

.legal article,
.license-card {
  position: relative;
  overflow: hidden;
  padding: clamp(26px, 5vw, 56px);
  border: 1px solid rgba(218, 224, 235, 0.92);
  border-radius: 28px;
  background: var(--refresh-card);
  box-shadow: var(--refresh-shadow), inset 0 1px 0 #fff;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.legal article::before,
.license-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--refresh-blue), #735ee9, var(--refresh-orange));
}

.legal h1,
.license-card h1 {
  margin: 0 0 10px;
  color: var(--refresh-ink);
  font-size: clamp(28px, 4.2vw, 42px);
  line-height: 1.16;
  font-weight: 850;
  letter-spacing: -0.045em;
}

.legal h2,
.license-card h2 {
  margin: 42px 0 12px;
  padding-top: 22px;
  border-top: 1px solid #edf0f5;
  color: #222d43;
  font-size: 21px;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.legal h3 {
  color: #2d3950;
}

.legal p,
.legal li,
.license-card p,
.license-card li {
  color: #4d586d;
  line-height: 1.84;
}

.legal .meta,
.license-card .meta {
  color: #7b8699;
  font-size: 13px;
}

.legal a,
.license-card a,
.license-wrap .back {
  color: var(--refresh-blue-dark);
  font-weight: 700;
  text-underline-offset: 3px;
}

.license-wrap .back {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-bottom: 15px;
  padding: 0 14px;
  border: 1px solid var(--refresh-line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 22px rgba(25, 42, 78, 0.05);
  text-decoration: none;
}

.license-card .notice,
.legal .callout {
  padding: 18px 20px;
  border: 1px solid #dce6fb;
  border-radius: 14px;
  background: #f2f6ff;
  color: #385079;
}

.legal table {
  overflow: hidden;
  border: 1px solid var(--refresh-line);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 14px;
  font-size: 14px;
}

.legal th,
.legal td {
  border: 0;
  border-right: 1px solid var(--refresh-line);
  border-bottom: 1px solid var(--refresh-line);
  padding: 13px 14px;
}

.legal th {
  color: #364159;
  background: #f4f6fa;
  font-weight: 800;
}

.legal tr > :last-child {
  border-right: 0;
}

.legal tbody tr:last-child > * {
  border-bottom: 0;
}

/* Team management */
body:has(.team-page) {
  background:
    radial-gradient(circle at 13% 4%, rgba(79, 124, 255, 0.13), transparent 27rem),
    var(--refresh-bg);
}

.team-topbar {
  min-height: 74px;
  padding: 12px max(22px, calc((100% - 1080px) / 2));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  background: rgba(7, 11, 19, 0.94);
  box-shadow: 0 12px 36px rgba(21, 32, 58, 0.16);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.team-brand {
  padding-right: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.team-brand-word {
  color: #fff;
  font-size: 20px;
}

.team-brand img {
  width: 76px;
  filter: invert(1);
}

.team-topbar > div > strong {
  color: #fff;
}

.team-topbar > div > span {
  color: rgba(255, 255, 255, 0.58);
}

.team-page {
  width: min(1080px, calc(100% - 40px));
  margin: 36px auto 76px;
}

.team-card {
  margin-bottom: 16px;
  padding: clamp(24px, 4vw, 34px);
  border-color: rgba(218, 224, 235, 0.92);
  border-radius: 22px;
  background: var(--refresh-card);
  box-shadow: 0 16px 44px rgba(25, 42, 78, 0.07), inset 0 1px 0 #fff;
}

.team-card-heading h1 {
  color: var(--refresh-ink);
  font-size: clamp(25px, 4vw, 36px);
  font-weight: 850;
  letter-spacing: -0.04em;
}

.team-eyebrow {
  color: var(--refresh-blue) !important;
  letter-spacing: 0.1em;
}

.team-field input,
.team-field select,
.team-inline-form input,
.team-limit-control input {
  min-height: 48px;
  border-color: #dce2ec;
  border-radius: 12px;
  background: #f8f9fc;
}

.team-field input:focus,
.team-field select:focus,
.team-inline-form input:focus,
.team-limit-control input:focus {
  border-color: #7898f0;
  box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.11);
}

.team-button {
  min-height: 46px;
  border-radius: 12px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.team-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.team-button-primary {
  background: linear-gradient(135deg, #557ff4, #3d68dc);
  box-shadow: 0 10px 22px rgba(55, 98, 213, 0.2);
}

.team-button-primary:hover {
  background: linear-gradient(135deg, #638bf6, #315dcc);
}

.team-button-secondary {
  color: var(--refresh-blue-dark);
  background: #edf2ff;
}

.team-metrics > div,
.team-list-row,
.team-transfer-panel,
.team-policy-box,
.team-member-token-summary,
.team-quote {
  border-color: #e3e7ef;
  border-radius: 14px;
  background: #f8f9fc;
}

.team-metrics > div {
  padding: 18px;
}

.team-metrics strong {
  color: #27334b;
  font-size: 24px;
}

.team-message {
  border: 1px solid #d9e4fb;
  border-radius: 13px;
  background: #eff4ff;
}

/* Template download */
body:has(.td-wrap) {
  background:
    radial-gradient(circle at 13% 3%, rgba(79, 124, 255, 0.13), transparent 28rem),
    radial-gradient(circle at 91% 88%, rgba(255, 155, 82, 0.1), transparent 22rem),
    var(--refresh-bg);
  color: var(--refresh-ink);
}

.td-wrap {
  width: min(1180px, calc(100% - 40px));
  padding: 54px 0 82px;
}

.td-head {
  margin-bottom: 28px;
}

.td-head h1 {
  color: var(--refresh-ink);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.15;
  font-weight: 850;
  letter-spacing: -0.045em;
}

.td-head p {
  color: var(--refresh-muted);
}

.td-back {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--refresh-line);
  border-radius: 11px;
  color: var(--refresh-blue-dark);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 20px rgba(25, 42, 78, 0.05);
}

.td-usage {
  gap: 12px;
}

.td-stat {
  padding: 21px;
  border-color: rgba(218, 224, 235, 0.92);
  border-radius: 17px;
  background: var(--refresh-card);
  box-shadow: 0 12px 34px rgba(25, 42, 78, 0.06);
}

.td-stat strong {
  color: #27334b;
  font-size: 24px;
}

.td-tools {
  gap: 9px;
  padding: 9px;
  border-color: rgba(218, 224, 235, 0.92);
  border-radius: 16px;
  background: var(--refresh-card);
  box-shadow: 0 12px 34px rgba(25, 42, 78, 0.055);
}

.td-tools input,
.td-tools select {
  min-height: 48px;
  border-color: #dce2ec;
  border-radius: 11px;
  background: #f8f9fc;
}

.td-tools button,
.td-download {
  min-height: 48px;
  border-radius: 11px;
  background: linear-gradient(135deg, #557ff4, #3d68dc);
  box-shadow: 0 10px 22px rgba(55, 98, 213, 0.16);
}

.td-grid {
  gap: 16px;
}

.td-card {
  border-color: rgba(218, 224, 235, 0.92);
  border-radius: 18px;
  background: var(--refresh-card);
  box-shadow: 0 14px 36px rgba(25, 42, 78, 0.065);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.td-card:hover {
  box-shadow: 0 20px 46px rgba(25, 42, 78, 0.11);
  transform: translateY(-4px);
}

.td-thumb {
  background: #e9edf4;
}

.td-card-body {
  gap: 11px;
  padding: 17px;
}

.td-channel {
  color: var(--refresh-blue-dark);
  background: #edf2ff;
}

.td-empty,
.td-message {
  border-color: rgba(218, 224, 235, 0.92);
  border-radius: 16px;
  background: var(--refresh-card);
}

dialog {
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(16, 29, 58, 0.28);
}

@media (max-width: 700px) {
  .legal,
  .license-wrap,
  .team-page,
  .td-wrap {
    width: min(100% - 24px, 1180px);
    padding-top: 24px;
  }

  .legal article,
  .license-card,
  .team-card {
    border-radius: 20px;
  }

  .legal table {
    display: block;
    overflow-x: auto;
    font-size: 12px;
  }

  .team-topbar {
    padding: 10px 14px;
  }

  .team-brand {
    padding-right: 12px;
  }

  .team-brand-word {
    font-size: 17px;
  }

  .team-brand img {
    width: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
