:root {
  --bg0: #f8fbff;
  --bg1: #eef5ff;
  --card: rgba(255, 255, 255, 0.9);
  --border: rgba(102, 146, 195, 0.24);
  --text: #112136;
  --muted: #3f5874;
  --muted2: #687e99;
  --brand: #ef3340;
  --brand-dark: #b8101d;
  --brand2: #0085ca;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 14% 0%, rgba(0, 133, 202, 0.24), transparent 58%),
    radial-gradient(760px 460px at 90% 14%, rgba(239, 51, 64, 0.14), transparent 52%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

button,
input,
textarea {
  font: inherit;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(239, 51, 64, 0.22);
  border-radius: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--brand), #f46570);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
}

.icon-sprite {
  display: none;
}

.ui-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button.secondary,
button.ghost {
  color: var(--text);
  background: rgba(0, 133, 202, 0.1);
  border-color: rgba(0, 133, 202, 0.2);
}

button.ghost {
  background: transparent;
}

.link-button {
  padding: 0;
  border: 0;
  color: #c4101e;
  background: transparent;
  font-weight: 900;
}

.auth-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
}

.partner-shell {
  min-height: 100vh;
}

.auth-card {
  width: min(440px, calc(100% - 32px));
  margin: 12vh auto;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 46px rgba(30, 55, 90, 0.12);
}

.brand-mark,
.eyebrow {
  color: #c4101e;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 8px 0 10px;
  letter-spacing: -0.03em;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.form {
  display: grid;
  gap: 10px;
}

.split-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.split-fields label {
  display: grid;
  gap: 7px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
}

.field-help {
  margin: -4px 0 4px;
  color: var(--muted2);
  font-size: 12px;
  line-height: 1.45;
}

.portal {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.84);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
}

.side-brand span {
  display: block;
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.side-brand small {
  color: var(--muted);
  font-weight: 750;
}

.portal-nav {
  display: grid;
  align-content: start;
  gap: 6px;
  overflow: auto;
}

.portal-link {
  position: relative;
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  min-height: 48px;
  padding: 12px 16px 12px 20px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  font-size: 18px;
  font-weight: 900;
}

.portal-link::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 999px;
  background: transparent;
}

.portal-link.active {
  color: var(--text);
  background: rgba(0, 133, 202, 0.08);
  border-color: rgba(0, 133, 202, 0.14);
}

.portal-link.active::before {
  background: var(--brand);
}

.search-box {
  display: grid;
  gap: 7px;
}

.search-box span {
  color: var(--muted2);
  font-size: 12px;
  font-weight: 850;
}

.doc-project-title {
  color: #c4101e;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.side-actions {
  display: grid;
  gap: 8px;
}

.content {
  padding: 34px clamp(20px, 5vw, 72px);
}

.content-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.content-top h1 {
  font-size: clamp(32px, 5vw, 58px);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  min-height: 32px;
  white-space: nowrap;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
}

.document {
  max-width: 1180px;
  padding: 30px 0 70px;
}

.equity-section {
  margin-bottom: 28px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    radial-gradient(640px 260px at 8% 0%, rgba(0, 133, 202, 0.12), transparent 58%),
    rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 40px rgba(30, 55, 90, 0.1);
}

.equity-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.total-badge {
  white-space: nowrap;
  border: 1px solid rgba(0, 133, 202, 0.2);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(0, 133, 202, 0.08);
  font-size: 12px;
  font-weight: 850;
}

.equity-main {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 26px;
  align-items: center;
}

.equity-chart {
  position: relative;
  width: min(320px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--equity-gradient));
  box-shadow: inset 0 0 0 1px rgba(17, 33, 54, 0.08), 0 18px 36px rgba(30, 55, 90, 0.12);
}

.equity-chart::after {
  content: "";
  position: absolute;
  inset: 23%;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
}

.equity-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}

.equity-center strong {
  font-size: 34px;
  line-height: 1;
}

