/* RyzeLab portal — calm, dense work tool built on the marketing site tokens. */
:root {
  --bg: #080b10;
  --surface: #0e131a;
  --surface-2: #131a23;
  --line: #1c2530;
  --line-strong: #2a3644;
  --text: #f0f3f7;
  --muted: #8b96a5;
  --accent: #b9f24b;
  --accent-ink: #0a0e06;
  --accent-soft: rgba(185, 242, 75, 0.1);
  --danger: #ff8a7a;
  --radius: 14px;
  --wrap: 1240px;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; line-height: 1.12; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.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;
}

/* Header */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(8, 11, 16, 0.94);
  border-bottom: 1px solid var(--line);
}
.app-header__inner { display: flex; align-items: center; gap: 22px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -0.02em; flex: none; }
.brand:hover { color: var(--text); }
.brand svg { width: 24px; height: 24px; flex: none; }
.brand em { font-style: normal; color: var(--accent); }
.app-nav { display: flex; align-items: center; gap: 6px; margin-left: 4px; flex: 1; min-width: 0; }
.app-nav a {
  display: inline-flex; align-items: center; height: 34px; padding: 0 11px;
  border-radius: 8px; color: var(--muted); font-size: 14px; white-space: nowrap;
}
.app-nav a:hover { color: var(--text); background: var(--surface-2); }
.app-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.app-user { display: flex; align-items: center; gap: 12px; flex: none; min-width: 0; }
.app-user__id { min-width: 0; text-align: right; }
.app-user__name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-user__role { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* Layout */
.page { padding: 30px 0 72px; }
.page__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px 24px; margin-bottom: 22px; }
.page__head h1 { font-size: clamp(26px, 3vw, 38px); }
.page__head p { color: var(--muted); margin-top: 6px; max-width: 54em; }
.page__head .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.section { margin-top: 28px; }
.section + .section { margin-top: 34px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section__head h2 { font-size: 20px; }
.section__head .count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.section__lead { color: var(--muted); font-size: 14px; margin-bottom: 14px; }

/* Panels and cards */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel--pad { padding: 18px; }
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel__head h3 { font-size: 16px; }
.panel__body { padding: 16px 18px; }
.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Lists and tables */
.item-list { display: grid; gap: 10px; }
.item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px;
}
.item__main { flex: 1 1 320px; min-width: 0; }
.item__title { font-weight: 600; font-size: 15px; }
.item__sub { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.item__aside { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: none; }
.item__meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.table-list { display: grid; }
.table-list__row {
  display: grid; gap: 14px; padding: 13px 16px;
  border-bottom: 1px solid var(--line); align-items: center;
}
.table-list__row:last-child { border-bottom: 0; }
.table-list--head .table-list__row { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding-block: 10px; }
.table-list--head .table-list__row:hover { background: transparent; }
.table-list__row:hover { background: var(--surface-2); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border-radius: 9px; border: 1px solid var(--line-strong);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  background: transparent; cursor: pointer; text-align: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--text); color: var(--text); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: #cbff66; border-color: #cbff66; color: var(--accent-ink); }
.btn--sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn--ghost { border-color: transparent; color: var(--muted); padding-inline: 8px; }
.btn--ghost:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }
.btn--danger { border-color: rgba(255, 138, 122, 0.45); color: var(--danger); }
.btn--danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(255, 138, 122, 0.07); }

