/* The service's admin page (canvas "A1"): a menu of sections on the left, one section at a time; on a phone the
   menu is a row of chips to scroll and every list row stacks into a card. Tokens from style.css. */

/* ---------- the header: logo, search, language, back ---------- */
.adm-head .logo { margin-right: 0; }
.adm-head .tag { margin-right: 8px; }
.adm-find { position: relative; flex: 1 1 280px; max-width: 520px; margin-right: auto; }
.adm-search { height: 42px; width: 100%; }
.adm-found { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; max-height: 60vh; overflow-y: auto; padding: 6px;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-2); animation: adm-pop var(--t-ui) var(--ease); }
.adm-found-item { display: flex; align-items: baseline; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text); font: 500 14.5px var(--font); text-align: left; cursor: pointer; }
.adm-found-item small { flex: none; width: 92px; color: var(--muted); font-size: 12.5px; }
.adm-found-item span { min-width: 0; overflow-wrap: anywhere; }
.adm-found-item:hover, .adm-found-item:focus-visible { background: var(--brand-50); outline: 0; }
.adm-found-none { margin: 0; padding: 10px; }
@keyframes adm-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.adm-gate { padding: 60px 16px; text-align: center; color: var(--muted); }

/* ---------- the layout ---------- */
.adm-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; max-width: 1440px; margin: 0 auto;
  padding: 24px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); align-items: start; }
.adm-nav { position: sticky; top: 90px; min-width: 0; }
.adm-rail { display: flex; flex-direction: column; gap: 18px; }
.adm-group { display: flex; flex-direction: column; gap: 2px; }
.adm-label { padding: 0 12px 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.adm-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--text-2); font: 500 14.5px var(--font); text-decoration: none; transition: background var(--t-hover) var(--ease), color var(--t-hover) var(--ease); }
.adm-link:hover { background: var(--surface-2); color: var(--text); }
.adm-link.is-on { background: var(--brand-50); color: var(--text); font-weight: 600; }
.adm-n { color: var(--muted); font-weight: 400; font-size: 13px; }
.adm-n:empty { display: none; }
.adm-n.is-hot { padding: 0 7px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-weight: 600; font-size: 12.5px; }
.adm-main { min-width: 0; }
.adm-sec { display: flex; flex-direction: column; gap: 16px; animation: ms-sec-in var(--t-layout) var(--ease); }
.adm-sec[hidden] { display: none; }
.adm-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.adm-title > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 72ch; }
.adm-title h1 { font-size: 28px; letter-spacing: -0.02em; }
.adm-title p { margin: 0; }
.adm-stack { display: flex; flex-direction: column; gap: 16px; }
.adm-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr)); gap: 16px; align-items: start; }
.adm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 12px; }

.adm-card { padding: 22px 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.adm-card h2 { font-size: 18px; margin: 0; }
.adm-card--flush { padding: 6px; }
.adm-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.adm-empty { margin: 0; padding: 14px 16px; }

/* a segmented choice (period, filter) */
.adm-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.adm-seg::-webkit-scrollbar { display: none; }
.adm-seg button { flex: none; min-height: 36px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 500 13.5px var(--font);
  white-space: nowrap; cursor: pointer; transition: background var(--t-hover) var(--ease), color var(--t-hover) var(--ease); }
.adm-seg button.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* ---------- list rows: what on the left, numbers, actions ---------- */
.adm-list { display: flex; flex-direction: column; }
.adm-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 18px; align-items: center; width: 100%; padding: 12px 14px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text); font: inherit; text-align: left; }
.adm-item + .adm-item { box-shadow: 0 -1px 0 var(--line); }
.adm-item.is-click { cursor: pointer; transition: background var(--t-hover) var(--ease); }
.adm-item.is-click:hover, .adm-item.is-click:focus-visible { background: var(--brand-50); }
.adm-item.is-off { opacity: 0.55; }
.adm-item.is-bad .adm-item-title { color: var(--warn); }
.adm-item.is-warn .adm-item-title { color: var(--caution); }
.adm-item-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.adm-item-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; overflow-wrap: anywhere; }
.adm-item-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.adm-item-sub a { color: inherit; }
.adm-item-nums { display: flex; gap: 18px; justify-content: flex-end; }
.adm-num { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 64px; }
.adm-num small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.adm-num b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-num.is-debt b { color: var(--warn); }
.adm-num .badge { margin-left: 0; }
.adm-item-acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.adm-list--sm .adm-item { padding: 9px 4px; font-size: 14px; }
.adm-list--sm .adm-item-title { font-weight: 500; }
.adm-plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fb-text { font-weight: 400; white-space: pre-wrap; }
.pr-code { font-weight: 700; }
.team-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; flex: none; }

