:root {
  --portal-bg: #f4f7fb;
  --portal-surface: #ffffff;
  --portal-ink: #132238;
  --portal-muted: #66758a;
  --portal-line: #dfe7f0;
  --portal-brand: #1677d2;
  --portal-brand-dark: #0b3d69;
  --portal-accent: #27b8ef;
  --portal-shadow: 0 12px 32px rgba(24, 54, 86, .08);
}

html { background: var(--portal-bg); }
body.portal-readable {
  background:
    radial-gradient(circle at 94% 2%, rgba(39, 184, 239, .09), transparent 25rem),
    var(--portal-bg);
  color: var(--portal-ink);
}

.sidebar {
  width: 264px;
  padding: 26px 18px 22px;
  background: linear-gradient(180deg, #071a2d 0%, #0a2944 100%);
  border-right: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 12px 0 36px rgba(7, 26, 45, .12);
  z-index: 20;
}
.brand {
  min-height: 56px;
  padding: 0 12px;
  border-radius: 14px;
}
.brand-wordmark strong { font-size: 1.15rem; letter-spacing: -.02em; }
.brand-wordmark small { letter-spacing: .14em; }
.sidebar nav { margin-top: 34px; gap: 6px; }
.sidebar nav a {
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #afc1d1;
  font-size: .82rem;
  font-weight: 650;
  line-height: 1.25;
  align-items: center;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}
.sidebar nav a > span {
  flex: 0 0 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  font-size: .9rem;
}
.sidebar nav a:hover { transform: translateX(2px); }
.sidebar nav a:hover,
.sidebar nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, .09);
  border-color: rgba(255, 255, 255, .08);
}
.sidebar nav a.active {
  border-left-color: var(--portal-accent);
  box-shadow: inset 3px 0 var(--portal-accent);
}
.sidebar-bottom { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-bottom a, .sidebar-bottom button { font-size: .78rem; }

main { margin-left: 264px; padding: 0 38px 64px; max-width: 1700px; }
main > header {
  height: auto;
  min-height: 104px;
  padding: 24px 2px 20px;
  border-bottom: 1px solid rgba(191, 205, 220, .55);
  margin-bottom: 24px;
}
header p, .panel-head p, .modal-head p {
  font-size: .72rem;
  letter-spacing: .13em;
}
header h1 { font-size: clamp(1.55rem, 2vw, 2rem); letter-spacing: -.035em; }

.account-banner {
  padding: 28px 30px;
  border-radius: 18px;
  background:
    linear-gradient(115deg, rgba(255,255,255,.05), transparent 45%),
    linear-gradient(120deg, #0a2b48, #0d5d98);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 18px 42px rgba(10, 43, 72, .16);
}
.account-banner .tier { display: none; }
.account-banner h2 { font-size: 1.35rem; letter-spacing: -.02em; }
.account-banner p, .credit span, .credit small { font-size: .78rem; }
.tier { border-radius: 999px; padding: 6px 10px; }
.credit { min-width: 170px; }
.credit strong { font-size: 2.4rem; line-height: 1; }

.stats { gap: 16px; margin: 22px 0; }
.stats article,
.panel {
  border: 1px solid rgba(210, 221, 232, .9);
  border-radius: 16px;
  box-shadow: var(--portal-shadow);
}
.stats article { min-height: 112px; padding: 22px; }
.stat-icon { width: 44px; height: 44px; border-radius: 13px; font-size: 1.05rem; }
.stats p { font-size: .69rem; letter-spacing: .09em; }
.stats strong { font-size: 1.65rem; line-height: 1.25; }
.stats small { font-size: .74rem; }

.panel { overflow: hidden; background: rgba(255, 255, 255, .96); }
.panel-head { padding: 24px 26px; gap: 18px; }
.panel-head h2 { font-size: 1.2rem; letter-spacing: -.02em; }
.panel-head small { color: var(--portal-muted); line-height: 1.5; }
.tools { flex-wrap: wrap; justify-content: flex-end; }
.tools input, .tools select {
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 10px;
  border-color: #d7e1eb;
  background: #f9fbfd;
  font-size: .82rem;
  color: var(--portal-ink);
}
.tools input { width: min(260px, 100%); }
.tools input:focus, .tools select:focus,
.form-grid input:focus, .form-grid textarea:focus {
  outline: 3px solid rgba(22, 119, 210, .15);
  border-color: var(--portal-brand);
}

.primary, .secondary {
  min-height: 42px;
  padding: 11px 17px;
  border-radius: 10px;
  font-size: .78rem;
  letter-spacing: .01em;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.primary { background: linear-gradient(135deg, #126dc2, #1693df); box-shadow: 0 8px 18px rgba(22, 119, 210, .2); }
.secondary { border: 1px solid #d8e2ec; background: #f7f9fc; }
.primary:hover, .secondary:hover { transform: translateY(-1px); }

table { min-width: 900px; }
th { padding: 14px 22px; font-size: .68rem; background: #f5f8fb; }
td { padding: 18px 22px; font-size: .82rem; }
td strong { font-size: .88rem; }
td small { font-size: .75rem; }
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: #f8fbfe; }
.status { padding: 7px 10px; font-size: .69rem; }
.view-btn { min-height: 36px; padding: 7px 8px; border-radius: 8px; font-size: .76rem; }
.view-btn:hover { background: #edf6fd; }

.industry-news-grid { gap: 16px; }
.industry-news-card { border-radius: 14px; }
.portal-app-page { border-radius: 18px; }

dialog { border-radius: 18px; box-shadow: 0 30px 100px rgba(5, 21, 37, .4); }
dialog::backdrop { background: rgba(5, 21, 37, .7); backdrop-filter: blur(4px); }
.modal-head { padding: 24px 28px; }
.close { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; }
.close:hover { background: #edf2f7; }
.form-grid label, .form-grid legend { font-size: .74rem; }
.form-grid input:not([type=checkbox]), .form-grid textarea {
  min-height: 44px;
  border-radius: 10px;
  font-size: .84rem;
}
.modal-actions { padding: 18px 28px; }

@media (max-width: 1100px) {
  .sidebar { width: 226px; }
  main { margin-left: 226px; padding-inline: 24px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body.portal-readable { padding-top: 0; }
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    padding: 10px 14px 8px;
    display: block;
    overflow: hidden;
  }
  .brand { min-height: 44px; padding: 0 6px; }
  .sidebar nav {
    display: flex;
    flex-direction: row;
    gap: 6px;
    margin-top: 7px;
    overflow-x: auto;
    padding: 0 0 5px;
    scrollbar-width: thin;
  }
  .sidebar nav a {
    flex: 0 0 auto;
    min-height: 39px;
    padding: 8px 11px;
    font-size: .76rem;
    white-space: nowrap;
  }
  .sidebar nav a > span { display: none; }
  .sidebar-bottom { display: none; }
  main { margin: 0; padding: 0 14px 42px; }
  main > header { min-height: 86px; margin-bottom: 16px; padding: 18px 2px 14px; }
  .account-banner { padding: 22px; }
  .panel-head { align-items: stretch; }
  .tools { justify-content: stretch; }
  .tools input, .tools select, .tools .primary { flex: 1 1 100%; width: 100%; }
}

@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .stats article { min-height: 96px; }
  .account-banner { display: grid; gap: 18px; }
  .account-banner .credit { margin: 0; padding: 18px 0 0; border-left: 0; border-top: 1px solid rgba(255,255,255,.18); }
  .panel-head, .modal-head, .form-grid, .modal-actions { padding-inline: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Project card dashboard */
.portal-projects .table-wrap { padding: 20px 24px 26px; background: #f3f7fb; }
.portal-projects table,
.portal-projects tbody { display: block; min-width: 0; width: 100%; }
.portal-projects thead { display: none; }
.portal-projects tbody {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.portal-projects tbody tr {
  min-width: 0;
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "project status"
    "manuals due"
    "notes notes"
    "actions actions";
  gap: 17px 20px;
  border: 1px solid #dce6ef;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(25, 55, 84, .06);
}
.portal-projects tbody tr:hover {
  border-color: #b9d5e9;
  box-shadow: 0 14px 30px rgba(25, 74, 113, .11);
  transform: translateY(-2px);
}
.portal-projects tbody td {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent !important;
}
.portal-projects tbody td:nth-child(1) { grid-area: project; }
.portal-projects tbody td:nth-child(2) { grid-area: manuals; align-self: center; }
.portal-projects tbody td:nth-child(3) { grid-area: status; text-align: right; }
.portal-projects tbody td:nth-child(4) { grid-area: notes; }
.portal-projects tbody td:nth-child(5) { grid-area: due; align-self: center; }
.portal-projects tbody td:nth-child(6) {
  grid-area: actions;
  padding-top: 16px;
  border-top: 1px solid #e8eef4;
}
.portal-projects tbody td:first-child strong { font-size: 1.08rem; line-height: 1.3; }
.portal-projects tbody td:first-child small { display: block; margin-top: 6px; font-size: .78rem; }
.portal-projects tbody td:nth-child(2)::before,
.portal-projects tbody td:nth-child(4)::before,
.portal-projects tbody td:nth-child(5)::before {
  display: block;
  margin-bottom: 7px;
  color: #718397;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .1em;
}
.portal-projects tbody td:nth-child(2)::before { content: "MANUALS"; }
.portal-projects tbody td:nth-child(4)::before { content: "PROJECT NOTES"; }
.portal-projects tbody td:nth-child(5)::before { content: "DUE DATE"; }
.portal-projects .project-actions .intake-btn,
.portal-projects .project-actions .project-files-btn {
  border: 1px solid #071a2d;
  background: #071a2d;
  color: #fff;
  box-shadow: 0 6px 14px rgba(7, 26, 45, .16);
}
.portal-projects .project-actions .intake-btn:hover,
.portal-projects .project-actions .project-files-btn:hover {
  background: #0c3152;
  border-color: #0c3152;
}
.portal-projects .project-notes-button,
.portal-projects .project-due-date-input {
  border: 1px solid #071a2d;
  background: #071a2d;
  color: #fff;
  box-shadow: 0 6px 14px rgba(7, 26, 45, .14);
}
.portal-projects .project-notes-button:hover,
.portal-projects .project-due-date-input:hover {
  background: #0c3152;
  border-color: #0c3152;
}
.portal-projects .project-due-date-input::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: .9;
}
.portal-projects #new-project {
  border: 1px solid #071a2d;
  background: #071a2d;
  color: #fff;
  box-shadow: 0 6px 14px rgba(7, 26, 45, .16);
}
.portal-projects #new-project:hover {
  background: #0c3152;
  border-color: #0c3152;
}
.portal-projects .manual-tags i { width: 30px; height: 30px; border-radius: 8px; }
.portal-projects .project-notes-button { min-width: 48px; min-height: 36px; border-radius: 9px; }
.portal-projects .project-due-date-input { min-height: 40px; border-radius: 9px; }
.portal-projects .project-actions { justify-content: flex-start; flex-wrap: wrap; }
.portal-projects .project-actions .intake-btn { flex: 1 1 150px; min-height: 42px; border-radius: 10px; }
.portal-projects .project-actions .project-files-btn { flex: 1 1 120px; min-height: 42px; border-radius: 10px; }
.portal-projects tbody tr:has(.empty-project-board) { display: block; grid-column: 1 / -1; }

@media (max-width: 980px) {
  .portal-projects tbody { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .portal-projects .table-wrap { padding: 14px; }
  .portal-projects tbody tr { padding: 18px; grid-template-columns: 1fr; grid-template-areas: "project" "status" "manuals" "due" "notes" "actions"; }
  .portal-projects tbody td:nth-child(3) { text-align: left; }
}

/* Release 81: compact project list replaces the large card grid. */
.portal-projects tbody { grid-template-columns: 1fr; gap: 11px; }
.portal-projects tbody tr {
  padding: 18px 20px;
  grid-template-columns: minmax(230px, 1.5fr) auto auto auto auto minmax(260px, 1fr);
  grid-template-areas: "project status manuals due notes actions";
  align-items: center;
  gap: 16px;
  border-radius: 13px;
}
.portal-projects tbody td:nth-child(2)::before,
.portal-projects tbody td:nth-child(4)::before,
.portal-projects tbody td:nth-child(5)::before { display: none; }
.portal-projects tbody td:nth-child(3) { text-align: left; }
.portal-projects tbody td:nth-child(6) {
  padding: 0 0 0 16px;
  border-top: 0;
  border-left: 1px solid #e8eef4;
}
.portal-projects .project-actions { justify-content: flex-end; flex-wrap: nowrap; }
.portal-projects .project-actions .intake-btn,
.portal-projects .project-actions .project-files-btn { flex: 0 0 auto; }

@media (max-width: 1180px) {
  .portal-projects tbody tr {
    grid-template-columns: minmax(220px, 1fr) auto auto auto;
    grid-template-areas: "project status manuals due" "notes actions actions actions";
  }
  .portal-projects tbody td:nth-child(6) { padding: 12px 0 0; border-left: 0; border-top: 1px solid #e8eef4; }
}

@media (max-width: 680px) {
  .portal-projects tbody tr {
    grid-template-columns: 1fr auto;
    grid-template-areas: "project status" "manuals due" "notes notes" "actions actions";
  }
  .portal-projects tbody td:nth-child(2)::before,
  .portal-projects tbody td:nth-child(4)::before,
  .portal-projects tbody td:nth-child(5)::before { display: block; }
  .portal-projects .project-actions { justify-content: stretch; flex-wrap: wrap; }
  .portal-projects .project-actions .intake-btn,
  .portal-projects .project-actions .project-files-btn { flex: 1 1 120px; }
}

/* Keep compact project values clearly labeled. */
.portal-projects tbody td:nth-child(2)::before,
.portal-projects tbody td:nth-child(3)::before,
.portal-projects tbody td:nth-child(4)::before,
.portal-projects tbody td:nth-child(5)::before {
  display: block;
  margin-bottom: 6px;
  color: #718397;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .1em;
  line-height: 1;
}
.portal-projects tbody td:nth-child(2)::before { content: "MANUAL"; }
.portal-projects tbody td:nth-child(3)::before { content: "STATUS"; }
.portal-projects tbody td:nth-child(4)::before { content: "NOTES"; }
.portal-projects tbody td:nth-child(5)::before { content: "DUE DATE"; }

/* Release 72: a visibly different, top-navigation workspace. */
body.portal-readable { min-height: 100vh; }
.sidebar {
  position: sticky;
  inset: 0 0 auto;
  width: 100%;
  min-height: 78px;
  padding: 10px max(24px, calc((100vw - 1440px) / 2));
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 24px;
  background: #071a2d;
  backdrop-filter: none;
  box-shadow: 0 8px 28px rgba(7, 26, 45, .15);
}
.sidebar .brand {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
}
.sidebar .brand::after {
  content: "WORKSPACE";
  color: #71808d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  line-height: 1;
}
.sidebar nav {
  min-width: 0;
  margin: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.sidebar nav::before { display: none; }
.sidebar nav::-webkit-scrollbar { display: none; }
.sidebar nav a {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 9px 11px;
  white-space: nowrap;
  font-size: .75rem;
}
.sidebar nav a > span { display: none; }
.sidebar nav a:hover { transform: translateY(-1px); }
.sidebar nav a.active {
  border: 1px solid rgba(79, 196, 243, .28);
  box-shadow: none;
  background: linear-gradient(135deg, rgba(39, 184, 239, .2), rgba(22, 119, 210, .2));
}
.sidebar-bottom {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 0 0 18px;
  border-top: 0;
  border-left: 1px solid rgba(255,255,255,.1);
}
.sidebar-bottom a { white-space: nowrap; }

main {
  width: min(1440px, 100%);
  max-width: none;
  margin: 0 auto;
  padding: 0 32px 72px;
}
main > header {
  display: none;
  position: relative;
  top: auto;
  z-index: auto;
  min-height: 0;
  margin: 0;
  padding: 18px 4px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

main > .account-banner { margin-top: 20px; }
header h1 { font-size: clamp(1.55rem, 2.3vw, 2.15rem); }

.account-banner {
  min-height: 116px;
  padding: 22px 28px;
  border-radius: 20px;
  background: #071a2d;
}
.account-banner h2 { margin-top: 8px; }
.credit { min-width: 220px; padding-right: 0; }

.portal-projects.panel {
  margin-top: 12px;
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(22, 52, 82, .1);
}
.portal-projects .panel-head {
  min-height: 108px;
  padding: 24px 28px;
  background: linear-gradient(180deg, #fff, #fbfdff);
}
.portal-projects .panel-head h2 { font-size: 1.35rem; }
.portal-projects .table-wrap { padding: 0 18px 18px; }
.portal-projects table {
  overflow: hidden;
  border: 1px solid #e1e9f1;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 14px;
}
.portal-projects th { padding-block: 16px; background: #eef4f8; }
.portal-projects td { padding-block: 20px; background: #fff; }
.portal-projects tbody tr:hover td { background: #f7fbff; }

@media (max-width: 1180px) {
  .sidebar { gap: 14px; padding-inline: 18px; }
  .sidebar-bottom { display: none; }
  .sidebar nav a { padding-inline: 9px; }
}

@media (max-width: 760px) {
  .sidebar { position: sticky; display: grid; grid-template-columns: 1fr; gap: 4px; padding: 9px 14px 7px; }
  .sidebar .brand { min-height: 38px; }
  .sidebar nav { width: 100%; margin: 0; }
  .sidebar nav a { min-height: 36px; }
  main { padding-inline: 14px; }
  main > header { min-height: 102px; padding-block: 24px 18px; }
  main > header { min-height: 0; padding-block: 14px 8px; }
  main > .account-banner { margin-top: 14px; }
  .account-banner { min-height: 0; }
  .portal-projects .panel-head { min-height: 0; }
  .portal-projects .table-wrap { padding-inline: 10px; }
}
