.plan-card {
  background:
    radial-gradient(ellipse at 95% 8%, rgba(204, 178, 255, 0.3), transparent 55%),
    radial-gradient(ellipse at 0% 38%, rgba(255, 255, 255, 0.5), transparent 65%),
    var(--glass-tile);
}

.plan-card .tile-head { align-items: center; }

.plan-card,
.plan-card > [data-plan="facts"]:not([hidden]) {
  display: flex;
  flex-direction: column;
}

.plan-card > [data-plan="facts"] { flex: 1; }
.plan-card .plan-usage { flex: 1; min-height: 168px; }

.plan-tier {
  padding: 5px 12px;
  color: var(--tint);
  background: var(--glass-chip);
  box-shadow: var(--shadow-dot);
}

.plan-usage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0;
  font-variant-numeric: tabular-nums;
}

.plan-balance { display: grid; min-width: 0; }

.plan-eyebrow {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
}

.plan-remaining {
  margin: 5px 0 3px;
  font-size: clamp(38px, 10vw, 58px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.plan-caption { font-size: 14px; }

.plan-consumed {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 12px;
}

.plan-ring {
  --ring-size: 116px;
  --ring-width: 8px;
  --ring-inset: 5px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.65) 54%, transparent 56%);
  transition: none;
}

.plan-ring-label {
  display: grid;
  gap: 5px;
  text-align: center;
}

.plan-ring-label strong { font-size: 25px; font-weight: 500; letter-spacing: -0.04em; }
.plan-ring-label > span { color: var(--ink-soft); font-size: 11px; font-weight: 400; }

.plan-renewal {
  display: flex;
  margin-top: 14px;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
}

.plan-renewal .icon { width: 14px; height: 14px; }
.plan-details { background: rgba(255, 255, 255, 0.64); }

.plan-accounts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--ink-line);
}

.plan-accounts > div:first-child { display: grid; gap: 5px; }
.plan-label { color: var(--ink-soft); font-size: 12px; }
.plan-accounts strong { font-size: 14px; font-weight: 500; }
.plan-slots { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }

.plan-slot {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 31px;
  height: 31px;
  border: 1px dashed rgba(90, 81, 146, 0.3);
  border-radius: 10px;
  color: var(--ink-faint);
}

.plan-slot[data-connected="true"] {
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(145deg, #E5DEF4, #F4F0FC);
  color: var(--tint);
  box-shadow: var(--shadow-dot);
}

.plan-slot[data-provider] {
  background: #FFFFFF;
  color: var(--ink);
}

.plan-slot .icon { width: 16px; height: 16px; }
.plan-slot[data-provider] .icon { width: 15px; height: 15px; margin: 0; }
.plan-slot[data-provider] { transition: transform 0.2s var(--ease-quint), box-shadow 0.2s ease; }

@media (hover: hover) {
  .plan-slot[data-provider]:hover {
    box-shadow: 0 0 0 0.5px var(--glass-hair), 0 5px 12px -4px rgba(38, 42, 82, 0.22);
    transform: translateY(-1px);
  }
}
.plan-slots-more { color: var(--ink-soft); font-size: 12px; }

.plan-history {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 17px;
}

.plan-window p { margin: 5px 0 11px; color: var(--ink-soft); font-size: 12px; }
.plan-window strong { margin-right: 4px; color: var(--ink); font-size: 26px; font-weight: 500; letter-spacing: -0.035em; }

.plan-window-track {
  height: 4px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(90, 81, 146, 0.08);
}

.plan-window-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #77ADBD, #A99FCB);
  transform-origin: left;
}

