/* Subscription page — layered on /shared/styles/theme.css; only page-specific rules here. */
.sub-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 22px 60px;
  display: grid;
  gap: 18px;
}
.sub-notice {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: #fff4e5;
  color: #7a4b00;
  border: 1px solid #ffd79a;
  font-size: 13.5px;
}
.sub-notice.err {
  background: #ffecef;
  color: #8b1130;
  border-color: #ffb8c6;
}
.sub-notice.ok {
  background: #e8f9ee;
  color: #14532d;
  border-color: #b7ebc8;
}
/* "Saved, but it will not take effect yet" — a true third outcome, not a success and not a
   failure. A center switching on an add-on Kuro has switched off globally lands here. */
.sub-notice.warn {
  background: #fff4e5;
  color: #7a4b00;
  border-color: #ffd79a;
}

/* A module the operator has switched off for every center: the row stays, greyed, with its
   switch disabled and the shared card underneath saying who switched it off and why. It is
   deliberately not styled as an error — nothing is broken and nothing is owed. */
.addon-globally-off {
  opacity: 0.82;
  background: var(--card-2);
  border-style: dashed;
}
.addon-globally-off .switch {
  cursor: not-allowed;
}
.addon-globally-off .switch input:disabled + .track {
  opacity: 0.45;
}
.addon-alert:empty {
  display: none;
}
.addon-alert .kuro-plan-alert {
  margin: 10px 0 0;
  max-width: none;
}
#credits-alert .kuro-plan-alert {
  margin: 12px 0 0;
  max-width: none;
}
.sub-grid-top {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
}
.sub-grid-bottom {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
}
@media (max-width: 860px) {
  .sub-grid-top,
  .sub-grid-bottom {
    grid-template-columns: 1fr;
  }
}
.sub-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sub-plan-name {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 6px 0 2px;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sub-plan-desc {
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
}
.sub-plan-globaloff {
  margin: 8px 0 0;
  padding: 6px 10px;
  border-left: 3px solid var(--muted);
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.08);
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.45;
}
.sub-plan-globaloff[hidden] {
  display: none;
}
.sub-plan-meta {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.sub-credit-big {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 6px 0 8px;
}
.sub-credit-buckets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.sub-credit-buckets .badge b {
  margin-left: 4px;
}
.b-monthly {
  background: rgba(0, 122, 255, 0.12);
  color: var(--blue-600);
}
.b-purchased {
  background: rgba(111, 66, 193, 0.12);
  color: var(--purple);
}
.b-free {
  background: rgba(52, 199, 89, 0.14);
  color: var(--green-2);
}
.sub-section {
  padding: 16px 20px 18px;
}
.sub-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 12px;
}
.sub-section-head h2 {
  font-size: 15px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}
.sub-section-head h2 i {
  color: var(--indigo);
}
.sub-group-desc {
  font-size: 12.5px;
  color: var(--muted);
}
.sub-base {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sub-base .chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.sub-base .chip i {
  color: var(--green);
}
/* align-items: start — without it every card in a row grows to the height of the tallest,
   and one "switched off by Kuro" explanation is ~300px tall, so its neighbour rendered as a
   near-empty box with a name at the top and a third of a screen of white under it. */
.sub-addons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  align-items: start;
}
.sub-wrap > *,
.sub-grid-top > *,
.sub-grid-bottom > * {
  min-width: 0;
}
/* #369-F: the two history cards (audit up to 100 rows, credits up to 50) scroll inside a
   bounded box, so the page is not ~10,000px tall. All rows stay reachable by scrolling. */
.sub-grid-bottom > .sub-section {
  overflow: auto;
  max-height: min(72vh, 640px);
}
.sub-grid-bottom .sub-table thead th {
  position: sticky;
  top: 0;
  background: var(--card, #fff);
  z-index: 1;
}
@media (max-width: 860px) {
  .sub-grid-bottom > .sub-section {
    max-height: 70vh;
  }
}
@media (max-width: 600px) {
  .sub-addons {
    grid-template-columns: minmax(0, 1fr);
  }
  .sub-section-head {
    flex-wrap: wrap;
    gap: 8px;
  }
  .addon-name {
    flex-wrap: wrap;
  }
}
.addon {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card-2);
  transition:
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}
.addon.on {
  background: #fff;
  border-color: rgba(0, 122, 255, 0.28);
  box-shadow: var(--shadow-sm);
}
.addon-name {
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.addon-name .ai {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(111, 66, 193, 0.12);
  color: var(--purple);
  letter-spacing: 0.04em;
}
.addon-desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 4px;
  line-height: 1.45;
}
.addon-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 6px;
}
.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch .track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cfd6e2;
  transition: background 0.15s ease;
  cursor: pointer;
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}
.switch input:focus-visible + .track {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
.switch input:checked + .track {
  background: var(--blue);
}
.switch input:checked + .track::after {
  transform: translateX(20px);
}
.switch input:disabled + .track {
  opacity: 0.5;
  cursor: default;
}
.sub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-bottom: 14px;
}
.sub-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}
.sub-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.sub-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.sub-table .neg {
  color: var(--red-2);
}
.sub-table .pos {
  color: var(--green-2);
}
.sub-empty {
  color: var(--muted);
  font-size: 12.5px;
  padding: 8px;
}
.app-modal {
  margin: 0;
  padding: 0;
  border: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 26, 40, 0.42);
  display: grid;
  place-items: center;
  z-index: 50;
}
.app-modal[hidden] {
  display: none;
}
.app-modal-card {
  width: min(460px, 92vw);
}
.app-modal-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}
.app-modal-card p {
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
}
.sub-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
/* #b3261e on white is 6.0:1, so the destructive answer is still perfectly legible — it just
   no longer looks like the recommended one. */
.sub-btn-danger {
  color: #b3261e;
  border-color: rgba(179, 38, 30, 0.45);
}
.sub-btn-danger:hover {
  background: rgba(179, 38, 30, 0.08);
  border-color: rgba(179, 38, 30, 0.7);
}
body:not(.authed) .sub-wrap {
  visibility: hidden;
}

/* Stripe Checkout, TEST MODE (owner 2026-10-07). checkout.js + subscription.js renderBuy(). */
.sub-test-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: #fff4e5;
  color: #7a4b00;
  border: 1px solid #ffd79a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  vertical-align: middle;
}
.sub-test-badge[hidden] {
  display: none;
}
.sub-buy {
  margin-top: 12px;
}
.sub-buy-row,
.sub-buy-plans {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}
.sub-buy-plans .sub-plan-option {
  flex: 1 1 200px;
  border: 1px solid var(--card-2);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.sub-buy-plans .sub-plan-option .addon-name {
  margin-bottom: 4px;
}
