@font-face {
  font-family: "EB Garamond Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 400 800;
  src: url("/assets/fonts/eb-garamond-latin.woff2") format("woff2-variations");
}

@font-face {
  font-family: "EB Garamond Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 400 800;
  src: url("/assets/fonts/eb-garamond-latin-ext.woff2") format("woff2-variations");
}

:root {
  --navy: #011063;
  --royal: #1d27a8;
  --lav: #646a8f;
  --vlight: #edeff7;
  --grey: #e5e5ea;
  --green: #2e7d32;
  --greenbg: #c6efce;
  --amber: #9c6500;
  --amberbg: #ffeb9c;
  --red: #9c0006;
  --redbg: #ffc7ce;
  --bluebg: #ddebf7;
  --ink: #1b2148;
  --muted: #62698c;
  --surface: #ffffff;
  --page: #f4f5f9;
  --shadow: 0 12px 36px rgba(1, 16, 99, 0.09);
  --brand-900: #00165f;
  --brand-800: #16307c;
  --brand-soft: #eef1f9;
  --text: #2b3550;
  --soft: #f8f8f8;
  --line: #e3e3e3;
  --font-display: "EB Garamond Variable", "EB Garamond", Georgia, serif;
  --font-ui: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--navy);
}

a {
  color: var(--royal);
}

.hidden {
  display: none !important;
}

.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;
}

select,
input,
textarea,
button {
  font-size: 13px;
  padding: 7px 9px;
  border: 1px solid var(--grey);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--royal);
  outline-offset: 2px;
}

button {
  cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled,
textarea:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

button.primary,
.btn-primary {
  background: var(--royal);
  color: #fff;
  border-color: var(--royal);
  font-weight: 700;
}

button.primary:hover,
.btn-primary:hover {
  background: var(--navy);
  border-color: var(--navy);
}

.btn-secondary {
  background: #fff;
  color: var(--navy);
  border: 1px solid #cfd3e5;
  font-weight: 700;
}

.btn-secondary:hover {
  background: var(--vlight);
}

.btn-danger {
  background: #fff;
  border: 1px solid #d6a3a8;
  color: var(--red);
  font-weight: 700;
}

.btn-danger:hover {
  background: #fff3f4;
}

.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--navy);
}

.btn-quiet:hover {
  background: var(--vlight);
}

.btn-sm {
  padding: 4px 9px;
  font-size: 11.5px;
  border-radius: 6px;
}

/* ---------- Tracker shell ---------- */
header.app-header {
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

header.app-header h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.1px;
}

.header-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  color: #fff;
  text-decoration: none;
  flex: 0 0 auto;
}

.app-logo {
  width: 125px;
  height: auto;
  display: block;
}

.brand-tag {
  color: #c3c8ec;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

header.app-header label {
  font-size: 12px;
  color: #dfe2f3;
}

header.app-header select,
header.app-header button {
  border-color: transparent;
}

header.app-header select {
  padding: 6px 8px;
}

.header-spacer {
  flex: 1;
}

.header-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.identity-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #2f3db4;
  border: 1px solid rgba(255, 255, 255, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}

.identity-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.identity-name {
  font-size: 12px;
  font-weight: 700;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-role {
  font-size: 11px;
  color: #c3c8ec;
}

.header-link,
.header-button {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12px;
  text-decoration: none;
  font-weight: 700;
}

.header-link:hover,
.header-button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.user-menu {
  position: relative;
}

.user-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 7px 4px 5px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  user-select: none;
}

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

.user-summary:hover,
.user-menu[open] .user-summary {
  background: rgba(255, 255, 255, 0.14);
}

.user-chevron {
  color: #b9bfe5;
  font-size: 9px;
  margin-left: 2px;
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  z-index: 50;
  width: 200px;
  background: #fff;
  border: 1px solid var(--grey);
  border-radius: 10px;
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.28);
  padding: 5px;
  display: flex;
  flex-direction: column;
}

.user-menu-panel a,
.user-menu-panel button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--navy);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 10px;
  border-radius: 6px;
}

.user-menu-panel a:hover,
.user-menu-panel button:hover {
  background: var(--vlight);
}

.user-menu-panel button {
  color: var(--red);
  border-top: 1px solid #eef0f6;
  border-radius: 0 0 6px 6px;
  margin-top: 2px;
  padding-top: 10px;
}

.header-spacer {
  flex: 1;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid var(--grey);
  flex-wrap: wrap;
  align-items: center;
}

.tab {
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}

.tab:hover {
  background: var(--vlight);
}

.tab.active {
  background: var(--navy);
  color: #fff;
}

.tab-link {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.wrap {
  padding: 10px;
}

.tablewrap {
  width: 100%;
  overflow: auto;
  max-height: calc(100vh - 170px);
}

.tablewrap::-webkit-scrollbar {
  height: 10px;
}

.tablewrap::-webkit-scrollbar-thumb {
  background: #9aa0c0;
  border-radius: 6px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1240px;
  background: #fff;
  font-size: 12px;
}

th,
td {
  border: 1px solid var(--grey);
  padding: 4px 7px;
  text-align: left;
  vertical-align: top;
}

:fullscreen .wrap,
:-webkit-full-screen .wrap {
  height: calc(100vh - 92px);
  overflow: auto;
}

th {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 3;
}

tr.blocked td {
  background: #fff7f7;
}

tr.phaserow td {
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.3px;
  padding: 5px 9px;
}

tr.r-todo td {
  background: #fbfbfd;
}

tr.r-prog td {
  background: #fff6df;
}

tr.r-block td {
  background: #ffe3e3;
}

tr.r-done td {
  background: #e3f4e8;
}

tr.r-done td:first-child {
  color: #2f6b43;
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

.b-block {
  background: var(--redbg);
  color: var(--red);
}

.b-inst {
  background: #eef0f7;
  color: #5b6180;
  border: 1px solid #d3d8ea;
  font-weight: 600;
  cursor: help;
}

.sgn-wait {
  background: #b3122b;
  color: #fff;
  font-weight: 800;
  text-transform: uppercase;
  animation: sgnblink 1.1s steps(2, start) infinite;
}

@keyframes sgnblink {
  50% {
    opacity: 0.4;
  }
}

.sgn-ok {
  background: #5a807e;
  color: #fff;
  font-weight: 800;
  text-transform: uppercase;
}

.sgnbtn {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 5px;
  cursor: pointer;
  background: #5a807e;
  color: #fff;
  border: 0;
  font-weight: 700;
}

.sgnbtn:hover {
  background: #4a6c6a;
}

/* Owner cell — the name and its sign-off controls read as one stacked unit.
   Buttons share a height and left edge so wrapped labels stay legible. */
.owner-name {
  display: block;
  line-height: 1.35;
}

.owner-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin-top: 6px;
}

.owner-actions > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 8px;
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
  text-wrap: balance;
}

