/* Screen-specific pieces: plan & billing, account. Shared components live in
 * components.css / widgets.css / forms.css; only what one screen needs lives here. */

/* --- plan & billing --------------------------------------------------------------- */

.plan-name {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.price-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.price-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.price-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.price-label {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.price-amount {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.price-period {
  color: var(--text-3);
  font-size: 13px;
}

.compare th.compare-feature {
  height: auto;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  white-space: normal;
}

.compare tbody tr:last-child th {
  border-bottom: 0;
}

.compare .compare-col {
  width: 22%;
  text-align: center;
}

.compare thead .compare-col {
  text-align: center;
}

.compare td.is-current {
  background: color-mix(in srgb, var(--primary-soft) 55%, transparent);
}

.compare tbody tr:hover td.is-current {
  background: var(--primary-soft);
}

.tick {
  display: inline-flex;
  color: var(--ok-dot);
}

.dash {
  color: var(--text-3);
}

.input-row {
  display: flex;
  gap: 8px;
  max-width: 520px;
}

.input-row .input {
  flex: 1;
}

.key-input {
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

.key-mask {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
}

@media (max-width: 520px) {
  .input-row {
    flex-direction: column;
  }

  .input-row .input {
    flex: none;
  }
}

.price-head {
  min-height: 22px;
}

/* --- account ---------------------------------------------------------------------- */

.settings-section {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 16px 40px;
  padding: 28px 0;
  border-top: 1px solid var(--border);
}

.settings-section:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.settings-intro h2 {
  font-size: 15px;
  font-weight: 600;
}

.settings-intro p {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 13px;
}

@media (max-width: 900px) {
  .settings-section {
    grid-template-columns: minmax(0, 1fr);
  }
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.method {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.method:first-child {
  border-top: 0;
}

.method-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-2);
}

.method-icon .icon {
  width: 18px;
  height: 18px;
}

.method-main {
  flex: 1;
  min-width: 180px;
}

.method-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.method-desc {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 13px;
}

.method-form {
  flex-basis: 100%;
  padding-top: 4px;
}

.method-form .form {
  max-width: 400px;
}

.device {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
}

.device .icon {
  color: var(--text-3);
}

.danger-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.danger-row p {
  max-width: 520px;
  color: var(--text-2);
  font-size: 13px;
}

.danger-row p.cell-title {
  margin-bottom: 2px;
  color: var(--text);
  font-size: 14px;
}

/* --- Plan & billing, round 1.3 (K3 grace banner, K4 renewal line and cancel dialog) --- */

.plan-renewal {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
}

.compare-disclosure > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--text-2);
  font-weight: 500;
  cursor: pointer;
}

.compare-disclosure[open] > summary .icon {
  transform: rotate(90deg);
}

.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: 14px;
  cursor: pointer;
}

fieldset.field {
  margin: 0;
  padding: 0;
  border: 0;
}

/* --- Who can see this page, round 1.4 (V) --- */

.vis-choices {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.vis-choice > span {
  display: grid;
  gap: 2px;
}

.vis-choice .icon {
  vertical-align: -2px;
}

.vis-hint {
  font-size: 13px;
}

.vis-preview {
  border-top: 1px solid var(--border);
}

.vis-lock-mock {
  display: grid;
  justify-items: center;
  gap: 6px;
  max-width: 320px;
  margin: 8px 0 10px;
  padding: 20px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
}

.vis-lock-title {
  margin: 0;
  font-weight: 600;
}

.vis-lock-field {
  display: block;
  width: 100%;
  height: 32px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--surface);
}

.cell-vis {
  display: inline-flex;
  flex: none;
}

.vis-pending {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 14px;
  color: var(--text-2);
  font-size: 13px;
}

/* --- admin: the account and page screens (admin insights, step 2) ------------------ */

/* The key facts above an account: stat tiles that wrap to two, then one, per row. */
.admin-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.admin-strip .stat-value {
  font-size: 22px;
}

.stat-lines {
  display: grid;
  gap: 2px;
  font-size: 13px;
}

.stat-lines span {
  color: var(--text-3);
}

/* One cell per day of the last 30; a filled cell is a day the account was used. */
.activity-strip {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 2px;
  margin-top: 8px;
}

.activity-strip span {
  height: 14px;
  border-radius: 2px;
  background: var(--surface-3);
}

.activity-strip span[data-on] {
  background: var(--chart-1);
}

/* The controls on the right of a card header: the period switch over the legend. */
.card-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

nav.segmented {
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
}

/* A link styled as the segmented control's pressed segment: the current sort / window. */
.segmented a.segment {
  text-decoration: none;
}

.segmented a.segment[aria-current="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px 24px;
}

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline-item {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-text {
  margin: 0;
  overflow-wrap: anywhere;
}

.timeline-meta {
  margin: 2px 0 0;
  color: var(--text-3);
  font-size: 12.5px;
}

/* Inside a card body (the notes), the card's own padding is the gutter. */
.timeline-flush .timeline-item {
  padding-left: 0;
  padding-right: 0;
}

.note-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .timeline-item {
    padding: 10px 12px;
  }
}

.table td.cell-nowrap {
  white-space: nowrap;
}

/* The account's pages table: six columns that fit a laptop without a scrollbar. Below
   760px the shared table rules take over (fewer columns, a narrower first cell). */
@media (min-width: 761px) {
  .admin-pages .cell-main {
    max-width: 240px;
  }
}

.admin-pages .spark {
  flex: none;
  width: 64px;
}

.admin-pages th,
.admin-pages td {
  padding-left: 12px;
  padding-right: 12px;
}

/* --- admin: the metrics dashboard (admin insights, step 3) ------------------------ */

/* The KPI tiles: as many per row as fit, down to two on a phone. */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi {
    padding: 12px 14px;
  }
}

