/* admin.css -- the /admin area. Rides on styles.css (tokens, type, header)
   and adds only what the admin screens need. Same warm, rounded feel as the
   marketplace; denser, because admins work in tables. */
body.admin { background: var(--bg); }

.ashell { display: grid; grid-template-columns: 240px 1fr; padding-top: var(--hdr); min-height: 100vh; }
/* The side menu is plain paper: solid ground, no graph paper behind it. */
.anav { background: var(--bg); position: sticky; top: var(--hdr); align-self: start; height: calc(100vh - var(--hdr)); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--rule); }
.anav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 500;
  color: var(--text); text-decoration: none; transition: .12s; }
.anav a svg { width: 17px; height: 17px; flex-shrink: 0; }
.anav a:hover { background: var(--surface); color: var(--head); }
.anav a.on { background: var(--card); color: var(--head); font-weight: 600; box-shadow: var(--shadow); }
.anav a.on svg { color: var(--accent); }
.anav .sep { height: 1px; background: var(--rule); margin: 10px 4px; }
.navbadge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font: 600 11px/20px var(--sans); text-align: center; }

/* The work area fills the space beside the menu, up to a readable width,
   and sits centred in it on wide screens -- never pinned to the left. */
.aview { padding: 28px 40px 64px; min-width: 0; width: 100%; max-width: 1520px; margin: 0 auto; }
.agate { padding: 80px 20px; text-align: center; color: var(--meta); font-size: 14px; }
.ahead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.ahead h2 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--head); }
.ahead .sub { font-size: 13.5px; color: var(--meta); }
.ahead .grow { flex: 1; }

/* controls */
.abtn { height: 38px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--rule-strong); background: var(--card); color: var(--head); transition: .15s; white-space: nowrap; text-decoration: none; }
.abtn:hover { border-color: var(--head); }
.abtn.p { background: var(--accent); border-color: var(--accent); color: #fff; }
.abtn.p:hover { filter: brightness(1.07); }
.abtn.danger { color: #9B3B3B; border-color: #E3C4C1; }
.abtn.danger:hover { background: #FBEFEE; border-color: #9B3B3B; }
.abtn.sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.abtn:disabled { opacity: .5; cursor: not-allowed; }
.ain { height: 38px; padding: 0 12px; border: 1px solid var(--rule-strong); border-radius: 10px; background: var(--card); color: var(--head);
  font-size: 14px; outline: 0; min-width: 0; transition: .12s; }
.ain::placeholder { color: var(--meta); }
.ain:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }
textarea.ain { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; width: 100%; }
textarea.ain.code { font: 13px/1.5 var(--mono); min-height: 150px; }
select.ain { padding-right: 8px; }
select.ain:disabled, .ain:disabled { background: var(--surface); color: var(--meta); }
.asearch { width: min(300px, 100%); border-radius: 999px; padding: 0 16px; }

/* panels + tables */
.apanel { background: var(--card); border: 1px solid var(--rule); border-radius: 16px; padding: 20px 22px; margin-bottom: 22px; box-shadow: var(--shadow); }
.apanel > h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: var(--head); }
.apanel > .hint { margin: 0 0 14px; }
.hint { display: block; font-size: 12.5px; color: var(--meta); line-height: 1.45; }
.atable-wrap { background: var(--card); border: 1px solid var(--rule); border-radius: 14px; overflow: auto; box-shadow: var(--shadow); }
.apanel .atable-wrap { box-shadow: none; }
.atable { width: 100%; border-collapse: collapse; }
.atable th { font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--meta); text-align: left;
  padding: 12px 14px; border-bottom: 1px solid var(--rule); background: var(--bg); white-space: nowrap; }
