/* v1.5.1 → v1.5.2 Akhand Gyan logistics: the console (/admin/akhand-gyan), the member page (/subscriptions) and the portal's floating
   card (assets/js/ag-portal.js). Colours come from the site tokens (assets/css/site.css), so Temple Dark (the default) and
   the light theme both hold; the portal shell, which has no site tokens, gets the Temple Dark values as fallbacks. */

/* ------------------------------------------------------------------ desk -- */
.desk-ag .ag-kpis { display: grid; gap: 14px; margin: 18px 0; }
.ag-kpi-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.ag-kpi { padding: 14px 16px; border: 1px solid var(--desk-line, rgba(217, 119, 6, .25)); border-radius: var(--desk-radius-sm, 12px); background: var(--desk-card, var(--surface)); }
.ag-kpi__n { margin: 0; font-size: 1.9rem; font-weight: 700; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.ag-kpi__l { margin: 4px 0 0; font-weight: 600; color: var(--ink); }
.ag-kpi__s { margin: 2px 0 0; font-size: .85rem; color: var(--muted); }
.ag-kpi--amber { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber) inset; }
.ag-pl { padding: 16px 18px; border: 1px solid var(--desk-line-strong, rgba(217, 119, 6, .38)); border-radius: var(--desk-radius, 16px); background: var(--desk-inset, var(--sunken)); }
.ag-pl__title { margin: 0 0 8px; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-text); }
.ag-pl__grid { display: grid; gap: 10px 18px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: 0; }
.ag-pl__grid dt { font-size: .82rem; color: var(--muted); }
.ag-pl__grid dd { margin: 2px 0 0; font-size: 1.15rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.ag-pl__net { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 14px 0 0; padding: 10px 14px; border-radius: 10px; font-size: 1.05rem; }
.ag-pl__net strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.ag-pl__net.is-over { background: rgba(47, 107, 58, .14); color: var(--success); border: 1px solid currentColor; }
.ag-pl__net.is-under { background: rgba(180, 35, 24, .12); color: var(--danger); border: 1px solid currentColor; }

.ag-tabs, .ag-modes { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.ag-tab, .ag-chip { min-height: 44px; padding: 0 16px; border: 1px solid var(--desk-line, var(--line)); border-radius: 999px; background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.ag-tab[aria-selected="true"], .ag-chip[aria-selected="true"] { background: var(--amber); border-color: var(--amber); color: #1A0E05; }
.ag-tab:focus-visible, .ag-chip:focus-visible { outline: 3px solid var(--focus, #FCD34D); outline-offset: 2px; }
.ag-h2 { margin: 0 0 10px; font-size: 1.2rem; }
.ag-h3 { margin: 18px 0 8px; font-size: 1rem; }
.ag-hint { margin: 6px 0 10px; font-size: .88rem; color: var(--muted); max-width: 60rem; }
.ag-sub { font-size: .84rem; color: var(--muted); }
.ag-bar, .ag-batch, .ag-pickup, .ag-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin: 0 0 10px; }
.ag-bar__q, .ag-batch__issues, .ag-pickup__memo { flex: 1 1 260px; }
.ag-batch .desk-field { flex: 1 1 200px; }
.ag-batch__copies { flex: 0 0 110px !important; }
.ag-batch .ag-hint { flex-basis: 100%; margin-top: 0; }
.ag-mode { border: 0; padding: 0; margin: 4px 0 12px; }
.ag-switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; cursor: pointer; }
.ag-switch input { width: 20px; height: 20px; accent-color: var(--amber); }
.ag-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .76rem; font-weight: 600; border: 1px solid var(--desk-line, var(--line)); color: var(--ink); white-space: nowrap; }
.ag-pill--active, .ag-pill--paid { border-color: var(--success); color: var(--success); }
.ag-pill--pending_payment, .ag-pill--unpaid, .ag-pill--partial { border-color: var(--amber); color: var(--amber-ink); }
.ag-pill--expired, .ag-pill--canceled { border-color: var(--danger); color: var(--danger); }
.ag-table td, .ag-grid td { vertical-align: top; }
.ag-grid input[type="text"], .ag-grid select { width: 100%; min-width: 7ch; min-height: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--desk-card, var(--surface)); color: var(--ink); font: inherit; font-variant-numeric: tabular-nums; }
.ag-grid input[data-g="tracking"] { min-width: 22ch; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.ag-grid input[data-g="cost"] { max-width: 9ch; }
.ag-grid input:focus, .ag-grid select:focus { outline: none; border-color: var(--amber); box-shadow: var(--desk-ring, 0 0 0 3px rgba(217, 119, 6, .3)); }
.ag-grid input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--amber); }
.ag-empty { padding: 18px; text-align: center; color: var(--muted); }
.ag-result { margin: 10px 0 0; }
.ag-result:empty { display: none; }
.ag-result[data-tone="error"] { color: var(--danger); font-weight: 600; }
.ag-result[data-tone="warn"] { color: var(--amber-ink); }
.ag-problems { margin: 6px 0 0; padding-left: 1.2em; }
.ag-drop { display: flex; align-items: center; gap: 14px; padding: 22px; margin: 6px 0 10px; border: 2px dashed var(--desk-line-strong, var(--line)); border-radius: 14px; cursor: pointer; background: var(--desk-inset, var(--sunken)); }
.ag-drop.is-over, .ag-drop:focus-within { border-color: var(--amber); background: rgba(217, 119, 6, .08); }
.ag-drop__icon { font-size: 1.8rem; }
.ag-rule { margin: 22px 0; border: 0; border-top: 1px solid var(--desk-line, var(--line)); }
.ag-settings { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 12px; }
.ag-settings .ag-actions, .ag-settings .ag-result { grid-column: 1 / -1; }
.ag-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--desk-line-strong, var(--line)); border-radius: 16px; background: var(--surface); color: var(--ink); }
.ag-dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
.ag-edit { padding: 20px; }
.ag-edit__grid { display: grid; gap: 10px 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 12px 0; }
.ag-edit__wide { grid-column: 1 / -1; }

