/* Portals hub. Same look as LeadsIQ: Figtree, the same blue, grey canvas, white sidebar with the blue logo tile, tinted icon blobs on cards,
   and the aurora + glass sign-in. No inline styles anywhere (the page's security policy forbids them). */

@font-face { font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap; src: url("/ui/fonts/figtree-latin.woff2") format("woff2"); }

:root {
  --background: #f9fafb;          /* LeadsIQ canvas (gray-50) */
  --card: #ffffff;
  --foreground: #0f172a;
  --text-2: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --border: #e5e7eb;
  --border-soft: #f1f5f9;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --ok: #059669; --ok-soft: #ecfdf5;
  --warn: #d97706; --warn-soft: #fffbeb;
  --bad: #dc2626; --bad-soft: #fef2f2;
  --violet: #7c3aed; --violet-soft: #f5f3ff;
  --orange: #ea580c; --orange-soft: #fff7ed;
  --radius: 8px;
  --shadow-card: 0 1px 2px 0 rgba(16, 24, 40, 0.04);
  --shadow-card-hover: 0 4px 12px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.04);
  --shadow-popover: 0 4px 16px -4px rgba(16, 24, 40, 0.12), 0 2px 6px -2px rgba(16, 24, 40, 0.06);
  --shadow-modal: 0 20px 40px -8px rgba(16, 24, 40, 0.18), 0 8px 16px -8px rgba(16, 24, 40, 0.08);
  --font: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
  --sidebar-w: 232px;
}
* { box-sizing: border-box; }
html { color-scheme: light; -webkit-text-size-adjust: 100%; scrollbar-width: thin; scrollbar-color: rgba(16,24,40,.18) transparent; }
body { margin: 0; background: var(--background); color: var(--foreground); font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-feature-settings: "rlig" 1, "calt" 1; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }
::selection { background: rgba(37, 99, 235, 0.15); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------- sign-in: aurora + glass card */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(135deg, #eff6ff 0%, #ffffff 50%, #eef2ff 100%); }
.aurora i { position: absolute; border-radius: 50%; filter: blur(80px); }
.aurora i:nth-child(1) { top: 10%; left: 15%; width: 400px; height: 400px; background: rgba(147, 197, 253, 0.35); animation: orb1 20s ease-in-out infinite; }
.aurora i:nth-child(2) { bottom: 5%; right: 10%; width: 300px; height: 300px; background: rgba(165, 180, 252, 0.35); animation: orb2 25s ease-in-out infinite; }
.aurora i:nth-child(3) { top: 30%; right: 25%; width: 350px; height: 350px; background: rgba(196, 181, 253, 0.3); animation: orb1 20s ease-in-out infinite reverse; }
@keyframes orb1 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(40px, -30px); } }
@keyframes orb2 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-30px, 40px); } }
@media (prefers-reduced-motion: reduce) { .aurora i { animation: none !important; } }
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-in { width: 100%; max-width: 448px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.logo-tile { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; background: var(--primary); color: #fff; border-radius: 16px; box-shadow: var(--shadow-popover); margin-bottom: 16px; }
.auth-logo h1 { font-size: 30px; font-weight: 700; color: #111827; letter-spacing: -0.02em; }
.auth-logo p { color: var(--muted); margin-top: 4px; font-size: 15px; }
.glass { background: linear-gradient(135deg, rgba(255,255,255,.85), rgba(255,255,255,.6)); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(15, 23, 42, 0.08); box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 20px -12px rgba(16,24,40,.12); border-radius: 16px; padding: 32px; }
.auth-note { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--faint); }
.notice-amber { margin-bottom: 16px; border: 1px solid #fde68a; background: #fffbeb; color: #92400e; border-radius: var(--radius); padding: 12px 16px; font-size: 14px; }

.flabel { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.field { margin-bottom: 18px; }
.field .hint { margin-top: 4px; font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font-size: 14px; background: #fff; border: 1px solid #e5e7eb; border-radius: var(--radius);
  font-weight: 400; letter-spacing: normal; text-transform: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: #60a5fa; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.input-wrap button { position: absolute; right: 8px; top: 50%; transform: translateY(-35%); border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 6px; }
.input-wrap button:hover { color: var(--text-2); }
.error { background: var(--bad-soft); color: var(--bad); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 16px; font-size: 13.5px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 7px 14px; font-weight: 600; font-size: 13.5px; border: 1px solid var(--border); background: #fff; border-radius: var(--radius); color: var(--text-2); transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: #f9fafb; border-color: #d1d5db; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--shadow-card); }
.btn.primary:hover { background: var(--primary-hover); box-shadow: var(--shadow-card-hover); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #f3f4f6; }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.btn.block { width: 100%; padding: 12px 16px; font-size: 15px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; pointer-events: none; }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- app shell: white sidebar + header */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; border-bottom: 1px solid var(--border-soft); }
.side-brand .brand-tile { width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.side-brand b { font-size: 13.5px; letter-spacing: 0.02em; text-transform: uppercase; font-weight: 700; color: #111827; }
.nav { padding: 12px 10px; display: grid; gap: 2px; overflow-y: auto; flex: 1; align-content: start; }
.nav-h { margin: 14px 10px 4px; font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 14px; }
.nav a:hover { background: #f3f4f6; text-decoration: none; }
.nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-foot { padding: 12px 16px; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--faint); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 0 24px; height: 64px; background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.top h2 { font-size: 17px; flex: 1; }
.menu-btn { display: none; }
.me { position: relative; }
.me-btn { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 6px; border-radius: 10px; }
.me-btn:hover { background: #f3f4f6; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.me-name { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-popover); padding: 6px; z-index: 50; }
.pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border-soft); margin-bottom: 4px; }
.pop .who b { display: block; font-size: 13.5px; } .pop .who span { font-size: 12px; color: var(--muted); }
.pop button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font-weight: 500; color: var(--text-2); text-align: left; }
.pop button:hover { background: #f3f4f6; }
.page { padding: 24px; max-width: 1240px; width: 100%; margin: 0 auto; }
.eyebrow { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 12px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .grow { flex: 1; }
.search { position: relative; min-width: 240px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input { margin: 0; padding-left: 36px; }

/* ------------------------------------------------------------- portal tiles: compact cards, icon on the left */
.group { margin-bottom: 22px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow-card); border: 1px solid var(--border-soft); transition: box-shadow .15s, transform .15s, border-color .15s; color: inherit; min-width: 0; }
a.tile:hover { box-shadow: var(--shadow-card-hover); border-color: #bfdbfe; transform: translateY(-1px); text-decoration: none; }
.tile .ticon { width: 46px; height: 46px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.tile.t-violet .ticon { background: var(--violet-soft); color: var(--violet); }
.tile.t-orange .ticon { background: var(--orange-soft); color: var(--orange); }
.tile.t-green .ticon { background: var(--ok-soft); color: var(--ok); }
.tile .tbody { flex: 1; min-width: 0; }
.tile h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.tile .desc { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .as { font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.tile .go { color: var(--faint); flex: none; }
a.tile:hover .go { color: var(--primary); }
.tile.off { background: #fafafa; border-style: dashed; box-shadow: none; }
.tile.off .ticon { background: #f3f4f6; color: var(--faint); }
.tile.off h3 { color: var(--muted); }
.empty { background: #fff; border: 1px dashed #d1d5db; border-radius: 14px; padding: 40px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

/* ------------------------------------------------------------- tables + cards (admin screens) */
.card { background: var(--card); border: 1px solid var(--border-soft); border-radius: 14px; box-shadow: var(--shadow-card); overflow: hidden; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
.card-h h3 { font-size: 15px; flex: 1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 18px; background: #f9fafb; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 18px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfc; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 6px; }
.person { display: flex; align-items: center; gap: 10px; }
.person span.avatar { width: 30px; height: 30px; font-size: 11.5px; color: #fff; }
.person b { display: block; font-size: 13.5px; } .person span { color: var(--muted); font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #f3f4f6; color: var(--text-2); }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.blue { background: var(--primary-soft); color: var(--primary); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.detail { font-family: var(--mono); font-size: 12px; color: var(--muted); max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------- modal, toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: grid; place-items: center; padding: 16px; z-index: 100; }
.modal { width: 100%; max-width: 480px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-modal); max-height: calc(100vh - 32px); overflow: auto; }
.modal.wide { max-width: 640px; }
.modal-h { padding: 20px 24px 8px; } .modal-h h3 { font-size: 18px; } .modal-h p { color: var(--muted); margin-top: 4px; font-size: 13.5px; }
.modal-b { padding: 12px 24px 8px; }
.modal-f { padding: 16px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.grant-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.grant-row:last-child { border-bottom: 0; }
.grant-row .sys { font-weight: 600; } .grant-row .sub { color: var(--muted); font-size: 12px; }
.grant-edit { display: grid; gap: 8px; margin-top: 8px; grid-template-columns: 1fr 1fr; }
.grant-edit .full { grid-column: 1 / -1; }
.grant-edit .input { margin-top: 0; }
.secret { font-family: var(--mono); font-size: 13px; background: #f3f4f6; border-radius: 8px; padding: 10px 12px; word-break: break-all; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.secret-l { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 4px; }
.qr { display: grid; place-items: center; padding: 8px; }
.warnbox { margin-top: 12px; background: var(--warn-soft); border: 1px solid #fde68a; color: #92400e; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow-popover); z-index: 200; }
.toast.err { background: var(--bad); }
.loading { padding: 60px 0; display: grid; place-items: center; color: var(--primary); }
.loading .spin { width: 26px; height: 26px; }
.scrim { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; z-index: 90; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-modal); }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 80; }
  .menu-btn { display: inline-flex; }
  .page { padding: 16px; } .top { padding: 0 14px; }
  .me-name { display: none; }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .grant-edit { grid-template-columns: 1fr; }
}
.checkrow { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-2); margin: 0 0 18px; cursor: pointer; }
.checkrow input { width: 16px; height: 16px; accent-color: var(--primary); }

/* two fields side by side (first / last name); stacks on phones */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