.atable td { padding: 12px 14px; font-size: 14px; color: var(--head); border-bottom: 1px solid var(--rule); vertical-align: middle; }
.atable tr:last-child td { border-bottom: 0; }
.atable tr.rowlink { cursor: pointer; }
.atable tr.rowlink:hover td { background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.atable .tmut, .tmut { color: var(--meta); font-size: 12.5px; }
.tnum { font-variant-numeric: tabular-nums; text-align: right; }
.aempty { padding: 40px 16px; text-align: center; color: var(--meta); font-size: 14px; }
.arow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.astack { display: grid; gap: 10px; }
.cell-app { display: flex; align-items: center; gap: 12px; }
.cell-app .dot { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, var(--card)); color: var(--c); }
.cell-app .dot svg { width: 16px; height: 16px; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--surface);
  font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; }
.chip .sw { width: 9px; height: 9px; border-radius: 3px; }
.chip.ok { background: #E7F1E6; color: #2F5D24; }
.chip.warn { background: #FBF1E2; color: #8A4F10; }
.chip.dep { background: var(--surface); color: var(--meta); }
.chip.info { background: #E6EEF6; color: #1C4E7F; }

/* toggle */
.sw2 { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--rule-strong); transition: .15s; flex-shrink: 0; }
.sw2::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.sw2.on { background: var(--accent); }
.sw2.on::after { left: 19px; }
.sw2:disabled { opacity: .4; cursor: not-allowed; }

/* colour picks */
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swpick { width: 24px; height: 24px; border-radius: 8px; border: 2px solid transparent; box-shadow: inset 0 0 0 2px var(--card); }
.swpick.on { border-color: var(--head); }

/* read-only facts: label left, value right */
.kv { display: grid; gap: 8px; }
.kv > div { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: baseline; }
.kv dt { font-size: 13px; color: var(--meta); }
.kv dd { margin: 0; font-size: 14px; color: var(--head); overflow-wrap: anywhere; }

/* requests */
.reqcard { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); }
.reqcard .who b { display: block; font-size: 15px; font-weight: 600; color: var(--head); }
.reqcard .who span { font-size: 13px; color: var(--meta); }
.reqcard .acts { margin-left: auto; display: flex; gap: 8px; flex-shrink: 0; }

/* drawer (editor) */
.adrawer-scrim { position: fixed; inset: 0; z-index: 80; background: rgba(28, 24, 18, .35); opacity: 0; pointer-events: none; transition: .2s; }
.adrawer-scrim.on { opacity: 1; pointer-events: auto; }
/* A floating, rounded panel: inset from the window edges, with
   the title bar and the Cancel/Save bar frozen while the form scrolls. */
.adrawer { position: fixed; top: 12px; right: 12px; bottom: 12px; z-index: 81; width: min(600px, calc(100vw - 24px)); background: var(--card);
  border-radius: 20px; border: 1px solid var(--rule);
  /* It is an <aside>: undo the catalog filter rail's aside rules (styles.css),
     whose padding and max-height pushed the frozen bars off the edges. */
  padding: 0; min-height: 0; max-height: none; align-self: auto;
  box-shadow: -18px 0 60px rgba(28, 24, 18, .2); transform: translateX(calc(100% + 24px)); transition: .24s cubic-bezier(.2, .7, .3, 1); overflow-y: auto; }
.adrawer.on { transform: none; }
.adr-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 18px 24px; background: var(--card); border-bottom: 1px solid var(--rule); }
.adr-head h3 { margin: 0; font-size: 18px; font-weight: 700; color: var(--head); flex: 1; letter-spacing: -.01em; }
.adr-head .lbl { font: 11px var(--mono); color: var(--meta); }
.adr-head .mclose { position: static; box-shadow: none; }
.adr-body { padding: 20px 24px 0; }
.adr-foot { position: sticky; bottom: 0; z-index: 2; display: flex; gap: 10px; justify-content: flex-end;
  margin: 20px -24px 0; padding: 14px 24px; background: var(--card); border-top: 1px solid var(--rule); }
