/* ─────────────────────────────────────────────────────────────────────────
   HORMACHUELOS — the account dashboard.

   Loaded after sketch.css on account.html only. The account card opens up
   into a dashboard: the sections down a sidebar, the plan on a painted
   banner, and each usage window as its own card with a large share left.
   On a phone the sidebar folds into a scrolling strip above the content.
   ───────────────────────────────────────────────────────────────────────── */

/* The dashboard fills the window under the site's nav, edge to edge, instead
   of sitting as a small card in the middle. */
.auth-main:has(.acct-dash) {
  display: block;
  min-height: 100svh;
  padding: 84px 0 0;
}

.auth-card.acct-dash {
  width: 100%;
  min-height: calc(100svh - 84px);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  padding: 0;
  overflow: visible;
  border-width: 1px 0 0;
  border-radius: 0;
  box-shadow: none;
}

/* ── Sidebar ── */

.acct-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 28px 14px 22px;
  border-right: 1px solid rgba(42, 32, 22, 0.18);
  background: rgba(243, 236, 224, 0.55);
}

.acct-side-label {
  margin: 0 10px 4px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sanguine);
}

.acct-dash .acct-bar {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.acct-dash .acct-tabs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
}

.acct-dash .acct-tab {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 17px;
  text-align: left;
}

