/* G-amini — client portal and admin portal (loaded after site.css, shares its tokens) */
body.portal { background: var(--bg); min-height: 100dvh; }
body.portal::before { display: none; }
.portal [hidden] { display: none !important; }

/* ---------- sign-in / sign-up screens ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.1fr); }
.auth-side { background: linear-gradient(160deg, #1d5f95 0%, var(--brand) 55%, #4d97cf 100%); color: #fff; padding: clamp(1.6rem, 4vw, 3.2rem); display: flex; flex-direction: column; gap: 2rem; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border-radius: 50%; border: 56px solid rgba(255,255,255,.08); }
.auth-side .brand-row { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: #fff; }
.auth-side .brand-row img { height: 40px; width: auto; filter: brightness(0) invert(1); }
.auth-side .brand-row span { font-size: .78rem; line-height: 1.15; opacity: .85; border-left: 1px solid rgba(255,255,255,.4); padding-left: .7rem; }
.auth-side h2 { color: #fff; font-size: clamp(1.7rem, 3vw, 2.5rem); max-width: 16ch; }
.auth-side p { color: rgba(255,255,255,.86); max-width: 42ch; margin: 0; }
.auth-side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.auth-side li { display: flex; gap: .7rem; align-items: flex-start; font-size: .95rem; }
.auth-side li .svgi { width: 22px; height: 22px; flex: none; color: #fff; }
.auth-side li .svgi .f { fill: #fff; opacity: .25; }
.auth-side .side-foot { margin-top: auto; font-size: .82rem; opacity: .8; position: relative; z-index: 1; }
.auth-side .side-foot a { color: #fff; }
.auth-main { display: grid; place-items: center; padding: clamp(1.2rem, 4vw, 3rem) 16px; }
.auth-card { width: min(460px, 100%); display: grid; gap: 1.1rem; }
.auth-card h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.auth-card .sub { color: var(--muted); margin: -.4rem 0 0; }
.auth-card form { display: grid; gap: .95rem; }
.auth-card .row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .92rem; }
.auth-card .btn { width: 100%; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); font: 600 .92rem var(--f-body); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.auth-card .small { font-size: .84rem; color: var(--muted); }
.auth-wide { width: min(640px, 100%); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; border-radius: 999px; min-height: 40px; font: 600 .92rem var(--f-body); color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(17, 38, 58, .14); }
.or { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .84rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.msg { border-radius: 12px; padding: .75rem .9rem; font-size: .92rem; display: flex; gap: .6rem; align-items: flex-start; }
.msg .svgi { width: 20px; height: 20px; flex: none; margin-top: .1rem; }
.msg.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.msg.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.msg.info { background: var(--brand-tint); color: var(--brand-ink); }
.msg .actions { margin-top: .4rem; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 3rem; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; padding: .4rem; border-radius: 8px; font: 600 .78rem var(--f-body); }
.meter { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--bad); transition: width .2s, background .2s; }

/* 4-digit PIN boxes */
.pin { display: flex; gap: .6rem; justify-content: flex-start; }
.pin input { width: 3.2rem; height: 3.6rem; text-align: center; font: 700 1.5rem var(--f-mono); border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--text); -webkit-text-security: disc; }
.pin input:focus { outline: 2px solid var(--brand-2); border-color: var(--brand); }
.otp { letter-spacing: .4em; font: 700 1.4rem var(--f-mono) !important; text-align: center; }

/* ---------- signed-in shell ---------- */
.p-top { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.p-top .in { display: flex; align-items: center; gap: 1rem; min-height: 60px; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); max-width: 1320px; margin: 0 auto; }
.p-top .logo img { height: 30px; width: auto; display: block; }
.p-top .tag { font-size: .74rem; color: var(--muted); border-left: 1px solid var(--line); padding-left: .7rem; line-height: 1.15; }
.p-top .grow { flex: 1; }
.p-top .co { font-weight: 600; font-size: .92rem; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-top .avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 .8rem var(--f-body); }
.p-top .admin-badge { background: #10283f; color: #fff; font: 700 .7rem var(--f-body); letter-spacing: .08em; text-transform: uppercase; padding: .3rem .55rem; border-radius: 6px; }
.p-menu { position: relative; }
.p-menu > button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px 3px 3px; display: flex; align-items: center; gap: .5rem; cursor: pointer; color: var(--text); font: 600 .88rem var(--f-body); }
.p-menu .dd { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); min-width: 240px; padding: .4rem; display: grid; z-index: 40; }
.p-menu .dd a, .p-menu .dd button { display: flex; gap: .6rem; align-items: center; text-align: left; padding: .6rem .7rem; border-radius: 9px; border: 0; background: none; color: var(--text); text-decoration: none; font: 500 .92rem var(--f-body); cursor: pointer; }
.p-menu .dd a:hover, .p-menu .dd button:hover { background: var(--surface-2); }
.p-menu .dd .svgi { width: 18px; height: 18px; color: var(--muted); }
.p-menu .dd .who { padding: .6rem .7rem .5rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; font-size: .85rem; color: var(--muted); }
.p-menu .dd .who b { display: block; color: var(--text); font-size: .95rem; }