.equity-center span {
  margin-top: 5px;
  color: var(--muted2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.equity-legend {
  display: grid;
  gap: 6px;
}

.equity-legend-item {
  display: grid;
  grid-template-columns: 10px minmax(90px, 1fr) minmax(80px, auto) minmax(62px, auto);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(102, 146, 195, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.equity-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.equity-name {
  font-weight: 800;
}

.equity-parts,
.equity-legend-item strong {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  text-align: right;
}

.equity-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.equity-metrics div {
  display: grid;
  gap: 4px;
  padding: 13px;
  border: 1px solid rgba(102, 146, 195, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.equity-metrics span,
.equity-metrics small {
  color: var(--muted2);
  font-size: 11px;
  font-weight: 850;
}

.equity-metrics span {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.equity-metrics strong {
  font-size: 20px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 30px;
}

.overview-card,
.project-card,
.project-page-list,
.project-document {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 10px 30px rgba(30, 55, 90, 0.08);
}

.overview-card {
  padding: 18px;
}

.overview-card strong {
  display: block;
  margin-top: 8px;
  font-size: 42px;
  line-height: 1;
}

.section-block {
  margin-top: 18px;
}

.section-head,
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.project-card {
  display: grid;
  grid-template-rows: 40px 38px 150px 54px;
  gap: 14px;
  min-height: 340px;
  padding: 18px;
}

.project-card h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.12;
  display: flex;
  align-items: center;
}

.project-card p {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  height: 40px;
}

.card-foot {
  align-self: end;
  min-height: 54px;
}

.card-foot span,
.label {
  color: var(--muted2);
  font-size: 12px;
  font-weight: 850;
}

.project-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 142px;
  width: 142px;
  height: 36px;
  border: 1px solid rgba(0, 133, 202, 0.18);
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(0, 133, 202, 0.08);
  color: var(--muted2);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-status-badge {
  flex-basis: 142px;
  width: 142px;
}

.status-active {
  color: #0f7a45;
  border-color: rgba(15, 122, 69, 0.24);
  background: rgba(15, 122, 69, 0.1);
}

.status-ideation {
  color: #8a6a00;
  border-color: rgba(214, 169, 0, 0.3);
  background: rgba(255, 214, 74, 0.22);
}

.status-research {
  color: #9a4d00;
  border-color: rgba(230, 126, 34, 0.28);
  background: rgba(230, 126, 34, 0.14);
}

.status-wip {
  color: #006ea8;
  border-color: rgba(0, 133, 202, 0.28);
  background: rgba(0, 133, 202, 0.12);
}

.status-beta {
  color: #6b48b8;
  border-color: rgba(139, 116, 224, 0.3);
  background: rgba(139, 116, 224, 0.14);
}

.projects-toolbar {
  max-width: 520px;
  margin-bottom: 16px;
}

.back-button {
  margin-bottom: 16px;
}

.project-detail-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.project-page-list {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 6px;
  padding: 14px;
}

.project-page-link {
  display: grid;
  gap: 3px;
  width: 100%;
  text-align: left;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.project-page-link.active {
  color: var(--text);
  background: rgba(0, 133, 202, 0.1);
  border-color: rgba(0, 133, 202, 0.18);
}

.project-page-link.child {
  margin-left: 12px;
  width: calc(100% - 12px);
}

.project-page-link small {
  color: var(--muted2);
  font-size: 12px;
  font-weight: 650;
}

.project-document {
  padding: 22px;
}

.doc-breadcrumbs {
  color: var(--muted2);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 12px;
}

.doc-pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 42px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.document h2 {
  margin-top: 30px;
  font-size: 24px;
}

.document p,
.document li {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.document blockquote {
  margin: 18px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--brand2);
  border-radius: 8px;
  background: rgba(0, 133, 202, 0.08);
  color: var(--muted);
}

.document table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  background: rgba(255, 255, 255, 0.72);
}

.document td {
  border: 1px solid var(--border);
  padding: 10px;
  color: var(--muted);
}

.document pre {
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: #0f1b2d;
  color: #f8fbff;
}

.document figure {
  margin: 20px 0;
}

.document img {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.document figcaption {
  margin-top: 6px;
  color: var(--muted2);
  font-size: 13px;
}

.document code {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 5px;
  background: rgba(255, 255, 255, 0.72);
}

.empty-state,
.profile-panel {
  max-width: 720px;
  margin-top: 28px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.compact-form {
  max-width: 440px;
}

.profile-password-head {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.error {
  color: var(--brand-dark);
  font-weight: 750;
}

.success {
  color: #0f7a45;
}

.hidden {
  display: none !important;
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .overview-grid,
  .project-card-grid,
  .project-detail-layout,
  .equity-main,
  .equity-metrics,
  .split-fields {
    grid-template-columns: 1fr;
  }

  .project-page-list {
    position: static;
  }
}
