:root {
  color-scheme: dark;
  --ink: #f7f5ff;
  --muted: #9a9bb5;
  --dim: #71738e;
  --void: #050611;
  --panel: rgba(14, 15, 33, .78);
  --panel-solid: #0f1022;
  --line: rgba(255, 255, 255, .1);
  --line-hot: rgba(152, 123, 255, .42);
  --violet: #9f7aea;
  --violet-bright: #c4a7ff;
  --cyan: #54e6ff;
  --mint: #6fffc5;
  --danger: #ff6f91;
  --warning: #ffcb6b;
  --radius: 22px;
  --shadow: 0 32px 90px rgba(0, 0, 0, .42);
  --font-display: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", sans-serif;
  --font-body: Inter, "Segoe UI Variable Text", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.portal-body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 12% 0%, rgba(115, 75, 226, .22), transparent 34rem),
    radial-gradient(circle at 92% 18%, rgba(35, 188, 223, .14), transparent 30rem),
    linear-gradient(145deg, #050611 0%, #080919 45%, #050611 100%);
  overflow-x: hidden;
}

.portal-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .2;
  background-image:
    linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.portal-body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: .025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.aurora { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .18; animation: drift 16s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { width: 28rem; height: 28rem; background: #7549ff; left: -8rem; top: 12%; }
.aurora i:nth-child(2) { width: 25rem; height: 25rem; background: #00d9ff; right: -9rem; top: 35%; animation-delay: -5s; }
.aurora i:nth-child(3) { width: 21rem; height: 21rem; background: #ff4fc4; left: 48%; bottom: -12rem; animation-delay: -9s; }
@keyframes drift { to { transform: translate3d(3rem, -2rem, 0) scale(1.14); } }

.skip-link { position: fixed; top: 1rem; left: 1rem; z-index: 100; transform: translateY(-180%); padding: .75rem 1rem; background: white; color: #090a14; border-radius: 10px; text-decoration: none; }
.skip-link:focus { transform: translateY(0); }

:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
::selection { background: rgba(159,122,234,.4); color: white; }

.portal-brand { display: inline-flex; align-items: center; gap: 1rem; text-decoration: none; }
.portal-brand img { display: block; width: 58px; height: 58px; object-fit: contain; filter: drop-shadow(0 0 18px rgba(159,122,234,.5)); }
.portal-brand > span:last-child { display: grid; gap: .18rem; }
.portal-brand strong { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: -.03em; }
.portal-brand small { color: var(--muted); font: 600 .68rem/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.portal-brand.compact img { width: 44px; height: 44px; }
.logo-orbit { position: relative; display: grid; place-items: center; }
.logo-orbit::before { content: ""; position: absolute; inset: -8px; border: 1px solid rgba(159,122,234,.32); border-radius: 50%; box-shadow: 0 0 25px rgba(84,230,255,.1); }

.eyebrow, .section-index { color: var(--violet-bright); font: 700 .7rem/1.2 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; }
.eyebrow { display: flex; align-items: center; gap: .65rem; margin: 0 0 1rem; }
.eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 16px var(--mint); }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 13px var(--mint); }

/* Sign in and initial security setup */
.login-stage { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(390px, .75fr); }
.login-story { min-height: 100vh; padding: clamp(2rem, 6vw, 6.5rem); display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--line); }
.story-copy { max-width: 760px; padding: 8vh 0; }
.story-copy h1, .workspace-header h1, .admin-header h1 { margin: 0; font: 500 clamp(3.6rem, 8vw, 8.2rem)/.9 var(--font-display); letter-spacing: -.075em; }
.story-copy h1 em, .workspace-header h1 em, .admin-header h1 em { color: transparent; font-style: normal; background: linear-gradient(115deg, var(--violet-bright), var(--cyan)); background-clip: text; -webkit-background-clip: text; }
.story-copy > p:last-child { max-width: 640px; margin: 2rem 0 0; color: #bebed0; font-size: clamp(1.05rem, 1.4vw, 1.28rem); line-height: 1.7; }
.trust-strip { display: flex; flex-wrap: wrap; gap: 1.4rem 2.4rem; color: var(--muted); font-size: .78rem; }
.trust-strip span { display: flex; align-items: center; gap: .6rem; }
.trust-strip b { color: var(--cyan); font: 700 .68rem var(--font-mono); }

.login-panel { min-height: 100vh; padding: clamp(2rem, 5vw, 5.5rem); display: flex; flex-direction: column; justify-content: center; background: rgba(5,6,17,.56); backdrop-filter: blur(28px); }
.mobile-login-brand { display: none; }
.signal-row { position: absolute; top: 2rem; right: 2rem; display: flex; align-items: center; gap: .55rem; color: var(--muted); font-size: .72rem; }
.signal-row b { color: #d7d7e5; font-family: var(--font-mono); }
.login-heading { margin-bottom: 2rem; }
.login-heading h2, .dialog-head h2 { margin: .8rem 0 .5rem; font: 600 clamp(2.2rem, 4vw, 3.5rem)/1 var(--font-display); letter-spacing: -.055em; }
.login-heading p, .dialog-head p, .card-heading p, .section-heading p { margin: 0; color: var(--muted); line-height: 1.6; }

.portal-form, .stack-form, .dialog-shell { display: grid; gap: 1rem; }
label { display: grid; gap: .55rem; color: #c8c8d8; font-size: .78rem; font-weight: 700; }
label > span small { margin-left: .3rem; color: var(--dim); font-weight: 500; }
input, select, textarea { width: 100%; color: var(--ink); background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 13px; padding: .92rem 1rem; transition: border-color .2s, background .2s, box-shadow .2s; }
input::placeholder, textarea::placeholder { color: #65677f; }
input:hover, select:hover, textarea:hover { background: rgba(255,255,255,.065); border-color: rgba(255,255,255,.18); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--line-hot); box-shadow: 0 0 0 4px rgba(159,122,234,.1), 0 0 28px rgba(84,230,255,.045); }
textarea { resize: vertical; min-height: 90px; }
select { cursor: pointer; }
option { background: #101122; }
.password-field { position: relative; }
.password-field input { padding-right: 5rem; }
.password-field button { position: absolute; top: 50%; right: .65rem; transform: translateY(-50%); border: 0; color: var(--cyan); background: transparent; padding: .55rem; cursor: pointer; font-size: .75rem; font-weight: 800; }

.primary-action, .ghost-button, .icon-button { border: 0; cursor: pointer; text-decoration: none; }
.primary-action { min-height: 52px; display: inline-flex; align-items: center; justify-content: space-between; gap: 1.2rem; color: #080916; background: linear-gradient(115deg, #bba0ff, #60e7ff); border-radius: 13px; padding: .85rem 1rem .85rem 1.2rem; font-weight: 900; box-shadow: 0 14px 35px rgba(92,191,255,.14); transition: transform .2s, box-shadow .2s, filter .2s; }
.primary-action i { font-style: normal; font-size: 1.15rem; }
.primary-action:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 18px 42px rgba(132,119,255,.22); }
.primary-action:active { transform: translateY(0) scale(.985); }
.primary-action:disabled { cursor: not-allowed; opacity: .55; filter: grayscale(.35); transform: none; }
.ghost-button { display: inline-flex; align-items: center; justify-content: center; color: #deddec; background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 12px; padding: .83rem 1rem; font-weight: 800; transition: .2s; }
.ghost-button:hover { color: white; background: rgba(159,122,234,.1); border-color: var(--line-hot); }
.ghost-button.full { width: 100%; }
.compact-action { min-height: 44px; padding: .7rem .85rem .7rem 1rem; font-size: .78rem; }

.login-help { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.4rem; color: var(--muted); font-size: .76rem; }
.login-help a { color: var(--cyan); text-decoration: none; font-weight: 800; }
.privacy-note { margin: 2rem 0 0; padding-top: 1.4rem; border-top: 1px solid var(--line); color: var(--dim); font-size: .68rem; line-height: 1.6; }
.alert { display: flex; gap: .85rem; align-items: flex-start; padding: .9rem 1rem; border: 1px solid rgba(255,111,145,.28); background: rgba(255,111,145,.07); border-radius: 13px; margin-bottom: 1.2rem; }
.alert > span { display: grid; place-items: center; flex: 0 0 24px; height: 24px; color: #080916; background: var(--danger); border-radius: 50%; font-weight: 900; }
.alert b { font-size: .78rem; }
.alert p { margin: .2rem 0 0; color: #d8a8b7; font-size: .72rem; line-height: 1.45; }
.password-rules { margin: .3rem 0 .4rem; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; color: var(--dim); font-size: .7rem; }
.password-rules li::before { content: "○"; margin-right: .4rem; color: var(--dim); }
.password-rules li.valid { color: #b9f6dd; }
.password-rules li.valid::before { content: "●"; color: var(--mint); }

/* Client workspace */
.portal-shell { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.portal-sidebar, .admin-rail { position: sticky; top: 0; height: 100vh; padding: 1.8rem 1.3rem; display: flex; flex-direction: column; background: rgba(7,8,20,.78); border-right: 1px solid var(--line); backdrop-filter: blur(28px); }
.portal-nav, .admin-nav { display: grid; gap: .45rem; margin-top: 3rem; }
.portal-nav button, .admin-nav a { width: 100%; display: flex; align-items: center; gap: .8rem; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 13px; padding: .8rem; text-align: left; text-decoration: none; cursor: pointer; transition: .2s; }
.portal-nav button:hover, .portal-nav button.active, .admin-nav a:hover, .admin-nav a.active { color: white; background: linear-gradient(120deg, rgba(159,122,234,.15), rgba(84,230,255,.05)); border-color: rgba(159,122,234,.2); }
.portal-nav button > i, .admin-nav a > i { width: 28px; font-style: normal; color: var(--violet-bright); text-align: center; font-size: 1.1rem; }
.portal-nav button > span { display: grid; gap: .2rem; }
.portal-nav b { font-size: .78rem; }
.portal-nav small { color: var(--dim); font-size: .65rem; }
.sidebar-security { margin-top: auto; display: flex; gap: .7rem; align-items: center; padding: .9rem; background: rgba(111,255,197,.045); border: 1px solid rgba(111,255,197,.11); border-radius: 13px; }
.sidebar-security > div { display: grid; gap: .16rem; }
.sidebar-security b { font-size: .7rem; }
.sidebar-security small { color: var(--dim); font-size: .58rem; }
.signout-link { display: flex; justify-content: space-between; margin-top: .8rem; color: var(--muted); padding: .8rem; text-decoration: none; font-size: .72rem; }
.signout-link:hover { color: var(--cyan); }

.portal-main { min-width: 0; padding: clamp(2rem, 5vw, 5rem); }
.workspace-header, .admin-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; padding-bottom: 2.4rem; border-bottom: 1px solid var(--line); }
.workspace-header h1 { font-size: clamp(2.8rem, 5.5vw, 6rem); }
.workspace-header > div:first-child > p:last-child, .admin-header > div:first-child > p:last-child { max-width: 720px; margin: 1.2rem 0 0; color: var(--muted); line-height: 1.6; }
.identity-chip { flex: 0 0 auto; display: flex; align-items: center; gap: .8rem; padding: .65rem .8rem; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 14px; }
.identity-chip > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #080916; background: linear-gradient(135deg, var(--violet-bright), var(--cyan)); font-weight: 900; }
.identity-chip > div { display: grid; gap: .2rem; }
.identity-chip b { font-size: .75rem; }
.identity-chip small { color: var(--dim); font-size: .62rem; }

.pulse-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin: 1.6rem 0 4.5rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: rgba(255,255,255,.025); box-shadow: var(--shadow); }
.pulse-grid article { min-width: 0; min-height: 132px; padding: 1.4rem; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--line); }
.pulse-grid article:last-child { border-right: 0; }
.pulse-grid span { color: var(--dim); font: 700 .62rem var(--font-mono); letter-spacing: .12em; }
.pulse-grid strong { font: 600 clamp(1.6rem, 3vw, 2.8rem)/1 var(--font-display); letter-spacing: -.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pulse-grid small { color: var(--muted); font-size: .67rem; }
.pulse-grid .date-metric { font-size: clamp(1.05rem, 2vw, 1.6rem); }
.trust-metric { background: linear-gradient(130deg, rgba(111,255,197,.08), rgba(84,230,255,.025)); }
.trust-metric strong { color: #d9fff1; font-size: clamp(1rem, 2vw, 1.35rem); }

.workspace-section { margin-bottom: 5rem; scroll-margin-top: 2rem; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; }
.section-heading h2, .card-heading h2 { margin: .65rem 0 .45rem; font: 600 clamp(1.8rem, 3vw, 3rem)/1 var(--font-display); letter-spacing: -.05em; }
.sync-state { display: flex; align-items: center; gap: .5rem; color: var(--mint); font: 700 .62rem var(--font-mono); letter-spacing: .1em; white-space: nowrap; }
.sync-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 12px var(--mint); }

.project-runway { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.project-card { position: relative; overflow: hidden; padding: 1.45rem; min-height: 250px; display: grid; gap: 1.1rem; background: linear-gradient(145deg, rgba(22,23,49,.9), rgba(10,11,28,.88)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0,0,0,.2); transition: transform .25s, border-color .25s; }
.project-card::after { content: ""; position: absolute; width: 10rem; height: 10rem; right: -5rem; top: -5rem; background: radial-gradient(circle, rgba(159,122,234,.18), transparent 68%); }
.project-card:hover { transform: translateY(-4px); border-color: var(--line-hot); }
.project-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.project-card h3 { margin: .45rem 0 0; font: 600 1.4rem var(--font-display); letter-spacing: -.035em; }
.status-pill, .direction-pill, .visibility-pill { display: inline-flex; align-items: center; width: max-content; border-radius: 999px; padding: .34rem .55rem; font: 700 .58rem var(--font-mono); letter-spacing: .04em; }
.status-pill { color: #d9fff1; background: rgba(111,255,197,.08); border: 1px solid rgba(111,255,197,.18); }
.project-progress { display: grid; gap: .55rem; }
.project-progress > div { display: flex; justify-content: space-between; color: var(--muted); font-size: .68rem; }
.progress-track { height: 7px; overflow: hidden; background: rgba(255,255,255,.06); border-radius: 99px; }
.progress-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--cyan)); border-radius: inherit; box-shadow: 0 0 18px rgba(84,230,255,.35); }
.project-milestone { display: flex; justify-content: space-between; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.project-milestone span { display: grid; gap: .3rem; }
.project-milestone small { color: var(--dim); font: 600 .57rem var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.project-milestone b { color: #d8d7e5; font-size: .72rem; }

.file-heading { align-items: center; }
.file-toolbar { display: grid; grid-template-columns: minmax(200px, 1fr) 220px auto; gap: .8rem; margin-bottom: 1rem; }
.search-box { position: relative; display: block; }
.search-box > span { position: absolute; z-index: 1; top: 50%; left: 1rem; transform: translateY(-50%); color: var(--dim); }
.search-box input { padding-left: 2.5rem; }
.segmented { display: flex; gap: .25rem; padding: .25rem; background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 13px; }
.segmented button { color: var(--muted); background: transparent; border: 0; border-radius: 9px; padding: .65rem .75rem; cursor: pointer; font-size: .68rem; font-weight: 800; white-space: nowrap; }
.segmented button.active { color: white; background: rgba(159,122,234,.15); box-shadow: inset 0 0 0 1px rgba(159,122,234,.16); }

.file-table-shell { overflow: hidden; background: rgba(10,11,28,.64); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.file-table-head, .file-row { display: grid; grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 1fr) 130px 90px 50px; align-items: center; gap: 1rem; }
.file-table-head { padding: .8rem 1.1rem; color: var(--dim); border-bottom: 1px solid var(--line); font: 700 .58rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.file-row { min-height: 76px; padding: .85rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.065); transition: background .2s; }
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: rgba(159,122,234,.04); }
.file-identity { min-width: 0; display: flex; align-items: center; gap: .8rem; }
.file-icon { flex: 0 0 40px; height: 44px; display: grid; place-items: center; color: var(--cyan); background: rgba(84,230,255,.06); border: 1px solid rgba(84,230,255,.13); border-radius: 11px; font: 700 .58rem var(--font-mono); }
.file-identity > div, .file-project { min-width: 0; display: grid; gap: .25rem; }
.file-identity b, .file-project b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; }
.file-identity small, .file-project small, .file-row > span { color: var(--dim); font-size: .64rem; }
.direction-pill.outbound { color: #c9f9ff; background: rgba(84,230,255,.07); }
.direction-pill.incoming { color: #e1d3ff; background: rgba(159,122,234,.09); }
.file-action { width: 38px; height: 38px; display: grid; place-items: center; color: var(--ink); background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; cursor: pointer; }
.file-action:hover { color: var(--cyan); border-color: rgba(84,230,255,.28); }
.empty-state { padding: 3.5rem 1.5rem; text-align: center; color: var(--muted); }
.empty-state b { display: block; color: var(--ink); font: 600 1.2rem var(--font-display); margin-bottom: .4rem; }

.trust-centre { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .75fr); gap: 3rem; padding: clamp(1.5rem, 4vw, 3.5rem); background: linear-gradient(135deg, rgba(159,122,234,.08), rgba(84,230,255,.035)); border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px); }
.trust-centre h2 { margin: .7rem 0 .8rem; font: 600 clamp(2rem, 4vw, 4.2rem)/.95 var(--font-display); letter-spacing: -.06em; }
.trust-centre p { color: var(--muted); line-height: 1.7; }
.trust-cards { display: grid; gap: .7rem; }
.trust-cards article { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: rgba(7,8,20,.44); border: 1px solid var(--line); border-radius: 14px; }
.trust-cards article > b { color: var(--violet-bright); font: 700 .63rem var(--font-mono); }
.trust-cards article > span { display: grid; gap: .2rem; }
.trust-cards strong { font-size: .76rem; }
.trust-cards small { color: var(--dim); font-size: .65rem; }
.portal-footer { display: flex; justify-content: space-between; gap: 1rem; margin-top: 4rem; padding-top: 1.3rem; color: var(--dim); border-top: 1px solid var(--line); font-size: .65rem; }
.portal-footer a { color: var(--muted); text-decoration: none; }

/* Upload dialog */
.upload-dialog { width: min(620px, calc(100vw - 2rem)); color: var(--ink); background: transparent; border: 0; padding: 0; }
.upload-dialog::backdrop { background: rgba(2,3,10,.8); backdrop-filter: blur(12px); }
.dialog-shell { padding: 1.6rem; background: #0d0e20; border: 1px solid var(--line-hot); border-radius: var(--radius); box-shadow: var(--shadow); }
.dialog-head { display: flex; justify-content: space-between; gap: 1rem; }
.dialog-head h2 { font-size: 2rem; }
.icon-button { flex: 0 0 38px; height: 38px; color: var(--muted); background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 10px; font-size: 1.35rem; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: .7rem; margin-top: .4rem; }
.drop-zone { min-height: 155px; position: relative; display: grid; place-items: center; align-content: center; gap: .45rem; text-align: center; background: linear-gradient(135deg, rgba(159,122,234,.06), rgba(84,230,255,.025)); border: 1px dashed rgba(159,122,234,.35); border-radius: 16px; cursor: pointer; transition: .2s; }
.drop-zone:hover, .drop-zone.dragging { background: rgba(159,122,234,.11); border-color: var(--violet-bright); }
.drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-zone b { font-size: .8rem; }
.drop-zone small { color: var(--dim); font-size: .65rem; }
.drop-icon { display: grid; place-items: center; width: 38px; height: 38px; color: #080916; background: linear-gradient(135deg, var(--violet-bright), var(--cyan)); border-radius: 50%; font-size: 1.15rem; }
.upload-progress { position: relative; overflow: hidden; display: flex; align-items: center; gap: .7rem; min-height: 42px; padding: .7rem; color: #c8f8ff; background: rgba(84,230,255,.055); border-radius: 11px; font-size: .7rem; }
.upload-progress i { width: 10px; height: 10px; border: 2px solid var(--cyan); border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-stack { position: fixed; z-index: 120; right: 1.2rem; bottom: 1.2rem; display: grid; gap: .65rem; width: min(390px, calc(100vw - 2.4rem)); }
.toast { padding: .9rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .8rem; color: #e7e6f2; background: rgba(15,16,34,.96); border: 1px solid var(--line-hot); border-radius: 13px; box-shadow: 0 20px 50px rgba(0,0,0,.4); animation: toast-in .25s ease-out; font-size: .74rem; }
.toast.error { border-color: rgba(255,111,145,.38); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.skeleton { position: relative; overflow: hidden; background: rgba(255,255,255,.035); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.065), transparent); animation: shimmer 1.4s infinite; }
.card-skeleton { height: 240px; border-radius: var(--radius); }
.row-skeleton { height: 76px; border-bottom: 1px solid var(--line); }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Admin file exchange */
.admin-layout { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.admin-rail { padding: 1.5rem 1.1rem; }
.rail-label { margin: 2.8rem .8rem .5rem; color: #555872; font: 700 .57rem var(--font-mono); letter-spacing: .15em; }
.admin-nav { margin: 0; }
.admin-nav a { padding: .75rem .7rem; font-size: .72rem; font-weight: 750; }
.admin-nav a b { margin-left: auto; color: #080916; background: var(--mint); padding: .18rem .34rem; border-radius: 5px; font: 900 .48rem var(--font-mono); }
.rail-profile { margin-top: auto; display: flex; align-items: center; gap: .65rem; padding: .8rem; border-top: 1px solid var(--line); }
.rail-profile > span { display: grid; place-items: center; width: 34px; height: 34px; color: #080916; background: linear-gradient(135deg, var(--violet-bright), var(--cyan)); border-radius: 10px; font-weight: 900; }
.rail-profile > div { min-width: 0; display: grid; flex: 1; gap: .15rem; }
.rail-profile b { overflow: hidden; text-overflow: ellipsis; font-size: .7rem; }
.rail-profile small { color: var(--dim); font-size: .58rem; }
.rail-profile a { color: var(--muted); text-decoration: none; }
.admin-main { min-width: 0; padding: clamp(1.6rem, 4vw, 4.5rem); }
.admin-header { align-items: center; }
.admin-header h1 { font-size: clamp(3rem, 5vw, 5.8rem); }
.header-actions { display: flex; gap: .65rem; align-items: center; flex: 0 0 auto; }
.admin-pulse { margin-bottom: 1.4rem; }
.admin-work-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 1rem; }
.admin-card { padding: clamp(1.2rem, 2.3vw, 2rem); background: linear-gradient(145deg, rgba(17,18,40,.86), rgba(9,10,26,.82)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 18px 55px rgba(0,0,0,.16); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.grant-form { margin-top: 1.4rem; }
.form-divider { position: relative; display: flex; align-items: center; gap: .8rem; margin: .2rem 0; color: var(--dim); font: 700 .56rem var(--font-mono); letter-spacing: .12em; }
.form-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem; background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 13px; cursor: pointer; }
.switch-row > span { display: grid; gap: .22rem; }
.switch-row b { font-size: .72rem; }
.switch-row small { color: var(--dim); font-size: .6rem; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row > i { position: relative; flex: 0 0 42px; height: 24px; background: #2a2b41; border-radius: 99px; transition: .2s; }
.switch-row > i::after { content: ""; position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; background: #8b8ca3; border-radius: 50%; transition: .2s; }
.switch-row input:checked + i { background: rgba(111,255,197,.2); box-shadow: inset 0 0 0 1px rgba(111,255,197,.18); }
.switch-row input:checked + i::after { transform: translateX(18px); background: var(--mint); box-shadow: 0 0 12px rgba(111,255,197,.45); }
.compact-switch { min-height: 46px; }
.credential-result { margin-top: .8rem; padding: .85rem; display: flex; align-items: center; justify-content: space-between; gap: .7rem; background: rgba(111,255,197,.055); border: 1px solid rgba(111,255,197,.18); border-radius: 13px; }
.credential-result > div { min-width: 0; display: grid; gap: .25rem; }
.credential-result span { color: var(--mint); font: 700 .55rem var(--font-mono); letter-spacing: .1em; }
.credential-result code { overflow-wrap: anywhere; color: white; font: 700 .72rem var(--font-mono); }
.credential-result small { color: var(--dim); font-size: .58rem; }
.credential-result button { color: #080916; background: var(--mint); border: 0; border-radius: 9px; padding: .55rem .7rem; font-size: .65rem; font-weight: 900; cursor: pointer; }
.admin-drop { min-height: 180px; }
.directory-card, .vault-card, .audit-card { margin-top: 1rem; }
.access-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.access-card { padding: 1rem; background: rgba(255,255,255,.026); border: 1px solid var(--line); border-radius: 15px; }
.access-card-head { display: flex; justify-content: space-between; gap: .7rem; }
.access-person { min-width: 0; display: flex; gap: .7rem; align-items: center; }
.access-avatar { flex: 0 0 34px; height: 34px; display: grid; place-items: center; color: #080916; background: linear-gradient(135deg, var(--violet-bright), var(--cyan)); border-radius: 10px; font-weight: 900; }
.access-person > div { min-width: 0; display: grid; gap: .2rem; }
.access-person b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; }
.access-person small { color: var(--dim); font-size: .58rem; }
.access-project { margin: .85rem 0; padding-top: .75rem; border-top: 1px solid var(--line); display: grid; gap: .25rem; }
.access-project small { color: var(--dim); font: 700 .53rem var(--font-mono); letter-spacing: .08em; }
.access-project b { font-size: .7rem; }
.access-actions { display: flex; justify-content: space-between; gap: .4rem; align-items: center; }
.access-actions span { color: var(--muted); font-size: .59rem; }
.tiny-button { color: var(--danger); background: transparent; border: 1px solid rgba(255,111,145,.18); border-radius: 8px; padding: .4rem .5rem; font-size: .57rem; cursor: pointer; }
.tiny-button.neutral { color: var(--cyan); border-color: rgba(84,230,255,.18); }
.admin-file-table .file-table-head, .admin-file-table .file-row { grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 1fr) 120px 120px 80px; }
.visibility-pill { color: #d9fff1; background: rgba(111,255,197,.07); }
.visibility-pill.private { color: #c3c3d5; background: rgba(255,255,255,.05); }
.visibility-pill.warning { color: #ffe7ad; background: rgba(255,203,107,.09); border: 1px solid rgba(255,203,107,.22); }
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; }
.audit-stream { display: grid; }
.audit-item { display: grid; grid-template-columns: 120px 160px minmax(0,1fr); gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); font-size: .68rem; }
.audit-item:last-child { border-bottom: 0; }
.audit-item time { color: var(--dim); font-family: var(--font-mono); }
.audit-item b { color: #d6d5e4; }
.audit-item span { color: var(--muted); overflow-wrap: anywhere; }

@media (max-width: 1180px) {
  .pulse-grid { grid-template-columns: repeat(2, 1fr); }
  .pulse-grid article:nth-child(2) { border-right: 0; }
  .pulse-grid article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .admin-work-grid { grid-template-columns: 1fr; }
  .access-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-toolbar { grid-template-columns: 1fr 190px; }
  .file-toolbar .segmented { grid-column: 1 / -1; width: max-content; }
}

@media (max-width: 900px) {
  .login-stage { grid-template-columns: 1fr; }
  .login-story { order: 2; min-height: auto; padding-bottom: 3rem; border-right: 0; border-top: 1px solid var(--line); border-bottom: 0; }
  .story-copy { padding: 12vh 0 8vh; }
  .login-panel { order: 1; min-height: 100svh; }
  .mobile-login-brand { display: inline-flex; margin-bottom: 2rem; }
  .signal-row { position: static; margin-bottom: 3rem; }
  .portal-shell, .admin-layout { display: block; }
  .portal-sidebar, .admin-rail { position: sticky; z-index: 30; top: 0; width: 100%; height: auto; padding: .8rem 1rem; flex-direction: row; align-items: center; gap: 1rem; overflow-x: auto; }
  .portal-sidebar .portal-brand small, .admin-rail .portal-brand small, .sidebar-security, .rail-label, .rail-profile { display: none; }
  .portal-nav, .admin-nav { display: flex; margin: 0 0 0 auto; }
  .portal-nav button, .admin-nav a { width: auto; white-space: nowrap; }
  .portal-nav small, .admin-nav a b { display: none; }
  .signout-link { margin: 0; white-space: nowrap; }
  .admin-nav a > i { display: none; }
  .portal-main, .admin-main { padding-top: 2rem; }
  .workspace-header, .admin-header { align-items: flex-start; flex-direction: column; }
  .identity-chip { align-self: stretch; }
  .header-actions { width: 100%; flex-wrap: wrap; }
  .project-runway { grid-template-columns: 1fr; }
  .trust-centre { grid-template-columns: 1fr; }
  .file-table-head { display: none; }
  .file-row, .admin-file-table .file-row { grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; }
  .file-row > *:nth-child(2), .file-row > *:nth-child(3), .file-row > *:nth-child(4) { grid-column: 1; }
  .file-row > *:last-child { grid-column: 2; grid-row: 1; }
}

@media (max-width: 620px) {
  .login-story, .login-panel { padding: 1.35rem; }
  .story-copy h1 { font-size: clamp(3.2rem, 17vw, 5.2rem); }
  .trust-strip { display: grid; }
  .portal-brand > span:last-child { display: none; }
  .portal-nav button > i { display: none; }
  .portal-nav button { padding: .65rem; }
  .portal-nav small { display: none; }
  .signout-link span { display: none; }
  .portal-main, .admin-main { padding: 1.25rem; }
  .workspace-header h1, .admin-header h1 { font-size: clamp(2.8rem, 15vw, 4.3rem); }
  .pulse-grid { grid-template-columns: 1fr 1fr; margin-bottom: 3.5rem; }
  .pulse-grid article { min-height: 112px; padding: 1rem; }
  .pulse-grid strong { font-size: 1.65rem; }
  .section-heading, .file-heading { align-items: flex-start; flex-direction: column; }
  .file-toolbar { grid-template-columns: 1fr; }
  .file-toolbar .segmented { grid-column: auto; width: 100%; overflow-x: auto; }
  .segmented button { flex: 1; }
  .two-col { grid-template-columns: 1fr; }
  .access-grid { grid-template-columns: 1fr; }
  .audit-item { grid-template-columns: 1fr; gap: .3rem; }
  .portal-footer { flex-direction: column; }
  .dialog-actions { grid-template-columns: 1fr; }
  .password-rules { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