/* settings: a label with its hint on the left, the control on the right */
.adm-rows { display: flex; flex-direction: column; }
.adm-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, var(--opt-control-w, 240px)); gap: 16px; align-items: center; padding: 10px 0; }
.adm-row + .adm-row { border-top: 1px solid var(--line); }
.adm-row > span:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.adm-row > span:first-child b { font-weight: 500; }
.adm-row small { font-size: 12.5px; }
.adm-row .field { height: 42px; }
.adm-row > b { text-align: right; overflow-wrap: anywhere; font-size: 13.5px; }

/* forms: labels above fields in a grid */
.adm-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 12px; }
.adm-f { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--text-2); min-width: 0; }
.adm-f .field { height: 44px; }
/* the app's dropdown (select.js) the same height as the fields beside it */
.ms-select .lp-btn { height: 44px; font-size: 14.5px; }
.p-msg:empty { display: none; }
.adm-f--wide { grid-column: span 2; }
.adm-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* the overview's bars */
.adm-chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-bottom: 2px; border-bottom: 1px solid var(--line-2); }
.adm-bar { flex: 1; min-width: 0; border-radius: 4px 4px 0 0; background: var(--brand-400); transition: height var(--t-layout) var(--ease); }
.adm-bar.is-weekend { background: var(--brand-300); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; margin-left: 6px; border-radius: 6px; font-size: 11px; font-weight: 600;
  vertical-align: 1px; background: var(--soft); color: var(--text-2); white-space: nowrap; }