.f { display: grid; gap: 6px; margin-bottom: 16px; align-content: start; }
.f > label { font-size: 13px; font-weight: 600; color: var(--head); }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fchk { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); cursor: pointer; }
.fchk input { width: 16px; height: 16px; accent-color: var(--accent); }
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface); border-radius: 12px; flex-wrap: wrap; }
.seg button { height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--text); }
.seg button.on { background: var(--card); color: var(--head); font-weight: 600; box-shadow: var(--shadow); }
.statusblock { border: 1px solid var(--rule); border-radius: 14px; padding: 14px 16px; margin: 0 0 18px; background: var(--bg); }
.statusblock b { font-size: 14px; color: var(--head); }
.clog { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; max-height: 160px; overflow-y: auto; font-size: 13px; }
.clog b { font: 12px var(--mono); color: var(--meta); margin-right: 8px; font-weight: 400; }
.callout { padding: 12px 14px; border-radius: 12px; background: var(--surface); font-size: 13px; line-height: 1.5; color: var(--text); }
.callout.connect { margin: 0 0 16px; display: grid; gap: 8px; justify-items: start; }
.callout code.cmd { display: block; width: 100%; padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--rule);
  font: 12px/1.5 var(--mono); color: var(--head); overflow-wrap: anywhere; user-select: all; }
select.ain option:disabled { color: var(--meta); }
.callout.warn { background: #FBF1E2; color: #7A4410; }

/* branding preview */
.brandrow { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.logo-drop { display: grid; place-items: center; min-height: 120px; border: 1.5px dashed var(--rule-strong); border-radius: 14px; background: var(--bg); padding: 16px; text-align: center; color: var(--meta); font-size: 13px; }
.logo-drop img { max-height: 64px; max-width: 220px; }
.grounds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.groundpick { text-align: left; padding: 14px; border-radius: 14px; border: 2px solid var(--rule); background: var(--card); }
.groundpick.on { border-color: var(--accent); }
.groundpick .pv { height: 54px; border-radius: 10px; margin-bottom: 10px; display: flex; align-items: flex-end; gap: 6px; padding: 8px; }
.groundpick .pv i { display: block; width: 26px; height: 26px; border-radius: 7px; }
.groundpick b { display: block; font-size: 14px; color: var(--head); }
.groundpick span { font-size: 12px; color: var(--meta); }

/* pickers */
.pick { position: relative; display: inline-block; }
.pmenu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 240px; background: var(--card); border: 1px solid var(--rule);
  border-radius: 12px; box-shadow: var(--shadow-hi); padding: 4px; max-height: 260px; overflow: auto; }
.pitem { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--head); }
.pitem:hover, .pitem.on { background: var(--surface); }
.pnone { padding: 10px 12px; font-size: 13px; color: var(--meta); }

/* chips that do something */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip.x { cursor: pointer; padding-right: 7px; }
.chip.x .rm { font-size: 14px; line-height: 1; opacity: .45; }
.chip.x:hover .rm { opacity: 1; }
.chip.x:hover { box-shadow: inset 0 0 0 1px currentColor; }
.chip.add { background: transparent; border: 1px dashed var(--rule-strong); color: var(--meta); cursor: pointer; }
.chip.add:hover { border-color: var(--accent); color: var(--accent); }
.chip .tmut { font-size: 11px; }