/* Forms */
.form { display: grid; gap: 14px; }
.form--panel { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.form__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 6px; align-content: start; }
.field label, .field__label {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted);
}
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 11px;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #566170; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); padding: 0; }
.field--check { grid-template-columns: auto 1fr; align-items: start; gap: 10px; }
.field--check label { text-transform: none; letter-spacing: 0; font-family: var(--font-body); font-size: 14px; color: #c4ccd6; line-height: 1.45; cursor: pointer; }
.field__hint { font-size: 12.5px; color: var(--muted); }
.form-status { font-size: 13.5px; min-height: 1.3em; color: var(--muted); }
.form-status.is-ok { color: var(--accent); }
.form-status.is-err { color: var(--danger); }
.form__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Status and badges */
.badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  color: #c4ccd6; background: var(--surface-2); white-space: nowrap;
}
.badge--accent { color: var(--accent); border-color: rgba(185, 242, 75, 0.4); background: var(--accent-soft); }
.badge--muted { color: var(--muted); }
.badge--danger { color: var(--danger); border-color: rgba(255, 138, 122, 0.4); background: rgba(255, 138, 122, 0.07); }
.badge--active, .badge--paid, .badge--signed, .badge--done { color: var(--accent); border-color: rgba(185, 242, 75, 0.4); background: var(--accent-soft); }
.badge--review, .badge--issued { color: #ffd479; border-color: rgba(255, 212, 121, 0.4); background: rgba(255, 212, 121, 0.07); }
.badge--void, .badge--skipped { color: var(--muted); }

/* Notice and error boxes */
.notice {
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); padding: 14px 16px; color: #c4ccd6; font-size: 14px;
}
.notice--warn { border-color: rgba(255, 212, 121, 0.45); background: rgba(255, 212, 121, 0.06); }
.notice--accent { border-color: rgba(185, 242, 75, 0.4); background: var(--accent-soft); }
.error-box {
  border: 1px solid rgba(255, 138, 122, 0.5); border-radius: 12px;
  background: rgba(255, 138, 122, 0.07); padding: 16px;
}
.error-box h3 { color: var(--danger); font-size: 16px; margin-bottom: 6px; }
.error-box p { color: #c4ccd6; margin-bottom: 12px; overflow-wrap: anywhere; }

/* Loading */
.state { display: grid; place-items: center; gap: 12px; padding: 64px 20px; text-align: center; color: var(--muted); }
.boot { display: grid; place-items: center; gap: 12px; min-height: 100vh; color: var(--muted); font-family: var(--font-body); }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Auth pages */
.auth-wrap { max-width: 480px; margin: 6vh auto 0; }
.auth-panel { padding: 26px; }
.auth-panel h1 { font-size: 30px; margin-bottom: 8px; }
.auth-panel > p { color: var(--muted); margin-bottom: 20px; }
.auth-panel .form { margin-top: 4px; }
.invite-person { display: grid; gap: 8px; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.invite-person strong { font-size: 18px; }
.invite-person span { color: var(--muted); }

/* Stage progress track */
.stage-track {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--surface);
}
.stage-track__item {
  position: relative; padding: 14px 14px 15px;
  border-right: 1px solid var(--line); min-width: 0;
}
.stage-track__item:last-child { border-right: 0; }
.stage-track__item::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: var(--line-strong);
}
.stage-track__item.is-pending::before { background: var(--line-strong); }
.stage-track__item.is-active::before, .stage-track__item.is-review::before { background: var(--accent); }
.stage-track__item.is-done::before { background: var(--accent); }
.stage-track__item.is-skipped::before { background: var(--line-strong); }
.stage-track__num { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.stage-track__item h3 { font-size: 15px; margin-bottom: 5px; }
.stage-track__item p { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.stage-track__item .badge { margin-top: 9px; }

/* Feed */
.live-line {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.04em; color: var(--muted);
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.live-line.is-live { color: var(--accent); border-color: rgba(185, 242, 75, 0.35); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.live-line.is-retry .live-dot { background: var(--muted); }
.feed { display: grid; gap: 10px; }
.feed-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; position: relative;
}
.feed-item.is-new { animation: newItem 6s ease-out both; border-color: rgba(185, 242, 75, 0.65); }
@keyframes newItem {
  0% { background: rgba(185, 242, 75, 0.16); }
  70% { background: rgba(185, 242, 75, 0.05); }
  100% { background: var(--surface); }
}
.feed-item__top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; }
.feed-item__kind { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.feed-item__time { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.feed-item__author { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.feed-item h3 { font-size: 15px; margin-bottom: 5px; }
.feed-item__body { color: #c4ccd6; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.feed-item__link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-weight: 600; font-size: 13.5px; color: var(--accent); }
.feed-item__approved { margin-top: 9px; font-size: 12.5px; color: var(--accent); }
.feed-item__actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.system-note { color: var(--muted); font-size: 13.5px; }

/* Invoices */
.invoice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.invoice-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; min-width: 0; }
.invoice-card h3 { font-size: 14.5px; margin-bottom: 6px; overflow-wrap: anywhere; }
.invoice-card__amount { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin: 4px 0 8px; }
.invoice-card__meta { font-size: 12px; color: var(--muted); display: grid; gap: 2px; }
.invoice-card__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* Copyable invite link */
.copy-row { display: flex; gap: 8px; margin-top: 8px; }
.copy-row input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 11px; font-family: var(--font-mono); font-size: 12.5px; color: var(--text); }

/* Admin control cards */
.control-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.control-card h3 { font-size: 15px; margin-bottom: 10px; }
.control-card .form-status { min-height: 0; margin-top: 4px; }

/* Audit */
.audit-item { display: grid; gap: 5px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.audit-item:last-child { border-bottom: 0; }
.audit-item__top { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.audit-item__action { font-weight: 600; font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.audit-item__meta { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }

/* Document */
.doc-layout { max-width: 860px; margin: 0 auto; }
.doc-body {
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--font-body); font-size: 15px; line-height: 1.75; color: #d5dbe3;
}
.signature-list { display: grid; gap: 10px; }
.signature {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px;
}
.signature__party { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.signature__name { font-weight: 600; margin-top: 4px; }
.signature__meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* Responsive */
@media (max-width: 1020px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-track__item { border-bottom: 1px solid var(--line); }
  .stage-track__item:nth-child(2n) { border-right: 0; }
  .stage-track__item:last-child { border-bottom: 0; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .app-header__inner { flex-wrap: wrap; gap: 10px; padding: 10px 0; }
  .app-nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .app-user__id { max-width: 130px; }
  .app-user__name { font-size: 12px; }
  .app-user__role { font-size: 9px; }
  .form__grid, .grid--2, .grid--3, .grid--4, .invoice-grid { grid-template-columns: minmax(0, 1fr); }
  .stage-track { grid-template-columns: minmax(0, 1fr); }
  .stage-track__item { border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-track__item:last-child { border-bottom: 0; }
  .page { padding-top: 20px; }
  .page__head { align-items: flex-start; flex-direction: column; }
  .item__aside { width: 100%; justify-content: flex-start; }
  .btn { min-height: 42px; }
  .btn--sm { min-height: 34px; }
  .copy-row { flex-direction: column; }
  .auth-wrap { margin-top: 2vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
