/* Client portal.
   Loaded after styles.css and reuses its tokens (--bg-color, --primary-color,
   .btn, .form-group), so the portal stays in step with the marketing site
   without duplicating any of it. Only portal-specific layout lives here. */

.portal-body {
  background: var(--bg-color);
  min-height: 100vh;
}

/* ------------------------------------------------------------------ nav */

.portal-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.9rem 2rem;
  background: rgba(13, 18, 30, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.portal-logo img {
  height: 34px;
  display: block;
}

.portal-nav-links {
  display: flex;
  gap: 1.75rem;
  margin-right: auto;
}

.portal-nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.portal-nav-links a:hover {
  color: var(--text-main);
}

.portal-nav-links a.is-current {
  color: var(--text-main);
  border-bottom-color: var(--primary-color);
}

.portal-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

/* When signed out there are no nav links, so the actions still need pushing
   right on their own. */
.portal-nav > .portal-nav-actions:first-of-type {
  margin-left: auto;
}

.portal-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gradient-main);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  flex-shrink: 0;
}

.portal-avatar.sm {
  width: 30px;
  height: 30px;
  font-size: 0.78rem;
}

/* ----------------------------------------------------------------- main */

.portal-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-sub {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 0.35rem;
}

.back-link {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}

.back-link:hover {
  color: var(--text-main);
}

/* ---------------------------------------------------------------- stats */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-foot {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* --------------------------------------------------------------- panels */

.panel {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.panel-head h2 {
  font-size: 1.05rem;
  font-weight: 700;
}

.panel-head a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.85rem;
}

.panel-head a:hover {
  text-decoration: underline;
}

.panel-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.panel-pair > .panel {
  margin-bottom: 1.5rem;
}

.empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1rem 0;
}

/* -------------------------------------------------------------- projects */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.project-card {
  display: block;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.4rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.project-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.project-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-list a {
  display: block;
  padding: 0.9rem;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease;
}

.project-list a:hover {
  background: rgba(255, 255, 255, 0.03);
}

.project-list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.project-title {
  font-weight: 600;
}

.project-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
  margin-bottom: 1rem;
}

.project-desc-full {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.7;
  margin-top: 1.1rem;
}

.project-list-foot {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.55rem;
}

.progress {
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--gradient-main);
  transition: width 0.4s ease;
}

.progress-lg {
  height: 10px;
}

/* ---------------------------------------------------------------- lists */

.team-list,
.link-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.team-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.team-list strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
}

.team-list .muted {
  font-size: 0.8rem;
}

.link-list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.link-list a {
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.9rem;
}

.link-list a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

/* --------------------------------------------------------------- tables */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  text-align: left;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: 0 0.6rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.8rem 0.6rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table a {
  color: var(--primary-color);
  text-decoration: none;
}

.muted {
  color: var(--text-muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
}

.overdue {
  color: #F87171;
  font-weight: 600;
}

/* -------------------------------------------------------- badges & tags */

.badge {
  display: inline-block;
  padding: 0.24rem 0.6rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-muted);
}

.badge-lg {
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
}

/* Live/positive */
.badge-in_progress,
.badge-active,
.badge-scheduled,
.badge-accepted {
  background: rgba(59, 130, 246, 0.16);
  color: #93C5FD;
}

/* Done */
.badge-delivered,
.badge-paid,
.badge-completed {
  background: rgba(34, 197, 94, 0.16);
  color: #86EFAC;
}

/* Needs attention */
.badge-review,
.badge-reviewing,
.badge-sent,
.badge-partial,
.badge-requested,
.badge-submitted {
  background: rgba(139, 92, 246, 0.16);
  color: #C4B5FD;
}

/* Stalled or wrong */
.badge-on_hold,
.badge-overdue,
.badge-cancelled,
.badge-declined,
.badge-void {
  background: rgba(248, 113, 113, 0.16);
  color: #FCA5A5;
}

