:root {
  --ink: #11130f;
  --ink-soft: #373b33;
  --muted: #717568;
  --line: #dedbd0;
  --paper: #f7f4eb;
  --panel: #fffdf7;
  --wash: #ebe5d6;
  --gold: #b9904b;
  --gold-deep: #806227;
  --green: #356b54;
  --red: #a0453b;
  --blue: #375f86;
  --shadow: 0 24px 70px rgba(31, 28, 20, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body[data-auth="signed-out"] .portal-app,
body[data-auth="signed-in"] .portal-entry {
  display: none;
}

body[data-role="client"] [data-admin-only] {
  display: none !important;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
  background:
    radial-gradient(circle at 82% 4%, rgba(185, 144, 75, 0.16), transparent 28%),
    linear-gradient(180deg, #f8f5ed 0%, #ece6d7 100%);
}

.portal-entry {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(340px, 0.42fr);
  gap: 28px;
  align-items: center;
  min-height: 100vh;
  padding: clamp(22px, 5vw, 72px);
  background: #030303;
  color: var(--panel);
  perspective: 1600px;
}

.portal-entry::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 68% 45%, rgba(185, 144, 75, 0.14), transparent 33%),
    linear-gradient(90deg, rgba(3, 3, 3, 0.9), rgba(3, 3, 3, 0.52) 48%, rgba(3, 3, 3, 0.9));
  pointer-events: none;
}

.emblem-backdrop {
  position: absolute;
  inset: -8vh -8vw;
  z-index: 0;
  display: grid;
  place-items: center;
}

.emblem-backdrop::before,
.emblem-backdrop::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.emblem-backdrop::before {
  width: min(98vmin, 980px);
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(230, 194, 126, 0.16), transparent 62%);
  filter: blur(20px);
}

.emblem-backdrop::after {
  width: min(72vmin, 720px);
  height: min(10vmin, 96px);
  transform: translateY(42vmin) rotateX(78deg);
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.72), transparent 68%);
  filter: blur(16px);
}

.coin-canvas {
  width: min(118vmin, 1120px);
  height: min(118vmin, 1120px);
  opacity: 0.92;
  filter:
    drop-shadow(0 0 30px rgba(185, 144, 75, 0.22))
    drop-shadow(0 48px 64px rgba(0, 0, 0, 0.62));
}

.entry-copy {
  position: relative;
  z-index: 2;
  max-width: 760px;
}

.entry-brand {
  display: inline-flex;
  margin-bottom: 54px;
}

.entry-brand img {
  width: min(88px, 26vw);
  height: auto;
  filter: drop-shadow(0 14px 34px rgba(230, 194, 126, 0.2));
}

.entry-copy h1 {
  max-width: 740px;
  margin: 12px 0 0;
  color: rgba(255, 253, 247, 0.96);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 6.8vw, 5.9rem);
  font-weight: 500;
  line-height: 0.98;
  text-wrap: balance;
}

.entry-copy h1::after {
  content: "";
  display: block;
  width: min(180px, 42vw);
  height: 1px;
  margin-top: 28px;
  background: linear-gradient(90deg, rgba(230, 194, 126, 0.95), rgba(230, 194, 126, 0));
}

.entry-copy > p:not(.eyebrow) {
  max-width: 520px;
  margin: 24px 0 0;
  color: rgba(255, 253, 247, 0.72);
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  line-height: 1.75;
}

.login-card {
  border: 1px solid rgba(230, 194, 126, 0.22);
  border-radius: 8px;
  background: rgba(6, 6, 6, 0.34);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(18px);
}

.module-constellation {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  max-width: 520px;
  margin-top: 34px;
}

.module-constellation span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(230, 194, 126, 0.34);
  border-radius: 999px;
  background: rgba(5, 5, 5, 0.3);
  color: rgba(255, 253, 247, 0.78);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-note {
  margin: 8px 0 0;
  color: rgba(255, 253, 247, 0.58);
  font-size: 0.9rem;
  line-height: 1.45;
}

.login-card {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 13px;
  padding: 24px;
  align-self: center;
}

.login-card h2 {
  margin: 0;
  color: rgba(255, 253, 247, 0.94);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 500;
}

.login-intro {
  margin: -4px 0 4px;
  color: rgba(255, 253, 247, 0.66);
  line-height: 1.45;
}

.login-card label {
  display: grid;
  gap: 6px;
  color: rgba(255, 253, 247, 0.82);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-card input[type="email"],
.login-card input[type="password"] {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid rgba(255, 253, 247, 0.18);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.08);
  color: var(--panel);
}