.p-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 1.6rem; max-width: 1320px; margin: 0 auto; padding: 1.4rem max(16px, env(safe-area-inset-right, 0px)) 3rem max(16px, env(safe-area-inset-left, 0px)); }
.p-nav { display: grid; gap: .2rem; align-content: start; position: sticky; top: 84px; }
.p-nav button { display: flex; align-items: center; gap: .7rem; padding: .62rem .8rem; border: 0; border-radius: 10px; background: none; text-align: left; color: var(--text); font: 500 .95rem var(--f-body); cursor: pointer; }
.p-nav button .svgi { width: 20px; height: 20px; color: var(--muted); flex: none; }
.p-nav button:hover { background: var(--surface-2); }
.p-nav button.on { background: var(--brand-tint); color: var(--brand-ink); font-weight: 600; }
.p-nav button.on .svgi { color: var(--brand); }
.p-nav .count { margin-left: auto; background: var(--brand); color: #fff; font: 700 .72rem var(--f-body); border-radius: 999px; padding: .1rem .45rem; }
.p-nav .sep { height: 1px; background: var(--line); margin: .5rem .3rem; }
.p-main { min-width: 0; display: grid; gap: 1.2rem; align-content: start; }
.p-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }
.p-head h1 { font-size: clamp(1.45rem, 2.6vw, 1.95rem); }
.p-head p { margin: .25rem 0 0; color: var(--muted); }
.p-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: clamp(1rem, 2vw, 1.4rem); display: grid; gap: .9rem; min-width: 0; }
.p-card h2 { font-size: 1.15rem; display: flex; justify-content: space-between; gap: .6rem; align-items: center; flex-wrap: wrap; }
.p-card h2 small { font: 500 .82rem var(--f-body); color: var(--muted); }
.p-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.2rem; }
.p-grid > .c8 { grid-column: span 8; } .p-grid > .c7 { grid-column: span 7; } .p-grid > .c6 { grid-column: span 6; } .p-grid > .c5 { grid-column: span 5; } .p-grid > .c4 { grid-column: span 4; } .p-grid > .c12 { grid-column: span 12; }
.p-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .9rem; }
.p-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: .95rem 1rem; display: grid; gap: .25rem; }
.p-kpi small { color: var(--muted); font-weight: 600; font-size: .8rem; }
.p-kpi b { font: 700 1.5rem/1.1 var(--f-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.p-kpi span { font-size: .8rem; color: var(--muted); }
.p-kpi[data-go] { cursor: pointer; } .p-kpi[data-go]:hover { border-color: var(--brand); }

.p-banner { border-radius: var(--r-m); padding: .9rem 1.1rem; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.p-banner.info { background: var(--brand-tint); color: var(--brand-ink); }
.p-banner.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.p-banner.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); }
.p-banner.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--text); }