.tag {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-muted);
  min-width: 54px;
  text-align: center;
}

.tag-figma  { background: rgba(236, 72, 153, 0.16); color: #F9A8D4; }
.tag-aws    { background: rgba(249, 115, 22, 0.16); color: #FDBA74; }
.tag-github { background: rgba(148, 163, 184, 0.18); color: #E2E8F0; }
.tag-doc    { background: rgba(59, 130, 246, 0.16);  color: #93C5FD; }

/* ---------------------------------------------------------------- forms */

.portal-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}

/* .form-group input/select/textarea are styled in styles.css; these only add
   what the portal needs on top. */
.portal-form .form-group {
  margin-bottom: 0;
}

.portal-form input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hint,
.optional {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.hint {
  display: block;
  margin-top: 0.35rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 0.4rem;
}

/* Stars render right-to-left so `~` can reach the ones before the hovered
   input, which in visual terms are the ones to its left. */
.stars {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 0.2rem;
}

.stars input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.stars label {
  font-size: 1.7rem;
  line-height: 1;
  color: rgba(148, 163, 184, 0.35);
  cursor: pointer;
  transition: color 0.15s ease;
}

.stars input:checked ~ label,
.stars label:hover,
.stars label:hover ~ label {
  color: #FBBF24;
}

.stars input:focus-visible + label {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------------------------------------------------------------ auth pages */

.auth-wrap {
  min-height: 72vh;
  display: grid;
  place-items: center;
  padding: 2rem 0;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 2.2rem;
  box-shadow: var(--shadow-lg);
}

.auth-card-wide {
  max-width: 660px;
}

.auth-card h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.5rem 0 1.6rem;
}

.auth-alt {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 1.4rem;
}

.auth-alt a {
  color: var(--primary-color);
  text-decoration: none;
}

.auth-alt a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------- flashes */

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.flash {
  padding: 0.8rem 1.1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  border: 1px solid;
}

.flash-success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #86EFAC;
}

.flash-error {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.3);
  color: #FCA5A5;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .panel-pair {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (max-width: 720px) {
  .portal-nav {
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    padding: 0.8rem 1.1rem;
  }

  .portal-nav-links {
    order: 3;
    width: 100%;
    gap: 1.1rem;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    /* Keep the row on one line and let it scroll rather than wrap into a
       stack that pushes the page content down. */
    white-space: nowrap;
  }

  .portal-main {
    padding: 1.75rem 1.1rem 4rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .page-head h1 {
    font-size: 1.5rem;
  }

  /* Tables are the one thing that cannot reflow; let them scroll sideways
     inside the panel instead of widening the page. */
  .panel {
    padding: 1.2rem;
  }

  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* ------------------------------------------------- invoice payment claim */

.invoice-actions { white-space: nowrap; }

.invoice-actions .claimed {
  color: #FCD34D;
  font-size: 0.75rem;
  white-space: normal;
  display: inline-block;
  max-width: 150px;
}

/* <details> keeps the form out of the way until it is wanted, which matters
   in a table row that is already wide. */
.claim { display: inline-block; }

.claim summary {
  cursor: pointer;
  color: var(--primary-color);
  font-size: 0.82rem;
  font-weight: 600;
  list-style: none;
}

.claim summary::-webkit-details-marker { display: none; }
.claim summary:hover { text-decoration: underline; }

.claim form {
  position: absolute;
  z-index: 20;
  margin-top: 0.6rem;
  width: 270px;
  white-space: normal;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.claim label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.claim input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.82rem;
}

.claim input[type="file"] { padding: 0.35rem; font-size: 0.74rem; }

/* ------------------------------------------------- signup recap + pending */

.signup-recap {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0.5rem 1rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 0.88rem;
}

.signup-recap dt { color: var(--text-muted); }
.signup-recap dd { font-weight: 500; }

.pending-mark {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 1.25rem;
  font-size: 1.6rem;
  color: #86EFAC;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
}