.login-card input[type="email"]:focus,
.login-card input[type="password"]:focus {
  border-color: rgba(230, 194, 126, 0.7);
  box-shadow: 0 0 0 3px rgba(185, 144, 75, 0.18);
  outline: none;
}

.login-error {
  display: none;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(160, 69, 59, 0.48);
  border-radius: 8px;
  background: rgba(160, 69, 59, 0.12);
  color: #ffd8d3;
  font-size: 0.78rem;
  line-height: 1.4;
}

.login-error.is-visible {
  display: block;
}

.entry-legal {
  position: absolute;
  left: clamp(22px, 5vw, 72px);
  right: clamp(22px, 5vw, 72px);
  bottom: 18px;
  z-index: 2;
  max-width: 980px;
  color: rgba(255, 253, 247, 0.42);
  font-size: 0.62rem;
  line-height: 1.45;
}

.forgot-link {
  justify-self: start;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(230, 194, 126, 0.88);
  font-size: 0.84rem;
  font-weight: 800;
}

.forgot-link:hover {
  color: #fff3c8;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.login-card fieldset {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.login-card legend {
  grid-column: 1 / -1;
  margin-bottom: 4px;
  color: rgba(255, 253, 247, 0.82);
  font-weight: 800;
}

.radio-row {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(255, 253, 247, 0.16);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.07);
}

@keyframes emblemTurn {
  0% {
    transform: rotateX(12deg) rotateY(0deg) rotateZ(-2deg);
  }

  50% {
    transform: rotateX(12deg) rotateY(180deg) rotateZ(-2deg);
  }

  100% {
    transform: rotateX(12deg) rotateY(360deg) rotateZ(-2deg);
  }
}

@keyframes coinLightSweep {
  0%,
  100% {
    opacity: 0.24;
    transform: translateZ(calc(var(--coin-depth) * 0.96)) rotateZ(-18deg);
  }

  45% {
    opacity: 0.62;
    transform: translateZ(calc(var(--coin-depth) * 0.96)) rotateZ(10deg);
  }
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 20px;
  background: #151712;
  color: #f7f4eb;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

.brand img {
  display: block;
  width: min(72px, 48%);
  height: auto;
  filter: drop-shadow(0 12px 30px rgba(230, 194, 126, 0.14));
}

.nav-stack {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(247, 244, 235, 0.72);
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 253, 247, 0.08);
  border-color: rgba(255, 253, 247, 0.16);
  color: #fffdf7;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(185, 144, 75, 0.18);
  color: #e6c27e;
  font-size: 0.7rem;
  font-weight: 800;
}

.sidebar-card {
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(255, 253, 247, 0.14);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.07);
}

.sidebar-card strong {
  display: block;
  margin-top: 8px;
}

.sidebar-card p {
  margin: 8px 0 0;
  color: rgba(247, 244, 235, 0.68);
  font-size: 0.9rem;
  line-height: 1.45;
}

.portal-main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid rgba(222, 219, 208, 0.75);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.72);
  box-shadow: 0 18px 48px rgba(31, 28, 20, 0.08);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0;
  color: var(--gold-deep);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar h1,
.hero-copy h2,
.section-heading h2 {
  margin: 4px 0 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.7rem, 4vw, 2.65rem);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-field input {
  width: min(36vw, 360px);
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

.search-field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(185, 144, 75, 0.16);
}

.primary-action,
.secondary-action,
.icon-button,
.segmented-control button,
.role-switch button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 15px;
  font-weight: 800;
}

.primary-action {
  background: var(--ink);
  color: var(--panel);
}

.secondary-action {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.role-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.role-switch button {
  min-height: 34px;
  background: transparent;
  color: var(--ink-soft);
}

.role-switch button.is-active {
  background: var(--gold);
  color: #151712;
}

.hero-panel {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 39%);
  align-items: stretch;
  gap: 18px;
  margin-bottom: 18px;
}

.view {
  display: none;
}

.view.is-active {
  display: grid;
}

.hero-copy,
.work-panel,
.metric-card,
.table-wrap,
.client-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 360px;
  padding: clamp(26px, 4vw, 54px);
  background:
    linear-gradient(135deg, rgba(255, 253, 247, 0.96), rgba(241, 235, 220, 0.92)),
    radial-gradient(circle at 90% 10%, rgba(185, 144, 75, 0.22), transparent 30%);
}

.hero-copy h2 {
  max-width: 720px;
  font-size: clamp(2.2rem, 6vw, 4.7rem);
  line-height: 0.98;
}

