/* MediWatch account area (account-v2, docs/design/rollout/account-v2/README.md):
 * the sign-in card used by /auth/login and signed-out /my-alerts, the signed-in
 * dashboard (header, section tabs, panels, key/value rows) and the billing
 * return pages' note links. Loaded after Thread (thread.css) on those pages.
 * Structure follows the dashboard-design preset (calm wash ground, white
 * working cards, one primary action per panel, destructive in muted red);
 * colour, type, radii and buttons are Thread's (docs/brand/BRAND.md). */

.acct-page { margin: 0; background: var(--th-wash); }
.acct-page main { display: block; }
.acct-shell {
  box-sizing: border-box; width: 100%; max-width: 720px; margin: 0 auto; padding: 32px 20px 88px;
  font: 500 16px/1.5 var(--th-font); color: var(--th-ink-700);
}
.acct-shell *, .acct-shell *::before, .acct-shell *::after { box-sizing: border-box; }
.acct-shell [hidden] { display: none !important; }
.acct-shell h1, .acct-shell h2, .acct-shell h3, .acct-shell p, .acct-shell ul { margin: 0; }
.acct-shell h1, .acct-shell h2, .acct-shell h3, .acct-shell ul { padding: 0; }
.acct-shell ul { list-style: none; }
.acct-shell a { color: var(--th-teal-700); }
.acct-shell :focus-visible { outline: 3px solid var(--th-teal-700); outline-offset: 2px; }
.acct-ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* buttons: Thread's shape, sized for a thumb */
.acct-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border: 0; border-radius: 12px; cursor: pointer;
  font: 650 15.5px/1.1 var(--th-font); text-decoration: none; white-space: nowrap;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background .18s, box-shadow .18s, transform .18s;
}
.acct-btn:active { transform: scale(.975); }
.acct-btn:disabled { opacity: .6; cursor: progress; }
.acct-btn-primary { background: var(--th-teal-700); color: #fff !important; }
.acct-btn-ghost { background: #fff; color: var(--th-teal-700) !important; box-shadow: inset 0 0 0 1.5px var(--th-line-strong); }
.acct-btn-danger { background: #fff; color: var(--th-short-ink, #B3261E) !important; box-shadow: inset 0 0 0 1.5px #F2C9C4; }
.acct-btn-quiet { background: transparent; color: var(--th-teal-700) !important; padding: 0 12px; }
.acct-btn-block { width: 100%; }
@media (hover: hover) {
  .acct-btn-primary:hover { background: var(--th-teal-800); }
  .acct-btn-ghost:hover, .acct-btn-quiet:hover { background: var(--th-mint); }
  .acct-btn-danger:hover { background: #FFF0EE; }
}

/* sign-in card (/auth/login and signed-out /my-alerts) */
.signin { max-width: 460px; margin: 8px auto 0; }
.signin-card {
  background: #fff; border-radius: 22px; padding: 32px 28px;
  box-shadow: inset 0 0 0 1px var(--th-line), var(--th-shadow-md);
}
.signin .login-icon {
  display: grid; place-items: center; width: 52px; height: 52px; margin: 0 0 18px; border-radius: 14px;
  background: var(--th-mint); color: var(--th-teal-700);
}
.signin .login-icon .material-icons-round { font-size: 26px; }
.signin h1 { font: 700 28px/1.15 var(--th-font); letter-spacing: -.028em; color: var(--th-ink-900); margin-bottom: 8px; }
.signin-lede { font-size: 16px; line-height: 1.55; color: var(--th-ink-700); margin-bottom: 22px !important; }
.signin-pending { margin: -10px 0 18px !important; font-weight: 650; color: var(--th-teal-800); }
.signin label { display: block; font: 650 14.5px/1.3 var(--th-font); color: var(--th-ink-900); margin-bottom: 8px; }
.acct-field {
  display: block; width: 100%; height: 54px; padding: 0 16px; margin: 0 0 12px; border: 0; border-radius: 13px;
  background: #fff; box-shadow: inset 0 0 0 1.5px var(--th-field);
  font: 500 16px/1.2 var(--th-font); color: var(--th-ink-900); -webkit-appearance: none; appearance: none;
}
.acct-field::placeholder { color: var(--th-ink-500); opacity: 1; }
.acct-field:focus { outline: 0; box-shadow: inset 0 0 0 1.5px var(--th-teal-700), 0 0 0 5px rgba(25, 195, 177, .18); }
.acct-field[aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--th-short-ink, #B3261E); }
.signin-foot { margin-top: 18px !important; font-size: 14px; color: var(--th-ink-500); }
.signin-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 18px; }
.signin-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 650; text-decoration: none; }
.signin-sent { text-align: left; }
.signin-sent h1 { font-size: 26px; }
.signin-sent .signin-email { font-weight: 700; color: var(--th-ink-900); word-break: break-all; }
.signin-steps { display: grid; gap: 8px; margin: 18px 0 22px !important; padding: 16px 18px !important; border-radius: 14px; background: var(--th-wash); font-size: 15px; }
.signin-steps li { display: flex; gap: 10px; }
.signin-steps li::before { content: ""; width: 7px; height: 7px; margin-top: 9px; border-radius: 50%; background: var(--th-teal-600); flex: none; }
.signin-actions { display: grid; gap: 10px; }

/* inline messages */
.acct-msg { margin: 0 0 14px !important; padding: 12px 14px; border-radius: 12px; font-size: 15px; line-height: 1.45; }
.acct-msg strong { color: inherit; }
.acct-msg-error { background: #FFF0EE; color: #8C1D17; box-shadow: inset 0 0 0 1px #F2C9C4; }
.acct-msg-ok { background: #E8F7EE; color: #17663E; box-shadow: inset 0 0 0 1px #C6E9D3; }
.acct-msg-note { background: var(--th-wash); color: var(--th-ink-700); box-shadow: inset 0 0 0 1px var(--th-line); }
.acct-msg-warn { background: #FFF4E0; color: #6E3900; box-shadow: inset 0 0 0 1px #F1D8A8; }

/* dashboard: header */
.acct-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.acct-head-text { min-width: 0; }
.acct-head h1 { font: 700 28px/1.15 var(--th-font); letter-spacing: -.028em; color: var(--th-ink-900); }
.acct-head .acct-email { margin-top: 2px !important; font-size: 15px; color: var(--th-ink-500); overflow-wrap: anywhere; }
.acct-head .acct-btn { flex: none; }

/* dashboard: section tabs (sticky under the site header) */
.acct-tabs {
  position: sticky; top: var(--th-header-h, 64px); z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0 -4px 18px; padding: 4px;
  background: rgba(242, 250, 248, .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-radius: 16px;
}
.acct-tabs::before { content: ""; position: absolute; inset: 4px; border-radius: 13px; background: #fff; box-shadow: inset 0 0 0 1px var(--th-line); z-index: -1; }
.acct-tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 56px; padding: 6px 4px; border: 0; border-radius: 12px; background: transparent; cursor: pointer;
  font: 650 15px/1.15 var(--th-font); color: var(--th-ink-700); -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.acct-tab small { font: 600 12.5px/1.2 var(--th-font); color: var(--th-ink-500); font-variant-numeric: tabular-nums; }
.acct-tab[aria-selected="true"] { background: var(--th-mint); color: var(--th-teal-800); box-shadow: inset 0 0 0 1.5px var(--th-teal-700); }
.acct-tab[aria-selected="true"] small { color: var(--th-teal-800); }
.acct-tab small.is-off { color: #8F4A00; }
@media (hover: hover) { .acct-tab:not([aria-selected="true"]):hover { background: var(--th-wash); } }

/* dashboard: cards and rows */
.acct-panel { display: grid; gap: 16px; }
.acct-panel:focus { outline: 0; }
.acct-card {
  background: #fff; border-radius: 18px; padding: 20px;
  box-shadow: inset 0 0 0 1px var(--th-line), var(--th-shadow-sm);
}
.acct-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.acct-card h2 { font: 680 19px/1.25 var(--th-font); letter-spacing: -.02em; color: var(--th-ink-900); }
.acct-card-sub { font-size: 15px; color: var(--th-ink-500); }
.acct-count { font: 650 14px/1 var(--th-font); color: var(--th-ink-500); font-variant-numeric: tabular-nums; white-space: nowrap; }
.acct-card p + p { margin-top: 10px; }
.acct-card .acct-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.acct-help { font-size: 14.5px; color: var(--th-ink-500); margin-top: 12px !important; }

.acct-kv { display: grid; gap: 0; margin: 0 0 4px; }
.acct-kv-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; padding: 10px 0; border-top: 1px solid var(--th-line); }
.acct-kv-row:first-child { border-top: 0; padding-top: 0; }
.acct-kv-row dt { font-size: 15px; color: var(--th-ink-500); }
.acct-kv-row dd { margin: 0; font-weight: 650; color: var(--th-ink-900); text-align: right; font-variant-numeric: tabular-nums; }

.acct-state { display: inline-flex; align-items: center; gap: 7px; font: 650 14px/1 var(--th-font); white-space: nowrap; }
.acct-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; box-sizing: border-box; }
.acct-state-on { color: #17663E; } .acct-state-on::before { background: #27B26C; }
.acct-state-off { color: #8F4A00; } .acct-state-off::before { border: 1.8px solid #E8920F; background: transparent; }

/* medicines */
.med-list { display: grid; }
.med-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 64px; padding: 10px 0; border-top: 1px solid var(--th-line); }
.med-item:first-child { border-top: 0; }
.med-main { min-width: 0; display: grid; gap: 5px; }
.med-name { font: 650 16.5px/1.3 var(--th-font); color: var(--th-ink-900); overflow-wrap: anywhere; }
.med-chip { justify-self: start; display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; font: 650 12.5px/1.1 var(--th-font); white-space: nowrap; }
.med-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; box-sizing: border-box; flex: none; }
.med-chip.tier-critical { color: #B3261E; background: #FFF0EE; } .med-chip.tier-critical::before { background: #D93A2F; }
.med-chip.tier-high { color: #8F4A00; background: #FFF4E0; } .med-chip.tier-high::before { border: 1.6px solid #E8920F; background: linear-gradient(90deg, #E8920F 50%, transparent 50%); }
.med-chip.tier-low { color: var(--th-ink-700); background: var(--th-wash); box-shadow: inset 0 0 0 1px var(--th-line); } .med-chip.tier-low::before { border: 1.6px solid var(--th-ink-500); }
/* each row's Remove is quiet; the red is kept for the confirm step */
.med-remove { flex: none; min-height: 44px; padding: 0 14px; color: var(--th-ink-700) !important; box-shadow: inset 0 0 0 1.5px var(--th-line-strong); }
@media (hover: hover) { .med-remove:hover { color: #8C1D17 !important; background: #FFF6F5; } }
.med-confirm { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 12px; margin: 2px 0; border-radius: 14px; background: #FFF6F5; box-shadow: inset 0 0 0 1px #F2C9C4; }
.med-confirm p { font-size: 15px; color: var(--th-ink-900); }
.med-confirm .acct-actions { margin: 0; display: flex; gap: 8px; }
.med-empty { padding: 4px 0 6px; color: var(--th-ink-700); }
.med-empty strong { display: block; color: var(--th-ink-900); }

.add-med { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--th-line); }
.add-med label { display: block; font: 650 14.5px/1.3 var(--th-font); color: var(--th-ink-900); margin-bottom: 8px; }
.add-med-row { display: flex; gap: 8px; }
.add-med-row .acct-field { margin: 0; flex: 1 1 auto; min-width: 0; }
.add-med-row .acct-btn { height: 54px; flex: none; }
.add-med .acct-msg { margin: 12px 0 0 !important; }

.recent-item { padding: 14px 0; border-top: 1px solid var(--th-line); }
.recent-item:first-child { border-top: 0; padding-top: 0; }
.recent-item .r-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.recent-name { font: 650 16px/1.3 var(--th-font); color: var(--th-ink-900); }
.recent-sum { margin-top: 6px; font-size: 15px; }
.recent-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 14px; color: var(--th-ink-500); }
.recent-empty { color: var(--th-ink-700); }

/* account tab: delete disclosure */
.acct-disclose > summary { list-style: none; cursor: pointer; }
.acct-disclose > summary::-webkit-details-marker { display: none; }
.acct-disclose-body { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--th-line); }
.acct-disclose-body ol { margin: 10px 0 0 20px; padding: 0; display: grid; gap: 6px; }
.acct-card-danger h2 { color: #8C1D17; }
.del-h { margin-top: 16px !important; font: 680 15.5px/1.3 var(--th-font); color: var(--th-ink-900); }
.del-list { display: grid; gap: 6px; margin-top: 8px !important; font-size: 15px; }
.del-list li { display: flex; gap: 10px; }
.del-list li::before { content: ""; width: 7px; height: 7px; margin-top: 9px; border-radius: 50%; background: var(--th-ink-500); flex: none; }
.del-paid { margin-top: 12px !important; padding: 12px 14px; border-radius: 12px; background: #FFF6F5; box-shadow: inset 0 0 0 1px #F2C9C4; font-size: 15px; }
.del-label { display: block; font: 600 15px/1.45 var(--th-font); color: var(--th-ink-900); margin-bottom: 8px; overflow-wrap: anywhere; }
#delete-confirm .acct-field { margin: 0; }
#delete-confirm .acct-msg { margin: 12px 0 0 !important; }
/* the one solid red button: the irreversible step */
.acct-btn-destroy { background: #B3261E; color: #fff !important; }
@media (hover: hover) { .acct-btn-destroy:hover { background: #8C1D17; } }
.signin h1:focus { outline: 0; }

/* dev test controls */
.dev-test-card { display: none; }
.dev-test-card.visible { display: block; }
.dev-plan-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dev-plan-buttons button.active { background: var(--th-mint); box-shadow: inset 0 0 0 1.5px var(--th-teal-700); }

/* billing return pages: links in the note use the brand teal */
.card > .note a { color: var(--th-teal-700); }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 2000;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: var(--th-ink-900); color: #fff;
  font: 600 15px/1.35 var(--th-font); box-shadow: var(--th-shadow-lg);
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .25s, transform .25s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.success { background: #17663E; }
#toast.error { background: #8C1D17; }
.acct-loading { padding: 48px 0; text-align: center; color: var(--th-ink-500); }

@media (min-width: 761px) {
  .acct-shell { padding-top: 48px; }
  .acct-card { padding: 24px 26px; }
  .acct-head h1 { font-size: 32px; }
}
@media (max-width: 380px) {
  .acct-shell { padding-left: 16px; padding-right: 16px; }
  .signin-card { padding: 26px 20px; }
  .acct-card { padding: 18px 16px; }
  .acct-tab { font-size: 14.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .acct-btn, #toast { transition: none; }
  .acct-btn:active { transform: none; }
}