/* onboarding checklist */
.ob-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.ob-steps li { display: flex; align-items: center; gap: .8rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.ob-steps li .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 2px solid var(--line); color: var(--muted); font: 700 .8rem var(--f-body); }
.ob-steps li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.ob-steps li.done .dot .svgi { width: 16px; height: 16px; }
.ob-steps li .t { flex: 1; min-width: 0; }
.ob-steps li.done .t { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.ob-steps li .btn { min-height: 36px; padding: .4rem .9rem; font-size: .88rem; }
.progress { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 6px; transition: width .4s; }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font: 600 .78rem var(--f-body); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: .7rem .85rem; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: .7rem .85rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr[data-open] { cursor: pointer; } .tbl tr[data-open]:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .muted, .muted { color: var(--muted); }
.tbl small { color: var(--muted); display: block; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.pill { display: inline-flex; align-items: center; gap: .3rem; font: 600 .76rem/1 var(--f-body); padding: .32rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: color-mix(in srgb, var(--warn) 70%, var(--text)); }
.pill.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.pill.info { background: var(--brand-tint); color: var(--brand-ink); }
.btn-sm { min-height: 36px; padding: .4rem .85rem; font-size: .88rem; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.toolbar .input { max-width: 320px; }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem 1.2rem; margin: 0; font-size: .93rem; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* plan picker */
.plans-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .7rem; }
.plans-pick label { border: 1.5px solid var(--line); border-radius: 14px; padding: .9rem; display: grid; gap: .2rem; cursor: pointer; background: var(--surface); }
.plans-pick label:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.plans-pick input { accent-color: var(--brand); }
.plans-pick b { font: 700 1.05rem var(--f-display); }
.plans-pick span { font-size: .84rem; color: var(--muted); }
.quote { display: grid; gap: .35rem; font-size: .95rem; }
.quote div { display: flex; justify-content: space-between; gap: 1rem; }
.quote .tot { border-top: 1px solid var(--line); padding-top: .5rem; font-weight: 700; font-size: 1.05rem; }
.app-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .5rem; }
.app-pick label { display: flex; gap: .55rem; align-items: center; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; cursor: pointer; background: var(--surface); }
.app-pick label:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.app-pick input { accent-color: var(--brand); }
.app-pick img, .app-pick .svgi { width: 26px; height: 26px; flex: none; }

/* tickets */
.thread { display: grid; gap: .7rem; }
.bubble { border-radius: 14px; padding: .75rem .9rem; background: var(--surface-2); max-width: 85%; }
.bubble.me { background: var(--brand-tint); margin-left: auto; }
.bubble small { display: block; color: var(--muted); font-size: .76rem; margin-bottom: .2rem; }
.bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* QR + recovery codes */
.qr-box { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.1rem; align-items: center; }
.qr-box .qr { background: #fff; padding: 10px; border-radius: 12px; border: 1px solid var(--line); line-height: 0; }
.qr-box .qr svg, .qr-box .qr img { width: 168px; height: 168px; display: block; }
.secret { font: 600 .92rem var(--f-mono); background: var(--surface-2); border-radius: 8px; padding: .5rem .6rem; overflow-wrap: anywhere; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; font: 600 .95rem var(--f-mono); background: var(--surface-2); border-radius: 12px; padding: .9rem; }
.ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .45rem; font-size: .94rem; }

/* print an invoice */
.inv-doc { background: #fff; color: #11263a; border: 1px solid var(--line); border-radius: var(--r-m); padding: 1.6rem; display: grid; gap: 1rem; }
.inv-doc .hd { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: start; }
.inv-doc img { height: 34px; }
.inv-doc .mark { font-size: .78rem; color: #536a80; border-top: 1px solid #d8e3ee; padding-top: .7rem; }
@media print {
  body.portal * { visibility: hidden; }
  .inv-doc, .inv-doc * { visibility: visible; }
  .inv-doc { position: absolute; inset: 0; border: 0; }
}

/* responsive */
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 1.2rem 16px; gap: .8rem; }
  .auth-side h2, .auth-side ul, .auth-side > p, .auth-side::after { display: none; }
  .auth-side .side-foot { display: none; }
  .p-shell { grid-template-columns: 1fr; gap: 1rem; padding-top: .8rem; }
  .p-nav { position: static; display: flex; overflow-x: auto; gap: .35rem; padding-bottom: .3rem; scrollbar-width: none; margin: 0 -16px; padding-inline: 16px; }
  .p-nav::-webkit-scrollbar { display: none; }
  .p-nav button { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: .45rem .8rem; font-size: .88rem; flex: none; }
  .p-nav .sep { display: none; }
  .p-grid > * { grid-column: 1 / -1 !important; }
}
@media (max-width: 560px) {
  .p-top .tag, .p-top .co, .p-top .hide-s { display: none; }
  .p-top .btn-primary { padding-inline: .8rem; }
  .qr-box { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .dl { grid-template-columns: 1fr; gap: .1rem; } .dl dd { margin-bottom: .45rem; }
  .bubble { max-width: 100%; }
  .tbl th, .tbl td { padding: .6rem .6rem; white-space: nowrap; }
}