.hero-copy p:not(.eyebrow) {
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.hero-media {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  border-radius: 8px;
  background: #20231c;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-overlay {
  position: absolute;
  right: 18px;
  bottom: 18px;
  min-width: 150px;
  padding: 16px;
  border: 1px solid rgba(255, 253, 247, 0.26);
  border-radius: 8px;
  background: rgba(17, 19, 15, 0.82);
  color: var(--panel);
}

.media-overlay span {
  display: block;
  color: rgba(255, 253, 247, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
}

.media-overlay strong {
  display: block;
  margin-top: 4px;
  font-size: 2rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: rgba(185, 144, 75, 0.12);
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0;
  font-size: 2rem;
}

.launch-strip,
.module-summary,
.document-toolbar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.82);
  box-shadow: 0 18px 48px rgba(31, 28, 20, 0.08);
}

.launch-strip {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(180px, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 16px;
}

.launch-strip.view:not(.is-active) {
  display: none;
}

.launch-strip strong,
.launch-strip span {
  display: block;
}

.launch-strip strong {
  margin-top: 5px;
  font-size: 1.05rem;
}

.launch-strip span {
  margin-top: 4px;
  color: var(--muted);
}

.launch-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--wash);
}

.launch-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--green));
}

.module-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
}

.module-summary article {
  padding: 16px;
  background: rgba(255, 253, 247, 0.78);
}

.module-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.module-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 1.55rem;
}

.content-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
}

.work-panel {
  min-width: 0;
  padding: 20px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-heading {
  margin-top: 8px;
}

.icon-button {
  width: 42px;
  padding: 0;
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.timeline,
.approval-list,
.project-board,
.document-grid,
.crm-list {
  display: grid;
  gap: 12px;
}

.timeline-item,
.approval-item,
.project-card,
.document-card,
.crm-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8ef;
}

.timeline-item {
  display: grid;
  grid-template-columns: 94px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  transition: transform 160ms ease, border-color 160ms ease;
}

.timeline-item:hover,
.project-card:hover,
.document-card:hover,
.crm-card:hover {
  border-color: rgba(185, 144, 75, 0.48);
  transform: translateY(-1px);
}

.timeline-item time,
.approval-item small,
.project-meta,
.document-card small,
.crm-card small,
.card-topline small,
.progress-label {
  color: var(--muted);
}

.timeline-item h3,
.approval-item h3,
.project-card h3,
.document-card h3,
.crm-card h3 {
  margin: 0;
  font-size: 1rem;
}

.timeline-item p,
.approval-item p,
.project-card p,
.client-detail p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(53, 107, 84, 0.13);
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status.risk {
  background: rgba(160, 69, 59, 0.12);
  color: var(--red);
}

.status.review {
  background: rgba(55, 95, 134, 0.13);
  color: var(--blue);
}

.approval-item {
  padding: 14px;
}

.project-board {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card,
.document-card,
.crm-card {
  padding: 16px;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.project-card:hover,
.document-card:hover,
.crm-card:hover {
  box-shadow: 0 18px 48px rgba(31, 28, 20, 0.1);
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.85rem;
}

.project-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.72);
}

.next-action {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(235, 229, 214, 0.62);
}

.next-action span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.next-action strong {
  display: block;
  margin-top: 4px;
  font-size: 0.94rem;
}

.progress-bar {
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--wash);
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.82rem;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.segmented-control button {
  min-height: 34px;
  background: transparent;
  color: var(--ink-soft);
}

.segmented-control button.is-active {
  background: var(--ink);
  color: var(--panel);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 4px;
  color: var(--muted);
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--gold-deep);
  font-weight: 900;
}

.document-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 10px;
}

.document-toolbar button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 800;
}

.document-toolbar button.is-active,
.document-toolbar button:hover {
  border-color: var(--line);
  background: #151712;
  color: var(--panel);
}

.document-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.doc-type {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #151712;
  color: var(--panel);
  font-weight: 900;
  font-size: 0.75rem;
}

.document-card h3 {
  min-height: 48px;
}

.document-card .text-button {
  margin-top: 16px;
  padding: 0;
}

.crm-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.34fr) minmax(0, 1fr);
  gap: 18px;
}

.admin-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-top: 8px;
  margin-bottom: 18px;
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid rgba(17, 19, 15, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(21, 23, 18, 0.96), rgba(49, 45, 34, 0.94)),
    radial-gradient(circle at 82% 18%, rgba(185, 144, 75, 0.28), transparent 32%);
  color: var(--panel);
  box-shadow: 0 24px 70px rgba(31, 28, 20, 0.16);
}

.admin-hero .eyebrow {
  color: #e6c27e;
}

.admin-hero h2 {
  max-width: 720px;
  margin: 6px 0 0;
  color: var(--panel);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.55rem);
  font-weight: 500;
  line-height: 1;
  text-wrap: balance;
}

