/* Scoped to the approved subscription sheet. The cabinet keeps its own styles. */
.subscription-sheet-enabled {
  --sheet-muted: #b1b1bb;
  --sheet-line: #37373c;
  --sheet-soft: #222225;
  --sheet-green: #82d6ac;
  --sheet-tint: #37281e;
  align-items: center;
}
[data-theme="light"] .subscription-sheet-enabled {
  --sheet-muted: #71717a;
  --sheet-line: #eaeaec;
  --sheet-soft: #f5f5f7;
  --sheet-green: #187249;
  --sheet-tint: #fff5ed;
}
#subscription-sheet-source { display: contents; }
.subscription-sheet-enabled > .modal-card {
  width: 464px;
  height: min(740px, calc(100dvh - 40px));
  max-width: 100%;
  max-height: calc(100dvh - 40px);
  border: 0;
  border-radius: 24px;
  padding: 0;
  gap: 0;
  overflow: hidden;
  box-shadow: 0 24px 100px #15151d30;
  animation: sheet-open .2s ease-out;
}
.subscription-sheet-enabled .sheet-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--sheet-line);
}
.subscription-sheet-enabled .sheet-heading { flex: 1; min-width: 0; }
.subscription-sheet-enabled #modal-sub-title {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -.45px;
  margin: 0;
  overflow-wrap: anywhere;
}
.subscription-sheet-enabled #modal-sub-title:focus { outline: none; }
.subscription-sheet-enabled #sheet-subtitle {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--sheet-muted);
}
.subscription-sheet-enabled #btn-modal-close,
.subscription-sheet-enabled #sheet-back {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--sheet-soft);
  color: var(--sheet-muted);
}
.subscription-sheet-enabled #sheet-back { background: transparent; margin-left: -10px; }
.subscription-sheet-enabled svg { flex-shrink: 0; width: 20px; height: 20px; }
.sheet-view {
  flex: 1;
  min-height: 0;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.sheet-view > * { animation: sheet-page-in .18s ease-out; }
.subscription-sheet-enabled #modal-op-status:empty { display: none; }
.subscription-sheet-enabled #modal-op-status:not(:empty) {
  flex-shrink: 0;
  padding: 14px 24px;
  margin: 0;
  border-top: 1px solid var(--sheet-line);
  background: var(--sheet-soft);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  max-height: 120px;
  overflow: auto;
  overflow-wrap: anywhere;
}
.sheet-button, .sheet-view .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 14px 18px;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #231206;
  box-shadow: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
}
.sheet-button:hover, .sheet-view .btn:hover { background: var(--brand-dark); }
.sheet-button.sheet-secondary, .sheet-view .ghost-btn {
  background: var(--sheet-soft);
  color: var(--ink);
  border: 0;
  border-radius: 12px;
  min-height: 44px;
}
.sheet-button:disabled, .sheet-view .btn:disabled { opacity: .45; cursor: not-allowed; }
.sheet-view :is(button,a,input,select,summary):focus-visible {
  outline: 3px solid var(--brand-dark);
  outline-offset: 3px;
}
.sheet-text {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--sheet-muted);
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}
.sheet-status-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  font-size: 12px;
  color: var(--sheet-muted);
}
.sheet-status-line > :last-child { text-align: right; }
.sheet-status { display: inline-flex; align-items: center; gap: 6px; color: var(--sheet-green); font-weight: 550; }
.sheet-status:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.sheet-status-warning { color: var(--brand-dark); }
.sheet-traffic-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sheet-traffic-top strong { font-size: 28px; font-weight: 600; letter-spacing: -1px; }
.sheet-traffic-top small, .sheet-traffic-top > span { font-size: 12px; font-weight: 400; color: var(--sheet-muted); letter-spacing: 0; }
.sheet-track { height: 5px; border-radius: 6px; background: var(--sheet-line); overflow: hidden; margin: 12px 0 8px; }
.sheet-track > span { display: block; height: 100%; border-radius: 6px; background: var(--brand); }
.sheet-caption { margin: 0; font-size: 12px; color: var(--sheet-muted); }
.sheet-auto-inline { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0 14px; }
.sheet-auto-inline .sheet-text { display: block; text-align: left; padding-left: 0; padding-top: 4px; padding-bottom: 4px; }
.sheet-auto-inline strong { display: block; font-size: 13px; font-weight: 550; }
.sheet-auto-inline small { display: block; font-size: 12px; margin-top: 4px; }
.sheet-switch { position: relative; width: 44px; height: 44px; flex-shrink: 0; padding: 0; border: 0; background: transparent; cursor: pointer; }
.sheet-switch:before { content: ""; position: absolute; left: 2px; top: 10px; width: 40px; height: 24px; border-radius: 20px; background: #d3d3d9; transition: background .18s; }
.sheet-switch:after { content: ""; position: absolute; left: 5px; top: 13px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0002; transition: transform .18s; }
.sheet-switch[aria-checked="true"]:before { background: var(--brand); }
.sheet-switch[aria-checked="true"]:after { transform: translateX(16px); }
.sheet-connect { margin: 16px 0 18px; }
.sheet-auto-inline + .sheet-connect { margin-top: 2px; }
.sheet-utilities { display: flex; gap: 16px; justify-content: center; padding: 3px 0 0; }
.sheet-utilities svg { width: 15px; height: 15px; }
.sheet-row {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 70px;
  padding: 13px 0;
  border: 0;
  border-top: 1px solid var(--sheet-line);
  width: 100%;
  text-align: left;
  color: var(--ink);
  background: none;
  cursor: pointer;
}
.sheet-row-icon { color: var(--sheet-muted); display: grid; place-items: center; width: 25px; flex-shrink: 0; }
.sheet-row-copy { flex: 1; min-width: 0; }
.sheet-row-copy strong { display: block; font-size: 14px; font-weight: 550; line-height: 1.4; }
.sheet-row-copy small { display: block; color: var(--sheet-muted); font-size: 12px; line-height: 1.45; margin-top: 4px; }
.sheet-row-end { color: var(--sheet-muted); font-size: 12px; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.sheet-row-end svg { width: 16px; height: 16px; }
.sheet-row:hover strong { color: var(--brand-dark); }
.sheet-intro { margin: 0 0 22px; color: var(--sheet-muted); font-size: 14px; line-height: 1.6; }
.sheet-section-title { margin: 24px 0 12px; font-size: 13px; font-weight: 600; }
.sheet-note { padding: 14px 16px; margin: 16px 0; border-radius: 10px; background: var(--sheet-soft); color: var(--sheet-muted); font-size: 12px; line-height: 1.6; }
.sheet-warning { background: var(--sheet-tint); color: var(--ink); }
.sheet-notice { padding: 18px; margin: 0 0 20px; border-radius: 14px; background: var(--sheet-tint); }
.sheet-notice h4 { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.35; }
.sheet-notice p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--sheet-muted); }
.sheet-notice .sheet-button { margin-top: 16px; }
.sheet-line { height: 1px; background: var(--sheet-line); margin: 20px 0; }
.sheet-danger { color: var(--danger); }
.sheet-space { margin: 12px 0; }
.sheet-bottom { margin-top: 20px; display: grid; gap: 10px; }
.sheet-quotas { display: grid; grid-template-columns: repeat(3,1fr); margin: 0 0 20px; background: var(--sheet-soft); border-radius: 12px; padding: 18px 0; }
.sheet-quotas > div { padding: 0 8px; text-align: center; }
.sheet-quotas > div + div { border-left: 1px solid var(--sheet-line); }
.sheet-quotas small { display: block; color: var(--sheet-muted); font-size: 11px; margin: 7px 0; }
.sheet-quotas strong { font-size: 16px; font-weight: 600; }
.sheet-empty { text-align: center; padding: 30px 12px; }
.sheet-empty > svg { width: 36px; height: 36px; color: var(--sheet-muted); }
.sheet-empty h4 { font-size: 18px; font-weight: 600; }
.sheet-empty p { font-size: 13px; line-height: 1.6; color: var(--sheet-muted); }
.sheet-option { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--sheet-line); border-radius: 12px; margin: 10px 0; cursor: pointer; }
.sheet-option:has(input:checked) { border-color: var(--brand); background: var(--sheet-tint); }
.sheet-option input { accent-color: var(--brand); width: 16px; height: 16px; flex-shrink: 0; margin: 0; }
.sheet-option strong { display: block; font-size: 14px; font-weight: 550; }
.sheet-option small { display: block; font-size: 12px; color: var(--sheet-muted); margin-top: 5px; }
.sheet-amount { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 18px 0; margin-top: 14px; border-top: 1px solid var(--sheet-line); }
.sheet-amount span { font-size: 13px; color: var(--sheet-muted); }
.sheet-amount strong { font-size: 24px; font-weight: 600; }
.sheet-disclosure { margin-top: 18px; border-top: 1px solid var(--sheet-line); padding-top: 4px; }
.sheet-disclosure summary { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; color: var(--sheet-muted); list-style: none; cursor: pointer; }
.sheet-disclosure summary:after { content: "+"; margin-left: auto; }
.sheet-disclosure[open] summary:after { content: "−"; }
.sheet-disclosure p { font-size: 12px; line-height: 1.65; color: var(--sheet-muted); }
.sheet-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 14px; border: 0; border-radius: 10px; background: var(--sheet-soft); color: var(--ink); cursor: pointer; text-align: left; }
.sheet-link code { min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
.sheet-confirm-icon { display: grid; place-items: center; width: 48px; height: 48px; background: var(--sheet-tint); color: var(--brand-dark); border-radius: 50%; margin-bottom: 20px; }
.sheet-confirm-title { font-size: 21px; letter-spacing: -.4px; font-weight: 600; line-height: 1.5; margin: 0 0 18px; }
.sheet-spinner { width: 24px; height: 24px; border: 2px solid var(--sheet-line); border-top-color: var(--brand); border-radius: 50%; animation: sheet-spin 1s linear infinite; margin: 12px auto; }

/* Existing forms are the actual controls, presented as one screen at a time. */
.sheet-view .modal-action-section, .sheet-view .autopay-panel-modal, .sheet-view .subscription-instructions {
  border: 0; border-radius: 0; padding: 0; margin: 0; background: none;
}
.sheet-view .modal-action-section > summary, .sheet-view .autopay-panel-modal > summary, .sheet-view .subscription-instructions > summary { display: none; }
.sheet-view .modal-action-body { padding: 0; border: 0; gap: 14px; }
.sheet-view .field span { color: var(--sheet-muted); font-size: 13px; }
.sheet-view .field input, .sheet-view .field select { border-color: var(--sheet-line); background: var(--card); border-radius: 10px; padding: 14px; min-height: 48px; font-size: 15px; }
.sheet-view .device-card { padding: 17px 0; border: 0; border-bottom: 1px solid var(--sheet-line); border-radius: 0; background: none; }
.sheet-view .devices-section { gap: 0; }
.sheet-view .device-name { font-size: 13px; }
.sheet-view .device-meta { font-size: 11px; color: var(--sheet-muted); line-height: 1.5; margin-top: 3px; }
.sheet-view .device-icon { color: var(--sheet-muted); font-size: 18px; }
.sheet-view .device-delete-btn { width: 44px; height: 44px; flex-shrink: 0; color: var(--sheet-muted); }
.sheet-readonly-device { padding: 17px 0; border-bottom: 1px solid var(--sheet-line); }
.sheet-readonly-device strong, .sheet-readonly-device small { display: block; font-size: 13px; }
.sheet-readonly-device small { color: var(--sheet-muted); margin-top: 5px; }
.sheet-view .subscription-name-hint { color: var(--sheet-muted); }
.sheet-view .autopay-coach, .sheet-view .autopay-manual-actions { display: none; }
.sheet-view .autopay-panel-modal > .modal-action-body { display: block; padding: 0; }
.sheet-view .autopay-switches { gap: 0; margin: 0; }
.sheet-view .autopay-switch { grid-template-columns: minmax(0, 1fr) 44px; border: 0; border-radius: 0; padding: 16px 0; background: none; gap: 16px; opacity: 1; }
.sheet-view .autopay-switch + .autopay-switch { border-top: 1px solid var(--sheet-line); }
.sheet-view .autopay-switch-title { display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: baseline; gap: 4px 8px; }
.sheet-view .autopay-switch-copy { overflow-wrap: anywhere; }
.sheet-view .autopay-switch i { justify-self: center; width: 40px; height: 24px; }
.sheet-view .autopay-switch i::after { width: 18px; height: 18px; }
.sheet-view .autopay-switch input:checked + i::after { transform: translateX(16px); }
.sheet-view .autopay-switch strong { font-size: 14px; font-weight: 550; }
.sheet-view .autopay-switch small { font-size: 12px; color: var(--sheet-muted); line-height: 1.6; }
.sheet-view .autopay-switch-title em { color: var(--sheet-muted); font-size: 12px; line-height: 1.5; font-weight: 400; }
.sheet-view .autopay-switch-secondary { margin-left: 16px; }
.sheet-view .autopay-switch:has(input:disabled) i { opacity: .45; }
.sheet-view .autopay-priority-note { background: var(--sheet-soft); color: var(--sheet-muted); border: 0; border-radius: 10px; padding: 14px 16px; font-size: 12px; }
.sheet-page-payments .autopay-switch:has([data-autopay-setting="traffic"]),
.sheet-page-payments .autopay-switch:has([data-autopay-setting="traffic-card"]),
.sheet-page-payments .autopay-method-row, .sheet-page-payments .autopay-empty,
.sheet-page-payments .autopay-priority-note, .sheet-page-payments .autopay-card-actions,
.sheet-page-traffic .autopay-switch:has([data-autopay-setting="renewal"]),
.sheet-page-traffic .autopay-method-row, .sheet-page-traffic .autopay-empty, .sheet-page-traffic .autopay-card-actions,
.sheet-page-card .autopay-switches, .sheet-page-card .autopay-priority-note { display: none; }
.sheet-page-card .autopay-card-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; border: 0; margin-top: 16px; }
.sheet-page-card .autopay-card-actions > :is(.btn, .ghost-btn) { flex: none; width: 100%; min-height: 48px; padding: 14px 18px; }
.sheet-page-card .autopay-empty { margin: 0 0 16px; }
.sheet-page-card .autopay-method-row { margin: 0; padding: 16px 0; border: 0; }
.sheet-page-card .autopay-method-copy strong { white-space: normal; overflow-wrap: anywhere; }
.sheet-page-card .autopay-empty-icon, .sheet-page-card .autopay-method-icon { display: grid; place-items: center; color: var(--sheet-muted); }
.sheet-page-card .autopay-empty { background: var(--sheet-soft); border: 0; }
.sheet-page-renew .modal-action-body > .row { flex-direction: column; align-items: stretch; }
.sheet-page-renew .radio-pill, .sheet-page-slots .radio-pill { border-color: var(--sheet-line); border-radius: 12px; padding: 16px; font-size: 13px; width: 100%; background: none; }
.sheet-page-renew .radio-pill:has(input:checked), .sheet-page-slots .radio-pill:has(input:checked) { border-color: var(--brand); background: var(--sheet-tint); }
.sheet-page-renew #modal-renew-method-wrap { flex-direction: row; }
.sheet-page-renew #modal-renew-method-wrap .radio-pill { flex: 1; }
.sheet-view .devswap-price { color: var(--sheet-muted); }
.sheet-view .autopay-empty p, .sheet-view .muted { color: var(--sheet-muted); }
.sheet-view .instruction-detected-card { border: 0; box-shadow: none; border-radius: 0; background: none; overflow: visible; }
.sheet-view .instruction-detected-header { flex-wrap: wrap; padding: 12px 0; background: none; border-bottom: 1px solid var(--sheet-line); }
.sheet-view .instruction-detected-badge { font-size: 11px; }
.sheet-view .instruction-others { border: 0; border-top: 1px solid var(--sheet-line); border-radius: 0; }
.sheet-view .instruction-others-summary { padding: 14px 0; }
.sheet-view .instruction-others-body { padding: 0; }
.sheet-page-guide .sheet-connect { margin-top: 0; }
.sheet-view .instruction-body { padding: 12px 0; border: 0; }
.sheet-view .instruction-smart { gap: 16px; }
.sheet-view .subscription-instructions > div { padding-top: 0; }
.sheet-view .instruction-summary { min-height: 44px; }

