/* Aflex App Hub — shared styles. Colours and spacing follow the approved
   mockup (App_Hub/mockup): navy header, logo on a glowing white plate,
   light blue-grey page, logo-blue accents. */
:root {
  --navy: #10233A;
  --navy-2: #1B3553;
  --navy-line: #3A5878;
  --blue: #1F4E8C;
  --blue-dark: #163A69;
  --blue-soft: #E3EBF5;
  --amber: #F0A33A;
  --ink: #10233A;
  --muted: #4A5A6C;
  --ground: #EEF2F7;
  --line: #D5DCE5;
  --soft: #E6EBF2;
  --danger: #B42318;
  --danger-soft: #FDE8E8;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }
a { color: var(--blue); }
a:hover { color: var(--blue-dark); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* Header */
.top { background: var(--navy); color: #fff; }
.top-row { padding-top: 14px; padding-bottom: 14px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.brand { display: flex; gap: 12px; align-items: center; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.logoplate {
  display: inline-flex; align-items: center; background: #fff; border-radius: 9px; padding: 5px 10px;
  box-shadow: 0 0 0 2px rgba(255,255,255,.35), 0 0 16px 3px rgba(255,255,255,.45);
}
.logoplate img { height: 28px; width: auto; display: block; }
.brand-div { width: 1px; height: 28px; background: var(--navy-line); margin-left: 6px; }
.brand-name { font-weight: 700; font-size: 17px; }

/* Page */
.page { padding-top: 36px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 32px; max-width: 1080px; }
h1 { margin: 0; font-size: 26px; line-height: 34px; font-weight: 700; }
.sub { margin: 6px 0 0; font-size: 14px; color: var(--muted); }

.empty { padding: 40px 24px; text-align: center; border-radius: 16px; background: #fff; border: 1px dashed #C3CDD9; }
.empty-title { font-weight: 700; font-size: 16px; }
.empty p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

/* Buttons, fields, messages */
.btn {
  height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 18px;
  border: 0; border-radius: 10px; background: var(--blue); color: #fff; font: 700 15px 'Plus Jakarta Sans', sans-serif;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--blue-dark); color: #fff; }
.btn-block { width: 100%; }
.linkbtn { border: 0; background: none; padding: 6px 0; color: var(--blue); font: 600 13px 'Plus Jakarta Sans', sans-serif; cursor: pointer; text-decoration: underline; }
.linkbtn:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.field input {
  height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid #B8C3CF; background: #fff;
  font: 500 16px 'Plus Jakarta Sans', sans-serif; color: var(--ink);
}
.field input:focus, .otp:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--muted); margin: 16px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--blue-soft); color: var(--blue-dark); font-size: 14px; }
.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; line-height: 20px; }
.alert.danger { background: var(--danger-soft); color: #7A1A12; }
.alert.dev { background: #FFF4E5; color: #7A4E00; }
.mono { font-family: Consolas, monospace; font-size: 16px; letter-spacing: .1em; }
.ink { color: var(--ink); }
.fine { margin: 0; font-size: 13px; color: var(--muted); }

/* Sign-in */
body.signin-page { background: var(--navy); }
.signin-wrap { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; }
.signin-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 36px 32px;
  display: flex; flex-direction: column; gap: 18px;
  box-shadow: 0 0 0 2px rgba(255,255,255,.25), 0 0 40px 6px rgba(255,255,255,.18);
}
.signin-card h1 { font-size: 22px; line-height: 30px; }
.signin-logo { height: 40px; width: auto; align-self: flex-start; }
.code-boxes { margin: 0; padding: 0; border: 0; }
.code-boxes legend { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.code-row { display: flex; gap: 8px; }
.otp {
  width: 100%; min-width: 0; height: 54px; text-align: center; font: 800 22px 'Plus Jakarta Sans', sans-serif;
  border: 1.5px solid #B8C3CF; border-radius: 10px; color: var(--ink);
}
.signin-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* Header search */
.search {
  flex: 1 1 280px; max-width: 440px; height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  border-radius: 10px; background: var(--navy-2); border: 1px solid #2C4A6B;
}
.search:focus-within { background: #22405F; border-color: #5C7FA8; }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: #fff; font: 500 15px 'Plus Jakarta Sans', sans-serif; }
.search input::placeholder { color: #A9B7C6; }

/* Home: sections of apps */
.appsection[hidden], .app[hidden] { display: none !important; }
.cathead {
  display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 14px; font-weight: 800;
  letter-spacing: .07em; text-transform: uppercase; color: var(--navy);
}
.cathead .count { font-size: 12px; font-weight: 700; letter-spacing: 0; padding: 2px 9px; border-radius: 999px; background: var(--navy); color: #fff; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.app {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
a.app:hover, a.app:focus-visible { border-color: var(--blue); box-shadow: 0 4px 14px rgba(16,35,58,.12); color: var(--ink); }
a.app:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.tile { width: 38px; height: 38px; border-radius: 10px; background: var(--blue); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.app-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.app .n { font-weight: 700; font-size: 15px; color: var(--navy); }
.app .d { font-size: 13px; line-height: 18px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app .pilot { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.app .go { flex-shrink: 0; color: var(--blue); }
.app.dim { background: #F6F8FB; border-style: dashed; border-color: #C3CDD9; }
.app.dim .n, .app.dim .d { color: var(--muted); }
.app.dim .tile { background: #DDE3EB; color: #6B7A8A; }
.app .later { flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header links */
.navlink { height: 40px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 10px; color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; }
.navlink:hover { background: rgba(255,255,255,.1); color: #fff; }
.sa-badge { padding: 4px 10px; border-radius: 999px; background: var(--amber); color: var(--navy); font-size: 11.5px; font-weight: 800; letter-spacing: .04em; }
.adminnav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.adminnav a { height: 40px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 10px; color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; }
.adminnav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.adminnav a[aria-current="page"] { background: #fff; color: var(--navy); font-weight: 700; }
.adminnav a.ghost { border: 1px solid var(--navy-line); }

/* Admin layout */
body.admin .page { max-width: 1280px; gap: 20px; padding-top: 28px; }
.pagehead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.back { font-size: 14px; font-weight: 600; text-decoration: none; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.side { flex: 1 1 280px; max-width: 360px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.content { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.row { min-height: 54px; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; color: var(--ink); text-decoration: none; }
.row:hover { background: var(--ground); color: var(--ink); }
.row.on { background: var(--blue-soft); }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-text .t { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.row-text .s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-text a.plain { text-decoration: none; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.panel h2 { margin: 0; font-size: 22px; font-weight: 800; }
.panel h3 { margin: 0; font-size: 16px; font-weight: 800; }
.panel p { margin: 0; font-size: 14px; color: var(--muted); }
.panel.head { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px; }
.panelhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.grow { flex: 1 1 240px; min-width: 0; }
.titleline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.eyebrow { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.twocol { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.twocol.tight { gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.right-actions { display: flex; justify-content: flex-end; }
.inline { display: inline; margin: 0; }
.pad { padding: 8px 10px; }
.filter { height: 42px; margin: 4px 4px 8px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 10px; background: var(--ground); }
.filter input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: 500 14px 'Plus Jakarta Sans', sans-serif; color: var(--ink); }

/* Buttons (variants) */
.btn.line { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.btn.line:hover { background: var(--blue-soft); color: var(--blue-dark); }
.btn.small { height: 38px; font-size: 13.5px; align-self: flex-start; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #8F1B12; }
.linkbtn.danger-text { color: var(--danger); }
.xbtn { width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.xbtn:hover { background: var(--ground); color: var(--danger); }

/* Tags, avatars, chips */
.tag { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.ok { background: #E2F3E8; color: #14613A; }
.tag.amber { background: #FFF1D2; color: #7A4E00; }
.tag.warn { background: #FDE7DA; color: #8A3A0B; }
.tag.info { background: var(--blue-soft); color: var(--blue-dark); }
.tag.st-live { background: #E2F3E8; color: #14613A; }
.tag.st-pilot { background: #FFF1D2; color: #7A4E00; }
.tag.st-soon { background: var(--soft); color: var(--muted); }
.tag.st-desktop { background: var(--blue-soft); color: var(--blue-dark); }
.av { width: 36px; height: 36px; border-radius: 50%; background: var(--blue-soft); color: var(--blue-dark); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex-shrink: 0; text-decoration: none; }
.av-lg { width: 60px; height: 60px; font-size: 20px; background: var(--blue); color: #fff; }
.av-sq { border-radius: 10px; background: var(--soft); color: var(--navy); }
.av-blocked { background: var(--danger-soft) !important; color: var(--danger) !important; }
.tile-dim { background: #DDE3EB; color: #6B7A8A; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); font-size: 13.5px; font-weight: 700; text-decoration: none; }
.chip:hover { background: #D3E0F0; color: var(--blue-dark); }
.app-chip { background: #fff; border: 1px solid var(--line); color: var(--ink); padding-left: 5px; }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.mini { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--soft); }
.mini.faded { opacity: .7; }
.why { white-space: normal !important; color: var(--blue-dark) !important; font-weight: 600; }
.why.personal { color: #8A3A0B !important; }
.plist { display: flex; flex-direction: column; border: 1px solid var(--soft); border-radius: 12px; overflow: hidden; }
.prow { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--soft); }
.prow:last-child { border-bottom: 0; }

/* Admin forms */
.toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.toggle { min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line); font-weight: 600; font-size: 14px; cursor: pointer; }
.toggle:has(input:checked) { background: var(--blue-soft); border-color: var(--blue); }
.toggle input { width: 20px; height: 20px; accent-color: var(--blue); flex-shrink: 0; }
.toggle em { font-style: normal; font-weight: 500; color: var(--muted); }
.addrow { display: flex; flex-wrap: wrap; gap: 10px; }
.addfield { flex: 1 1 260px; }
.addfield input { width: 100%; height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid #B8C3CF; font: 500 14px 'Plus Jakarta Sans', sans-serif; color: var(--ink); }
.addrow .btn { height: 44px; }
.field select, .field textarea { padding: 10px 12px; border-radius: 10px; border: 1px solid #B8C3CF; background: #fff; font: 500 15px 'Plus Jakarta Sans', sans-serif; color: var(--ink); }
.field select { height: 46px; }
.field textarea { resize: vertical; line-height: 22px; }
.field .hint { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.field .err { font-weight: 600; font-size: 13px; color: var(--danger); }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); }
.field.narrow { max-width: 260px; }
.count-right { align-self: flex-end; }
fieldset.field { border: 0; margin: 0; padding: 0; }
fieldset.field legend { margin-bottom: 8px; }
.radios { display: flex; flex-wrap: wrap; gap: 8px; font-weight: 600; }
.radio { height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 999px; border: 1px solid #C9D2DC; font-size: 14px; cursor: pointer; }
.radio:has(input:checked) { border: 1.5px solid var(--blue); background: var(--blue-soft); }
.radio input { accent-color: var(--blue); }
.icons { display: flex; flex-wrap: wrap; gap: 8px; }
.iconpick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.iconpick > span { width: 44px; height: 44px; border-radius: 11px; border: 1.5px solid var(--line); display: grid; place-items: center; color: var(--ink); cursor: pointer; }
.iconpick input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.iconpick input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.preview-side { gap: 10px; padding: 16px; position: sticky; top: 16px; }
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--ground); }
.segmented button { flex: 1; height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 600 14px 'Plus Jakarta Sans', sans-serif; cursor: pointer; }
.segmented button.on { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(16,35,58,.12); }
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: '▾'; color: var(--muted); }
details.fold[open] > summary::after { content: '▴'; }
.danger-zone { border-color: #E4A7A1; }
.danger-zone h3 { color: var(--danger); }
.dropform { position: relative; }
.dropform > summary { list-style: none; }
.dropform > summary::-webkit-details-marker { display: none; }
.dropform > form { position: absolute; right: 0; top: 54px; z-index: 5; width: 340px; box-shadow: 0 12px 32px rgba(16,35,58,.18); }
.preview-banner { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
ul.fine { margin: 0; padding-left: 20px; line-height: 22px; }
.keybox { margin: 8px 0; padding: 10px 12px; border-radius: 8px; background: #fff; border: 1px solid #E8C98A; font: 600 13px Consolas, monospace; white-space: pre-wrap; word-break: break-all; user-select: all; }

/* Signed-in user menu */
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--amber); color: var(--navy);
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.usermenu-panel {
  position: absolute; right: 0; top: 48px; z-index: 10; width: 260px; background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 10px 30px rgba(16,35,58,.18);
}
.usermenu-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--soft); margin-bottom: 4px; display: flex; flex-direction: column; }
.usermenu-who span { font-size: 13px; color: var(--muted); }
.usermenu-panel button {
  width: 100%; text-align: left; border: 0; background: none; padding: 10px; border-radius: 8px;
  font: 600 14px 'Plus Jakarta Sans', sans-serif; color: var(--ink); cursor: pointer;
}
.usermenu-panel button:hover { background: var(--ground); }

@media (max-width: 640px) {
  .signin-card { padding: 28px 20px; }
  .dropform > form { position: static; width: auto; margin-top: 10px; }
  .adminnav { margin-left: 0; }
  .side { max-width: none; }
  .wrap { padding: 0 16px; }
  .brand-div, .brand-name { display: none; }
}
