:root {
  --accred-ink: #111827;
  --accred-muted: #667085;
  --accred-line: #dfe7ee;
  --accred-green: #0abf94;
  --accred-green-dark: #087b63;
  --accred-soft: #eefaf6;
  --accred-warm: #fff7e8;
}

html {
  min-height: 100%;
  background: #f4f7fa;
}

body {
  min-height: 100dvh;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(10, 191, 148, 0.28);
  outline-offset: 2px;
}

.accred-premium-fab {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(84px, calc(72px + env(safe-area-inset-bottom)));
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #111827, #0b6b5b);
  box-shadow: 0 14px 38px rgba(17, 24, 39, 0.28);
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

.accred-premium-fab[hidden] {
  display: none;
}

.accred-premium-fab small {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  color: #063f35;
  background: #bff7e5;
  font-size: 12px;
}

.accred-premium-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(9, 15, 13, 0.68);
  backdrop-filter: blur(10px);
}

.accred-premium-sheet {
  width: min(520px, 100%);
  max-height: min(92dvh, 760px);
  overflow: hidden;
  border: 1px solid rgba(223, 231, 238, 0.95);
  border-radius: 28px 28px 22px 22px;
  background: #fff;
  box-shadow: 0 -18px 55px rgba(15, 23, 42, 0.28);
}

.accred-premium-grip {
  width: 46px;
  height: 4px;
  margin: 10px auto 6px;
  border-radius: 999px;
  background: #d7dfdd;
}

.accred-premium-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 12px 18px 8px;
}

.accred-premium-kicker {
  color: var(--accred-green-dark);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.accred-premium-head h2 {
  margin: 4px 0 0;
  color: var(--accred-ink);
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
}

.accred-premium-head p {
  margin: 8px 0 0;
  color: var(--accred-muted);
  font-size: 14px;
  line-height: 1.45;
}

.accred-premium-close {
  width: 42px;
  height: 42px;
  border: 1px solid var(--accred-line);
  border-radius: 999px;
  color: var(--accred-ink);
  background: #f8fafc;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.accred-premium-body {
  max-height: calc(92dvh - 212px);
  overflow: auto;
  padding: 10px 18px 16px;
}

.accred-premium-benefits {
  display: grid;
  gap: 8px;
}

.accred-premium-benefit {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px;
  border: 1px solid #c9f2e6;
  border-radius: 16px;
  background: var(--accred-soft);
}

.accred-premium-benefit i {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  color: #fff;
  background: var(--accred-green);
  font-style: normal;
  font-weight: 900;
}

.accred-premium-benefit strong {
  display: block;
  color: var(--accred-ink);
  font-size: 14px;
  line-height: 1.2;
}

.accred-premium-benefit span {
  display: block;
  margin-top: 2px;
  color: var(--accred-muted);
  font-size: 12px;
  line-height: 1.35;
}

.accred-premium-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  margin-bottom: 8px;
}

.accred-premium-plan-head strong {
  color: var(--accred-ink);
  font-size: 17px;
}

.accred-premium-refresh {
  border: 0;
  color: var(--accred-green-dark);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.accred-premium-plans {
  display: grid;
  gap: 9px;
}

.accred-premium-plan {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--accred-line);
  border-radius: 18px;
  color: var(--accred-ink);
  background: #f8fafc;
  text-align: left;
  cursor: pointer;
}

.accred-premium-plan.is-selected {
  border-color: var(--accred-green);
  background: #fff;
  box-shadow: 0 10px 30px rgba(10, 191, 148, 0.15);
}

.accred-premium-plan-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.accred-premium-plan-title {
  display: grid;
  gap: 2px;
}

.accred-premium-plan-title strong {
  font-size: 16px;
}

.accred-premium-plan-title span,
.accred-premium-plan-note {
  color: var(--accred-muted);
  font-size: 13px;
  line-height: 1.35;
}

.accred-premium-price {
  text-align: right;
  white-space: nowrap;
}

.accred-premium-price strong {
  display: block;
  font-size: 20px;
  line-height: 1.1;
}

.accred-premium-badge {
  display: inline-flex;
  margin-top: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #064e3b;
  background: #bff7e5;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.accred-premium-error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 11px;
  border: 1px solid #fecaca;
  border-radius: 15px;
  color: #b91c1c;
  background: #fff1f2;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.4;
}

