.portal-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-page .site-header {
  position: relative;
}

/* The nav wraps onto a second row (right-aligned) when the window is too narrow for it, so no
   link runs off the side. */
.portal-nav {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px 24px;
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 800;
}

.portal-nav a {
  padding: 10px 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.portal-nav form {
  flex: 0 0 auto;
}

.portal-nav a:hover,
.portal-nav a:focus-visible {
  border-color: currentColor;
}

.portal-nav .portal-logout-button {
  color: inherit;
  border-color: currentColor;
}

.portal-main {
  position: relative;
  flex: 1;
  overflow: hidden;
  padding: 82px 0 104px;
  background: var(--paper);
}

.portal-shell {
  position: relative;
  z-index: 1;
}

.portal-kicker {
  margin-bottom: 20px;
  color: var(--accent-dark);
  font-size: 0.73rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.portal-heading {
  max-width: 820px;
  color: var(--heading-accent);
  font-family: var(--sans);
  font-size: clamp(3.4rem, 7vw, 6.8rem);
  font-weight: 600;
}

.portal-lead {
  max-width: 680px;
  margin-top: 25px;
  color: var(--ink-soft);
  font-size: 1.08rem;
  line-height: 1.72;
}

.portal-lead a {
  border-bottom: 2px solid var(--accent);
  font-weight: 750;
}

.portal-login-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(380px, 0.65fr);
  align-items: start;
  gap: 18px 82px;
}

.portal-login-card,
.client-project-card {
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow: var(--shadow);
}

.portal-login-card {
  display: grid;
  gap: 20px;
  padding: 34px;
}

.portal-login-card h2,
.client-project-card h2 {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.portal-login-card > p {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.65;
}

.portal-login-card label {
  display: grid;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-login-card input {
  width: 100%;
  min-height: 51px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: var(--white);
  outline: none;
}

.portal-login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.16);
}

.portal-login-card .button {
  width: 100%;
}

.portal-error {
  padding: 11px 13px;
  border-left: 3px solid var(--accent-dark);
  color: var(--ink) !important;
  background: var(--sage);
  font-weight: 750;
}

.portal-security-note {
  padding-top: 3px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.55;
}

.portal-admin-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  grid-column: 2;
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: var(--white);
}

.portal-admin-entry span {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

/* Administrator access emails a code; Enter a code opens the page for a code already emailed. */
.portal-admin-entry-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 20px;
}

a.portal-logout-button {
  display: inline-block;
  text-decoration: none;
}

.portal-projects {
  display: grid;
  gap: 22px;
  margin-top: 58px;
}

.client-project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 55px;
  padding: 36px;
}

.client-project-copy {
  display: grid;
  gap: 15px;
}