/* v1.5.2 console: segmented switches, status pills, the carrier overview, the back-catalog matrix, the label panel */
.ag-actions--tools { margin-top: -2px; }
.ag-neg { color: var(--danger); }
.ag-pos { color: var(--success); }
.ag-amber { color: var(--amber-ink); }
.ag-pill--lg { padding: 3px 10px; font-size: .8rem; }
.ag-pill--warn { border-color: var(--amber); color: var(--amber-ink); background: rgba(232, 150, 42, .12); }
.ag-pill--out { border-color: var(--danger); color: var(--danger); background: rgba(248, 113, 113, .1); }
[data-theme="dark"] .ag-pill--out { color: #FECACA; }
.ag-row--warn td:first-child { box-shadow: inset 4px 0 0 var(--amber); }
.ag-seg { display: inline-flex; flex-wrap: wrap; gap: 0; margin: 4px 0 14px; padding: 4px; border: 1px solid var(--desk-line-strong, var(--line)); border-radius: 999px; background: var(--desk-inset, var(--sunken)); }
.ag-seg__btn { min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.ag-seg__btn[aria-checked="true"] { background: var(--amber); color: #1A0E05; box-shadow: 0 2px 10px -4px rgba(232, 150, 42, .7); }
.ag-seg__btn:focus-visible { outline: 3px solid var(--focus, #FCD34D); outline-offset: 2px; }
.ag-import { margin: 4px 0 16px; padding: 16px; border: 1px solid var(--desk-line, var(--line)); border-radius: var(--desk-radius-sm, 12px); background: var(--desk-inset, var(--sunken)); }
.ag-pl-slot { margin: 0 0 18px; }
.ag-tchips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; padding: 0; list-style: none; }
.ag-tchip { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: 1px solid var(--desk-line, var(--line)); border-radius: 999px; font-size: .88rem; color: var(--ink); }
.ag-tchip__n { font-weight: 700; font-variant-numeric: tabular-nums; }
.ag-tchip--delivered, .ag-tchip--picked_up { border-color: var(--success); }
.ag-tchip--exception { border-color: var(--amber); background: rgba(232, 150, 42, .12); color: var(--amber-ink); }
.ag-alert { margin: 10px 0; padding: 12px 16px; border: 1px solid var(--amber); border-radius: var(--desk-radius-sm, 12px); background: rgba(232, 150, 42, .1); color: var(--ink); }
.ag-alert__t { margin: 0 0 6px; font-weight: 700; color: var(--amber-ink); }
.ag-dupes .ag-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ag-flags { margin: 6px 0 8px; padding-left: 1.1em; display: grid; gap: 6px; font-size: .92rem; }
.ag-mini { min-height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--desk-card, var(--surface)); color: var(--ink); font: inherit; }
.ag-more { margin: 16px 0 0; }
.ag-more > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--gold-text); }
.ag-matrix-wrap { max-height: 70vh; overflow: auto; }
.ag-matrix { min-width: 760px; font-variant-numeric: tabular-nums; }
.ag-matrix thead th { position: sticky; top: 0; z-index: 1; background: var(--desk-card, var(--surface)); }
.ag-matrix th[scope="row"] { position: sticky; left: 0; background: var(--desk-card, var(--surface)); font-weight: 700; }
.ag-mx { padding: 2px !important; text-align: center; }
.ag-mx__b { width: 100%; min-width: 44px; min-height: 40px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.ag-mx--has .ag-mx__b { color: var(--ink); font-weight: 700; background: rgba(110, 231, 161, .07); border-color: rgba(110, 231, 161, .25); }
.ag-mx--low .ag-mx__b { border-color: var(--amber); background: rgba(232, 150, 42, .12); color: var(--amber-ink); }
.ag-mx--out .ag-mx__b { border-color: var(--danger); background: rgba(248, 113, 113, .1); color: var(--danger); }
.ag-mx__b:hover { border-color: var(--desk-line-strong, var(--line)); }
.ag-mx__b:focus-visible { outline: 3px solid var(--focus, #FCD34D); outline-offset: 1px; }
.ag-mx__m { font-size: .7rem; font-weight: 400; color: var(--muted); }
.ag-mx--has .ag-mx__m, .ag-mx--low .ag-mx__m, .ag-mx--out .ag-mx__m { color: inherit; }   /* AAA on the tinted cells */
.ag-mx__t { text-align: right; font-weight: 700; }
.ag-cell-editor { position: sticky; top: 8px; z-index: 2; margin: 0 0 12px; padding: 12px 16px; border: 1px solid var(--amber); border-radius: var(--desk-radius-sm, 12px); background: var(--desk-card, var(--surface)); box-shadow: var(--desk-shadow, none); }
.ag-cell-editor__title { margin: 0 0 8px; font-weight: 700; }
.ag-cell-editor__row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.ag-cell-editor__row .desk-field { flex: 0 1 120px; }
.ag-step { width: 48px; height: 48px; border: 1px solid var(--amber); border-radius: 50%; background: transparent; color: var(--ink); font-size: 1.4rem; font-weight: 700; line-height: 1; cursor: pointer; }
.ag-step:hover { background: rgba(232, 150, 42, .14); }
.ag-step:focus-visible { outline: 3px solid var(--focus, #FCD34D); outline-offset: 2px; }
.ag-labels { margin-top: var(--desk-gap, 20px); border-top: 3px solid var(--amber); }
.ag-labels__form { display: grid; gap: 10px 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; margin: 6px 0 10px; }

/* ---------------------------------------------------- the member page -- */
.ag-member { padding: clamp(24px, 5vw, 56px) 0 64px; background: var(--parchment, #0D0B09); color: var(--ink, #FCFBF7); }
.ag-member__wrap { max-width: 760px; }
.ag-member__eyebrow { margin: 0 0 6px; font-weight: 600; color: var(--gold-text, #F2B54C); }
.ag-member__head h1 { margin: 0 0 8px; }
.ag-member__lead { margin: 0 0 22px; color: var(--muted, #BBA996); }
.ag-member__foot { margin-top: 28px; font-size: .9rem; color: var(--muted, #BBA996); }
.ag-card { position: relative; margin: 0 0 18px; padding: 22px clamp(18px, 4vw, 28px); border: 1px solid rgba(217, 119, 6, .35); border-radius: 18px;
  background: linear-gradient(160deg, rgba(252, 251, 247, .06), rgba(252, 251, 247, .015)), var(--surface, #161311);
  box-shadow: 0 1px 0 rgba(242, 181, 76, .25) inset, 0 18px 40px -24px rgba(0, 0, 0, .7); }
.ag-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.ag-card__head h2 { margin: 0; font-size: 1.25rem; }
.ag-status { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; border: 1px solid currentColor; }
.ag-status--move { color: var(--amber-ink, #F5B544); }
.ag-status--done { color: var(--success, #6EE7A1); }
.ag-status--pickup { color: var(--gold-text, #F2B54C); }
.ag-status--wait { color: var(--muted, #BBA996); }
.ag-status--warn { color: var(--danger, #F87171); }
.ag-card__grid { display: grid; gap: 10px 18px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 0 0 14px; }
.ag-card__grid dt { font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted, #BBA996); }
.ag-card__grid dd { margin: 2px 0 0; font-weight: 600; }
.ag-card__wide { grid-column: 1 / -1; }
.ag-card__note { margin: 0 0 12px; color: var(--muted, #BBA996); }
.ag-card__term { margin: 12px 0 0; font-weight: 600; color: var(--gold-text, #F2B54C); }
.ag-card__history { margin-top: 12px; }
.ag-card__history summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.ag-renew { margin: 0 0 14px; padding: 16px 18px; border: 1px solid #F59E0B; border-radius: 14px; background: rgba(245, 158, 11, .12);
  box-shadow: 0 0 24px -6px rgba(245, 158, 11, .55); color: var(--ink, #FCFBF7); }
.ag-renew__title { margin: 0 0 10px; font-weight: 700; }
.ag-renew__ways { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.ag-renew__zelle { margin: 0; flex: 1 1 260px; font-size: .92rem; }
@media (prefers-reduced-motion: no-preference) { .ag-renew { animation: ag-glow 3.2s ease-in-out infinite; } }
@keyframes ag-glow { 50% { box-shadow: 0 0 34px -4px rgba(245, 158, 11, .75); } }

/* ------------------------------------------------- the portal's card -- */
.ag-float { position: fixed; z-index: 45; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(380px, calc(100vw - 32px));
  padding: 14px 40px 14px 16px; border-radius: 14px; background: #161311; color: #FCFBF7; border: 1px solid rgba(217, 119, 6, .45);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .75); font-size: .92rem; line-height: 1.45; }
.ag-float--amber { border-color: #F59E0B; box-shadow: 0 0 26px -6px rgba(245, 158, 11, .6), 0 18px 40px -16px rgba(0, 0, 0, .75); }
.ag-float p { margin: 0 0 6px; }
.ag-float__t { font-weight: 700; }
.ag-float__a { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 0 !important; }
.ag-float a { color: #F2B54C; font-weight: 600; }
.ag-float__btn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; background: #D97706; color: #1A0E05 !important; text-decoration: none; }
.ag-float__x { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #BBA996; font-size: 1.4rem; cursor: pointer; }
.ag-float__x:focus-visible { outline: 2px solid #FCD34D; }
@media (max-width: 600px) { .ag-float { left: 16px; right: 16px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } }
