/* WireLab account UI — responsive account interface.
   All original state classes and [hidden] behavior are retained. */
:root {
  color-scheme: dark;
  --bg: #080f1c;
  --panel: #101d30;
  --panel-raised: #172a40;
  --edge: #31465f;
  --ink: #edf6fa;
  --muted: #b4c7d8;
  --soft: #9eb3c7;
  --mint: #67e8ce;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { margin: 0; width: 100%; scroll-padding-block: 20px 110px; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
header, main, section, article, nav, form, label, .card-top > div { min-width: 0; }
[hidden] { display: none !important; }
a { color: var(--mint); text-decoration: none; }
p, li, h1, h2, h3, label, textarea { overflow-wrap: anywhere; }
button, input, textarea, select { font: inherit; }
button, .button, .chatgpt-button, summary { -webkit-tap-highlight-color: transparent; }

/* Full wordmark is never squeezed by the navigation. */
.account-header {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 1264px;
  min-height: 76px;
  margin-inline: auto;
  padding: 16px 32px;
  border-bottom: 1px solid var(--edge);
}
.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 23px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -.04em;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  flex: 0 0 36px;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--mint);
  color: #082923;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.07em;
}
.header-context { display: none; }
.account-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.account-nav > a, .account-nav > button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}
.account-nav > button { border-color: var(--edge); }
.nav-icon { display: none; width: 20px; height: 20px; flex: 0 0 auto; }
body[data-page="account"] #accountLink,
body[data-page="admin"] #adminLink,
.account-nav [aria-current="page"] {
  background: #173b37;
  color: var(--mint);
  border-color: #31594f;
}

main { flex: 1; width: 100%; max-width: 1264px; margin-inline: auto; padding: 36px 32px 56px; }
h1 { margin: 0 0 16px; font-size: clamp(30px, 3.7vw, 46px); font-weight: 650; line-height: 1.15; letter-spacing: -.045em; }
h2 { margin: 0 0 10px; font-size: 23px; font-weight: 650; line-height: 1.25; letter-spacing: -.025em; }
h3 { margin: 0; font-size: 18px; font-weight: 650; line-height: 1.3; letter-spacing: -.015em; }
p { margin: 0 0 14px; color: var(--muted); }
.eyebrow { margin: 0 0 12px; color: var(--mint); font-size: 11px; font-weight: 700; line-height: 1.4; letter-spacing: .12em; }
.small { font-size: 13px; line-height: 1.5; }

/* The form is the first mobile task; the research introduction follows it. */
.auth-layout { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 68px); align-items: start; }
.intro { padding-block: 14px; }
.intro > p { max-width: 590px; }
.intro > h1 { max-width: 650px; }
.intro img { display: block; width: 100%; height: auto; margin: 24px 0 16px; border: 1px solid var(--edge); border-radius: var(--radius); }
.auth-card, .status-card { padding: 28px; border: 1px solid var(--edge); border-radius: var(--radius); background: var(--panel); }
.auth-card > p { font-size: 14px; }
.auth-card form { margin-top: 20px; }
label { display: grid; gap: 6px; margin: 16px 0; color: #d8e6f0; font-size: 14px; font-weight: 500; line-height: 1.4; }
input, textarea, select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #46617c;
  border-radius: 9px;
  background: #091525;
  color: var(--ink);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.45;
}
input::placeholder, textarea::placeholder { color: #91a8bd; opacity: 1; }
input[type="search"] { -webkit-appearance: none; appearance: none; }
textarea { resize: vertical; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid #46617c;
  border-radius: 9px;
  background: #192e47;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
}
.primary { border-color: var(--mint); background: var(--mint); color: #082923; }
.danger { border-color: #91616e; background: #3c2634; color: #ffd3dc; }
.full { width: 100%; }
button:disabled { opacity: .5; cursor: wait; }
input:focus-visible, textarea:focus-visible, select:focus-visible,
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--mint); outline-offset: 3px; }
.chatgpt-button { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; margin: 22px 0 18px; padding: 11px 14px; border: 1px solid #4b8977; border-radius: 9px; background: #173b37; color: #dffbf0; font-size: 15px; font-weight: 650; text-align: center; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--soft); font-size: 12px; line-height: 1.4; text-align: center; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--edge); }
.message { margin: 12px 0; color: #eed09f; font-size: 14px; line-height: 1.45; }
.message:empty, #reviewNote:empty, #copyStatus:empty { display: none; }
.message.error { color: #ffb5ba; }
.message.success { color: #9be9c8; }
.switch { margin: 20px 0 12px; text-align: center; }
.switch a { text-decoration: underline; text-underline-offset: 3px; }
.optional { color: var(--soft); font-size: 12px; font-weight: 400; }
details { margin-top: 20px; }
summary { min-height: 44px; padding-block: 10px; color: #c6dbe9; font-size: 14px; line-height: 1.5; cursor: pointer; }
details p { margin-top: 10px; }
#approvalNote { margin-bottom: 6px; }
#forgotHelp { margin-top: 8px; }
#forgotHelp .small { margin-bottom: 0; }

.narrow { max-width: 720px; margin-inline: auto; }
.status-card { margin: 20px 0; }
.status-card h2 { margin-top: 16px; }
#accountEmail { font-size: 14px; }
#reviewNote { padding: 12px; border-left: 2px solid var(--mint); border-radius: 0 7px 7px 0; background: #0c1829; }
.badge { display: inline-flex; flex: 0 0 auto; align-items: center; width: fit-content; max-width: 100%; padding: 4px 9px; border: 1px solid #657386; border-radius: 6px; background: #263247; color: #d8e4ef; font-size: 11px; font-weight: 650; line-height: 1.35; letter-spacing: .045em; }
.badge.approved { border-color: #477967; background: #163b33; color: #a6f2d3; }
.badge.pending { border-color: #806741; background: #382f24; color: #f3d39f; }
.badge.rejected, .badge.revoked { border-color: #79505f; background: #3b2430; color: #ffc2cb; }
.actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin-top: 16px; }

/* Administration keeps heading, filters and search close to the work list. */
.admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.admin-heading h1 { margin: 0; font-size: clamp(28px, 3.6vw, 38px); }
.admin-heading > button { flex: 0 0 auto; }
.admin-description { margin: 6px 0 0; font-size: 14px; }
.admin-notice { margin: 16px 0 0; padding: 0; border: 1px solid #2f514f; border-radius: 10px; background: #11292d; }
.admin-notice summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; padding: 11px 14px; color: #c8eee1; font-size: 13px; font-weight: 600; list-style: none; }
.admin-notice summary::-webkit-details-marker { display: none; }
.admin-notice summary::after { content: ""; flex: 0 0 7px; width: 7px; height: 7px; margin-right: 3px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.admin-notice[open] summary::after { transform: rotate(225deg); }
.admin-notice p { margin: 0; padding: 0 14px 14px; color: #b9d1d3; font-size: 13px; line-height: 1.5; }
.admin-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); align-items: end; gap: 20px; margin: 20px 0 0; }
#statusTabs { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px; border: 1px solid var(--edge); border-radius: 11px; background: #0a1626; }
#statusTabs button { flex: 1 1 auto; min-height: 44px; padding: 8px 6px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; white-space: normal; }
#statusTabs button.active, #statusTabs button[aria-pressed="true"] { border-color: #4b8776; background: #1b4941; color: #bcffea; }
.admin-toolbar label { margin: 0; font-size: 12px; }
#accountSearch { min-height: 46px; }
#accountCount { margin: 12px 0 10px; color: var(--soft); font-size: 12px; }
.accounts-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; }
.account-card { display: flex; flex-direction: column; min-width: 0; padding: 20px; border: 1px solid var(--edge); border-radius: 12px; background: var(--panel); }
.account-card .card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-top > div { flex: 1; }
.card-top p { margin: 4px 0 0; font-size: 14px; line-height: 1.45; }
.account-card .identity { margin: 10px 0 0; color: #a9d8e9; font-size: 12px; line-height: 1.45; }
.account-card .request { margin: 12px 0 0; padding: 11px 12px; border: 1px solid #263b52; border-radius: 8px; background: #0b1728; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.account-card .timestamps { order: 10; margin: 14px 0 0; padding-top: 10px; border-top: 1px solid #2a3c52; color: var(--soft); font-size: 12px; line-height: 1.45; }
.account-card label { margin: 12px 0 0; font-size: 12px; }
.account-card .review-note { margin: 8px 0 0; }
.review-note summary { padding-block: 11px; color: #b9cddd; font-size: 13px; }
.review-note[open] label { margin: 4px 0 12px; }
.account-card .actions { gap: 8px; margin-top: 12px; }
.account-card .actions button { flex: 1 1 140px; min-height: 44px; padding: 10px 12px; font-size: 13px; }
.empty-state { grid-column: 1 / -1; padding: 32px 20px; border: 1px dashed #46617c; border-radius: 12px; color: var(--muted); text-align: center; font-size: 14px; }
.audit-panel { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--edge); }
.audit-panel > summary { color: var(--muted); }
.audit-panel > button { margin-top: 10px; }
.audit-panel ol { padding-left: 22px; }
.audit-panel li { margin: 10px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

dialog { width: min(600px, calc(100% - 32px)); max-width: 600px; max-height: calc(100dvh - 32px); margin: auto; padding: 24px; overflow: auto; border: 1px solid #55728b; border-radius: 14px; background: var(--panel); color: var(--ink); }
dialog::backdrop { background: #030912d9; }
dialog p { font-size: 14px; }
dialog textarea { font-size: 16px; }
footer { flex-shrink: 0; padding: 18px 20px; border-top: 1px solid #263b52; color: var(--soft); font-size: 12px; line-height: 1.5; text-align: center; }

@media (hover: hover) {
  a:hover { text-decoration: underline; }
  .brand:hover, .account-nav > a:hover { text-decoration: none; }
  button:hover, .button:hover { background: #24445f; text-decoration: none; }
  .primary:hover { border-color: #9bf2de; background: #9bf2de; }
  .danger:hover { background: #523142; }
  .account-nav > a:hover, .account-nav > button:hover { background: #172b40; color: var(--ink); }
  .chatgpt-button:hover { background: #214e44; text-decoration: none; }
}

@media (max-width: 960px) {
  .auth-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; max-width: 660px; margin-inline: auto; }
  .auth-layout > .auth-card { order: -1; }
  .intro { padding-block: 0; }
  .intro h1 { max-width: 580px; font-size: 34px; }
  .intro h1 br { display: none; }
  .intro img { max-height: 260px; object-fit: cover; }
  .accounts-list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .account-header { min-height: 64px; padding: 14px 16px; gap: 14px; }
  .brand { gap: 9px; font-size: 22px; }
  .brand-mark { flex-basis: 34px; width: 34px; min-width: 34px; height: 34px; border-radius: 9px; font-size: 23px; }
  .header-context { display: block; min-width: 0; margin-left: auto; color: var(--soft); font-size: 12px; font-weight: 500; line-height: 1.3; text-align: right; overflow-wrap: anywhere; }

  /* Existing hidden attributes determine which items are available. */
  .account-nav {
    position: fixed;
    z-index: 100;
    inset: auto 0 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 4px;
    min-height: 68px;
    margin: 0;
    padding: 7px max(12px, env(safe-area-inset-right, 0px)) calc(7px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
    border-top: 1px solid #354b62;
    background: #080f1c;
    box-shadow: 0 -8px 28px #03091366;
  }
  .account-nav > a, .account-nav > button {
    flex: 1 1 0;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    max-width: 150px;
    min-height: 52px;
    padding: 6px 4px;
    border-color: transparent;
    border-radius: 9px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.15;
    white-space: normal;
  }
  .nav-icon { display: block; }
  body:is([data-page="account"], [data-page="admin"], [data-page="activity"]) { padding-bottom: calc(var(--mobile-nav-height, 80px) + 18px); }
  body:is([data-page="login"], [data-page="register"], [data-page="reset"], [data-page="__WIRELAB_PAGE__"]) .account-nav { display: none; }

  main { padding: 22px 16px 36px; }
  h1 { font-size: 30px; }
  h2 { font-size: 22px; }
  .auth-card, .status-card { padding: 22px; border-radius: 12px; }
  .auth-layout { gap: 28px; }
  .intro h1 { font-size: 28px; }
  .intro > p:not(.eyebrow) { font-size: 14px; }
  .intro img { margin: 18px 0 14px; }
  .status-card { margin-top: 16px; }
  .status-card .actions > * { flex: 1 1 170px; }

  body[data-page="admin"] main { padding-top: 18px; }
  #adminView > .eyebrow { display: none; }
  .admin-heading { gap: 8px; }
  .admin-heading h1 { font-size: 25px; line-height: 1.2; }
  .admin-heading > button { min-height: 44px; padding-inline: 12px; font-size: 13px; }
  .admin-description { margin-top: 4px; font-size: 13px; }
  .admin-notice { margin-top: 12px; }
  .admin-notice summary { padding: 10px 12px; }
  .admin-notice p { padding-inline: 12px; }
  .admin-toolbar { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 12px; }
  #statusTabs { gap: 3px; padding: 3px; }
  #statusTabs button { padding-inline: 3px; font-size: 13px; }
  .account-search .field-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  #accountCount { margin: 10px 0 8px; }
  .accounts-list { gap: 12px; }
  .account-card { padding: 16px; }
  .card-top { gap: 8px; }
  .account-card .actions button { flex-basis: 130px; }
  .empty-state { padding: 28px 16px; }
  .audit-panel { margin-top: 20px; }
  dialog { padding: 20px; }
  dialog .actions > * { flex: 1 1 100px; }
}

@media (max-width: 359px) {
  .account-header { padding-inline: 12px; }
  main { padding-inline: 12px; }
  .header-context { font-size: 11px; }
  .auth-card, .status-card { padding: 18px; }
  #statusTabs { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #statusTabs button { grid-column: span 2; }
  #statusTabs button[data-status="revoked"], #statusTabs button[data-status="all"] { grid-column: span 3; }
  .account-card .card-top { flex-wrap: wrap; }
  .account-card .card-top > div { flex-basis: 100%; }
}

html, body { max-width: 100%; overflow-x: clip; overscroll-behavior-x: none; background: #080f1c; }

.brand-mark svg { display: block; flex: 0 0 24px; }
.admin-heading { flex-wrap: wrap; }
.admin-heading h1 { flex: 1 1 9em; }
.account-nav span { max-width: 100%; overflow-wrap: anywhere; text-align: center; }
html { scroll-padding-bottom: calc(var(--mobile-nav-height, 80px) + 20px); }
@media (max-width: 900px) {
  .account-header { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  .account-header { flex-wrap: wrap; }
  .header-context { flex: 1 1 90px; }
  main { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
}

/* Operational dashboard uses the same account navigation and dark surfaces. */
.admin-sections { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 24px; }
.admin-sections a { display:flex; align-items:center; min-height:44px; padding:10px 16px; border:1px solid var(--edge); border-radius:12px; text-decoration:none; }
.admin-sections [aria-current=page] { background:#18372f; color:#91efda; border-color:#54b9a6; }
.activity-filters { display:grid; grid-template-columns:minmax(140px, .6fr) minmax(220px,1fr) auto; align-items:end; gap:16px; margin:24px 0 8px; }
.activity-filters label,.activity-outcome { display:grid; gap:8px; margin:0; min-width:0; }
.activity-filters select,.activity-outcome select { width:100%; min-width:0; min-height:48px; padding:10px 12px; border:1px solid var(--edge); border-radius:10px; color:var(--ink); background:#14253a; font:inherit; font-size:16px; }
.activity-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:16px 0; }
.activity-metric { background:#102135; border:1px solid var(--edge); border-radius:14px; padding:18px; display:flex; flex-direction:column; gap:10px; }
.activity-metric span { color:var(--muted); font-size:14px; line-height:1.5; }
.activity-metric strong { font-size:2rem; line-height:1.15; color:#91efda; }
.activity-panel { padding:24px; margin-top:24px; background:#0d1b2c; border:1px solid var(--edge); border-radius:16px; min-width:0; }
.activity-panel h2 { margin:0 0 12px; font-size:1.3rem; line-height:1.4; }
.activity-people { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin-top:20px; }
.activity-person { padding:20px; background:#12243a; border:1px solid var(--edge); border-radius:12px; min-width:0; }
.activity-person h3 { margin:0 0 8px; font-size:1.05rem; line-height:1.5; }
.activity-email { overflow-wrap:anywhere; margin:0 0 10px; }
.activity-facts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px 12px; margin:20px 0 0; }
.activity-facts dt { color:var(--muted); font-size:14px; line-height:1.5; }
.activity-facts dd { margin:5px 0 0; font-size:1.15rem; font-weight:650; }
.activity-columns { display:grid; grid-template-columns:1.4fr 1fr; gap:20px; }
.activity-summary-row { display:flex; justify-content:space-between; flex-wrap:wrap; align-items:baseline; gap:8px 20px; border-top:1px solid var(--edge); padding:14px 0; }
.activity-summary-row p { margin:0; font-size:14px; }
.activity-recent { display:grid; gap:12px; margin-top:18px; }
.activity-record { border:1px solid var(--edge); border-radius:12px; padding:18px; min-width:0; }
.activity-record-top { display:flex; justify-content:space-between; align-items:baseline; gap:12px; flex-wrap:wrap; margin-bottom:10px; }
.activity-record p { margin:6px 0 0; overflow-wrap:anywhere; }
.activity-status { display:inline-block; padding:5px 10px; border-radius:8px; font-size:14px; line-height:1.5; background:#24354a; }
.activity-status.completed { color:#a8edd3; background:#18392f; }
.activity-status.failed { color:#ffc0bd; background:#492b33; }
.activity-status.unconfirmed,.activity-status.started { color:#ffe0a2; background:#3d3421; }
.activity-outcome { max-width:300px; margin-top:20px; }
#activityView .admin-description { max-width:70ch; font-size:16px; line-height:1.6; }
#activityView .admin-notice p { margin:14px 0 0; }
@media(max-width:760px) {
 .activity-filters { grid-template-columns:1fr; gap:16px; }
 .activity-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
 .activity-metric { padding:14px; }
 .activity-people,.activity-columns { grid-template-columns:1fr; }
 .activity-panel { padding:16px; margin-top:20px; }
 .activity-person { padding:16px; }
 .activity-facts { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .activity-columns { gap:0; }
 .activity-record { padding:14px; }
 .admin-sections { margin-bottom:20px; }
}

#activityCSV[aria-disabled="true"] { opacity:.5; pointer-events:none; }