.client-project-status {
  width: max-content;
  padding: 6px 9px;
  color: var(--ink-deep);
  background: var(--sage);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.client-project-copy > p {
  max-width: 720px;
  color: var(--ink-soft);
  line-height: 1.68;
}

.client-project-action {
  min-width: 220px;
  display: grid;
  gap: 11px;
}

.client-project-action small {
  max-width: 240px;
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.5;
}

.portal-secondary-link {
  width: max-content;
  padding: 7px 0 5px;
  border-bottom: 2px solid var(--accent);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.portal-secondary-link:hover,
.portal-secondary-link:focus-visible {
  color: var(--accent-dark);
}

.portal-account-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.portal-account-actions p {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.portal-logout-button {
  padding: 8px 0;
  border: 0;
  border-bottom: 2px solid var(--accent);
  color: var(--ink);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
}

.portal-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.portal-footer-inner p,
.portal-footer-inner a {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.75rem;
}

.portal-footer-inner a:hover {
  color: var(--gold);
}

.portal-page :focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

@media (max-width: 900px) {
  .portal-login-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .portal-login-card,
  .portal-admin-entry {
    max-width: 620px;
  }

  .portal-login-card {
    margin-top: 30px;
  }

  .portal-admin-entry {
    grid-column: auto;
  }

  .client-project-card {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .client-project-action {
    min-width: 0;
    max-width: 360px;
  }
}

@media (max-width: 680px) {
  .portal-page .header-inner {
    flex-wrap: wrap;
    gap: 16px;
    padding-block: 20px;
  }

  .portal-nav {
    gap: 14px;
    font-size: 0.75rem;
  }

  .portal-main {
    padding: 58px 0 76px;
  }

  .portal-heading {
    font-size: clamp(3.2rem, 16vw, 5rem);
  }

  .portal-login-card,
  .client-project-card {
    padding: 24px 21px;
  }

  .portal-account-actions,
  .portal-footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Portal template: billing, documents, signing */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.portal-section {
  margin-top: 58px;
}

.portal-section > h2,
.admin-panel h2,
.admin-sidebar h2 {
  margin-bottom: 18px;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.portal-section .client-project-card h3 {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.portal-notice,
.portal-empty {
  margin-top: 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--heading-accent);
  color: var(--ink);
  background: var(--sage);
  font-size: 0.9rem;
  line-height: 1.6;
}

.portal-empty {
  margin-top: 0;
  color: var(--ink-soft);
}

.portal-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}

.portal-table th,
.portal-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.portal-table th {
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.portal-table tbody tr:last-child td {
  border-bottom: 0;
}

.portal-table td small {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.portal-number {
  font-weight: 800;
  letter-spacing: 0.04em;
}

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

.portal-actions a + a {
  margin-left: 18px;
}

.portal-status {
  display: inline-block;
  padding: 5px 9px;
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  white-space: nowrap;
}

.portal-status-open { color: #00212b; background: #d9f3fa; }
.portal-status-paid { color: #ffffff; background: #085858; }
.portal-status-void { color: #555555; background: #f2f2f2; }
.portal-status-neutral { color: var(--ink-deep); background: var(--sage); }

.portal-form {
  display: grid;
  align-content: start;
  gap: 16px;
  margin-top: 26px;
  padding: 30px;
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow: var(--shadow);
}

.portal-form h3 {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.portal-form > p {
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.6;
}

.portal-form label {
  display: grid;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-form input,
.portal-form select,
.portal-form textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: var(--white);
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0;
  text-transform: none;
  outline: none;
}

.portal-form input[type="file"] {
  padding: 11px 13px;
}

.portal-form input:focus,
.portal-form select:focus,
.portal-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.16);
}

.portal-form .button {
  width: max-content;
}

.portal-form .portal-check {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.portal-form .portal-check input {
  width: 20px;
  min-height: 0;
  height: 20px;
  margin-top: 2px;
}

.portal-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 32px;
  margin-top: 40px;
}

.portal-card {
  padding: 32px;
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow: var(--shadow);
}

.portal-card-action {
  display: grid;
  align-content: start;
  gap: 22px;
}

.portal-card-action .button {
  width: 100%;
}

.portal-facts {
  display: grid;
  gap: 14px;
}

.portal-facts div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: center;
  font-size: 0.95rem;
}

.portal-facts dt {
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.portal-description {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  line-height: 1.7;
}

.portal-sign {
  max-width: 780px;
}

.sign-pad {
  display: grid;
  gap: 10px;
}

.sign-pad-label {
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sign-pad canvas {
  width: 100%;
  height: auto;
  border: 1px dashed rgba(0, 0, 0, 0.35);
  background: #ffffff;
  touch-action: none;
  cursor: crosshair;
}

.sign-pad.has-ink canvas {
  border-style: solid;
}

.sign-pad-tools {
  display: flex;
  align-items: center;
  gap: 18px;
}

.sign-pad-tools small {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

/* Admin panel: cool dark palette */
.portal-admin .portal-main {
  color: #ffffff;
  background: #00212b;
}

.portal-admin .portal-heading {
  color: #ffffff;
}

.portal-admin .portal-kicker {
  color: #67e8f9;
}

.portal-admin .portal-lead,
.portal-admin .portal-empty {
  color: rgba(255, 255, 255, 0.72);
}

.portal-admin .portal-empty,
.portal-admin .portal-notice {
  border-left-color: #67e8f9;
  color: #ffffff;
  background: #003544;
}

.portal-admin .portal-error {
  border-left-color: #f472b6;
  color: #ffffff !important;
  background: #003544;
}

.admin-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.admin-chip {
  padding: 6px 10px;
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.admin-chip-on { color: #00212b; background: #67e8f9; }
.admin-chip-off { color: #ffffff; background: #003544; border: 1px solid rgba(255, 255, 255, 0.24); }

.admin-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.6fr);
  gap: 36px;
  margin-top: 52px;
}

.admin-sidebar h2,
.admin-panel h2 {
  color: #ffffff;
}

.admin-client-list {
  display: grid;
  gap: 8px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.admin-client-link {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  background: #003544;
}

.admin-client-link small {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.7rem;
}

.admin-client-link:hover,
.admin-client-link:focus-visible,
.admin-client-link.is-current {
  border-color: #67e8f9;
  background: #00404f;
}

.admin-panel {
  display: grid;
  gap: 22px;
  align-content: start;
}

.admin-panel-head {
  display: grid;
  gap: 10px;
}

.admin-panel h3 {
  margin-top: 12px;
  color: #ffffff;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 22px;
}

.portal-admin .portal-form {
  margin-top: 0;
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  background: #003544;
  box-shadow: none;
}

.portal-admin .portal-form h3 {
  margin-top: 0;
  color: #ffffff;
}

.portal-admin .portal-form > p,
.portal-admin .portal-security-note {
  color: rgba(255, 255, 255, 0.68);
}

.portal-admin .portal-form input,
.portal-admin .portal-form select,
.portal-admin .portal-form textarea {
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  background: #00212b;
}

.portal-admin .portal-form input:focus,
.portal-admin .portal-form select:focus,
.portal-admin .portal-form textarea:focus {
  border-color: #67e8f9;
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.28);
}

.portal-admin .portal-form .button,
.portal-admin .button-solid {
  border-color: #67e8f9;
  color: #00212b;
  background: #67e8f9;
}

.portal-admin .portal-table {
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  background: #003544;
  box-shadow: none;
}

.portal-admin .portal-table th,
.portal-admin .portal-table td {
  border-bottom-color: rgba(255, 255, 255, 0.14);
}

.portal-admin .portal-table th,
.portal-admin .portal-table td small {
  color: rgba(255, 255, 255, 0.62);
}

.portal-admin .portal-secondary-link,
.portal-admin .portal-logout-button {
  border-bottom-color: #67e8f9;
  color: #ffffff;
}

.portal-admin .portal-secondary-link:hover,
.portal-admin .portal-logout-button:hover {
  color: #67e8f9;
}

.portal-admin .portal-status-open { color: #00212b; background: #67e8f9; }
.portal-admin .portal-status-paid { color: #00212b; background: #c4b5fd; }
.portal-admin .portal-status-void { color: #ffffff; background: #00404f; }
.portal-admin .portal-status-neutral { color: #ffffff; background: #00404f; }

@media (max-width: 900px) {
  .portal-detail-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .portal-table thead {
    display: none;
  }

  .portal-table tr {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
  }

  .portal-table td {
    padding: 0;
    border: 0;
  }

  .portal-actions {
    margin-top: 6px;
  }
}

/* Quote and invoice document: a white page in every view, printable as-is */
.portal-heading-sm {
  font-size: clamp(2.4rem, 4.6vw, 4rem);
  line-height: 1.02;
}

.portal-inline-link {
  border-bottom: 2px solid currentColor;
  font-weight: 750;
}

.billing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: start;
  gap: 32px;
  margin-top: 40px;
}

.billing-layout-admin {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
}

.billing-doc {
  min-width: 0;
  padding: 44px 48px 36px;
  border: 1px solid var(--line);
  color: #111111;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.billing-doc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 26px;
  border-bottom: 2px solid #111111;
}

.billing-doc-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.billing-doc-mark {
  flex: 0 0 auto;
  width: 74px;
  height: auto;
  color: #00212b;
}

.billing-doc-from {
  display: grid;
  gap: 3px;
  color: #555555;
  font-size: 0.8rem;
}

.billing-doc-from strong {
  color: #111111;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.billing-doc-type {
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}

.billing-doc-type span {
  color: #085858;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.billing-doc-type strong {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
}

.billing-doc-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 18px 24px;
  margin-top: 26px;
}

.billing-doc-meta dt {
  color: #555555;
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.billing-doc-meta dd {
  margin-top: 6px;
  font-size: 0.95rem;
  font-weight: 650;
}

.billing-doc-title {
  margin-top: 34px;
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.billing-lines {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.billing-lines th,
.billing-lines td {
  padding: 12px 0 12px 14px;
  text-align: right;
  vertical-align: top;
}

.billing-lines th:first-child,
.billing-lines td:first-child {
  padding-left: 0;
  text-align: left;
}

.billing-lines thead th {
  padding-top: 0;
  border-bottom: 1px solid #111111;
  color: #555555;
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.billing-lines tbody td {
  border-bottom: 1px solid #e6e6e6;
  line-height: 1.5;
}

.billing-lines td:not(:first-child) {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.billing-lines tfoot th {
  color: #555555;
  font-weight: 650;
  text-align: right;
}

.billing-lines tfoot td {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.billing-lines tfoot tr:first-child th,
.billing-lines tfoot tr:first-child td {
  padding-top: 18px;
}

.billing-lines .billing-total th {
  color: #111111;
  font-size: 0.8rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.billing-lines .billing-total td {
  color: #085858;
  font-size: 1.35rem;
  font-weight: 850;
}

.billing-doc-notes {
  margin-top: 30px;
  padding: 18px 20px;
  background: #f2f2f2;
}

.billing-doc-notes h3 {
  color: #555555;
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.billing-doc-notes p {
  margin-top: 8px;
  line-height: 1.65;
}

.billing-doc-foot {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid #e6e6e6;
  color: #555555;
  font-size: 0.78rem;
}

.billing-actions .button {
  width: 100%;
}

.billing-actions .portal-notice {
  margin-top: 0;
}

.billing-accept {
  display: grid;
  gap: 14px;
}

.billing-accept label {
  display: grid;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.billing-accept input {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0;
  text-transform: none;
  outline: none;
}

.billing-accept input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.16);
}

.billing-print {
  justify-self: start;
}

/* Admin: quote and invoice tools */
.button-outline {
  border-color: currentColor;
  background: transparent;
}

.portal-admin .button-outline {
  border-color: #67e8f9;
  color: #ffffff;
}

.portal-admin .button-outline:hover {
  color: #00212b;
  background: #67e8f9;
}

.portal-admin .billing-doc {
  border-color: #ffffff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
}

.portal-admin .portal-inline-link {
  border-bottom-color: #67e8f9;
  color: #ffffff;
}

.portal-admin .portal-kicker .portal-inline-link {
  color: #67e8f9;
}

.admin-inline-form,
.admin-template-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 18px;
}

.admin-inline-form label,
.admin-template-picker label,
.admin-stack-form label,
.admin-copy label {
  display: grid;
  flex: 1 1 240px;
  gap: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-inline-form input,
.admin-template-picker select,
.admin-stack-form input,
.admin-stack-form select,
.admin-copy input {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 0;
  color: #ffffff;
  background: #00212b;
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0;
  text-transform: none;
  outline: none;
}

.admin-inline-form input:focus,
.admin-template-picker select:focus,
.admin-stack-form input:focus,
.admin-stack-form select:focus,
.admin-copy input:focus {
  border-color: #67e8f9;
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.28);
}

.admin-inline-form .button {
  min-height: 44px;
}

.admin-section-head {
  display: grid;
  gap: 16px;
}

.admin-section-head h3 {
  margin-top: 0;
}

.admin-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.admin-actions-spaced {
  margin: 30px 0 26px;
}

.admin-sidebar-link {
  margin-top: 20px;
}

.admin-cards {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.admin-card {
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  background: #003544;
}

.admin-card h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.admin-card .button {
  width: max-content;
  max-width: 100%;
}

.admin-meta {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.85rem;
  line-height: 1.55;
}

.admin-copy {
  display: grid;
  gap: 8px;
}

.admin-copy-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-copy-row input {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
}

.admin-stack-form {
  display: grid;
  gap: 14px;
}

.admin-stack-form label[hidden] {
  display: none;
}

.admin-field-hint {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.45;
  text-transform: none;
}

.admin-stack-form .portal-check {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 12px;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.admin-stack-form .portal-check input {
  width: 20px;
  min-height: 0;
  height: 20px;
  margin-top: 2px;
}

.admin-manage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.admin-activity {
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  list-style: none;
}

.admin-activity li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.8rem;
  line-height: 1.45;
}

.admin-activity time {
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

.admin-danger {
  margin-top: 22px;
}

.portal-admin .admin-danger .portal-logout-button {
  border-bottom-color: #f472b6;
}

/* Admin: invoice totals at the end of a project's quotes and invoices */
/* A wrapping row, so each line of figures fills its width and no empty cell shows. */
.billing-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.14);
}

.billing-totals div {
  display: grid;
  flex: 1 1 140px;
  align-content: start;
  gap: 4px;
  padding: 14px 16px;
  background: #003544;
}

.billing-totals dt {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.billing-totals dd {
  margin: 0;
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.billing-totals .billing-totals-due dd {
  color: #67e8f9;
}

/* Admin: Books (the journal, the balance check and the activity log) */
.books-filters {
  margin-top: 8px;
}

.books-filters label {
  flex: 1 1 180px;
}

.books-filters input {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 0;
  color: #ffffff;
  background: #00212b;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color-scheme: dark;
  outline: none;
}

.books-filters input:focus {
  border-color: #67e8f9;
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.28);
}

.books-filters .button {
  min-height: 44px;
}

.books-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 18px 0 30px;
}

.portal-admin .books-periods a[aria-current="page"] {
  color: #67e8f9;
  border-bottom-width: 3px;
}

.books-check {
  display: grid;
  gap: 10px;
  margin-bottom: 26px;
  padding: 20px 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 4px solid #67e8f9;
  color: rgba(255, 255, 255, 0.82);
  background: #003544;
}

.books-check-off {
  border-left-color: #f472b6;
}

.books-check h2 {
  margin: 0;
  color: #ffffff;
  font-size: 1.4rem;
}

.books-check p,
.books-check ul {
  margin: 0;
}

.books-check ul {
  display: grid;
  gap: 6px;
  padding-left: 18px;
}

.books-check form {
  margin-top: 4px;
}

.books-summary {
  margin-bottom: 36px;
}

.billing-totals .books-summary-note {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
  font-weight: 400;
}

.books-section {
  display: grid;
  gap: 12px;
  margin-bottom: 40px;
}

.books-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 20px;
}

.books-section-head h2 {
  margin: 0;
}

.books-section .admin-meta {
  margin: 0;
}

.books-money {
  font-variant-numeric: tabular-nums;
  text-align: right !important;
  white-space: nowrap;
}

.books-table tfoot th,
.books-table tfoot td {
  padding: 15px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-weight: 700;
  text-align: left;
}

.books-activity td:first-child {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .books-table tfoot tr {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
  }

  .books-table tfoot th,
  .books-table tfoot td {
    padding: 0;
    border: 0;
  }

  .books-money {
    text-align: left !important;
  }

  .books-table td[data-label]:not(:empty)::before {
    content: attr(data-label) " ";
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
}

/* Admin: the page confirming a quote or invoice is deleted */
.billing-delete {
  display: grid;
  gap: 14px;
  max-width: 640px;
  margin-top: 28px;
}

.billing-delete .admin-activity {
  padding-top: 0;
  border-top: 0;
}

.portal-admin .button-danger {
  border-color: #f472b6;
  color: #00212b;
  background: #f472b6;
}

.portal-admin .button-danger:hover,
.portal-admin .button-danger:focus-visible {
  border-color: #f9a8d4;
  background: #f9a8d4;
}

/* Admin: line-item editor */
.billing-editor,
.billing-editor-template {
  max-width: 980px;
}

.portal-admin .billing-editor {
  margin-top: 30px;
}

.billing-editor-template {
  margin-top: 26px;
}

.billing-kind {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 0;
  padding: 0;
  border: 0;
}

.billing-kind legend {
  margin-bottom: 10px;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.billing-editor-kind {
  color: #67e8f9;
  font-size: 0.8rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.line-editor {
  display: grid;
  gap: 12px;
}

.line-editor-table {
  width: 100%;
  border-collapse: collapse;
}

.line-editor-table th {
  padding: 0 10px 8px 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
}

.line-editor-table td {
  padding: 4px 10px 4px 0;
  vertical-align: middle;
}

.line-editor-table th:nth-child(2),
.line-editor-table td:nth-child(2) {
  width: 92px;
}

.line-editor-table th:nth-child(3),
.line-editor-table td:nth-child(3) {
  width: 150px;
}

.line-editor-table th:nth-child(4),
.line-editor-table td:nth-child(4) {
  width: 130px;
  text-align: right;
}

.line-editor-table th:nth-child(5),
.line-editor-table td:nth-child(5) {
  width: 84px;
  padding-right: 0;
  text-align: right;
}

.portal-form .line-editor-table input {
  min-height: 44px;
  padding: 8px 10px;
}

.line-amount {
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.line-remove {
  padding: 6px 0 4px;
  border: 0;
  border-bottom: 2px solid #f472b6;
  color: #ffffff;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 850;
  cursor: pointer;
}

.line-remove:hover {
  color: #f472b6;
}

.line-editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.line-editor-total {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.line-editor-total output {
  margin-left: 10px;
  color: #67e8f9;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.billing-editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin-top: 6px;
}

/* Fields sit inside bold uppercase labels and inherit their font; keep typed values at a normal weight. */
.portal-login-card input,
.portal-form input,
.portal-form select,
.portal-form textarea,
.billing-accept input,
.admin-inline-form input,
.admin-template-picker select,
.admin-stack-form input,
.admin-stack-form select,
.admin-copy input {
  font-weight: 400;
}

/* Quote and invoice credentials */
.billing-doc-from .billing-doc-license {
  margin-top: 4px;
  color: #111111;
  font-weight: 650;
}

.billing-doc-foot {
  display: grid;
  gap: 6px;
}

.billing-doc-foot .billing-doc-insurance {
  color: #111111;
  font-weight: 650;
}

/* Invoices: "I'm paying by check" reveals where to mail the check */
.billing-check summary {
  width: 100%;
  border-color: #111111;
  color: #111111;
  background: #ffffff;
  list-style: none;
}

.billing-check summary::-webkit-details-marker {
  display: none;
}

/* The site's FAQ plus/minus icon does not belong on this button. */
.billing-check summary::before,
.billing-check summary::after {
  content: none;
}

.billing-check[open] summary {
  color: #ffffff;
  background: #111111;
}

.billing-check-address {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 16px 18px;
  border-left: 3px solid #085858;
  color: #555555;
  background: #f2f2f2;
  font-size: 0.86rem;
  line-height: 1.6;
}

.billing-check-address address {
  color: #111111;
  font-size: 1rem;
  font-style: normal;
  line-height: 1.55;
}

/* Admin: email fields holding several addresses, each a removable chip */
.admin-inline-form .admin-emails-field {
  flex-basis: 100%;
}

.recipient-anchor {
  position: relative;
  display: block;
}

.recipient-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #00212b;
  cursor: text;
}

.portal-form .recipient-box {
  min-height: 48px;
}

.recipient-box:focus-within {
  border-color: #67e8f9;
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.28);
}

.recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  min-height: 30px;
  padding: 0 2px 0 10px;
  border: 1px solid rgba(103, 232, 249, 0.5);
  color: #ffffff;
  background: #003544;
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: none;
  cursor: default;
}

.recipient-chip.is-invalid {
  border-color: #f472b6;
  box-shadow: inset 3px 0 0 #f472b6;
}

.recipient-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipient-chip-remove {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  cursor: pointer;
}

.recipient-chip-remove:hover {
  color: #ffffff;
  background: rgba(103, 232, 249, 0.16);
}

.recipient-chip-remove:focus-visible {
  color: #ffffff;
  outline: 2px solid #67e8f9;
  outline-offset: -2px;
}

.recipient-chip-remove svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.portal-admin .recipient-box input.recipient-entry {
  flex: 1 1 140px;
  width: auto;
  min-width: 140px;
  min-height: 30px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.portal-admin .recipient-box input.recipient-entry:focus {
  border: 0;
  box-shadow: none;
}

/* Admin: pick list of addresses already emailed, eight rows tall */

.recipient-list {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  z-index: 30;
  max-height: calc(44px * 8 + 2px);
  overflow-y: auto;
  margin: 4px 0 0;
  padding: 0;
  border: 1px solid #67e8f9;
  color: #ffffff;
  background: #00212b;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0;
  list-style: none;
  text-transform: none;
  scrollbar-color: #67e8f9 #00212b;
  scrollbar-width: thin;
}

.recipient-list[hidden] {
  display: none;
}

.recipient-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.recipient-option:last-child {
  border-bottom: 0;
}

.recipient-option:hover,
.recipient-option.is-active {
  background: #003544;
}

.recipient-option.is-active {
  box-shadow: inset 3px 0 0 #67e8f9;
}

.recipient-address {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipient-sent {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.75rem;
}

@media (max-width: 1080px) {
  .billing-layout,
  .billing-layout-admin {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .billing-doc {
    padding: 28px 20px 24px;
  }

  .billing-doc-head {
    flex-direction: column;
  }

  .billing-doc-type {
    justify-items: start;
    text-align: left;
  }

  .billing-lines,
  .billing-lines tbody,
  .billing-lines tfoot {
    display: block;
    width: 100%;
  }

  .billing-lines thead {
    display: none;
  }

  .billing-lines tbody tr {
    display: grid;
    grid-template-columns: 0.6fr 1fr 1fr;
    gap: 4px 12px;
    padding: 12px 0;
    border-bottom: 1px solid #e6e6e6;
  }

  .billing-lines tbody td {
    padding: 0;
    border: 0;
    text-align: left;
  }

  .billing-lines tbody td:first-child {
    grid-column: 1 / -1;
    font-weight: 650;
  }

  .billing-lines tbody td:last-child {
    text-align: right;
  }

  .billing-lines tfoot tr {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding-top: 12px;
  }

  .billing-lines tfoot th,
  .billing-lines tfoot td,
  .billing-lines tfoot tr:first-child th,
  .billing-lines tfoot tr:first-child td {
    padding: 0;
  }

  .billing-lines tfoot tr:first-child {
    padding-top: 16px;
  }

  .billing-lines tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: #555555;
    font-size: 0.6rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .line-editor-table thead {
    display: none;
  }

  .line-editor-table tr {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    gap: 8px 10px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }

  .line-editor-table td,
  .line-editor-table td:nth-child(n) {
    width: auto;
    padding: 0;
    text-align: left;
  }

  .line-editor-table td:first-child {
    grid-column: 1 / -1;
  }

  .line-editor-table td:nth-child(4) {
    align-self: center;
    text-align: right;
  }

  .line-editor-table td:nth-child(5) {
    grid-column: 1 / -1;
  }

  .admin-copy-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-copy-row .portal-logout-button {
    align-self: flex-start;
  }
}

@media print {
  .topline,
  .site-header,
  .site-footer,
  .skip-link,
  .billing-actions,
  .admin-cards,
  .portal-detail > .portal-kicker,
  .portal-detail > .portal-heading,
  .portal-shell > .portal-notice,
  .portal-shell > .portal-error {
    display: none !important;
  }

  body,
  .portal-main,
  .portal-admin .portal-main {
    padding: 0;
    background: #ffffff;
  }

  .billing-layout {
    display: block;
    margin: 0;
  }

  .billing-doc,
  .portal-admin .billing-doc {
    padding: 0;
    border: 0;
    box-shadow: none;
  }
}

/* Admin list: status that opens a popup, how it was paid or when it is due, and a trash button */
.status-change {
  display: inline-flex;
  border-radius: 0;
  outline: none;
  cursor: pointer;
}

.status-change:hover .portal-status,
.status-change:focus-visible .portal-status {
  box-shadow: 0 0 0 2px #00212b, 0 0 0 4px #67e8f9;
}

.portal-table td small.status-detail {
  margin-top: 6px;
}

.billing-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.billing-trash {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  background: transparent;
  outline: none;
}

.billing-trash svg {
  width: 18px;
  height: 18px;
}

.billing-trash:hover,
.billing-trash:focus-visible {
  border-color: #f472b6;
  color: #f472b6;
  box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.24);
}

/* Admin popups */
.admin-dialog {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 28px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  background: #003544;
}

.admin-dialog [hidden] {
  display: none !important;
}

.admin-dialog .button {
  width: max-content;
  max-width: 100%;
}

.admin-dialog::backdrop {
  background: rgba(0, 16, 21, 0.74);
}

.admin-dialog[open] {
  display: grid;
  gap: 18px;
}

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

.admin-dialog-head h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.admin-dialog-close {
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  background: transparent;
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.admin-dialog-close:hover,
.admin-dialog-close:focus-visible {
  border-color: #67e8f9;
  color: #67e8f9;
  outline: none;
}

.admin-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.status-choice {
  display: inline-flex;
  width: max-content;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.status-option {
  min-width: 96px;
  min-height: 42px;
  padding: 8px 20px;
  border: 0;
  color: #ffffff;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.status-option + .status-option {
  border-left: 1px solid rgba(255, 255, 255, 0.28);
}

.status-option[aria-pressed="true"][data-status-option="due"] {
  color: #00212b;
  background: #67e8f9;
}

.status-option[aria-pressed="true"][data-status-option="paid"] {
  color: #00212b;
  background: #c4b5fd;
}

.status-option:focus-visible {
  outline: 2px solid #67e8f9;
  outline-offset: 2px;
}

/* Documents grouped by section, in the client portal and the admin panel */
.document-section-heading {
  margin: 30px 0 12px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-admin .document-section-heading {
  color: rgba(255, 255, 255, 0.72);
}

.admin-panel-subheading {
  margin-top: 40px;
}

/* Document tables line up from section to section */
@media (min-width: 901px) {
  .portal-table-documents {
    table-layout: fixed;
  }

  .portal-table-documents th:nth-child(1) { width: 56%; }
  .portal-table-documents th:nth-child(2) { width: 26%; }
  .portal-table-documents th:nth-child(3) { width: 18%; }
}

/* Crew portal: paperwork, hours and invoices, lien waivers */
.button-small {
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.74rem;
}

.portal-form label[hidden] {
  display: none;
}

.crew-page .portal-admin-entry .crew-forgot-email {
  width: min(260px, 100%);
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: var(--white);
  font: inherit;
  font-size: 0.85rem;
  outline: none;
}

.crew-page .portal-admin-entry .crew-forgot-email:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.16);
}

.crew-paperwork td strong {
  display: block;
}

.crew-paperwork td small,
.crew-page .portal-table td small {
  color: var(--ink-soft);
}

.crew-paperwork .portal-actions {
  text-align: right;
}

.crew-send {
  max-width: 880px;
}

.crew-fields,
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 18px;
  align-items: start;
}

.form-hint {
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.5;
  text-transform: none;
}

.paperwork-form {
  max-width: 920px;
  gap: 22px;
}

.form-section {
  display: grid;
  gap: 14px;
  min-width: 0;
  margin: 0;
  padding: 20px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.form-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.form-section > legend {
  padding: 0 0 10px;
  color: var(--heading-accent);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.form-choice {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.form-choice > legend {
  padding: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-grid .form-choice,
.form-grid .portal-check {
  grid-column: 1 / -1;
}

.form-attest {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-left: 3px solid var(--heading-accent);
  background: var(--sage);
  font-size: 0.9rem;
  line-height: 1.65;
}

.waiver-preview {
  display: grid;
  gap: 14px;
  padding: 34px 38px;
  border: 1px solid var(--line);
  color: #111111;
  background: #ffffff;
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.75;
}

.waiver-preview h2 {
  color: #111111;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
}

.waiver-fill {
  padding: 0 2px;
  border-bottom: 1px solid #111111;
  font-weight: 600;
}

.waiver-fill:empty::before {
  content: "\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0\00a0";
}

.waiver-choice {
  padding: 1px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
}

.waiver-choice.is-circled {
  border-color: #111111;
}

.waiver-warning {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-align: center;
}

.waiver-preview .portal-security-note {
  font-family: var(--sans);
}

/* Paperwork on the admin side (Section 2 of the I-9) */
.portal-admin .form-section {
  border-top-color: rgba(255, 255, 255, 0.14);
}

.portal-admin .form-section > legend {
  color: #67e8f9;
}

.portal-admin .form-hint {
  color: rgba(255, 255, 255, 0.62);
}

.portal-admin .form-attest {
  border-left-color: #c4b5fd;
  color: #ffffff;
  background: #00212b;
}

.portal-admin .portal-form .portal-check {
  color: #ffffff;
}

.portal-admin .sign-pad canvas {
  border-color: rgba(255, 255, 255, 0.4);
}

.portal-admin .sign-pad-tools small {
  color: rgba(255, 255, 255, 0.62);
}

/* Admin: Labor */
.labor-table td {
  vertical-align: top;
}

.labor-table select,
.labor-table input {
  width: 100%;
  min-width: 150px;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 0;
  color: #ffffff;
  background: #00212b;
  font: inherit;
  font-size: 0.85rem;
  outline: none;
}

.labor-table select:focus,
.labor-table input:focus {
  border-color: #67e8f9;
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.28);
}

.labor-table .labor-amount {
  min-width: 110px;
}

.labor-actions {
  display: grid;
  gap: 10px;
  justify-items: start;
  min-width: 170px;
}

.labor-actions form {
  margin: 0;
}

.portal-admin .portal-table td small.labor-files {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.portal-admin .labor-files .portal-secondary-link {
  font-size: 0.72rem;
}

.admin-panel-wide {
  margin-top: 40px;
}

.books-jobs .books-loss {
  color: #f472b6;
}

@media (max-width: 680px) {
  .waiver-preview {
    padding: 24px 20px;
  }

  .crew-paperwork .portal-actions {
    text-align: left;
    white-space: normal;
  }
}

/* Admin: one employee or subcontractor */
.labor-worker-grid {
  align-items: start;
  margin-top: 44px;
}

.labor-worker-grid .admin-card {
  align-content: start;
}

.labor-worker-grid .admin-activity li {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 10px;
}

.labor-table td:first-child a {
  white-space: nowrap;
}

.portal-admin .paperwork-form {
  margin-top: 36px;
}

/* The admin nav wraps on phones rather than running off the side. */
@media (max-width: 900px) {
  .portal-page .header-inner {
    flex-wrap: wrap;
    gap: 10px 16px;
    padding-block: 16px;
  }

  .portal-nav {
    flex-basis: 100%;
    justify-content: flex-start;
    row-gap: 0;
  }

  .portal-nav a {
    padding: 7px 0;
  }
}

/* Admin list: how a paid invoice was paid, which opens a popup to change it */
.portal-table td small.status-detail .payment-change {
  border-bottom: 1px dashed #67e8f9;
  color: inherit;
  text-decoration: none;
}

.portal-table td small.status-detail .payment-change:hover,
.portal-table td small.status-detail .payment-change:focus-visible {
  border-bottom-style: solid;
  color: #67e8f9;
}

/* Admin: Banking */
.bank-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 18px;
  margin: 6px 0 16px;
}

.bank-bulk [hidden],
.bank-file [hidden] {
  display: none !important;
}

.bank-bulk-label {
  display: grid;
  flex: 1 1 280px;
  gap: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bank-check-all {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
}

.bank-bulk select,
.bank-file select {
  width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 0;
  color: #ffffff;
  background: #00212b;
  font: inherit;
  font-size: 0.85rem;
  outline: none;
}

.bank-bulk select {
  min-height: 44px;
}

.bank-bulk select:focus,
.bank-file select:focus {
  border-color: #67e8f9;
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.28);
}

.bank-file {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
}

.bank-check {
  width: 40px;
}

.bank-check input,
.bank-check-all input {
  width: 18px;
  height: 18px;
  accent-color: #67e8f9;
}

.bank-in {
  color: #67e8f9;
}

.bank-out {
  color: #ffffff;
}

.bank-suggest {
  max-width: 230px;
  padding: 7px 11px;
  border: 1px solid #c4b5fd;
  color: #00212b;
  background: #c4b5fd;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.bank-suggest:hover,
.bank-suggest:focus-visible {
  border-color: #ffffff;
  background: #ffffff;
  outline: none;
}

.bank-accounts {
  align-items: start;
}

.bank-accounts .admin-card {
  align-content: start;
}

@media (max-width: 900px) {
  .bank-check {
    width: auto;
  }

  .bank-file {
    min-width: 0;
  }
}

/* A page section straight after the intro (Banking) */
.admin-intro + .books-section {
  margin-top: 44px;
}

/* Portal footer: Legal and privacy beside Contact */
.portal-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

/* Admin: Add a payment, as its own page */
.admin-card-narrow {
  max-width: 620px;
  margin-top: 30px;
}

/* Admin: a new invoice's Payments already received */
.listed-payments {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.listed-payments legend {
  padding: 0 0 8px;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.listed-payment {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(150px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(150px, 1fr);
  gap: 10px 12px;
  align-items: end;
}

.listed-payments [hidden] {
  display: none !important;
}

.listed-payments .portal-logout-button {
  justify-self: start;
}

@media (max-width: 900px) {
  .listed-payment {
    grid-template-columns: 1fr 1fr;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }
}

/* The trash button on an expense row is a button, not a link */
button.billing-trash {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.billing-row-actions form {
  margin: 0;
}

/* Upload document near the top of the client and crew portals */
.portal-lead-actions {
  margin-top: 22px;
}

/* Admin home: Add a client portal folds into a bar under the menu */
.admin-add-client {
  position: relative;
  margin: 0 0 30px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #003544;
}

.admin-add-client > summary {
  display: block;
  padding: 16px 64px 16px 20px;
  color: #ffffff;
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  list-style: none;
  cursor: pointer;
}

.admin-add-client > summary::-webkit-details-marker {
  display: none;
}

.admin-add-client > summary:hover,
.admin-add-client > summary:focus-visible {
  color: #67e8f9;
  outline: none;
}

/* The site's drawn + (styles.css summary), in cyan; open, the − button takes its place */
.admin-add-client > summary::before,
.admin-add-client > summary::after {
  right: 28px;
  width: 16px;
  background: #67e8f9;
}

.admin-add-client[open] > summary::before,
.admin-add-client[open] > summary::after {
  display: none;
}

.admin-collapse {
  position: absolute;
  top: 10px;
  right: 12px;
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  background: transparent;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.admin-add-client[open] .admin-collapse {
  display: block;
}

/* A drawn −, so it stays crisp at any zoom */
.admin-collapse {
  font-size: 0;
}

.admin-collapse::before {
  content: "";
  display: block;
  width: 14px;
  height: 2px;
  margin: 0 auto;
  background: currentColor;
}

.admin-collapse:hover,
.admin-collapse:focus-visible {
  border-color: #67e8f9;
  color: #67e8f9;
  outline: none;
}

.admin-inline-form.admin-add-client-form {
  padding: 0 20px 22px;
}

.admin-add-client-form .portal-error {
  flex-basis: 100%;
}

/* Admin: a field saved with the disk beside it */
.admin-inline-form.admin-save-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}

.icon-save {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #67e8f9;
  background: #00212b;
  cursor: pointer;
}

.icon-save svg {
  width: 20px;
  height: 20px;
}

.icon-save:hover,
.icon-save:focus-visible {
  border-color: #67e8f9;
  background: #003544;
  outline: none;
}

/* Start from a template: a plain box with no arrow; choosing opens the template */
.admin-template-picker select.select-plain {
  -webkit-appearance: none;
  appearance: none;
  background-image: none;
  cursor: pointer;
}

.admin-template-picker [hidden] {
  display: none !important;
}

/* The admin list: a whole quote or invoice row opens it */
tr.billing-row-link {
  cursor: pointer;
}

tr.billing-row-link:hover td {
  background: rgba(103, 232, 249, 0.06);
}

.billing-row-title {
  color: inherit;
  text-decoration: none;
}

.billing-row-title:hover,
.billing-row-title:focus-visible {
  color: #67e8f9;
}

/* Admin: the Schedule, a month calendar of crews on jobs */
.cal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
  margin: 40px 0 18px;
}

.cal-head h2 {
  min-width: 200px;
  color: #ffffff;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  text-align: center;
}

.cal-head .button {
  margin-left: auto;
}

.cal-grid {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-collapse: collapse;
  background: #003544;
  table-layout: fixed;
}

.cal-grid th {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
}

.cal-day {
  height: 128px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  vertical-align: top;
}

.cal-day.is-other {
  background: #002b38;
}

.cal-day.is-other .cal-date {
  color: rgba(255, 255, 255, 0.35);
}

.cal-day.is-today {
  box-shadow: inset 0 0 0 2px #67e8f9;
}

.cal-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.cal-date {
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 800;
}

.cal-weekday {
  display: none;
}

.cal-add {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  color: #67e8f9;
  font-weight: 800;
  opacity: 0.55;
}

.cal-day:hover .cal-add,
.cal-add:focus-visible {
  border-color: rgba(103, 232, 249, 0.5);
  opacity: 1;
}

.cal-entry {
  display: grid;
  gap: 3px;
  margin-top: 4px;
  padding: 5px 7px;
  border-left: 3px solid #67e8f9;
  color: #ffffff;
  background: #00212b;
  font-size: 0.74rem;
  line-height: 1.3;
}

.cal-entry.is-note {
  border-left-color: #c4b5fd;
}

.cal-entry:hover,
.cal-entry:focus-visible {
  background: #00404f;
}

.cal-entry strong {
  font-weight: 800;
}

.cal-time {
  color: #67e8f9;
  font-size: 0.68rem;
  font-weight: 700;
}

.cal-crew {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.cal-person {
  padding: 1px 5px;
  color: #00212b;
  background: #67e8f9;
  font-size: 0.64rem;
  font-weight: 800;
}

.cal-person.is-doubled {
  background: #f472b6;
}

.cal-notes {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
}

.schedule-when {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.schedule-crew {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px 14px;
  margin: 0;
  padding: 12px 0 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.schedule-crew input[type="checkbox"] {
  accent-color: #67e8f9;
}

.schedule-crew legend {
  padding-bottom: 6px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.schedule-crew .portal-check small {
  display: block;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.7rem;
  font-weight: 500;
}

.admin-dialog.schedule-dialog {
  width: min(660px, calc(100% - 32px));
}

.schedule-form textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 0;
  color: #ffffff;
  background: #00212b;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

@media (max-width: 760px) {
  .cal-grid thead {
    display: none;
  }

  .cal-grid,
  .cal-grid tbody,
  .cal-grid tr,
  .cal-day {
    display: block;
    width: auto;
  }

  .cal-day {
    height: auto;
    border-width: 0 0 1px;
  }

  .cal-day.is-other,
  .cal-day.is-empty:not(.is-today) {
    display: none;
  }

  .cal-weekday {
    display: inline;
  }

  .cal-head {
    gap: 12px 20px;
  }

  .cal-head h2 {
    order: -1;
    flex-basis: 100%;
    text-align: left;
  }

  .cal-head .button {
    width: 100%;
    margin-left: 0;
  }
}

/* Important notes: the admin's and team leaders' board (light in the crew portal, dark in admin) */
.notes-board .note-add {
  max-width: 760px;
}

.portal-admin .notes-board {
  margin-top: 30px;
}

.note-add textarea {
  width: 100%;
  min-height: 84px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: var(--white);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.notes-list {
  display: grid;
  gap: 12px;
  max-width: 900px;
  margin-top: 26px;
}

.note-card {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  background: var(--white);
  scroll-margin-top: 110px;
}

.note-in-progress { border-left-color: #085858; }
.note-completed { border-left-color: #999999; }
.note-contingent { border-left-style: dashed; border-left-color: #085858; }

.note-text {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.6;
}

.note-meta {
  color: var(--ink-soft);
  font-size: 0.74rem;
}

.note-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.note-steps form {
  margin: 0;
}

.note-step {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
}

.note-step.is-current::before {
  content: "✓ ";
}

.note-step-in-progress.is-current { border-color: #085858; color: #ffffff; background: #085858; }
.note-step-completed.is-current { border-color: #111111; color: #ffffff; background: #111111; }
.note-step-contingent.is-current { border-style: dashed; border-color: #085858; color: #085858; background: #f2f2f2; }

.notes-completed {
  max-width: 900px;
  margin-top: 26px;
  border-bottom: 0;
}

.notes-completed > summary {
  width: max-content;
  padding: 7px 26px 5px 0;
  border-bottom: 2px solid var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

/* The site's drawn + (styles.css summary), smaller, after the label */
.notes-completed > summary::before,
.notes-completed > summary::after {
  right: 2px;
  width: 12px;
  background: currentColor;
}

.notes-completed .note-card {
  margin-top: 12px;
}

.portal-admin .note-add textarea {
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  background: #00212b;
}

.portal-admin .note-card {
  border-color: rgba(255, 255, 255, 0.18);
  border-left-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  background: #003544;
}

.portal-admin .note-in-progress { border-left-color: #67e8f9; }
.portal-admin .note-completed { border-left-color: #c4b5fd; }
.portal-admin .note-contingent { border-left-style: solid; border-left-color: #f472b6; }

.portal-admin .note-text {
  color: #ffffff;
}

.portal-admin .note-meta {
  color: rgba(255, 255, 255, 0.62);
}

.portal-admin .note-step {
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.portal-admin .note-step:hover,
.portal-admin .note-step:focus-visible {
  border-color: #67e8f9;
  outline: none;
}

.portal-admin .note-step-in-progress.is-current { border-color: #67e8f9; color: #00212b; background: #67e8f9; }
.portal-admin .note-step-completed.is-current { border-color: #c4b5fd; color: #00212b; background: #c4b5fd; }
.portal-admin .note-step-contingent.is-current { border-style: solid; border-color: #f472b6; color: #00212b; background: #f472b6; }

.portal-admin .notes-completed > summary {
  border-bottom-color: #67e8f9;
  color: #ffffff;
}

/* Add expense, compact: the box says what goes in it (a placeholder, or a small tag inside it) */
.admin-dialog.expense-dialog {
  width: min(520px, calc(100% - 32px));
}

.expense-form {
  gap: 10px;
}

.expense-form .in-box {
  display: block;
}

.expense-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.expense-form .in-box-tagged {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-left: 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #00212b;
}

.expense-form .in-box-tagged:focus-within {
  border-color: #67e8f9;
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.28);
}

.in-box-tag {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.expense-form .in-box-tagged input,
.expense-form .in-box-tagged select {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  padding-left: 0;
  border: 0;
  background: transparent;
}

.expense-form .in-box-tagged input:focus,
.expense-form .in-box-tagged select:focus {
  box-shadow: none;
}

.expense-form input[type="file"] {
  padding: 8px 12px 8px 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.8rem;
}

.expense-form input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.expense-form .button {
  width: 100%;
}

@media (max-width: 480px) {
  .expense-pair {
    grid-template-columns: 1fr;
  }
}

/* The project panel: Expenses with its Job book link */
.admin-subhead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 18px;
  margin-top: 12px;
}

.admin-subhead h3 {
  margin: 0;
}

/* Display all data to client portal (read only): a checkbox at the very bottom */
.admin-access {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.admin-access .portal-check,
.admin-add-client-form .admin-add-client-access {
  display: flex;
  flex: 1 1 100%;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.admin-access .portal-check input,
.admin-add-client-form .admin-add-client-access input {
  flex: 0 0 auto;
  width: 20px;
  min-height: 0;
  height: 20px;
  accent-color: #67e8f9;
}

/* The Muskegon login is set in Render: shown, not saved here */
.icon-save.icon-save-off {
  color: rgba(255, 255, 255, 0.35);
  cursor: default;
}

/* Books: the jobs ledger's total, overhead, and the bottom line */
.books-overhead .books-money,
.books-categories .books-money {
  width: 180px;
}

.books-net {
  margin-top: 14px;
}

.books-net .books-loss,
.billing-totals dd.books-loss {
  color: #f472b6;
}

.books-overhead-added {
  margin-top: 22px;
  border-bottom: 0;
}

.books-overhead-added > summary {
  width: max-content;
  padding: 7px 26px 5px 0;
  border-bottom: 2px solid #67e8f9;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
}

.books-overhead-added > summary::before,
.books-overhead-added > summary::after {
  right: 2px;
  width: 12px;
  background: currentColor;
}

.books-overhead-added .portal-table {
  margin-top: 14px;
}

.books-categories {
  margin-top: 18px;
}

/* A project shown read only: its figures in the client portal, on the light theme */
body:not(.portal-admin) .billing-totals {
  margin-top: 14px;
  border-color: var(--line);
  background: var(--line);
}

body:not(.portal-admin) .billing-totals div {
  background: var(--white);
}

body:not(.portal-admin) .billing-totals dt {
  color: var(--ink-soft);
}

body:not(.portal-admin) .billing-totals dd {
  color: var(--ink);
}

body:not(.portal-admin) .billing-totals .billing-totals-due dd {
  color: var(--heading-accent);
}

body:not(.portal-admin) .billing-totals dd.books-loss {
  color: #9d174d;
}

#financials-heading + .billing-totals {
  margin: 0 0 18px;
}

.books > .billing-totals {
  margin-bottom: 40px;
}

.books-section-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.books .admin-intro .portal-lead-actions {
  margin: 18px 0 30px;
}

/* Date pickers' calendar icons, light on the dark admin fields */
.portal-admin input[type="date"] {
  color-scheme: dark;
}

/* The gallery: photos with their notes. Each tile is the image itself, cropped to fit; a click
   opens the full image. At the top of the client portal, in the crew portal and on the panel. */
.photo-gallery {
  margin-top: 34px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
  gap: 22px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.photo-gallery .photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
  gap: 18px 14px;
}

.photo-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.photo-link {
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  background: var(--sage);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.photo-link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, opacity 0.2s ease;
}

.photo-link:hover img,
.photo-link:focus-visible img {
  transform: scale(1.04);
}

.photo-link:focus-visible {
  outline: 2px solid var(--heading-accent);
  outline-offset: 3px;
}

.photo-note {
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.photo-meta {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.crew-page .photo-grid {
  margin-top: 26px;
}

/* Add photos: several at once, sharing one note */
.photo-upload textarea {
  min-height: 92px;
  resize: vertical;
}

/* The client portal: Upload document and Gallery side by side */
.portal-uploads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 0 26px;
  align-items: start;
}

/* The panel's Gallery, on the dark theme: the master switch beside its heading, and each photo's
   Shown checkbox and trash button. A hidden photo is dimmed. */
.portal-admin .photo-link {
  border-color: rgba(255, 255, 255, 0.18);
  background: #003544;
  box-shadow: none;
}

.portal-admin .photo-link:hover,
.portal-admin .photo-link:focus-visible {
  border-color: #67e8f9;
}

.portal-admin .photo-link:focus-visible {
  outline-color: #67e8f9;
}

.portal-admin .photo-note {
  color: #ffffff;
}

.portal-admin .photo-meta {
  color: rgba(255, 255, 255, 0.62);
}

.photo-card.is-hidden .photo-link {
  border-style: dashed;
}

.photo-card.is-hidden .photo-link img {
  opacity: 0.35;
}

.admin-gallery-head {
  margin-top: 30px;
}

.photo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 2px;
}

.photo-actions form,
.gallery-master {
  margin: 0;
}

.photo-shown,
.gallery-master {
  display: flex;
  align-items: center;
  gap: 12px;
}

.photo-shown .portal-check,
.gallery-master .portal-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.gallery-master .portal-check {
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.photo-shown .portal-check input,
.gallery-master .portal-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  accent-color: #67e8f9;
}

.gallery-master .portal-check input {
  width: 20px;
  height: 20px;
}

.photo-actions .billing-trash {
  width: 32px;
  height: 32px;
}

.photo-shown [hidden],
.gallery-master [hidden] {
  display: none !important;
}

.portal-admin .photo-upload {
  margin-top: 4px;
}

/* Projects under this login: a checkbox for each other project, saved with the disk */
.admin-inline-form.admin-login-group {
  align-items: start;
}

.admin-login-group .icon-save {
  margin-top: 25px;
}

.admin-login-group fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.admin-login-group legend {
  margin-bottom: 8px;
  padding: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-login-group .portal-check {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.admin-login-group .portal-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: #67e8f9;
}

/* Projects under one login: the client switches between them at the top of the portal */
.project-switch {
  margin-bottom: 30px;
}

.project-switch form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-switch button,
.project-switch-current {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--white);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-switch button {
  cursor: pointer;
}

.project-switch button:hover,
.project-switch button:focus-visible {
  border-color: var(--heading-accent);
  color: var(--heading-accent);
  outline: none;
}

.project-switch-current {
  border-color: var(--heading-accent);
  color: #ffffff;
  background: var(--heading-accent);
}