.admin-hero p:not(.eyebrow) {
  max-width: 650px;
  margin: 14px 0 0;
  color: rgba(255, 253, 247, 0.7);
  font-size: 1rem;
  line-height: 1.65;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.admin-hero .secondary-action {
  border-color: rgba(255, 253, 247, 0.22);
  color: var(--panel);
}

.admin-hero .primary-action {
  background: #e6c27e;
  color: #151712;
}

.crm-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.crm-kpis article {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.82);
  box-shadow: 0 16px 38px rgba(31, 28, 20, 0.07);
}

.crm-kpis span,
.crm-kpis small,
.client-workstream span,
.admin-action-card span {
  display: block;
  color: #777a70;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.crm-kpis strong {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
  font-weight: 500;
}

.crm-kpis small {
  margin-top: 5px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.crm-command {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.76);
  box-shadow: 0 16px 38px rgba(31, 28, 20, 0.06);
}

.crm-search {
  flex: 1;
}

.crm-search input {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fbf8ef;
  color: var(--ink);
  outline: none;
}

.crm-search input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(185, 144, 75, 0.14);
}

.crm-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  background:
    linear-gradient(180deg, #fffdf7, #f8f3e7);
}

.crm-card.is-active {
  outline: 3px solid rgba(185, 144, 75, 0.22);
  border-color: var(--gold);
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(242, 231, 204, 0.96));
}

.crm-card-top,
.crm-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.crm-card-top {
  margin-bottom: 12px;
}

.crm-card-top .status {
  min-height: 22px;
  padding: 0 8px;
  font-size: 0.58rem;
}

.crm-card p {
  margin-bottom: 14px;
}

.crm-card-meta {
  padding-top: 12px;
  border-top: 1px solid rgba(17, 19, 15, 0.08);
  color: #777a70;
  font-size: 0.78rem;
  font-weight: 800;
}

.client-detail {
  position: relative;
  overflow: hidden;
  padding: clamp(22px, 3vw, 32px);
}

.client-detail::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--gold), var(--green), rgba(55, 95, 134, 0.82));
}