.adm-item-title .badge { margin-left: 0; }
.badge--admin { background: var(--brand-700); color: #fff; }
.badge--off { background: var(--warn-bg); color: var(--warn); }
.badge--live { background: #fdf1dc; color: var(--amber-ink); }
.badge--ok { background: #e6f4ec; color: #14532d; }
.badge--warn { background: var(--caution-bg); color: var(--caution); }
.hl-sum { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.hl-sum .badge { margin-left: 0; height: 24px; font-size: 12px; }

/* ---------- the side panel ---------- */
.adm-sheet { position: fixed; inset: 0; z-index: 40; background: rgba(15, 38, 32, 0.35); display: flex; justify-content: flex-end; animation: fade-in var(--t-ui) var(--ease); }
.adm-panel { width: min(600px, 100%); height: 100%; overflow-y: auto; background: var(--bg); box-shadow: var(--shadow-2); position: relative;
  padding: 28px max(20px, env(safe-area-inset-right, 0px)) 40px 24px; animation: slide-in var(--t-layout) var(--ease); }
#sheet-body { display: flex; flex-direction: column; gap: 16px; }
#sheet-body > * { flex-shrink: 0; }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.adm-close { position: absolute; top: 18px; right: 18px; z-index: 1; }
.p-head { display: flex; flex-direction: column; gap: 6px; }
.p-head h2 { font-size: 22px; padding-right: 44px; overflow-wrap: anywhere; margin: 0; }
.p-head p { margin: 0; }
.p-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.p-badges .badge { margin-left: 0; }
.p-wallet { display: flex; flex-direction: column; gap: 12px; }
.p-balance { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-radius: var(--r-md); background: var(--brand-700); color: #e1e8e5; }
.p-balance b { font-family: var(--display); font-size: 34px; color: #fff; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.p-balance .muted { color: #b9cdc6; }
.p-credit { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.p-credit p { margin: 0; }
.p-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.p-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.p-row3 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 8px; }
.p-row .field, .p-row3 .field, .p-credit > .field { height: 44px; }
.p-msg { min-height: 18px; margin: 0; color: var(--muted); }
.p-msg.is-ok { color: var(--ok); }
.p-msg.is-err { color: var(--warn); }
.p-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.p-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; min-height: 40px; }
.p-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.p-facts > div { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.p-facts small { font-size: 12px; color: var(--muted); }
.p-facts b { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.p-link { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--r-md); background: var(--brand-50); }
.p-link[hidden] { display: none; }
.p-link input { font-family: var(--mono); font-size: 12.5px; }
.p-save-note { align-self: flex-start; }
.adm-panel textarea { width: 100%; resize: vertical; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; font: 400 14px/1.5 var(--font); background: var(--surface); color: var(--text); }
.adm-panel textarea:focus { outline: 0; border-color: var(--brand-400); box-shadow: 0 0 0 4px var(--ring); }
.adm-panel h3 { font-size: 16px; margin: 6px 0 0; }
.r-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.r-facts dt { color: var(--muted); }
.r-facts dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---------- provider keys ---------- */
.keys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.key-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.key-card p { margin: 0; }
.key-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.key-head .badge { margin-left: 0; }
/* API key fields: plain text fields drawn as dots. A password field would make the browser's password
   manager fill every key field on the page with the saved sign-in password. */
.key-input { -webkit-text-security: disc; font-family: var(--mono, monospace); }
.key-input.is-shown { -webkit-text-security: none; }
.field-eye { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--dim); cursor: pointer; }
.field-eye:hover, .field-eye.is-on { color: var(--brand-500); }
.field-eye .eye-slash { display: none; }
.field-eye.is-on .eye-slash { display: inline; }
.mono { font-family: var(--mono); }

/* ---------- a phone and a narrow window ---------- */
@media (max-width: 900px) {
  .adm-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 12px; }
  .adm-nav { position: sticky; top: 0; z-index: 4; margin: 0 -16px; padding: 8px 0; background: var(--bg); border-bottom: 1px solid var(--line); }
  .adm-rail { flex-direction: row; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 16px; scroll-padding-inline: 16px; }
  .adm-rail::-webkit-scrollbar { display: none; }
  .adm-group { display: contents; }
  .adm-label { display: none; }
  .adm-link { flex: none; white-space: nowrap; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
  .adm-link.is-on { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
  .adm-link.is-on .adm-n { color: rgba(255, 255, 255, 0.75); }
  .adm-head { position: static; }
  .adm-find { order: 3; flex-basis: 100%; max-width: none; }
  .adm-back { display: none; }
}
@media (max-width: 640px) {
  .adm-title h1 { font-size: 24px; }
  .adm-card { padding: 18px 16px; }
  .adm-card--flush { padding: 4px; }
  .adm-item { grid-template-columns: minmax(0, 1fr); }
  .adm-item-nums { justify-content: flex-start; flex-wrap: wrap; gap: 8px 16px; }
  .adm-num { align-items: flex-start; min-width: 0; }
  .adm-item-acts { justify-content: flex-start; }
  .adm-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .adm-row > b { text-align: left; }
  .adm-f--wide { grid-column: auto; }
  .p-row3 { grid-template-columns: minmax(0, 1fr); }
  .p-facts { grid-template-columns: minmax(0, 1fr); }
  .adm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .adm-tiles .ms-tile { padding: 12px; }
  .adm-tiles .ms-tile b { font-size: 20px; }
}
.key-card .p-row .btn { height: 44px; }
/* the overview's six numbers: three a row on a wide screen, two on a phone */
#ov-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { #ov-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* a phone: the money form reads top to bottom — amount, kind, why — and its button comes last */
@media (max-width: 640px) {
  .p-credit .p-row3 { display: contents; }
  .p-credit .p-row3 .btn { order: 1; }
}
/* a narrow phone: the logo and the language on one row, the search under them (the "Service admin" tag gives way) */
@media (max-width: 480px) {
  .adm-head .tag { display: none; }
  .adm-head .lang-switch { margin-left: auto; }
}
/* the panel leaves faster than it came (--t-exit) */
.adm-sheet.is-out { animation: fade-out var(--t-exit) var(--ease-in) both; }
.adm-sheet.is-out .adm-panel { animation: slide-out var(--t-exit) var(--ease-in) both; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes slide-out { to { transform: translateX(30px); opacity: 0; } }
@media (max-width: 900px) {
  /* the search's results above the sticky row of sections */
  .adm-head { position: relative; z-index: 6; }
}
@media (max-width: 640px) {
  .adm-found-item { flex-direction: column; align-items: flex-start; gap: 0; }
  .adm-found-item small { width: auto; }
  .p-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* a message at the top on a phone: not over the button just pressed */
  .adm-body .toast { top: 12px; bottom: auto; }
}
@media (max-width: 480px) {
  .key-card .p-row { grid-template-columns: minmax(0, 1fr); }
}