@keyframes sheet-open { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sheet-page-in { from { opacity: 0; transform: translateX(5px); } to { opacity: 1; transform: translateX(0); } }
@keyframes sheet-spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) {
  .subscription-sheet-enabled { align-items: flex-end; padding: 0; }
  .subscription-sheet-enabled > .modal-card { width: 100%; height: min(740px, calc(100dvh - 24px)); max-height: calc(100dvh - 24px); border-radius: 24px 24px 0 0; }
  .subscription-sheet-enabled .sheet-header { padding: 19px 22px 16px; }
  .subscription-sheet-enabled #modal-sub-title { font-size: 19px; }
  .sheet-view { padding: 22px; padding-bottom: max(22px, env(safe-area-inset-bottom)); }
  .sheet-row { min-height: 66px; }
}
@media (max-width: 360px) {
  .subscription-sheet-enabled .sheet-header { padding: 17px 18px 14px; }
  .sheet-view { padding: 18px; }
  .sheet-traffic-top strong { font-size: 26px; }
  .sheet-row-copy strong { font-size: 13px; }
  .sheet-utilities { gap: 10px; }
  .sheet-utilities .sheet-text { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .subscription-sheet-enabled, .subscription-sheet-enabled *, .subscription-sheet-enabled *:before, .subscription-sheet-enabled *:after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.subscription-sheet-enabled .sheet-view .autopay-switch:has(input:checked) { background: none; }
.sheet-payment-copy { display: block; min-width: 0; }
.sheet-payment-copy strong { display: block; font-size: 14px; font-weight: 550; }
.sheet-payment-copy small { display: block; color: var(--sheet-muted); margin-top: 5px; font-size: 12px; }
.sheet-page-renew > [data-sheet-slot], .sheet-page-renew #modal-renew-wrap { min-height: 100%; }
.sheet-page-renew .modal-action-body { display: flex; flex-direction: column; min-height: min(590px, calc(100dvh - 220px)); }
.sheet-page-renew .sheet-amount { margin-top: auto; }
.sheet-page-renew .radio-pill { justify-content: flex-start; gap: 12px; }
.sheet-page-renew .radio-pill input { flex-shrink: 0; }

.subscription-sheet-enabled .sheet-view .autopay-switch:has(input:disabled) { opacity: 1; }

/* One divider per boundary, including the panels borrowed from the cabinet. */
.sheet-view > .sheet-row:first-child { border-top: 0; }
.sheet-view .sheet-line + .sheet-row { border-top: 0; }
.sheet-page-devices .device-card:last-child { border-bottom: 0; }
.sheet-page-family > .sheet-amount:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.sheet-page-slots .devswap-option { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 6px 12px; padding: 16px; }
.sheet-page-slots .devswap-option input { grid-row: 1 / 3; margin: 3px 0 0; }
.sheet-page-slots .devswap-option span:first-of-type { min-width: 0; line-height: 1.5; }
.sheet-page-slots .devswap-price { grid-column: 2; justify-self: start; font-weight: 400; }
.sheet-view .sheet-row-copy, .sheet-view .field, .sheet-view .device-info { min-width: 0; overflow-wrap: anywhere; }
.sheet-view .sheet-row-end { max-width: 35%; flex-wrap: wrap; justify-content: flex-end; }
.sheet-view .sheet-section-title { margin-bottom: 8px; }
.sheet-page-name .subscription-name-hint { display: none; }

.sheet-page-traffic .autopay-switch:has([data-autopay-setting="traffic"]) { border-top: 0; }