/* people table */
.tsel { width: 34px; }
.tsel input { width: 16px; height: 16px; accent-color: var(--accent); }
.atable tr.sel td { background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.pname { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pname b { font-weight: 600; }
.editn { opacity: 0; color: var(--meta); font-size: 13px; padding: 0 2px; }
tr:hover .editn { opacity: 1; }
.namein { height: 30px; width: 200px; }
.sw2.warnb.on { background: #9B3B3B; }
.bulkbar { position: sticky; top: calc(var(--hdr) + 8px); z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 10px 14px; border-radius: 14px; background: var(--head); color: var(--card); box-shadow: var(--shadow-hi); }
.bulkbar b { font-size: 13px; font-weight: 600; margin-right: 4px; }
.bulkbar .ain { height: 30px; background: var(--card); }
.bulkbar .abtn:not(.p) { background: transparent; color: var(--card); border-color: rgba(255,255,255,.35); }
.bulkbar .grow { flex: 1; }
.seg button .tmut { font-size: 11px; margin-left: 2px; }
.linkbtn { color: var(--accent); font-size: 13px; font-weight: 600; padding: 0; }
.linkbtn:hover { text-decoration: underline; }
.asub { font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--meta); margin-bottom: 8px; }
.h3note { font-size: 12.5px; font-weight: 400; color: var(--meta); margin-left: 6px; }
code { font: 12.5px var(--mono); background: var(--surface); padding: 1px 6px; border-radius: 6px; }

/* grants */
.grantcols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: 16px 18px; border-radius: 14px; background: var(--bg); border: 1px solid var(--rule); }
.grantform { display: grid; gap: 10px; margin-top: 16px; }
.callout + .callout { margin-top: 8px; }
#gNote .callout { margin-top: 10px; }

/* external */
.abanner { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-radius: 14px; margin-bottom: 22px; font-size: 13.5px; line-height: 1.5; }
.abanner b { flex-shrink: 0; font-size: 14px; }
.abanner::before { content: ""; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.abanner.ok { background: #E7F1E6; color: #2F5D24; }
.abanner.ok::before { background: #3E7B30; }
.abanner.wait { background: #FBF1E2; color: #7A4410; }
.abanner.wait::before { background: #C77A1E; }
.invgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.invgrid .chips { margin-top: 10px; }
.ain.sm { height: 30px; padding: 0 8px; font-size: 13px; border-radius: 8px; }

/* analytics */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--card); border: 1px solid var(--rule); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .v { font-size: 30px; font-weight: 700; letter-spacing: -.03em; color: var(--head); font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 15px; font-weight: 500; color: var(--meta); margin-left: 4px; }
.kpi .l { font-size: 12.5px; color: var(--text); margin-top: 2px; }
.kpi .l span { display: block; color: var(--meta); font-size: 11.5px; }
.kpi.attn { border-color: var(--accent); }
.kpi.attn .v { color: var(--accent); }
.agrid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.agrid2 > .apanel { margin-bottom: 22px; }
.strip { width: 100%; height: auto; display: block; margin-top: 10px; }
.strip .base { stroke: var(--rule); }
.strip .bar { fill: color-mix(in srgb, var(--accent) 70%, var(--card)); }
.strip .grid { stroke: var(--rule); stroke-dasharray: 3 4; opacity: .7; }
.strip .bar0 { fill: var(--rule-strong); opacity: .4; }
.strip .barin { fill: color-mix(in srgb, var(--accent) 32%, var(--card)); }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 3px 0 8px; vertical-align: -1px; }
.lg.in { background: color-mix(in srgb, var(--accent) 32%, var(--card)); }
.lg.out { background: color-mix(in srgb, var(--accent) 70%, var(--card)); }
.strip .ax { font: 8.5px var(--mono); fill: var(--meta); }
.hbars { display: grid; gap: 4px; margin-top: 12px; }
.hb { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 12px; align-items: center; padding: 6px 8px; border-radius: 10px; }
.hb.click { cursor: pointer; }
.hb.click:hover, .hb.on { background: var(--surface); }
.hb-l { font-size: 13.5px; font-weight: 600; color: var(--head); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-s { display: block; font-size: 11.5px; font-weight: 400; color: var(--meta); }
.hb-t { position: relative; height: 22px; display: flex; align-items: center; gap: 8px; }
.hb-f { height: 100%; border-radius: 7px; background: color-mix(in srgb, var(--accent) 70%, var(--card)); }
.hb.on .hb-f { background: var(--accent); }
.hb-v { font: 600 12px var(--mono); color: var(--head); }

.amodal-scrim { position: fixed; inset: 0; z-index: 95; background: rgba(28, 24, 18, .42); display: grid; place-items: center; padding: 16px; }
.amodal { width: min(540px, 100%); max-height: 90vh; overflow: auto; background: var(--card); border-radius: 18px; padding: 24px 26px; box-shadow: var(--shadow-hi); }
.amodal h3 { margin: 0 0 10px; font-size: 19px; font-weight: 700; color: var(--head); letter-spacing: -.01em; }
.amodal p, .amodal li { font-size: 14px; line-height: 1.55; color: var(--text); }
.amodal ul { margin: 0 0 10px; padding-left: 20px; }
.amodal .callout { margin-top: 6px; }
.amodal-acts { justify-content: flex-end; margin-top: 18px; }
.atoast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 99; background: var(--head); color: var(--card);
  padding: 12px 20px; border-radius: 999px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-hi); max-width: 80vw; }
.atoast.err { background: #9B3B3B; color: #fff; }

@media (max-width: 820px) {
  .ashell { grid-template-columns: 1fr; }
  /* Admin has no search bar, so its header stays one row on a phone. */
  body.admin { --hdr: 64px; }
  body.admin .hd { flex-wrap: nowrap; padding: 0 14px; }
  body.admin .actions .abtn { width: 38px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
  /* The menu becomes one row that scrolls sideways, pinned under the header. */
  .anav { position: sticky; top: var(--hdr); z-index: 20; height: auto; display: flex; flex-direction: row; flex-wrap: nowrap;
    gap: 4px; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--rule);
    scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .anav::-webkit-scrollbar { display: none; }
  .anav a { flex: none; white-space: nowrap; padding: 8px 12px; }
  .anav .sep { display: none; }
  .aview { padding: 18px 14px 48px; }
  .ahead h2 { font-size: 23px; }
  .ahead .asearch, .ahead .pick { width: 100% !important; max-width: none; }
  .f2, .brandrow, .grantcols, .invgrid, .agrid2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .reqcard { flex-direction: column; }
  .reqcard .acts { margin-left: 0; flex-wrap: wrap; }
  .seg { flex-wrap: wrap; }
  /* The editor drawer is an <aside>; styles.css hides asides (the filter
     rail) on phones, which made the editor invisible here. */
  .adrawer { display: block; padding: 0; top: 8px; right: 8px; bottom: 8px; width: calc(100vw - 16px); border-radius: 16px; }
}

/* Tables whose number columns read best centred (Settings > AI usage). */
.atable.ctr th:not(:first-child), .atable.ctr td:not(:first-child) { text-align: center; }

/* ---------- AI Guidelines (admin/guidelines.js) ---------- */
.gbuild { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.gboard { flex: 1 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 0; }
.gpost { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.gpost > div:first-child { flex: 1 1 200px; }
.gblocks { padding: 4px 16px; }
.gblk { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); }
.gblk:first-child { border-top: 0; }
.gblk.off .gbt { opacity: .6; }
.gbt { flex: 1 1 220px; min-width: 0; }
.gbt b { color: var(--head); font-size: 14px; margin-right: 6px; }
.gbt .chip { height: 20px; font-size: 11px; margin-right: 4px; }
.gbt .hint { margin-top: 2px; }
.gsw { width: 38px; height: 22px; border-radius: 999px; background: var(--rule-strong); position: relative; flex-shrink: 0; margin-top: 2px; }
.gsw i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: .15s; }
.gsw.on { background: var(--accent); }
.gsw.on i { left: 19px; }
.gsw.fixed { opacity: .55; cursor: not-allowed; }
.seg.sm button { height: 28px; padding: 0 10px; font-size: 12px; }
.glink { color: var(--accent); font-size: 12px; font-weight: 600; text-decoration: underline; }
/* An <aside>: keep it sticky beside the board, drop the filter rail's look. */
.gpage { flex: 1 1 380px; min-width: 0; max-width: 520px; display: block !important; background: none; border-right: 0;
  padding: 0 4px 12px; min-height: 0; top: calc(var(--hdr) + 12px); max-height: calc(100vh - var(--hdr) - 24px); }
@media (max-width: 820px) { .gpage { position: static; max-height: none; overflow: visible; } }
.gmeter { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.gbar { height: 6px; border-radius: 999px; background: var(--rule); overflow: hidden; margin-bottom: 12px; }
.gbar i { display: block; height: 100%; background: #3E7A6A; border-radius: 999px; }
.gbar i.over { background: var(--accent); }
.gpaper { background: var(--card); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow-hi); padding: 26px 26px 18px; }
.gptitle { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 16px; color: var(--head); }
.gptitle img { max-height: 28px; max-width: 100px; }
.grule { display: block; width: 100%; text-align: left; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; border: 1px dashed transparent; font-size: 12.5px; line-height: 1.45; color: var(--text); cursor: text; }
button.grule:hover { border-color: var(--rule-strong); background: var(--surface); }
.grule b { color: var(--head); margin-right: 4px; }
.grule b::after { content: "."; }
.gintro { color: var(--meta); }
.gprules { margin: 6px 0 0; padding-left: 20px; }
.gprules li { margin: 0 0 2px; }
.gedit { display: flex; flex-direction: column; gap: 6px; padding: 8px; margin: 4px -8px; border-radius: 8px; background: var(--surface); }
.gedit textarea { height: auto; min-height: 64px; padding: 8px 10px; line-height: 1.45; resize: vertical; }
.gpfoot { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--rule); }
.gpfoot p { margin: 0 0 3px; font-size: 10.5px; line-height: 1.45; color: var(--meta); }
.gchoice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: 10px; margin-top: 8px; cursor: pointer; font-size: 13.5px; }
.gchoice input { margin-top: 3px; accent-color: var(--accent); }

/* Settings > Services and connections (admin/ai.js): one table, an editor
   row under the open category. */
.atable.svc td { vertical-align: top; }
.atable.svc td:first-child { width: 30%; }
.atable.svc { min-width: 880px; }
.atable.svc code { font-size: 12.5px; white-space: nowrap; }
.atable.svc tr.svc-group td { background: var(--surface); padding: 10px 14px; font-size: 13px; }
.atable.svc tr.svc-edit td { background: color-mix(in srgb, var(--accent) 3%, var(--card)); padding: 16px 18px 18px; }
.svc-grid { display: grid; grid-template-columns: minmax(200px, 260px) 1fr; gap: 14px; align-items: start; }
.svc-fields { display: flex; flex-wrap: wrap; gap: 12px; }
.svc-grid .f, .svc-fields .f { display: flex; flex-direction: column; gap: 5px; margin: 0; }
.svc-fields .f .ain { width: 240px; }
.svc-fields .f select.ain { width: 300px; }
.svc-fields .f input[type=number] { width: 130px; }
.svc-grid > .f .ain { width: 100%; }
.svc-about { display: grid; gap: 4px; margin-top: 12px; }
.svc-helplink { font-size: 12.5px; margin-top: 2px; align-self: flex-start; }
.svc-help { white-space: pre-wrap; font-family: inherit; font-size: 13px; line-height: 1.55; max-height: 60vh; overflow: auto; margin: 10px 0 0;
  padding: 12px 14px; border-radius: 8px; background: var(--surface); }
.chip.hub { height: 20px; padding: 0 8px; font-size: 11px; background: #EEE8F7; color: #4A3478; }
.svc-prices { margin-top: 14px; }
.svc-prices > summary { cursor: pointer; font-size: 13px; }
@media (max-width: 760px) { .svc-grid { grid-template-columns: 1fr; } .svc-fields .f .ain { width: 100%; } }
