:root {
  --bg: #f4f6f8;
  --card: #fff;
  --ink: #1a2332;
  --muted: #5b6b7c;
  --line: #d8dee6;
  --accent: #1f6feb;
  --accent-ink: #fff;
  --danger: #b42318;
  --ok: #067647;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  min-height: 100vh;
}
/* Cyber HUD backgrounds (AW Neural) — absolute /static path; cover; moderate overlay */
html:has(body.page-bg-full),
html:has(body.page-bg-faint) {
  min-height: 100%;
  background-color: #0b1220;
}
body.page-bg-full {
  min-height: 100vh;
  background-color: #0b1220;
  background-image:
    linear-gradient(rgba(8, 15, 30, 0.38), rgba(8, 15, 30, 0.48)),
    url("/static/hud-bg.jpg");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: scroll;
}
body.page-bg-faint {
  min-height: 100vh;
  background-color: #e8eef4;
  background-image:
    linear-gradient(rgba(244, 246, 248, 0.88), rgba(244, 246, 248, 0.92)),
    url("/static/hud-bg.jpg");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: scroll;
}
body.page-bg-full .lib-hero h1 {
  color: #f1f5f9;
  text-shadow: 0 1px 8px rgba(0,0,0,0.35);
}
body.page-bg-full .lib-hero .muted {
  color: #cbd5e1;
}
body.page-bg-full .flash .ok { color: #86efac; }
body.page-bg-full .flash .error { color: #fca5a5; }
body.page-bg-full .login-card {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
body.page-bg-full .lib-card {
  background: rgba(255, 255, 255, 0.94);
}
body.page-bg-full .lib-card.soon {
  background: rgba(248, 250, 252, 0.88);
}
body.page-bg-faint .filters,
body.page-bg-faint .table-wrap,
body.page-bg-faint .edit-card {
  background: rgba(255, 255, 255, 0.94);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.25rem;
  background: #0f172a;
  color: #e2e8f0;
}
.top a { color: inherit; text-decoration: none; }
.brand { font-weight: 650; letter-spacing: 0.02em; line-height: 1.25; }
.brand .company {
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  color: #94a3b8;
  margin-top: 0.15rem;
}
.company-line {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}
.user { display: flex; gap: 0.75rem; align-items: center; font-size: 0.9rem; flex-shrink: 0; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }
.login-card, .edit-card {
  max-width: 420px;
  margin: 3rem auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.edit-card { max-width: 640px; }
h1 { margin: 0 0 0.25rem; font-size: 1.35rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); }
.stack { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 1rem; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; font-weight: 600; }
input, select, textarea {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(0.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: #f1f5f9; border-color: rgba(255,255,255,0.45); }
.user .btn.ghost { color: #e2e8f0; }
.btn.small { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.inline-form { display: inline-flex; margin: 0; padding: 0; align-items: center; }
.toolbar { margin-bottom: 0.75rem; }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem;
}
.filters .grow { flex: 1 1 220px; }
.table-wrap {
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th, table.data td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.data th {
  background: #eef2f7;
  position: sticky;
  top: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
td.fn { max-width: 360px; word-break: break-word; }
.actions { white-space: nowrap; display: flex; gap: 0.3rem; flex-wrap: nowrap; align-items: center; min-width: 17.5rem; }
.flash { list-style: none; padding: 0; }
.flash .ok { color: var(--ok); }
.flash .error { color: var(--danger); }
.trade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem 0.75rem; }
.check { flex-direction: row; align-items: center; font-weight: 500; }
.check input { width: auto; }
.row-btns { display: flex; gap: 0.5rem; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem; }
legend { padding: 0 0.35rem; font-size: 0.85rem; font-weight: 600; }

.brand .version {
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: #cbd5e1;
  margin-top: 0.1rem;
}
.version-line {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--accent);
}
.lib-hero { margin-bottom: 1rem; }
.lib-hero h1 { margin-bottom: 0.35rem; }
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}
.lib-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 160px;
}
.lib-card h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}
.lib-card.active { border-color: #93c5fd; }
.lib-card.soon {
  opacity: 0.72;
  background: #f8fafc;
}
.lib-num {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #0f172a;
}
.lib-card.active .lib-num {
  background: var(--accent);
  color: #fff;
}
.lib-card .btn { margin-top: auto; align-self: flex-start; }
.badge {
  display: inline-block;
  margin: 0.35rem 0 0;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  width: fit-content;
}
.lib-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.btn.ghost.dark {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
/* AW white logo + homepage link (v9) — ~3rem logo; header company = Allied Wealth */
.brand {
  min-width: 0;
  flex: 1 1 12rem;
  max-width: calc(100% - 11rem);
}
.brand-home {
  display: flex; align-items: center; gap: 0.65rem;
  color: inherit; text-decoration: none;
  min-width: 0;
  max-width: 100%;
}
.brand-home:hover { text-decoration: none; opacity: 0.95; }
.brand-logo-white {
  width: auto; height: 3rem;
  max-height: 3rem;
  object-fit: contain; flex-shrink: 0;
  display: block;
}
.brand-text-stack {
  display: flex; flex-direction: column; line-height: 1.25;
  min-width: 0;
  flex: 1 1 auto;
}
.brand-text-stack .brand-name { font-weight: 650; letter-spacing: 0.02em; }
.brand-text-stack .version { font-size: 0.78rem; color: #94a3b8; }
.brand-text-stack .company {
  font-weight: 500;
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 0.15rem;
  white-space: nowrap; /* short label — no ellipsis */
}
.top .user { flex-wrap: wrap; flex-shrink: 0; margin-left: auto; }
.user-hello {
  flex-shrink: 0;
  font-weight: 600;
  white-space: nowrap;
  margin-right: 0.15rem;
}



/* —— Admin Storage usage —— */
.storage-card {
  max-width: 780px;
  margin: 0 auto 2rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem 1.5rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}
.storage-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}
.storage-pct-hero {
  font-size: clamp(1.45rem, 3.2vw, 1.85rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.storage-pct-green { color: #16a34a; }
.storage-pct-orange { color: #ea580c; }
.storage-pct-red { color: #dc2626; }
.storage-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.storage-level {
  flex-shrink: 0;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}
.storage-level-green { background: #dcfce7; color: #166534; }
.storage-level-orange { background: #ffedd5; color: #9a3412; }
.storage-level-red { background: #fee2e2; color: #991b1b; }
.storage-bar {
  height: 1.15rem;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}
.storage-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
  min-width: 0;
}
.storage-fill-green { background: linear-gradient(90deg, #22c55e, #16a34a); }
.storage-fill-orange { background: linear-gradient(90deg, #fb923c, #ea580c); }
.storage-fill-red { background: linear-gradient(90deg, #f87171, #dc2626); }
.storage-figures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}
.storage-fig {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
}
.storage-fig-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.storage-fig strong { font-size: 1.15rem; }
.storage-registry { margin-top: 1.15rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.storage-folders {
  display: block;
  float: none;
  clear: both;
  margin: 1rem 0 0 0;
  padding: 0 0 0 0.55rem; /* Libraries heading + table not flush to card edge */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  justify-self: stretch;
  align-self: stretch;
  text-align: left;
}
.storage-folders > .storage-kicker {
  margin-left: 0;
  padding-left: 0;
}
.storage-table-note {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: left;
}
.storage-table {
  width: 100%;
  max-width: 100%;
  margin: 0.25rem 0 0 0;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: auto;
}
.storage-table th, .storage-table td {
  text-align: left;
  padding: 0.32rem 0.55rem 0.32rem 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.storage-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
/* Slightly more space between Library name and Size (not huge) */
.storage-table td:nth-child(2),
.storage-table th:nth-child(2) {
  text-align: right;
  padding-left: 1.35rem;
  padding-right: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.storage-table td:nth-child(3),
.storage-table th:nth-child(3) {
  text-align: right;
  padding-left: 0.55rem;
  padding-right: 0;
  font-variant-numeric: tabular-nums;
}
.storage-row-meta td { color: #475569; font-weight: 600; }
.storage-actions { margin-top: 1.25rem; }
.storage-admin-link {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-start;
}
body.page-bg-full .storage-hero h1 { color: #f1f5f9; }
body.page-bg-full .storage-hero .muted { color: #cbd5e1; }
@media (max-width: 640px) {
  .storage-figures { grid-template-columns: 1fr; }
  .storage-meta { flex-wrap: wrap; }
}


/* Back link readable on dark cyber hub/management/libraries — 20261027w */
body.page-bg-full .btn.ghost,
body.page-bg-full a.btn.ghost,
body.page-bg-full .storage-admin-link .btn.ghost,
body.page-bg-full .storage-admin-link a.btn.ghost,
body.page-bg-full .wrap > .storage-admin-link > a.btn.ghost {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border-color: rgba(248,250,252,0.65) !important;
  background: rgba(15, 23, 42, 0.55) !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.55);
}
body.page-bg-full .btn.ghost:hover,
body.page-bg-full a.btn.ghost:hover,
body.page-bg-full .storage-admin-link .btn.ghost:hover,
body.page-bg-full .storage-admin-link a.btn.ghost:hover {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border-color: rgba(255,255,255,0.9) !important;
  background: rgba(15, 23, 42, 0.75) !important;
}

/* —— Admin Portal / User Overview (20261102uo1) —— */
.portal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1rem;
}
.portal-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(15, 23, 42, 0.45);
  color: #f1f5f9 !important;
  font-weight: 650;
  font-size: 0.88rem;
  text-decoration: none !important;
}
.portal-tab:hover { border-color: #fff; background: rgba(15, 23, 42, 0.7); }
.portal-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff !important;
}
body.page-bg-faint .portal-tab {
  background: #fff;
  color: var(--ink) !important;
  border-color: var(--line);
}
body.page-bg-faint .portal-tab.active {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
}
.portal-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.9rem;
}
.portal-card {
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: 0 10px 28px rgba(0,0,0,0.22);
  text-decoration: none !important;
  color: inherit;
  display: block;
}
.portal-card h2 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.portal-card:hover { border-color: #93c5fd; }
.uo-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem;
  margin-bottom: 0.85rem;
}
.uo-filters .grow { flex: 1 1 220px; }
.uo-table-wrap {
  background: rgba(255,255,255,0.96);
  box-shadow: 0 12px 36px rgba(0,0,0,0.25);
}
.uo-table { font-size: 0.86rem; }
.uo-table th { white-space: nowrap; }
.uo-row-disabled { opacity: 0.72; background: #f8fafc; }
.uo-access { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.uo-chip {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
}
.uo-chip-warn { background: #ffedd5; color: #9a3412; }
.uo-status {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.uo-status-active { background: #dcfce7; color: #166534; }
.uo-status-disabled { background: #fee2e2; color: #991b1b; }
.uo-role {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 650;
  background: #eef2ff;
  color: #3730a3;
}
.uo-role-admin { background: #dbeafe; color: #1e40af; }
.uo-role-mid { background: #e0e7ff; color: #3730a3; }
.uo-role-front { background: #fce7f3; color: #9d174d; }
.uo-role-viewer { background: #f1f5f9; color: #475569; }
.uo-role-procurement { background: #ecfdf5; color: #047857; }
.uo-mono { font-variant-numeric: tabular-nums; white-space: nowrap; }
.uo-projects { max-width: 220px; word-break: break-word; color: #334155; font-size: 0.82rem; }
.uo-projects-fieldset { margin-top: 0.75rem; }
.uo-project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
  max-height: 220px;
  overflow: auto;
  padding: 0.5rem 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}
@media (max-width: 640px) {
  .uo-project-grid { grid-template-columns: 1fr; }
}

.uo-footnote { margin-top: 0.85rem; font-size: 0.82rem; }
.uo-edit { max-width: 560px; margin: 0 auto 2rem; }
.uo-edit fieldset { margin-top: 0.35rem; }
.uo-edit .check { margin: 0.25rem 0; }
body.page-bg-full .flash {
  background: rgba(15,23,42,0.55);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  margin: 0 0 0.85rem;
}

/* uo-add-project */
.uo-edit { max-width: 640px; }
.uo-add-project {
  margin-top: 1rem;
  border-top: 2px solid #e2e8f0;
  padding-top: 1rem;
}
.uo-add-project-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: #0f172a;
}
.uo-add-project .muted { margin: 0 0 0.75rem; font-size: 0.85rem; }


/* uo-manage-projects */
.uo-manage-projects {
  margin-top: 1rem;
  border-top: 2px solid #e2e8f0;
  padding-top: 1rem;
}
.uo-manage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.uo-manage-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: #f8fafc;
}
.uo-manage-edit {
  display: grid;
  gap: 0.5rem;
}
.uo-manage-edit .row-btns { margin-top: 0.15rem; }
.uo-manage-delete { margin-top: 0.45rem; }
.uo-manage-id { margin: 0.35rem 0 0; font-size: 0.78rem; }

/* Username readonly field on Edit User */
.uo-edit input.uo-readonly,
.uo-edit input[readonly] {
  background: #f3f4f6;
  color: #374151;
  cursor: default;
  border-color: #d1d5db;
}

/* Add User hero + Director role — 20261102add1 */
.uo-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.uo-hero-text { flex: 1 1 auto; min-width: 12rem; }
.uo-add-user {
  flex: 0 0 auto;
  align-self: center;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.65rem 1.25rem;
  white-space: nowrap;
}
.uo-role-director { background: #fef3c7; color: #92400e; }

/* Circular Permanently Remove A/C (−) — far right of Actions — 20261102rm1 */
.btn-icon-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  border: 1.5px solid #b42318;
  background: #fff;
  color: #b42318;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  vertical-align: middle;
}
.btn-icon-remove:hover {
  background: #b42318;
  color: #fff;
  filter: none;
}
.btn-icon-remove:focus-visible {
  outline: 2px solid #b42318;
  outline-offset: 2px;
}

/* Keep Edit / Disable / Reset PW / − on one Actions row — 20261102rm2 */
.inline-form { display: inline-flex; margin: 0; padding: 0; align-items: center; }
.actions {
  white-space: nowrap;
  display: flex;
  gap: 0.3rem;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 17.5rem;
}
table.data td.actions {
  vertical-align: middle;
  min-width: 17.5rem;
}
.btn.small { padding: 0.22rem 0.42rem; font-size: 0.78rem; }