.reqsgn {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 5px;
  cursor: pointer;
  background: #fff;
  border: 1px solid #b3122b;
  color: #b3122b;
  font-weight: 700;
}

.reqsgn:hover {
  background: #faeef0;
}

.chip-req {
  padding: 2px 9px;
  border: 0;
  border-radius: 5px;
  background: #5a807e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.chip-req:hover {
  background: #4a6c6a;
}

.sgn-req {
  background: #fbefdd;
  border: 1px solid #d9822b;
  color: #8a5a12;
  font-weight: 800;
  text-transform: uppercase;
}

.btnblue {
  background: var(--royal);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 6px 12px;
  font-weight: 700;
  cursor: pointer;
}

.btnblue:hover {
  background: var(--navy);
}

.btnupload {
  background: #5a807e;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 6px 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
}

.btnupload:hover {
  background: #4a6c6a;
}

tr.locked td {
  opacity: 0.96;
}

.lockmark {
  color: #9aa0c0;
  font-size: 11px;
  margin-left: 4px;
}

.b-prog {
  background: var(--amberbg);
  color: var(--amber);
}

.b-done {
  background: var(--greenbg);
  color: var(--green);
}

.pill {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
}

.s-todo {
  background: #eee;
  color: #444;
}

.s-prog {
  background: var(--amberbg);
  color: var(--amber);
}

.s-block {
  background: var(--redbg);
  color: var(--red);
}

.s-done {
  background: var(--greenbg);
  color: var(--green);
}

.kan {
  display: flex;
  gap: 12px;
  overflow-x: auto;
}

.kcol {
  flex: 1;
  min-width: 230px;
  background: #fff;
  border: 1px solid var(--grey);
  border-radius: 8px;
  padding: 8px;
}

.kcol h3 {
  margin: 4px 0 8px;
  font-size: 13px;
  text-align: center;
  padding: 4px;
  border-radius: 6px;
}

.card {
  background: var(--vlight);
  border: 1px solid var(--grey);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  cursor: grab;
}

.card .t {
  font-weight: 700;
  margin-bottom: 4px;
}

.card.blk {
  border-color: var(--red);
  background: #fff2f2;
}

.meta {
  color: var(--lav);
  font-size: 11px;
}

.gantt {
  background: #fff;
  border: 1px solid var(--grey);
  border-radius: 8px;
  padding: 10px;
  overflow-x: auto;
}

.grow {
  display: grid;
  grid-template-columns: 260px 1fr;
  align-items: center;
  border-top: 1px solid var(--grey);
  min-height: 26px;
}