.acct-tab-icon {
  flex: none;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.acct-side-user {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 12px;
  align-items: center;
  margin-top: auto;
  padding: 16px 10px 0;
  border-top: 1px solid rgba(42, 32, 22, 0.18);
}

.acct-side-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9864a, #8e3a1c);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}

.acct-side-who {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.acct-side-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.acct-side-plan {
  font-size: 14px;
  color: var(--ink-soft);
}

.acct-side-signout {
  grid-column: 1 / -1;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.acct-side-signout:hover {
  background: rgba(42, 32, 22, 0.07);
}

/* ── Content ── */

.acct-main {
  min-width: 0;
  padding: 36px clamp(24px, 4vw, 56px) 40px;
}

/* On a wide screen the usage windows sit side by side. */
@media (min-width: 1100px) {
  .acct-dash #usage {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .acct-dash #usage > :not(.usage-window),
  .acct-dash #usage:has(#usage-five-block[hidden]) .usage-window {
    grid-column: 1 / -1;
  }
}

.acct-dash .acct-head {
  margin-bottom: 4px;
}

/* ── The plan banner ── */

.acct-hero {
  overflow: hidden;
  border: 1px solid rgba(42, 32, 22, 0.4);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.9);
}

/* A wash of the theme's inks - sanguine, ochre, leaf - laid like paint. */
.acct-hero-art {
  height: 112px;
  background:
    radial-gradient(120% 140% at 8% 110%, rgba(77, 106, 42, 0.75), transparent 55%),
    radial-gradient(90% 120% at 92% -10%, rgba(110, 44, 20, 0.9), transparent 60%),
    radial-gradient(70% 90% at 55% 60%, rgba(214, 160, 82, 0.85), transparent 70%),
    linear-gradient(120deg, #c9864a, #8e3a1c 55%, #4d2a14);
  border-bottom: 1px solid rgba(42, 32, 22, 0.3);
}

.acct-hero-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 20px;
}

.acct-hero-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.acct-hero-tag {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.acct-hero-plan {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--ink);
}

.acct-hero-meta {
  margin: 2px 0 0;
  font-size: 16.5px;
  color: var(--ink-soft);
}

.acct-hero-meta[hidden] {
  display: none;
}

.acct-hero-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.acct-hero-btn {
  flex: none;
  padding: 13px 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.acct-hero-btn:hover {
  background: #3d2f20;
  transform: translateY(-1px);
}

/* ── Usage windows as cards ── */

/* Larger type all through the dashboard: the title, the section labels, and
   the rows inside every section. */
.acct-dash .acct-head h1 {
  font-size: 34px;
}

.acct-dash .auth-sub {
  font-size: 17px;
}

.acct-dash .acct-menu-btn {
  padding: 10px 18px;
  font-size: 15px;
}

.acct-dash .acct-menu-item {
  font-size: 15.5px;
}

.acct-dash .usage-block-head,
.acct-dash .order-block-head,
.acct-dash .plan-block-head,
.acct-dash .device-block-head {
  font-size: 13px;
}

.acct-dash .usage-block-head {
  margin-top: 10px;
}

.acct-dash .usage-line,
.acct-dash .plan-option-name,
.acct-dash .pay-card-line,
.acct-dash .device-name {
  font-size: 17px;
}

.acct-dash .usage-updated,
.acct-dash .device-lead,
.acct-dash .device-when,
.acct-dash .plan-note,
.acct-dash .pay-empty,
.acct-dash .ref-rules,
.acct-dash .ref-empty {
  font-size: 15.5px;
}

.acct-dash .acct-pane .usage-window {
  gap: 10px;
  padding: 18px 20px;
  border-radius: 16px;
}

.acct-dash .usage-window-top {
  align-items: center;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.acct-dash .usage-window-top strong {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.acct-dash .usage-bar {
  height: 12px;
}

.acct-dash .acct-pane .usage-window .usage-reset {
  padding: 0;
  font-size: 15.5px;
}

/* Free Haiku's one-time human check, under its bar. */
.acct-dash .fh-verify:not([hidden]) {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

/* ── Phone: the sidebar becomes a strip across the top ── */

@media (max-width: 760px) {
  .auth-card.acct-dash {
    grid-template-columns: minmax(0, 1fr);
  }

  .acct-side {
    flex-direction: row;
    align-items: center;
    padding: 8px 6px;
    border-right: 0;
    border-bottom: 1px solid rgba(42, 32, 22, 0.18);
  }

  .auth-main:has(.acct-dash) {
    padding-top: 72px;
  }

  .auth-card.acct-dash {
    min-height: calc(100svh - 72px);
  }

  .acct-side-label,
  .acct-side-user {
    display: none;
  }

  .acct-dash .acct-bar {
    min-width: 0;
    flex: 1;
  }

  .acct-dash .acct-tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .acct-dash .acct-tab {
    flex: 1 0 auto;
    flex-direction: column;
    gap: 4px;
    width: auto;
    padding: 8px 6px;
    font-size: 13px;
    text-align: center;
  }

  .acct-main {
    padding: 22px 18px 22px;
  }

  .acct-hero-art {
    height: 84px;
  }

  .acct-hero-body {
    flex-wrap: wrap;
    padding: 16px;
  }

  .acct-hero-plan {
    font-size: 28px;
  }

  .acct-dash .acct-head h1 {
    font-size: 27px;
  }

  .acct-hero-btn {
    width: 100%;
  }

  .acct-dash .acct-pane .usage-window {
    padding: 14px 16px;
  }

  .acct-dash .usage-window-top strong {
    font-size: 24px;
  }
}

/* ── API keys ──
   The endpoint and header in one paper slip, then the keys as a list with a
   clear New key button above it. */

.api-setup {
  display: grid;
  margin-bottom: 26px;
  border: 1px solid rgba(42, 32, 22, 0.4);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.9);
}

.api-setup-row {
  display: grid;
  gap: 8px;
  padding: 16px 20px;
}

.api-setup-row + .api-setup-row {
  border-top: 1px solid rgba(42, 32, 22, 0.14);
}

.api-setup-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.api-setup-value {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.api-setup-value code,
.api-made code {
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(42, 32, 22, 0.06);
  font-size: 15.5px;
  color: var(--ink);
}

.api-setup-value code {
  flex: 1;
}

/* The formats list: plain lines, the paths as small inline code. */
.api-formats {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.api-formats p {
  margin: 0;
  line-height: 1.5;
}

.api-formats code {
  flex: none;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 14px;
}

.api-copy {
  flex: none;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.api-copy:hover {
  background: rgba(42, 32, 22, 0.07);
}

.api-keys-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sanguine);
}

.api-new {
  padding: 12px 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.api-new:hover {
  background: #3d2f20;
  transform: translateY(-1px);
}

.api-new:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

/* Naming a new key: a small card in the middle of a dimmed page. */
.api-dialog {
  width: min(420px, calc(100vw - 32px));
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(42, 32, 22, 0.18);
}

.api-dialog::backdrop {
  background: rgba(42, 32, 22, 0.35);
}

.api-dialog form {
  display: grid;
  gap: 12px;
  padding: 24px;
}

.api-dialog h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.api-dialog label {
  font-size: 15px;
  color: var(--ink-soft);
}

.api-dialog input,
.api-dialog select {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15.5px;
}

.api-dialog input:focus,
.api-dialog select:focus {
  outline: 2px solid var(--sanguine);
  outline-offset: 1px;
}

.api-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.api-dialog .api-new {
  padding: 9px 20px;
  font-size: 15px;
}

/* The new key's dialog: wider, so the 51-character key wraps less. */
#api-key-dialog {
  width: min(560px, calc(100vw - 32px));
}

.api-dialog .api-key-note {
  margin: 0;
  font-size: 15px;
  color: var(--ink-soft);
}

.api-key-box code {
  font-size: 14.5px;
  user-select: all;
}

/* The new key, shown once: a highlighted slip so it is not missed. */
.api-made:not([hidden]) {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 16px 20px;
  border: 1px solid var(--sanguine);
  border-radius: 14px;
  background: rgba(142, 58, 28, 0.07);
  font-size: 15.5px;
}

.api-list {
  display: grid;
  gap: 10px;
}

.api-list .device-row {
  padding: 16px 20px;
  border: 1px solid rgba(42, 32, 22, 0.4);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.9);
}

.api-prefix {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(42, 32, 22, 0.06);
  font-size: 14.5px;
  font-weight: 500;
}

.api-list .device-revoke {
  font-size: 15px;
}

.api-list .pay-empty {
  margin: 0;
  padding: 22px 20px;
  border: 1px dashed rgba(42, 32, 22, 0.35);
  border-radius: 14px;
  text-align: center;
}

@media (max-width: 760px) {
  .api-setup-value {
    flex-wrap: wrap;
  }

  .api-new {
    padding: 10px 18px;
    font-size: 15px;
  }
}


/* ── Tasks tab (tasks.js): one row per task - what to do on the left, the
   reward and its button on the right. ── */

.task-list {
  display: grid;
  gap: 10px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.task,
.task-empty {
  padding: 14px 16px;
  border: 1px solid rgba(42, 32, 22, 0.18);
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.6);
}

.task {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.task-empty {
  color: var(--ink-soft);
}

.task[data-state="ready"] {
  border-color: var(--sanguine);
  background: rgba(194, 84, 46, 0.07);
}

.task[data-state="done"] {
  opacity: 0.7;
}

.task-main {
  display: grid;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.task-title {
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}

.task-detail,
.task-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.45;
}

.task-note:empty {
  display: none;
}

.task-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-progress {
  flex: 1 1 auto;
  height: 6px;
  max-width: 260px;
  border-radius: 99px;
  background: rgba(42, 32, 22, 0.12);
  overflow: hidden;
}

.task-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
}

.task-count {
  color: var(--ink-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.task-proof {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.task-proof .ref-link {
  padding: 8px 12px;
  font-size: 13.5px;
}

.task-side {
  display: grid;
  justify-items: end;
  gap: 8px;
  flex: none;
}

.task-reward {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.task-badge {
  padding: 4px 10px;
  border: 1px solid rgba(42, 32, 22, 0.25);
  border-radius: 99px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
}

.task-claim:disabled {
  opacity: 0.35;
  cursor: default;
  filter: none;
}

@media (max-width: 760px) {
  .task {
    flex-direction: column;
  }

  .task-side {
    grid-auto-flow: column;
    align-items: center;
    justify-items: start;
  }
}