.plan-window-flagged .plan-window-track > span { background: linear-gradient(90deg, #B8A6D3, #DAA3BD); }
.plan-footnote { margin: 16px 0 0; color: var(--ink-soft); font-size: 11px; }

.plan-uses { margin-top: 20px; background: rgba(255, 255, 255, 0.64); }
.plan-uses-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.plan-uses-reset { color: var(--ink-soft); font-size: 11px; }

.plan-uses-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 24px;
  margin-top: 14px;
}

.plan-use-name { color: var(--ink-soft); font-size: 12px; }
.plan-use p { margin: 3px 0 8px; color: var(--ink-soft); font-size: 12px; }
.plan-use strong { margin-right: 4px; color: var(--ink); font-size: 20px; font-weight: 500; letter-spacing: -0.03em; }
.plan-use[data-full="true"] p { color: var(--bad); }
.plan-use[data-full="true"] .plan-window-track > span { background: linear-gradient(90deg, #DAA3BD, #E58A9B); }
.plan-status { margin: 20px 0 4px; color: var(--ink-soft); font-size: 14px; }
.plan-card[data-exhausted="true"] .plan-remaining { color: var(--ink-faint); }

.plan-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 9px 14px 9px 9px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 0.5px var(--glass-hair), 0 1px 2px rgba(38, 42, 82, 0.05);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.plan-alert[hidden] { display: none; }

.plan-alert::before {
  content: '';
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--plan-alert-glyph) center / 14px 14px no-repeat, var(--plan-alert-tint);
  animation: plan-alert-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.plan-alert[data-tone="bad"] {
  --plan-alert-tint: #FFE1E6;
  --plan-alert-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23E3264C' stroke-width='1.9' stroke-linecap='round'%3E%3Cpath d='M8 4.6v4.1'/%3E%3Ccircle cx='8' cy='11.3' r='0.35' fill='%23E3264C'/%3E%3C/svg%3E");
}

.plan-alert[data-tone="wait"] {
  --plan-alert-tint: #FFEFD2;
  --plan-alert-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23D98200' stroke-width='1.9' stroke-linecap='round'%3E%3Cpath d='M8 4.6v4.1'/%3E%3Ccircle cx='8' cy='11.3' r='0.35' fill='%23D98200'/%3E%3C/svg%3E");
}

@keyframes plan-alert-pop {
  from { transform: scale(0.4); opacity: 0; }
}

.plan-saved { margin-top: 18px; padding: 16px 0 4px; border-top: 1px solid var(--ink-line); }
.plan-saved-tile { margin: 0; padding: 20px; border-top: 1px solid var(--glass-rim); }
.plan-saved-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.plan-saved-status { color: var(--ink-soft); font-size: 11px; }
.plan-saved-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; font-variant-numeric: tabular-nums; }
.plan-saved-grid > div { display: grid; justify-items: start; gap: 3px; }
.plan-saved-grid strong { margin-top: 8px; font-size: 24px; font-weight: 500; letter-spacing: -0.04em; line-height: 1.1; }
.plan-saved-grid > div > span:last-child { color: var(--ink-soft); font-size: 12px; }

.plan-saved-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--mesh-icon-sky);
  box-shadow: var(--modal-icon-raised-shadow);
  color: #FFFFFF;
}

.plan-saved-grid > [data-tone="lilac"] .plan-saved-icon { background: var(--mesh-icon-lilac); }
.plan-saved-grid > [data-tone="coral"] .plan-saved-icon { background: var(--mesh-icon-coral); }

.plan-saved-icon svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12));
}