.grow > .grow-label {
  min-width: 0;
  padding: 2px 6px;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gbarwrap {
  position: relative;
  height: 18px;
  margin: 3px 0;
}

.gbar {
  position: absolute;
  height: 16px;
  border-radius: 4px;
  background: var(--royal);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
}

.gbar.blk {
  background: var(--red);
}

.gbar.done {
  background: var(--green);
}

.phaseh {
  background: var(--vlight);
  font-weight: 700;
  padding: 4px 8px;
  border-top: 2px solid var(--navy);
}

.cards-dash {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.kpi {
  background: #fff;
  border: 1px solid var(--grey);
  border-radius: 10px;
  padding: 10px 16px;
  min-width: 130px;
}

.kpi .n {
  font-size: 24px;
  font-weight: 700;
}

.kpi .l {
  font-size: 11px;
  color: var(--lav);
}

.barrow {
  display: grid;
  grid-template-columns: 230px 1fr 46px;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  font-size: 12px;
}

.barbg {
  background: var(--grey);
  border-radius: 6px;
  height: 14px;
  overflow: hidden;
}

.barfg {
  background: var(--royal);
  height: 14px;
}

.note {
  font-size: 11px;
  color: var(--lav);
}

.depinfo {
  font-size: 11.5px;
  color: var(--lav);
  margin-top: 3px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.rem {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  cursor: pointer;
  background: #fff;
}

.rem:hover {
  background: var(--vlight);
}

.empty-state {
  background: #fff;
  border: 1px dashed #cfd3e5;
  border-radius: 10px;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 24px;
  background: var(--soft);
  font-family: var(--font-ui);
}

.login-shell input,
.login-shell button,
.login-shell label,
.login-shell span,
.login-shell p {
  font-family: var(--font-ui);
}

.login-card {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 44px;
  box-shadow: 0 10px 40px rgba(0, 22, 95, 0.06);
}

.login-heading {
  margin-bottom: 30px;
}

.login-logo {
  width: 150px;
  height: auto;
  display: block;
  margin-bottom: 28px;
}

.login-heading h2 {
  margin: 0 0 9px;
  color: var(--brand-900);
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.login-heading > p:last-child {
  margin: 0;
  color: #707070;
  font-size: 14px;
  line-height: 1.55;
}

.login-card .alert {
  margin: -8px 0 18px;
  padding: 11px 13px;
  border-radius: 2px;
  font-size: 13px;
}

.login-card .alert-error {
  color: #a63c3c;
  background: #fbf0f0;
  border: 1px solid rgba(166, 60, 60, 0.3);
}

.login-card .field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.login-card .field > span {
  color: var(--brand-900);
  font-size: 13px;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid #cfd6e4;
  border-radius: 2px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-card input:focus,
.login-card input:focus-visible {
  outline: none;
  border-color: var(--brand-900);
  box-shadow: 0 0 0 3px rgba(0, 22, 95, 0.09);
}

.login-submit {
  width: 100%;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 18px;
  color: #fff;
  background: var(--brand-900);
  border: 0;
  border-radius: 2px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.login-submit:hover {
  background: var(--brand-800);
}

.login-submit:disabled {
  opacity: 0.55;
  cursor: default;
}

.button-arrow {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  transition: transform 0.2s;
}

.login-submit:hover .button-arrow {
  transform: translateX(2px);
}

/* ---------- Auth pages ---------- */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(380px, 0.95fr);
  background: var(--vlight);
}

.auth-brand {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 18%, rgba(119, 123, 173, 0.45), transparent 34%),
    radial-gradient(circle at 8% 92%, rgba(29, 39, 168, 0.62), transparent 40%),
    linear-gradient(145deg, #010b47 0%, var(--navy) 48%, #111d7a 100%);
  color: #fff;
  padding: clamp(28px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-brand::after {
  content: "";
  position: absolute;
  inset: auto -80px -190px auto;
  width: 440px;
  height: 440px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  box-shadow:
    0 0 0 36px rgba(255, 255, 255, 0.035),
    0 0 0 72px rgba(255, 255, 255, 0.025);
  pointer-events: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 13px;
  text-transform: uppercase;
  color: #d8dcf4;
}

.brand-mark::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: #7d86db;
  box-shadow: 0 0 0 4px rgba(125, 134, 219, 0.17);
}

.auth-brand-copy {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 36px 0;
}

.auth-brand-copy h1 {
  font-size: clamp(34px, 4.6vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 0 0 18px;
  font-weight: 800;
}

.auth-brand-copy p {
  color: #cbd0ed;
  font-size: 15px;
  line-height: 1.6;
  max-width: 420px;
  margin: 0;
}

.auth-brand-foot {
  position: relative;
  z-index: 1;
  font-size: 11px;
  color: #a7add8;
  letter-spacing: 0.03em;
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 4vw, 56px);
}

.auth-card {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid var(--grey);
  border-radius: 16px;
  padding: clamp(24px, 3.5vw, 36px);
  box-shadow: var(--shadow);
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.auth-card .auth-intro {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 22px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > label {
  font-size: 12px;
  font-weight: 700;
  color: #343b69;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font-size: 14px;
  padding: 10px 11px;
  border-color: #d4d7e3;
}

.field .hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 62px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
}

.password-toggle:hover {
  color: var(--navy);
  background: var(--vlight);
}

.auth-submit {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
}

.auth-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
}

.auth-note {
  margin-top: 20px;
  padding: 11px 13px;
  border-radius: 8px;
  background: #f6f7fc;
  border: 1px solid #e3e5f0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}

.alert {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.45;
  border: 1px solid transparent;
}

.alert-error {
  background: #fff3f4;
  border-color: #f0c6cb;
  color: var(--red);
}

.alert-success {
  background: #f1f9f3;
  border-color: #c5e3cc;
  color: #226632;
}

.alert-info {
  background: #f2f4fd;
  border-color: #d7dbf1;
  color: #3d467f;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.brand-logo {
  width: 150px;
  height: auto;
  display: block;
  margin-bottom: 24px;
}

/* ---------- External upload page ---------- */
.upload-page {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(24px, 6vw, 72px) 18px;
  background:
    radial-gradient(circle at 50% -10%, rgba(119, 123, 173, 0.22), transparent 46%),
    var(--page);
}

.upload-card {
  width: min(620px, 100%);
  background: #fff;
  border: 1px solid var(--grey);
  border-radius: 16px;
  padding: clamp(24px, 4vw, 38px);
  box-shadow: var(--shadow);
}

.upload-card h1 {
  margin: 0 0 8px;
  font-size: 27px;
  letter-spacing: -0.025em;
}

.upload-intro {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 20px;
}

.upload-exit {
  border: 1px solid #e3e5f0;
  background: #f8f9fd;
  border-radius: 10px;
  padding: 13px 15px;
  margin-bottom: 18px;
}

.upload-exit .label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 4px;
}

.upload-exit .value {
  font-size: 15px;
  font-weight: 700;
}

.upload-exit .expiry {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
}

.upload-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.upload-file-field input[type="file"] {
  width: 100%;
  font-size: 12.5px;
  padding: 9px;
  background: #fbfbfe;
}

.upload-footnote {
  border-top: 1px solid #eef0f6;
  margin-top: 20px;
  padding-top: 14px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.55;
}

.upload-success {
  margin-top: 16px;
}

#manageUploadLinksDialog {
  width: min(1080px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
}

#manageUploadLinksDialog .dialog-body {
  overflow-y: auto;
}

.link-table {
  min-width: 900px;
}

.link-table td {
  vertical-align: middle;
}

.link-label {
  font-weight: 700;
  max-width: 240px;
  overflow-wrap: anywhere;
}

.link-table .note {
  margin-top: 3px;
}

/* ---------- Simple page shell (account/admin) ---------- */
.page-shell {
  min-height: 100vh;
  background: var(--page);
}

.page-topbar {
  background: var(--navy);
  color: #fff;
  padding: 11px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.page-topbar h1 {
  font-size: 15px;
  margin: 0;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
}

.topbar-logo {
  width: 112px;
  height: auto;
  display: block;
}

.topbar-sep {
  color: rgba(255, 255, 255, 0.35);
}

.page-topbar .back-link {
  color: #dfe2f3;
  font-size: 12px;
  text-decoration: none;
  font-weight: 700;
}

.page-topbar .back-link:hover {
  color: #fff;
  text-decoration: underline;
}

.page-content {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px) 18px 48px;
}

.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-title-row h2 {
  margin: 0 0 5px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  max-width: 650px;
}

.panel {
  background: #fff;
  border: 1px solid var(--grey);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(1, 16, 99, 0.04);
}

.panel-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--grey);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-head h3 {
  margin: 0;
  font-size: 15px;
}

.panel-body {
  padding: 18px;
}

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

.profile-item {
  padding: 13px 14px;
  border: 1px solid #e6e8f0;
  border-radius: 9px;
  background: #fafbfe;
}

.profile-item .label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 700;
}

.profile-item .value {
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

/* ---------- Admin users ---------- */
.toolbar {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar input[type="search"] {
  min-width: 230px;
}

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

.user-table {
  min-width: 820px;
}

.user-table th {
  position: static;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.user-table td {
  vertical-align: middle;
  font-size: 12.5px;
  padding: 9px 10px;
}

.user-name {
  font-weight: 700;
  color: var(--ink);
}

.user-email {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 20px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-active {
  background: #e9f6ec;
  color: #2d713d;
}

.status-inactive {
  background: #f1f2f6;
  color: #6b7192;
}

.role-badge {
  background: #eef0fb;
  color: #3c4582;
  border-radius: 20px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button {
  white-space: nowrap;
}

.you-badge {
  background: var(--navy);
  color: #fff;
  border-radius: 20px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: 1px;
}

/* ---------- Dialogs, toasts ---------- */
dialog {
  border: 0;
  border-radius: 14px;
  padding: 0;
  width: min(520px, calc(100vw - 28px));
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(1, 16, 99, 0.28);
}

dialog::backdrop {
  background: rgba(1, 10, 54, 0.48);
}

.dialog-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--grey);
}

.dialog-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--navy);
}

.dialog-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.dialog-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dialog-actions {
  padding: 0 20px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.dialog-actions .left {
  margin-right: auto;
}

.temp-password-box {
  border: 1px dashed #b8bdd8;
  background: #f7f8fd;
  border-radius: 9px;
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.temp-password-box code {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  overflow-wrap: anywhere;
  flex: 1;
  min-width: 170px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  border-radius: 9px;
  padding: 11px 13px;
  background: #fff;
  border: 1px solid var(--grey);
  box-shadow: 0 12px 34px rgba(1, 16, 99, 0.16);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
  animation: toast-in 0.18s ease-out;
}

.toast.success {
  border-color: #b9dcc2;
}

.toast.error {
  border-color: #e6b6bc;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page);
  color: var(--muted);
  font-size: 13px;
  z-index: 999;
}

.loading-screen .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--royal);
  margin-right: 8px;
  animation: pulse 1s infinite ease-in-out;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
    transform: scale(0.8);
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .login-shell {
    padding: 32px 18px;
  }

  .login-card {
    padding: 30px 22px;
  }

  .login-heading h2 {
    font-size: 36px;
  }
}

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

  .auth-brand {
    min-height: 240px;
    padding: 28px;
  }

  .auth-brand-copy {
    margin: 24px 0 8px;
  }

  .auth-brand-copy h1 {
    font-size: 36px;
  }

  .auth-brand-copy p {
    font-size: 13px;
  }

  .auth-brand-foot {
    display: none;
  }

  .auth-main {
    padding: 24px 16px 40px;
    align-items: flex-start;
  }

  .account-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .upload-form-grid {
    grid-template-columns: 1fr;
  }

  header.app-header {
    padding: 9px 11px;
    gap: 8px;
  }

  .identity-copy {
    display: none;
  }

  .header-link,
  .header-button {
    padding: 6px 8px;
    font-size: 11px;
  }

  .tabs {
    padding: 7px 10px;
  }

  .page-topbar {
    padding: 10px 13px;
  }

  .page-content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar input[type="search"] {
    flex: 1;
    min-width: 150px;
  }
}

/* ---------- Responsive layout pass ---------- */
.header-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.header-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.header-field > span {
  white-space: nowrap;
}

.header-field select {
  height: 34px;
  min-width: 0;
}

.header-field-fund select {
  width: 100px;
}

.header-field-exit select {
  width: 180px;
}

.header-field-owner select {
  width: 130px;
}

.header-field-coinvest select {
  width: 88px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

header.app-header .signoff-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

header.app-header .signoff-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

header.app-header .signoff-toggle.on {
  background: #d9822b;
  border-color: #d9822b;
}

.signoff-toggle:disabled {
  opacity: 0.45;
  cursor: default;
}

.signoff-count {
  background: #fff;
  color: #b3122b;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 10.5px;
  line-height: 16px;
  min-width: 16px;
  text-align: center;
}

.signoff-toggle.on .signoff-count {
  background: rgba(255, 255, 255, 0.92);
  color: #8a5a12;
}

.signoff-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 16px 0;
  padding: 8px 12px;
  border: 1px solid #d9822b;
  border-radius: 6px;
  background: #fbefdd;
  color: #8a5a12;
  font-weight: 600;
}

.signoff-banner-show {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 3px 11px;
  border: 0;
  border-radius: 5px;
  background: #d9822b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.signoff-banner-show:hover {
  background: #bf6f1f;
}

.tabs-summary {
  margin-left: auto;
}

/* Dense tables keep every column on a laptop. Flexible columns replace the
   fixed 1,410px grid that pushed Comment off-screen below 1440px. */
.task-table {
  width: 100%;
  min-width: 1080px;
  table-layout: fixed;
}

.task-table .col-task {
  width: 21%;
}

.task-table .col-owner {
  width: 10%;
}

.task-table .col-phase {
  width: 8%;
}

.task-table .col-due {
  width: 10%;
}

.task-table .col-status {
  width: 9%;
}

.task-table .col-depends {
  width: 25%;
}

.task-table .col-comment {
  width: 17%;
}

.cp-table {
  width: 100%;
  min-width: 880px;
  table-layout: fixed;
}

.link-table {
  min-width: 800px;
}

.cp-table .col-cp-index {
  width: 4%;
}

.cp-table .col-cp-name {
  width: 33%;
}

.cp-table .col-cp-party {
  width: 14%;
}

.cp-table .col-cp-status {
  width: 13%;
}

.cp-table .col-cp-evidence {
  width: 20%;
}

.cp-table .col-cp-note {
  width: 16%;
}

.task-table th,
.task-table td,
.cp-table th,
.cp-table td {
  overflow-wrap: anywhere;
}

.status-select,
.cpst {
  width: 100%;
  min-height: 34px;
  font-weight: 700;
  border-radius: 6px;
}

.due-field {
  display: flex;
  align-items: center;
  gap: 4px;
}

.due-field .duein {
  flex: 1 1 auto;
  width: 72px;
  min-width: 0;
  padding: 4px 6px;
}

.due-field .duein.overdue {
  color: var(--red);
  font-weight: 700;
}

.due-field .dued {
  flex: 0 0 30px;
  width: 30px;
  padding: 2px;
  background: #fff;
}

.cmt,
.cpnote {
  width: 100%;
  border: 1px solid var(--grey);
  border-radius: 6px;
  font: inherit;
  overflow-wrap: anywhere;
}

.cmt {
  min-height: 48px;
  resize: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}

.cpnote {
  min-height: 32px;
}

.cp-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* Small laptops: keep all seven columns, but tighten the non-editable ones
   so the table fits without a hidden Comment column. Phone and tablet card
   layouts live below 1,025px, so the compact 12px select never applies where
   iOS would zoom the page on focus. */
@media (min-width: 1025px) and (max-width: 1200px) {
  .task-table {
    min-width: 860px;
  }

  .task-table .status-select {
    padding-right: 4px;
    padding-left: 6px;
    font-size: 12px;
  }

  .task-table .col-task {
    width: 22%;
  }

  .task-table .col-owner {
    width: 12%;
  }

  .task-table .col-phase {
    width: 8%;
  }

  .task-table .col-due {
    width: 10%;
  }

  .task-table .col-status {
    width: 10%;
  }

  .task-table .col-depends {
    width: 23%;
  }

  .task-table .col-comment {
    width: 15%;
  }
}

@media (max-width: 1400px) {
  .identity-copy {
    display: none;
  }

  .user-summary {
    padding-right: 6px;
  }
}

@media (max-width: 1024px) {
  .user-menu-panel {
    width: 210px;
  }
}

/* Tablets and phones: tables become readable records instead of a 1,240px
   canvas that must be scrolled sideways. The 1,025px boundary keeps the
   seven-column table from clipping dates and comments on small laptops. */
@media (max-width: 1024px) {
  input,
  select,
  textarea {
    font-size: 16px;
  }

  /* Component rules above set 12–14px controls. Repeat them here so every
     focusable field clears iOS's 16px zoom threshold on touch screens. */
  .field input,
  .field select,
  .field textarea,
  .login-card input,
  .upload-file-field input[type="file"] {
    font-size: 16px;
  }

  .tablewrap {
    max-height: none;
    overflow: visible;
  }

  .task-tablewrap,
  .cp-tablewrap,
  .admin-table-wrap {
    overflow: visible;
  }

  .task-table,
  .cp-table,
  .user-table,
  .link-table {
    display: block;
    width: 100%;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
  }

  .task-table thead,
  .cp-table thead,
  .user-table thead,
  .link-table thead {
    display: none;
  }

  .task-table tbody,
  .cp-table tbody {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .task-table tr:not(.phaserow),
  .cp-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px 14px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--grey);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  }

  .task-table tr.r-prog,
  .cp-table tr.r-prog {
    background: #fffbf2;
    border-color: #efe0bb;
  }

  .task-table tr.r-block {
    background: #fff6f6;
    border-color: #f0c6cb;
  }

  .task-table tr.r-done,
  .cp-table tr.r-done {
    background: #f5fbf6;
    border-color: #c5e3cc;
  }

  .task-table tr:not(.phaserow) td,
  .cp-table tr:not(.phaserow) td {
    display: block;
    padding: 0;
    border: 0;
    background: transparent !important;
    vertical-align: top;
  }

  .task-table tr:not(.phaserow) td[data-label]::before,
  .cp-table tr:not(.phaserow) td[data-label]::before,
  .user-table td[data-label]::before,
  .link-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .task-table .task-title {
    grid-column: 1 / -1;
    border-left: 0 !important;
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.4;
  }

  .task-table tr:not(.phaserow) td:nth-child(2) {
    grid-column: 1;
  }

  .task-table tr:not(.phaserow) td:nth-child(3) {
    display: none;
  }

  .task-table tr:not(.phaserow) td:nth-child(4) {
    grid-column: 2;
  }

  .task-table tr:not(.phaserow) td:nth-child(5),
  .task-table tr:not(.phaserow) td:nth-child(6),
  .task-table tr:not(.phaserow) td:nth-child(7) {
    grid-column: 1 / -1;
  }

  .owner-actions > button {
    min-height: 30px;
    padding-block: 5px;
  }

  .task-table tr.phaserow {
    display: block;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }

  .task-table tr.phaserow td {
    display: block;
    padding: 8px 10px !important;
    border: 0 !important;
    border-radius: 7px;
    font-size: 11px !important;
  }

  .task-table select,
  .task-table input,
  .task-table textarea,
  .cp-table select,
  .cp-table textarea {
    min-height: 44px;
  }

  .task-table select,
  .cp-table select {
    width: 100%;
  }

  .due-field {
    gap: 6px;
  }

  .due-field .duein {
    width: auto;
    flex: 1 1 auto;
  }

  .due-field .dued {
    flex: 0 0 38px;
    width: 38px;
  }

  .cmt {
    min-height: 64px;
    padding: 10px;
    font-size: 16px;
    line-height: 1.4;
  }

  .task-title .badge {
    margin-top: 4px;
  }

  .cp-table tr td.cp-index {
    display: none;
  }

  .cp-table .cp-title {
    grid-column: 1 / -1;
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.4;
  }

  .cp-table tr:not(.phaserow) td:nth-child(3) {
    grid-column: 1;
  }

  .cp-table tr:not(.phaserow) td:nth-child(4) {
    grid-column: 2;
  }

  .cp-table tr:not(.phaserow) td:nth-child(5),
  .cp-table tr:not(.phaserow) td:nth-child(6) {
    grid-column: 1 / -1;
  }

  .cp-table .cpnote {
    min-height: 60px;
    padding: 10px;
    font-size: 16px;
    line-height: 1.4;
  }

  .cp-table .cpup {
    min-height: 40px;
  }

  .cp-table .note a {
    overflow-wrap: anywhere;
  }

  /* Team accounts and upload links read as list rows inside their surface. */
  .user-table tbody,
  .link-table tbody {
    display: flex;
    flex-direction: column;
  }

  .user-table tbody tr,
  .link-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 9px 14px;
    padding: 13px 16px;
    border: 0;
    border-bottom: 1px solid #eef0f6;
    background: #fff;
  }

  .user-table tbody tr:last-child,
  .link-table tbody tr:last-child {
    border-bottom: 0;
  }

  .user-table td,
  .link-table td {
    display: block;
    padding: 0;
    border: 0;
    font-size: 13px;
  }

  .user-table .user-cell,
  .link-table .link-cell {
    grid-column: 1 / -1;
    padding-bottom: 9px;
    border-bottom: 1px solid #f1f2f7;
  }

  .user-table .user-name {
    font-size: 15px;
  }

  .user-table .user-actions,
  .link-table .link-actions {
    grid-column: 1 / -1;
    padding-top: 2px;
  }

  .user-table .row-actions {
    gap: 8px;
  }

  .user-table .row-actions button,
  .link-table .link-actions button {
    min-height: 40px;
  }

  .user-table tr.empty-row,
  .link-table tr.empty-row {
    display: block;
    padding: 22px 16px;
    border: 0;
    text-align: center;
  }
}

/* Phone chrome: brand and account on top, a single filter rail, then the
   actions. This replaces the five-row header that consumed half the screen. */
@media (max-width: 620px) {
  header.app-header {
    position: relative;
    display: block;
    padding: 10px 12px 12px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .header-brand {
    flex-direction: row;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding-right: 58px;
  }

  .app-logo {
    width: 104px;
  }


  .header-spacer {
    display: none;
  }

  .user-menu {
    position: absolute;
    top: 10px;
    right: max(12px, env(safe-area-inset-right));
  }

  .user-summary {
    min-height: 44px;
  }

  .user-menu-panel {
    width: 220px;
    top: calc(100% + 6px);
  }

  .header-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    margin: 8px -12px 10px;
    padding: 0 12px 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .header-filters::-webkit-scrollbar {
    display: none;
  }

  .header-field {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .header-field > span {
    color: #c3c8ec;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    line-height: 1;
    text-transform: uppercase;
  }

  .header-field select {
    width: auto;
    height: 44px;
    padding: 8px 10px;
    border-radius: 8px;
  }

  .header-field-fund select {
    width: 100px;
  }

  .header-field-exit select {
    width: 190px;
  }

  .header-field-owner select {
    width: 130px;
  }

  .header-field-coinvest select {
    width: 96px;
  }

  .header-actions {
    gap: 8px;
    flex-wrap: wrap;
  }

  .header-actions button {
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
  }

  .tabs {
    position: sticky;
    top: 0;
    z-index: 45;
    flex-wrap: nowrap;
    gap: 2px;
    padding: 6px 10px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    overflow-x: auto;
    scrollbar-width: none;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    -webkit-overflow-scrolling: touch;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 44px;
    padding: 0 10px;
    font-size: 12.5px;
    white-space: nowrap;
  }

  .tabs-summary {
    display: none;
  }

  .wrap {
    padding: 8px;
  }

  .cp-tools {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .cp-tools::-webkit-scrollbar {
    display: none;
  }

  .cp-tools .btnblue,
  .cp-tools .btn-secondary,
  .cp-tools .btnupload {
    flex: 0 0 auto;
    min-height: 44px;
    white-space: nowrap;
  }

  .cp-tools .header-spacer {
    display: none;
  }

  .cp-tools #cpAdd {
    order: 1;
  }

  .cp-tools #shareUploadLink {
    order: 2;
  }

  .cp-tools .btnupload {
    order: 3;
  }

  .cp-tools #cpTemplate {
    order: 4;
  }

  .cp-tools #cpImport {
    order: 5;
  }

  .cp-tools #manageUploadLinks {
    order: 6;
  }

  .cp-tools #cpClear {
    order: 7;
  }

  .cards-dash {
    gap: 8px;
  }

  .kpi {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    padding: 10px 13px;
  }

  .kpi .n {
    font-size: 22px;
  }

  .barrow {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 10px;
    margin: 9px 0;
  }

  .barrow > :first-child {
    grid-column: 1;
  }

  .barrow .barbg {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .barrow > :last-child {
    grid-column: 2;
    grid-row: 1;
    font-size: 11px;
  }

  .kan {
    gap: 10px;
    scroll-snap-type: x proximity;
    scroll-padding: 8px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .kcol {
    flex: 0 0 min(84vw, 310px);
    min-width: 0;
    scroll-snap-align: start;
  }

  .grow {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding: 7px 0;
  }

  .grow > :first-child {
    padding: 0 2px !important;
    font-size: 12px !important;
    overflow-wrap: anywhere;
  }

  .gbarwrap {
    height: 22px;
    margin: 2px 0 0;
  }

  .gbar {
    height: 20px;
    line-height: 20px;
    min-width: 56px !important;
  }

  .page-topbar {
    gap: 8px;
    padding: 10px 13px;
    padding-left: max(13px, env(safe-area-inset-left));
    padding-right: max(13px, env(safe-area-inset-right));
  }

  .topbar-logo {
    width: 88px;
  }

  .topbar-sep,
  #topIdentity {
    display: none;
  }

  .page-topbar h1 {
    font-size: 13px;
  }

  .page-topbar .header-link,
  .page-topbar .header-button {
    min-height: 38px;
    padding: 6px 9px;
    font-size: 11.5px;
  }

  .page-content {
    padding: 16px 12px 40px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .page-title-row {
    gap: 12px;
  }

  .page-title-row h2 {
    font-size: 22px;
  }

  .page-title-row .btn-primary {
    width: 100%;
    min-height: 44px;
  }

  .panel-head,
  .panel-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .toolbar {
    width: 100%;
    gap: 8px;
  }

  .toolbar input[type="search"],
  .toolbar select {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  .form-actions .btn-primary,
  .upload-card .form-actions .btn-primary,
  .auth-form .auth-submit {
    width: 100%;
    min-height: 44px;
  }

  .login-shell {
    min-height: 100dvh;
    padding: 28px 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .login-card {
    padding: 28px 22px;
  }

  .login-logo,
  .brand-logo {
    width: 132px;
  }

  .login-heading h2 {
    font-size: 34px;
  }

  .upload-page {
    min-height: 100dvh;
    padding: 24px 12px 40px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .upload-card {
    padding: 24px 20px;
  }

  .upload-card h1 {
    font-size: 24px;
  }

  .profile-grid {
    gap: 9px;
  }

  .account-layout {
    gap: 12px;
  }

  dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
  }

  .dialog-head {
    padding: 16px 16px 12px;
  }

  .dialog-body {
    padding: 14px 16px;
  }

  .dialog-actions {
    padding: 12px 16px 16px;
  }

  .dialog-actions button {
    flex: 1 1 0;
    min-height: 44px;
  }

  .toast-stack {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: calc(100vw - 20px);
  }
}

/* Dialogs are task surfaces, not posters: cap them to the viewport, scroll the
   body, and keep the actions reachable on short laptop and landscape screens. */
dialog {
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: hidden;
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog > form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.dialog-head,
.dialog-actions {
  flex: 0 0 auto;
}

.dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dialog-actions {
  border-top: 1px solid #eef0f6;
  padding-top: 14px;
  background: #fff;
  border-radius: 0 0 14px 14px;
}

#manageUploadLinksDialog {
  width: min(1080px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
}

@media (max-height: 560px) and (min-width: 621px) {
  dialog {
    max-height: calc(100dvh - 24px);
  }

  .dialog-head {
    padding: 14px 20px 10px;
  }

  .dialog-head p {
    display: none;
  }

  .dialog-body {
    padding: 12px 20px;
  }
}

/* The muted green action surfaces need a darker ground to carry white text
   at their small sizes. */
.btnupload,
.sgnbtn,
.sgn-ok {
  background: #4a6f6d;
}

.btnupload:hover,
.sgnbtn:hover {
  background: #3d5c5a;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

@media (max-width: 620px) {
  .topbar-actions {
    margin-left: auto;
  }
}

@media (max-width: 620px) {
  .header-filters {
    mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent 100%);
  }

  .signoff-banner {
    margin: 8px 8px 0;
    font-size: 12px;
  }
}

@media (min-width: 621px) and (max-width: 900px) {
  .header-field select {
    height: 40px;
  }

  .header-actions button {
    min-height: 40px;
  }

  .user-summary {
    min-height: 40px;
  }

  .tab {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
  }

  .page-topbar .header-link,
  .page-topbar .header-button {
    min-height: 38px;
  }

  .toolbar input,
  .toolbar select {
    min-height: 40px;
  }

  .cp-tools .btnblue,
  .cp-tools .btn-secondary,
  .cp-tools .btnupload,
  .dialog-actions button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 620px) {
  .cp-tools {
    mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent 100%);
  }
}

/* Tablet header: brand and actions share the top line, with the full filter
   row beneath. It keeps all four filters visible and saves a row over the
   wrapped desktop layout. */
@media (min-width: 621px) and (max-width: 900px) {
  header.app-header {
    padding: 10px 16px;
  }

  .header-spacer {
    display: none;
  }

  .header-actions {
    order: 2;
    margin-left: auto;
  }

  .user-menu {
    order: 3;
  }

  .header-filters {
    order: 4;
    flex: 1 0 100%;
    gap: 12px;
  }
}

@media (min-width: 621px) and (max-width: 900px) {
  .cards-dash {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cards-dash.cp-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .header-field-exit select {
    width: 210px;
  }
}

@media (max-width: 360px) {
  .tabs {
    gap: 1px;
  }

  .tab {
    padding: 0 7px;
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .header-field-exit select {
    width: 160px;
  }
}

@media (min-width: 621px) and (max-width: 900px) {
  .tabs {
    position: sticky;
    top: 0;
    z-index: 45;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  }
}

/* ---------- Device adaptation pass ---------- */

/* Laptop header: actions and account share the top line, filters take a
   full second row until the single-line desktop header has room. The
   1,420px boundary leaves room for the live sign-off counter badge. */
@media (min-width: 901px) and (max-width: 1420px) {
  header.app-header {
    padding: 10px 16px;
  }

  .header-spacer {
    display: none;
  }

  .header-actions {
    order: 2;
    margin-left: auto;
  }

  .user-menu {
    order: 3;
  }

  .header-filters {
    order: 4;
    flex: 1 0 100%;
    gap: 12px;
  }
}

@media (min-width: 1401px) and (max-width: 1500px) {
  .identity-copy {
    display: none;
  }

  .user-summary {
    padding-right: 6px;
  }
}

/* Phone chrome: every action stays in one swipeable rail above the sticky
   tabs instead of wrapping into a ragged second row. */
@media (max-width: 620px) {
  header.app-header {
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .header-actions {
    flex-wrap: nowrap;
    width: calc(100% + 24px);
    margin: 0 -12px;
    padding: 0 12px 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .header-actions::-webkit-scrollbar {
    display: none;
  }

  .header-actions > button {
    flex: 0 0 auto;
  }

  /* Only administrators have the extra import and reset actions; fade the
     rail edge only when those buttons actually make it overflow. */
  .header-actions:has(#taskImport:not(.hidden)) {
    mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent 100%);
  }

  .page-topbar {
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .page-topbar h1 {
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.22);
  }

  .wrap {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .page-content {
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }

  .login-shell {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  .upload-page {
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }

  .dialog-actions {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .user-menu-panel a,
  .user-menu-panel button {
    display: flex;
    align-items: center;
    min-height: 44px;
  }

  .password-toggle {
    min-width: 48px;
    min-height: 36px;
  }

  .signoff-banner {
    line-height: 1.35;
  }

  .signoff-banner-show {
    min-height: 40px;
    padding-inline: 14px;
  }
}

/* Tablet cards: use a third column for status so owner, due and status read
   as one control row instead of leaving half a row empty. */
@media (min-width: 720px) and (max-width: 1024px) {
  .task-table tr:not(.phaserow) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .task-table tr:not(.phaserow) td:nth-child(2) {
    grid-column: 1;
  }

  .task-table tr:not(.phaserow) td:nth-child(4) {
    grid-column: 2;
  }

  .task-table tr:not(.phaserow) td:nth-child(5) {
    grid-column: 3;
  }

  .task-table tr:not(.phaserow) td:nth-child(6),
  .task-table tr:not(.phaserow) td:nth-child(7) {
    grid-column: 1 / -1;
  }
}

/* Touch targets: sign-off and request actions are primary controls, not
   fine-pointer chips. */
@media (max-width: 1024px) {
  .owner-actions > button {
    min-height: 40px;
    padding-block: 8px;
    font-size: 12px;
  }

  .rem {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 4px 8px;
  }

  .signoff-banner-show {
    min-height: 40px;
  }

  .due-field .dued {
    flex: 0 0 44px;
    width: 44px;
  }

  /* On touch-sized screens the timeline label is the content; wrap it
     instead of hiding the end of every long task name. */
  .grow > .grow-label {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 620px) {
  .owner-actions > button {
    min-height: 44px;
  }

  .cp-table .cpup {
    min-height: 44px;
  }

  .password-toggle {
    min-height: 40px;
  }

  .temp-password-box .btn-sm {
    min-height: 40px;
    padding-inline: 14px;
  }

  /* Landscape phones keep the notch away from cards, dialogs and toasts. */
  .wrap {
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }

  .signoff-banner {
    margin-left: max(8px, env(safe-area-inset-left));
    margin-right: max(8px, env(safe-area-inset-right));
  }

  dialog,
  #manageUploadLinksDialog {
    width: calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right));
  }

  .toast-stack {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    width: auto;
  }
}

/* Small tablets: below 732px the top-line actions and the four filters no
   longer fit together, so use the compact header rhythm instead of letting
   the account chip and Co-invest filter drop into ragged rows. */
@media (min-width: 621px) and (max-width: 731px) {
  header.app-header {
    position: relative;
    display: block;
    padding: 10px 12px 12px;
  }

  .header-brand {
    flex-direction: row;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding-right: 58px;
  }

  .app-logo {
    width: 104px;
  }

  .header-spacer {
    display: none;
  }

  .user-menu {
    position: absolute;
    top: 10px;
    right: 12px;
  }

  .user-summary {
    min-height: 44px;
  }

  .header-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    margin: 8px -12px 10px;
    padding: 0 12px 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .header-filters::-webkit-scrollbar {
    display: none;
  }

  .header-field {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .header-field > span {
    color: #c3c8ec;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    line-height: 1;
    text-transform: uppercase;
  }

  .header-field select {
    width: auto;
    height: 44px;
    padding: 8px 10px;
    border-radius: 8px;
  }

  .header-field-fund select {
    width: 100px;
  }

  .header-field-exit select {
    width: 190px;
  }

  .header-field-owner select {
    width: 130px;
  }

  .header-field-coinvest select {
    width: 96px;
  }

  .header-actions {
    flex-wrap: nowrap;
    width: calc(100% + 24px);
    margin: 0 -12px;
    padding: 0 12px 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .header-actions::-webkit-scrollbar {
    display: none;
  }

  .header-actions > button {
    flex: 0 0 auto;
    min-height: 44px;
  }
}

/* Touch input also appears on tablets and touch laptops wider than the card
   breakpoint. Keep fields at 16px there so iOS never zooms the page when a
   control takes focus. */
@media (pointer: coarse) {
  input,
  select,
  textarea,
  .field input,
  .field select,
  .field textarea,
  .login-card input,
  .upload-file-field input[type="file"],
  .task-table .status-select {
    font-size: 16px;
  }
}