.accred-premium-loading {
  display: grid;
  place-items: center;
  min-height: 122px;
  color: var(--accred-muted);
  font-size: 14px;
}

.accred-premium-foot {
  display: grid;
  gap: 8px;
  padding: 12px 18px 18px;
  border-top: 1px solid var(--accred-line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), #fff);
}

.accred-premium-pay,
.accred-premium-secondary {
  min-height: 48px;
  border-radius: 16px;
  font-weight: 850;
  cursor: pointer;
}

.accred-premium-pay {
  border: 1px solid var(--accred-green);
  color: #fff;
  background: linear-gradient(135deg, var(--accred-green), #0f8f77);
  box-shadow: 0 12px 28px rgba(10, 191, 148, 0.24);
}

.accred-premium-pay:disabled {
  opacity: 0.58;
  cursor: default;
}

.accred-premium-secondary {
  border: 1px solid var(--accred-line);
  color: var(--accred-ink);
  background: #fff;
}

.accred-premium-toast {
  position: fixed;
  left: 50%;
  bottom: max(88px, calc(80px + env(safe-area-inset-bottom)));
  z-index: 11000;
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid #bbf7d0;
  border-radius: 16px;
  color: #064e3b;
  background: #ecfdf5;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.16);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 720px) {
  body {
    min-width: 320px;
    background:
      linear-gradient(180deg, rgba(10, 191, 148, 0.08), rgba(244, 247, 250, 0) 260px),
      #f4f7fa;
  }

  .auth-shell {
    align-items: stretch;
    padding: max(16px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  }

  .auth-stage {
    width: 100%;
    min-height: auto;
    border-radius: 24px;
    grid-template-columns: 1fr;
  }

  .auth-brand {
    min-height: 116px;
    padding: 22px;
  }

  .auth-card {
    width: 100%;
    border-width: 0;
    box-shadow: none;
    padding: 20px;
  }

  .topbar {
    min-height: 58px;
    padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .topbar-status {
    display: none;
  }

  .main-content {
    padding: 14px 14px calc(96px + env(safe-area-inset-bottom));
  }

  .workspace-head {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px;
    border-radius: 20px;
  }

  .workspace-head h2 {
    font-size: 28px;
    line-height: 1.08;
  }

  .workspace-actions {
    justify-content: stretch;
  }

  .workspace-actions > *,
  .btn {
    min-height: 44px;
  }

  .portal-rail {
    position: fixed;
    z-index: 80;
    inset: auto 0 0 0;
    width: 100%;
    height: calc(68px + env(safe-area-inset-bottom));
    padding: 7px 8px max(7px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-right: 0;
    flex-direction: row;
    justify-content: space-around;
  }

  .brand-lockup,
  .rail-hint,
  .rail-status {
    display: none;
  }

  .rail-nav {
    width: 100%;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  .rail-link {
    min-height: 52px;
    padding: 6px 4px;
    border-radius: 14px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    font-size: 10px;
    line-height: 1.1;
  }

  .rail-link svg {
    width: 20px;
    height: 20px;
  }

  .metric-strip,
  .workbench-grid,
  .split-grid,
  .answer-review-grid,
  .result-actions-grid {
    grid-template-columns: 1fr;
  }

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

  .data-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    padding: 12px;
  }

  .data-row:has(>.row-icon) {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .row-actions,
  .row-facts {
    grid-column: 1 / -1;
    justify-content: flex-start;
    justify-items: start;
  }

  .panel-head,
  .block-head {
    display: grid;
  }

  .search-box {
    width: 100%;
    min-width: 0;
  }

  .accred-premium-fab {
    right: 12px;
    bottom: max(78px, calc(70px + env(safe-area-inset-bottom)));
  }

  .accred-premium-modal {
    padding: 0;
  }

  .accred-premium-sheet {
    width: 100%;
    max-height: 94dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 28px 28px 0 0;
  }

  .accred-premium-body {
    max-height: calc(94dvh - 220px);
  }
}

@media (max-width: 380px) {
  .accred-premium-head h2 {
    font-size: 25px;
  }

  .accred-premium-plan-top {
    display: grid;
  }

  .accred-premium-price {
    text-align: left;
  }
}