.kpi .stat-value {
  font-size: 22px;
}

.delta {
  color: var(--text-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

/* On a tile more is better, so up reads as good; elsewhere (downgrades) it stays neutral. */
.kpi .delta[data-dir="up"] {
  color: var(--ok);
}

.kpi .delta[data-dir="down"] {
  color: var(--danger);
}

.delta-vs,
.kpi-note {
  color: var(--text-3);
  font-size: 12px;
}

.kpi-note {
  font-style: italic;
}

.kpi-foot {
  margin: 12px 0 0;
  font-size: 12.5px;
}

.table-caption {
  padding: 10px 20px 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  caption-side: top;
}

/* Top pages and accounts share a half-width card: long titles and addresses are cut
   with an ellipsis instead of pushing the views column out of the card. */
.admin-top .cell-main {
  max-width: 340px;
}

@media (max-width: 480px) {
  .admin-top .cell-main {
    max-width: 230px;
  }
}

.funnel td.col-num,
.cohorts td {
  white-space: nowrap;
}

.funnel .meter {
  max-width: 220px;
}

/* A cohort cell's tint follows its share; capped so the number stays readable. */
.cohort-cell[data-state="value"] {
  background: color-mix(in srgb, var(--chart-1) calc(var(--tint, 0%) * 0.55), transparent);
}

.cohort-cell[data-state="unknown"],
.cohort-cell[data-state="empty"] {
  color: var(--text-3);
}

.cohorts th,
.cohorts td {
  padding-left: 8px;
  padding-right: 8px;
}

/* The public abuse-report form and its thank-you (report_base.html): one column, the
   wordmark above a card wider than the sign-in one, on the page background. */
.report-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  min-height: 100vh;
  padding: 40px 16px;
  background: var(--bg);
}

.report-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 600px;
  padding: 28px 28px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.report-card .form {
  gap: 18px;
}

.report-card fieldset.field .check {
  display: flex;
}

.report-target a {
  overflow-wrap: anywhere;
}

.report-subtitle {
  font-size: 16px;
  font-weight: 600;
}

.report-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 20px;
  list-style: disc;
}

.report-foot {
  max-width: 600px;
  color: var(--text-3);
  font-size: 12.5px;
  text-align: center;
}

@media (max-width: 480px) {
  .report-card {
    padding: 20px 16px;
  }
}

/* An abuse report on its admin screen: the reporter's text keeps its line breaks. */
.report-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.report-wrap {
  overflow-wrap: anywhere;
}
