/* Extension popup — same palette as cloud app, minimal control-panel layout */

:root {
  --av-bg: #161210;
  --av-panel: #1e1915;
  --av-field: rgba(237, 231, 218, 0.05);
  --av-ink: #ede7da;
  --av-ink-2: rgba(237, 231, 218, 0.62);
  --av-ink-3: rgba(237, 231, 218, 0.4);
  --av-line: rgba(237, 231, 218, 0.14);
  --av-line-2: rgba(237, 231, 218, 0.28);
  --av-accent: #e0603a;
  --av-indigo: #8fb0d1;
  --av-danger: #e8896f;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --jp-round: "Hiragino Maru Gothic ProN", "Zen Maru Gothic", "Hiragino Sans", sans-serif;
}

:root[data-theme="light"] {
  --av-bg: #f5efe0;
  --av-panel: #fdfaf1;
  --av-field: rgba(38, 34, 27, 0.04);
  --av-ink: #26221b;
  --av-ink-2: rgba(38, 34, 27, 0.62);
  --av-ink-3: rgba(38, 34, 27, 0.42);
  --av-line: rgba(38, 34, 27, 0.16);
  --av-line-2: rgba(38, 34, 27, 0.32);
  --av-accent: #d84e2a;
  --av-indigo: #2c4a68;
  --av-danger: #b8492b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.av {
  width: 320px;
  background: var(--av-bg);
  color: var(--av-ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.shell { padding: 14px 14px 16px; }

.av-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 0 4px;
}

.av-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.av-hanko {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--av-accent);
  color: #fffdf6;
  font-family: var(--jp-round);
  font-weight: 900;
  font-size: 11px;
  transform: rotate(-6deg);
  flex: none;
  box-shadow: 0 0 0 2px var(--av-bg), 0 0 0 3px var(--av-accent);
}

.av-title {
  font-family: var(--jp-round);
  font-size: 14px;
  font-weight: 800;
}

.av-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.av-account {
  margin-top: 12px;
  display: grid;
  gap: 7px;
}

.av-account-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1.5px solid var(--av-line);
  border-radius: 10px;
  background: var(--av-panel);
  font-size: 11.5px;
  color: var(--av-ink-2);
}

.av-account-row b {
  display: block;
  font-size: 12px;
  color: var(--av-ink);
}

.av-account-sub {
  display: block;
  font-size: 10.5px;
  color: var(--av-ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.av-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--av-accent);
}

.av-dot-off {
  background: transparent;
  border: 2px dashed var(--av-line-2);
}

.av-dot-warn {
  background: #f0a637;
}

/* ── Monthly usage ─────────────────────────────────────────────────────────
   The popup used to show account state but never how much of the plan was
   left, so a learner's first hint of a cap was a feature quietly stopping. */
.av-usage {
  margin-top: 10px;
  padding: 10px 11px 11px;
  border: 1.5px solid var(--av-line);
  border-radius: 10px;
  background: var(--av-panel);
}

.av-usage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.av-usage-title {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--av-ink-3);
}

.av-usage-plan {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  color: var(--av-accent);
}

.av-meter + .av-meter {
  margin-top: 8px;
}

.av-meter-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  color: var(--av-ink-2);
}

.av-meter-val {
  font-variant-numeric: tabular-nums;
  color: var(--av-ink);
}

.av-meter-track {
  margin-top: 4px;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--av-field);
  border: 1px solid var(--av-line);
}

.av-meter-fill {
  height: 100%;
  background: var(--av-accent);
}

.av-meter-fill.av-meter-low {
  background: #f0a637;
}

.av-meter-fill.av-meter-full {
  background: var(--av-danger);
}

.av-usage-cta {
  margin-top: 10px;
}

.av-usage-note {
  margin-top: 7px;
  font-size: 10px;
  line-height: 1.45;
  color: var(--av-ink-3);
}

.av-review-prompt-host {
  margin-top: 12px;
}

.av-review-prompt-host[hidden] {
  display: none;
}

.av-review-prompt {
  display: grid;
  gap: 8px;
  padding: 10px 11px;
  border: 1.5px solid var(--av-line);
  border-radius: 10px;
  background: var(--av-panel);
}

.av-review-prompt-copy {
  font-size: 12px;
  color: var(--av-ink-2);
  line-height: 1.4;
}

.av-review-prompt-actions {
  display: grid;
  gap: 6px;
}

.av-actions {
  margin-top: 12px;
  display: grid;
  gap: 7px;
}

.av-error {
  font-size: 11px;
  color: var(--av-danger);
}

.av-hint {
  font-size: 10.5px;
  color: var(--av-ink-3);
  line-height: 1.35;
}

.av-stamp-rally {
  margin-top: 14px;
  overflow: hidden;
  border-radius: 14px;
  border: 2px solid var(--av-indigo);
  background: var(--av-panel);
}

.av-stamp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--av-indigo);
  color: var(--av-bg);
  padding: 7px 11px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.av-stamp-head-jp {
  font-family: var(--jp-round);
  letter-spacing: 0.24em;
  opacity: 0.85;
}

.av-stamp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  padding: 10px 10px 4px;
}

.av-stamp {
  aspect-ratio: 1;
  border: 2px dashed var(--av-line-2);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 8px;
  font-weight: 700;
  color: var(--av-ink-3);
}

.av-stamp-hit {
  border: 2px solid var(--av-accent);
  color: var(--av-accent);
  font-family: var(--jp-round);
  font-weight: 900;
  font-size: 13px;
  transform: rotate(-8deg);
}

.av-stamp-note {
  padding: 0 10px 10px;
  font-size: 11px;
  color: var(--av-ink-2);
}
.av-stamp-note b { color: var(--av-accent); font-weight: 800; }

.av-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1.5px solid var(--av-line);
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--av-ink-3);
}

.av-footer a {
  color: var(--av-ink-2);
  text-decoration: none;
  font-weight: 700;
}
.av-footer a:hover { color: var(--av-ink); }

.av-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  border: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  background: transparent;
  transition: background 130ms ease, border-color 130ms ease, opacity 130ms ease;
}
/* display:inline-flex above would override the hidden attribute, leaving an
   empty pill (the due-review button) visible when there is nothing due. */
.av-btn[hidden] { display: none; }
.av-btn:active { transform: translateY(1px); }
.av-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.av-btn-block { width: 100%; }

.av-btn-primary {
  background: var(--av-accent);
  border-color: var(--av-accent);
  color: #fffdf6;
}
.av-btn-primary:hover:not(:disabled) { opacity: 0.88; }

.av-btn-ghost {
  border-color: var(--av-ink);
  color: var(--av-ink);
}
.av-btn-ghost:hover:not(:disabled) { background: var(--av-field); }

.av-btn-quiet {
  border-color: var(--av-line);
  color: var(--av-ink-3);
}
.av-btn-quiet:hover:not(:disabled) { color: var(--av-ink); }

.av-btn-sm { padding: 0.35rem 0.55rem; font-size: 11px; }
.av-icon-btn { padding: 0.35rem; min-width: 30px; }

#copilot-btn.active {
  border-color: var(--av-accent);
  color: var(--av-accent);
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--av-accent);
  outline-offset: 2px;
}
