/*
 * admin.css — admin-UI-specific styles on top of shared_lib's tokens.css.
 * Kept narrow: chrome layout, page heads, card primitive, table primitive.
 * Brand tokens (colors, type, spacing) live in tokens.css.
 */

/* Chrome ------------------------------------------------------------------ */
.hg-chrome {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--chrome-bg);
  color: #fff;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--chrome-line);
}
.hg-chrome__brand        { display: flex; align-items: center; gap: 24px; }
.hg-chrome__wordmark     { color: #fff; text-decoration: none; font-weight: 800;
                           letter-spacing: .2em; font-size: 16px; }
.hg-chrome__subtitle     { font-family: var(--font-mono); font-size: 10px;
                           color: var(--chrome-mute); letter-spacing: .14em; }
.hg-chrome__nav          { display: flex; gap: 24px; align-items: center; }
.hg-chrome__nav-link     { color: var(--chrome-mute); text-decoration: none;
                           font-size: 12px; font-weight: 600; letter-spacing: .1em;
                           text-transform: uppercase; padding: 4px 0;
                           border-bottom: 2px solid transparent; }
.hg-chrome__nav-link:hover { color: #fff; border-bottom-color: var(--hg-red); }
.hg-chrome__actor        { display: flex; align-items: center; gap: 12px;
                           font-size: 12px; color: var(--chrome-mute); }
.hg-chrome__actor-email  { color: #fff; }
.hg-chrome__actor-role   { font-family: var(--font-mono); font-size: 10px;
                           letter-spacing: .14em; text-transform: uppercase;
                           color: var(--hg-red); }

/* Main + page heads ------------------------------------------------------- */
.hg-main          { padding: 32px; max-width: 1280px; margin: 0 auto; }
.hg-main--centered { display: flex; align-items: center; justify-content: center;
                     min-height: calc(100vh - 56px - 60px); }
.hg-page-head     { margin-bottom: 24px; }
.hg-page-head .t-h1 { margin: 4px 0 8px; }

/* Card primitive ---------------------------------------------------------- */
.hg-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: 20px 24px;
  box-shadow: var(--shadow-1);
}
.hg-card--placeholder p { margin: 4px 0; color: var(--fg-3); }
.hg-card--placeholder .t-mono { color: var(--ink-1); background: var(--surface-2);
                                padding: 2px 6px; border-radius: 2px; }

/* Footer ------------------------------------------------------------------ */
.hg-foot {
  background: var(--chrome-bg);
  color: var(--chrome-mute);
  padding: 16px 32px;
  margin-top: 56px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  display: flex;
  justify-content: space-between;
}

/* Table primitive (used as customer / audit / usage tables land) ---------- */
.hg-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hg-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-3);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
}
.hg-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--fg-1);
}
.hg-table tr:hover td { background: var(--surface-2); }

/* Filter bar (search + status dropdown + buttons) ------------------------- */
.hg-filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 16px 0 12px;
}
.hg-input {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-2);
  background: var(--paper);
  color: var(--ink-1);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
}
.hg-input:focus { border-color: var(--hg-blue); }
.hg-input--select { padding-right: 32px; }
.hg-input[type="search"] { min-width: 280px; }

/* Scope toggle (My book / All accounts) ----------------------------------- */
.hg-scope-toggle {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-2);
  overflow: hidden;
}
.hg-scope-toggle__btn {
  padding: 7px 14px;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--fg-3);
  background: var(--surface);
  text-decoration: none;
  border-right: 1px solid var(--line-2);
}
.hg-scope-toggle__btn:last-child { border-right: 0; }
.hg-scope-toggle__btn:hover    { color: var(--fg-1); }
.hg-scope-toggle__btn.is-active { background: var(--ink-0); color: #fff; }

/* Status chip (active / trial / paused / churned) ------------------------- */
.hg-status {
  display: inline-block;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  border-radius: 2px;
}
.hg-status--active  { background: var(--gain-50); color: var(--gain); }
.hg-status--trial   { background: var(--hg-blue-50); color: var(--hg-blue-700); }
.hg-status--paused  { background: var(--ink-8); color: var(--ink-4); }
.hg-status--churned { background: var(--hg-red-50); color: var(--hg-red-700); }

/* Definition list — used on detail pages ---------------------------------- */
.hg-dl {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 16px;
  font-size: 13px;
}
.hg-dl dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding-top: 4px;
}
.hg-dl dd { margin: 0; color: var(--fg-1); }

/* Section heading inside a card ------------------------------------------- */
.hg-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 20px;
}
.hg-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.hg-section__title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin: 0 0 12px;
}

/* Plaintext-once (for issued/rotated keys) -------------------------------- */
.hg-plaintext {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-2);
  padding: 14px 16px;
  word-break: break-all;
  user-select: all;
  transition: filter 200ms ease;
}
.hg-plaintext.is-blurred { filter: blur(8px); cursor: pointer; }

/* Entitlements list (issue-key wizard) ------------------------------------ */
.hg-ent-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-2) var(--radius-2) 0 0;
  border-bottom: 0;
}
.hg-ent-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius-2) var(--radius-2);
  background: var(--paper);
  max-height: 480px;
  overflow-y: auto;
}
.hg-ent-row {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 14px;
}
.hg-ent-row:last-child { border-bottom: 0; }
.hg-ent-row:hover     { background: var(--surface-2); }
.hg-ent-row__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.hg-ent-row__id   { font-weight: 700; font-size: 13px; color: var(--ink-1); }
.hg-ent-row__desc { font-size: 11px; color: var(--fg-3); margin-top: 2px; }
.hg-ent-row__pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Pill checkbox — one per (dataset, granularity) tuple. The native
   checkbox is hidden visually but stays in the form; the label acts
   as the affordance and shows checked state via :has(). */
.hg-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--fg-2);
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  transition: background 100ms ease, border-color 100ms ease, color 100ms ease;
}
.hg-pill:hover { border-color: var(--ink-6); }
.hg-pill input { margin: 0; cursor: pointer; }
.hg-pill:has(input:checked) {
  background: var(--hg-red);
  color: #fff;
  border-color: var(--hg-red);
}
/* Fallback for browsers without :has() — keep the checkbox visible
   so the user can still see/check state. */
@supports not selector(:has(*)) {
  .hg-pill { padding-left: 8px; }
}

/* Form layout ------------------------------------------------------------- */
.hg-form { display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.hg-form__field { display: flex; flex-direction: column; gap: 4px; }
.hg-form__label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.hg-form__hint { font-size: 11px; color: var(--fg-4); }
.hg-form__error { font-size: 12px; color: var(--hg-red); margin-top: 4px; }
.hg-form__actions { display: flex; gap: 10px; margin-top: 8px; }
textarea.hg-input { min-height: 96px; padding: 10px 12px; font-family: var(--font-sans); resize: vertical; }