.plan-saved-tile .plan-saved-grid { gap: 20px; margin-top: 18px; }
.plan-saved-tile .plan-saved-grid > * { --saved-wash: 59, 139, 217; display: grid; grid-template: "icon label" auto "count count" auto / auto 1fr; align-items: center; justify-items: start; gap: 14px 12px; min-width: 0; padding: 16px; border-radius: var(--radius-panel); background: radial-gradient(ellipse 85% 95% at 0% 0%, rgba(var(--saved-wash), 0.17), transparent 70%), var(--container-inner-surface, rgba(255, 255, 255, 0.5)); box-shadow: var(--memory-inner-shadow); color: var(--ink); text-decoration: none; transition: box-shadow 0.18s ease; animation: plan-saved-rise 520ms var(--ease-out) both; }
.plan-saved-tile .plan-saved-grid > [data-tone="lilac"] { --saved-wash: 138, 99, 217; animation-delay: 70ms; }
.plan-saved-tile .plan-saved-grid > [data-tone="coral"] { --saved-wash: 238, 100, 100; animation-delay: 140ms; }
.plan-saved-tile .plan-saved-grid .plan-saved-icon { grid-area: icon; width: 34px; height: 34px; border-radius: 11px; }
.plan-saved-tile .plan-saved-grid .plan-saved-icon svg { width: 16px; height: 16px; }
.plan-saved-tile .plan-saved-grid strong { grid-area: count; margin: 0; font-size: clamp(30px, 3.6vw, 44px); font-weight: 500; letter-spacing: -0.045em; line-height: 1; }
.plan-saved-tile .plan-saved-grid > * > span:last-child { grid-area: label; color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.plan-saved-tile .plan-saved-grid > a:focus-visible { outline: 2px solid var(--tint); outline-offset: 3px; }
.plan-saved-tile .plan-saved-grid > a:active { transform: scale(0.99); }
@media (hover: hover) { .plan-saved-tile .plan-saved-grid > a:hover { box-shadow: var(--shadow-lift); } }
@media (max-width: 640px) {
  .plan-saved-tile .plan-saved-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .plan-saved-tile .plan-saved-grid > * { grid-template: "icon label count" auto / auto 1fr auto; padding: 12px 16px 12px 12px; }
  .plan-saved-tile .plan-saved-grid strong { font-size: 26px; }
}
@keyframes plan-saved-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .plan-saved-tile .plan-saved-grid > * { animation: none; transition: none; } }
.plan-saved-note { margin: 16px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.plan-retry:not(:empty) { margin-top: 16px; }

.plan-upgrade {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--glass-rim);
  border-radius: var(--radius-panel);
  background: radial-gradient(ellipse at 0% 100%, #a787ee33, transparent 75%), radial-gradient(ellipse at 100% 0%, #ec9dcc2e, transparent 70%), rgba(255, 255, 255, 0.64);
  box-shadow: 0 0 0 0.5px var(--glass-hair);
}

.plan-upgrade p { margin: 0; min-width: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.plan-upgrade p strong { display: block; color: var(--ink); font-size: 15px; font-weight: 500; }
.plan-upgrade .button { flex: none; }

.plan-compare { margin: 0; border-radius: var(--radius-panel); background: var(--glass-card); box-shadow: 0 0 0 0.5px var(--glass-hair); padding: 4px 16px; }

.plan-compare-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 72px;
  gap: 10px;
  align-items: baseline;
  padding: 11px 0;
  border-top: 1px solid var(--ink-line);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.plan-compare-row:first-child { border-top: 0; }
.plan-compare-row > :first-child { color: var(--ink-soft); }
.plan-compare-row > :not(:first-child) { text-align: right; }
.plan-compare-row > span:nth-child(2) { color: var(--ink-faint); }
.plan-compare-row > strong { font-weight: 500; }
.plan-compare-head { color: var(--ink-soft); font-size: 12px; font-weight: 500; }
.plan-compare-head > span:nth-child(3) { color: var(--tint); }
.plan-compare-tiers { padding: 2px 0; background: none; box-shadow: none; }
.plan-compare-tiers .plan-compare-row { grid-template-columns: minmax(0, 1fr) repeat(3, minmax(44px, auto)); font-size: 13px; padding: 9px 0; }
.plan-compare-tiers[hidden] { display: none; }
.plan-compare-tiers + .tile-actions { margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  .plan-alert::before { animation: none; }
  .plan-slot[data-provider] { transition: none; }
}

@media (max-width: 360px) {
  .plan-ring { --ring-size: 92px; --ring-width: 6px; }
  .plan-ring-label strong { font-size: 21px; }
  .plan-history { gap: 16px; }
  .plan-uses-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
}