.client-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.client-detail-head h2 {
  margin-top: 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.detail-stat {
  grid-column: span 2;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8ef;
}

.detail-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.detail-stat strong {
  display: block;
  margin-top: 5px;
  font-size: 1.1rem;
}

.client-workstream {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.client-workstream div {
  padding: 16px;
  border: 1px solid rgba(185, 144, 75, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(235, 229, 214, 0.72), rgba(255, 253, 247, 0.82));
}

.client-workstream strong {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.35;
}

.relationship-notes {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8ef;
}

.relationship-notes h3 {
  margin: 0;
  font-size: 1rem;
}

.admin-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.admin-action-card {
  min-height: 102px;
  padding: 15px;
  border: 1px solid rgba(17, 19, 15, 0.1);
  border-radius: 8px;
  background: #151712;
  color: var(--panel);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.admin-action-card:hover {
  border-color: rgba(230, 194, 126, 0.42);
  box-shadow: 0 18px 42px rgba(31, 28, 20, 0.16);
  transform: translateY(-1px);
}

.admin-action-card span {
  color: rgba(230, 194, 126, 0.78);
}

.admin-action-card strong {
  display: block;
  margin-top: 8px;
  color: var(--panel);
  font-size: 0.95rem;
  line-height: 1.32;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid rgba(255, 253, 247, 0.2);
  border-radius: 8px;
  background: #151712;
  color: var(--panel);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.portal-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-top: 28px;
  padding: 18px 0 4px;
  border-top: 1px solid rgba(17, 19, 15, 0.12);
  color: #777a70;
  font-size: 0.66rem;
  line-height: 1.45;
}

.portal-footer p {
  max-width: 860px;
  margin: 0;
}

.portal-footer div {
  display: grid;
  gap: 4px;
  min-width: 210px;
  text-align: right;
  text-transform: uppercase;
}

.portal-footer span:first-child {
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.portal-footer span:last-child {
  letter-spacing: 0.06em;
}

.portal-app .eyebrow,
.portal-app th,
.portal-app .status,
.portal-app .nav-item,
.portal-app .text-button,
.portal-app .document-toolbar button,
.portal-app .primary-action,
.portal-app .secondary-action {
  letter-spacing: 0.06em;
}

.portal-app .eyebrow {
  color: #8f6b29;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
}

.portal-app .topbar h1,
.portal-app .section-heading h2,
.portal-app .hero-copy h2,
.portal-app .client-detail h2 {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

.portal-app .topbar h1 {
  font-size: clamp(1.55rem, 3.2vw, 2.2rem);
  line-height: 1.05;
}

.portal-app .section-heading h2 {
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  line-height: 1.15;
}

.portal-app .hero-copy h2 {
  max-width: 780px;
  font-size: clamp(2.15rem, 5.2vw, 4.15rem);
  line-height: 1.02;
  text-wrap: balance;
}

.portal-app .hero-copy p:not(.eyebrow),
.portal-app .timeline-item p,
.portal-app .approval-item p,
.portal-app .project-card p,
.portal-app .client-detail p,
.portal-app td,
.portal-app .launch-strip span {
  color: #4c5147;
  font-size: 0.96rem;
  line-height: 1.58;
}

.portal-app .nav-item {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-app .metric-card span,
.portal-app .metric-card small,
.portal-app .module-summary span,
.portal-app .detail-stat span,
.portal-app .next-action span,
.portal-app .project-meta,
.portal-app .document-card small,
.portal-app .crm-card small,
.portal-app .card-topline small,
.portal-app .progress-label,
.portal-app td small {
  color: #777a70;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
}

.portal-app .metric-card strong,
.portal-app .module-summary strong,
.portal-app .detail-stat strong,
.portal-app .launch-strip strong {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

.portal-app .metric-card strong {
  font-size: 1.85rem;
}

.portal-app .timeline-item h3,
.portal-app .approval-item h3,
.portal-app .project-card h3,
.portal-app .document-card h3,
.portal-app .crm-card h3,
.portal-app .relationship-notes h3,
.portal-app td strong {
  color: #171913;
  font-size: 0.98rem;
  font-weight: 760;
  line-height: 1.28;
}

.portal-app .status {
  min-height: 26px;
  font-size: 0.66rem;
  font-weight: 900;
}

.portal-app th {
  color: #777a70;
  font-size: 0.7rem;
  font-weight: 900;
}

.portal-app .text-button {
  font-size: 0.76rem;
  text-transform: uppercase;
}

.portal-app .search-field input {
  font-size: 0.92rem;
}

.portal-app .primary-action,
.portal-app .secondary-action,
.portal-app .segmented-control button,
.portal-app .role-switch button,
.portal-app .document-toolbar button {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

  .emblem-backdrop {
    opacity: 0.58;
  }

  .emblem-rotor {
    width: min(126vmin, 820px);
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-stack {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    font-size: 0.84rem;
  }

  .sidebar-card {
    display: none;
  }

  .hero-panel,
  .content-grid,
  .crm-layout {
    grid-template-columns: 1fr;
  }

  .metrics-grid,
  .document-grid,
  .crm-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-actions {
    justify-content: flex-start;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-stat {
    grid-column: span 1;
  }
}

@media (max-width: 720px) {
  .portal-entry {
    padding: 18px 18px 96px;
  }

  .entry-legal {
    left: 18px;
    right: 18px;
    bottom: 16px;
    font-size: 0.6rem;
  }

  .login-card fieldset {
    grid-template-columns: 1fr;
  }

  .module-constellation span {
    min-height: 36px;
    font-size: 0.74rem;
  }

  .portal-main {
    padding: 14px;
  }

  .sidebar {
    gap: 14px;
    padding: 14px;
  }

  .brand {
    min-height: 42px;
    justify-content: flex-start;
  }

  .brand img {
    width: 56px;
  }

  .nav-stack {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .nav-stack::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 96px;
    min-height: 70px;
    padding: 8px;
    gap: 6px;
    font-size: 0.74rem;
  }

  .nav-icon {
    width: 30px;
    height: 30px;
    font-size: 0.62rem;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 14px;
    padding: 14px;
  }

  .topbar h1 {
    font-size: 1.5rem;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .search-field {
    grid-column: 1 / -1;
  }

  .topbar-actions .primary-action,
  .topbar-actions .secondary-action {
    min-height: 38px;
    padding: 0 10px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field input {
    width: 100%;
  }

  .metrics-grid,
  .project-board,
  .document-grid,
  .detail-grid,
  .crm-kpis,
  .client-workstream,
  .admin-action-grid {
    grid-template-columns: 1fr;
  }

  .crm-command {
    align-items: stretch;
    flex-direction: column;
  }

  .crm-command .segmented-control {
    width: 100%;
    overflow-x: auto;
  }

  .crm-command .segmented-control button {
    flex: 1;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .hero-media {
    min-height: 300px;
  }

  .portal-footer {
    flex-direction: column;
    gap: 12px;
  }

  .portal-footer div {
    min-width: 0;
    text-align: left;
  }
}
