:root {
  --ink: #181817;
  --muted: #6f706c;
  --paper: #f4f2ec;
  --card: #fffefa;
  --line: #d9d6cd;
  --accent: #be5b2b;
  --soft: #e8e3d9;
  --error: #a6352b;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
.site-header { display: flex; align-items: baseline; gap: 12px; padding: 28px clamp(22px, 5vw, 72px); }
.brand { color: var(--ink); font-size: 1.15rem; font-weight: 800; letter-spacing: .22em; text-decoration: none; }
.product-name { color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .2em; }
main { width: min(800px, calc(100% - 36px)); margin: 5vh auto 8vh; }
.intro { max-width: 650px; margin-bottom: 34px; }
.eyebrow, .step-label { margin: 0 0 10px; color: var(--accent); font-size: .75rem; font-weight: 800; letter-spacing: .16em; }
h1 { max-width: 640px; margin: 0; font-size: clamp(2.35rem, 7vw, 4.6rem); font-weight: 500; line-height: .98; letter-spacing: -.055em; }
.lede { max-width: 590px; margin: 22px 0 0; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: clamp(24px, 5vw, 48px); box-shadow: 0 22px 60px rgba(30, 28, 23, .08); }
#loading { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 2px solid var(--soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.form-topline { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 32px; }
.form-topline h2, .state-card h2 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.25rem); font-weight: 500; letter-spacing: -.035em; }
.progress { display: flex; gap: 6px; padding-top: 8px; }
.progress span { display: block; width: 36px; height: 4px; background: var(--soft); border-radius: 999px; }
.progress span.active { background: var(--accent); }
.step { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 20px; margin: 0; padding: 0; border: 0; }
.field { display: flex; flex-direction: column; gap: 8px; }
.full { grid-column: 1 / -1; }
label, .choice-label { font-size: .9rem; font-weight: 700; }
label span { color: var(--accent); }
input, select, textarea { width: 100%; min-height: 50px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 12px 14px; color: var(--ink); font: inherit; outline: none; transition: border-color .2s, box-shadow .2s; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(190, 91, 43, .12); }
input[readonly] { color: var(--muted); background: #f1efe9; }
small { color: var(--muted); font-size: .78rem; }
.choice-field { gap: 13px; }
.choices { display: flex; gap: 12px; flex-wrap: wrap; }
.choices label { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; font-weight: 500; }
.choices input, .consent input { width: 18px; min-height: 18px; accent-color: var(--accent); }
.account-note { padding: 18px; border-radius: 10px; background: #f1eee7; }
.account-note p { margin: 7px 0 0; color: var(--muted); line-height: 1.5; }
.consent { display: flex; align-items: flex-start; gap: 12px; color: var(--muted); font-weight: 500; line-height: 1.5; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 34px; }
.button { min-height: 50px; border-radius: 8px; padding: 0 22px; border: 1px solid var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.button.primary { background: var(--ink); color: #fff; }
.button.secondary { background: transparent; color: var(--ink); }
.button:disabled { opacity: .55; cursor: wait; }
.form-error { margin-bottom: 24px; padding: 13px 15px; border-radius: 8px; color: var(--error); background: #f8e9e6; line-height: 1.45; }
.state-card { text-align: center; padding-block: 60px; }
.state-card > p:not(.eyebrow) { max-width: 540px; margin: 18px auto; color: var(--muted); line-height: 1.6; }
.state-mark { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 22px; border-radius: 50%; color: #fff; background: var(--ink); font-size: 1.35rem; font-weight: 700; }
.success .state-mark { background: var(--accent); }
.text-link { color: var(--ink); font-weight: 700; text-underline-offset: 4px; }
.next-step { display: flex; align-items: center; gap: 15px; max-width: 480px; margin: 12px auto 0; padding: 15px 18px; text-align: left; border-radius: 10px; background: #f1eee7; }
.next-step span { color: var(--accent); font-size: .75rem; font-weight: 800; }
.next-step p { margin: 0; color: var(--ink); }
footer { padding: 26px; color: var(--muted); text-align: center; font-size: .78rem; }
.staff-shell { width: min(1240px, calc(100% - 40px)); margin-top: 3vh; }
.auth-panel { width: min(560px, 100%); margin: 5vh auto; }
.auth-panel h1 { font-size: clamp(2.5rem, 6vw, 4rem); }
.login-form { display: grid; gap: 20px; margin-top: 32px; }
.login-form .button { width: 100%; }
.text-button { display:inline-flex; align-items:center; justify-content:center; min-height:42px; padding:0; border:0; background:transparent; color:var(--ink); font:inherit; font-weight:700; text-decoration:underline; text-underline-offset:4px; cursor:pointer; }
.text-button:hover { color:var(--accent); }
.success-message { padding:13px 15px; border-radius:8px; color:#246541; background:#e5f3ea; line-height:1.45; }
.dashboard-head { display:flex; align-items:flex-end; justify-content:space-between; gap:30px; margin-bottom:28px; }
.dashboard-head h1 { font-size:clamp(2.7rem,6vw,5rem); }
.team-actions { display:flex; align-items:center; gap:10px; color:var(--muted); font-size:.85rem; }
.quiet-button,.close-button { border:1px solid var(--line); background:var(--card); color:var(--ink); border-radius:8px; min-height:40px; padding:0 14px; cursor:pointer; font-weight:700; }
.invite-button{background:var(--ink);border-color:var(--ink);color:#fff}
.metrics { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:18px; }
.metrics article { display:flex; flex-direction:column; gap:5px; padding:20px; background:var(--card); border:1px solid var(--line); border-radius:12px; }
.metrics strong { font-size:2rem; font-weight:500; }
.metrics span { color:var(--muted); font-size:.82rem; }
.toolbar { display:grid; grid-template-columns:1fr 180px; gap:12px; margin-bottom:12px; }
.toolbar input,.toolbar select { background:var(--card); }
.project-list { overflow:hidden; border:1px solid var(--line); border-radius:14px; background:var(--card); }
.project-row { position:relative; display:grid; grid-template-columns:minmax(260px,1.4fr) minmax(190px,1fr) 150px 110px 20px; align-items:center; gap:18px; width:100%; padding:20px 22px; border:0; border-bottom:1px solid var(--line); background:transparent; color:var(--ink); text-align:left; cursor:pointer; }
.project-row:last-child { border-bottom:0; }
.project-row:hover { background:#f7f5ef; }
.project-main { display:flex; align-items:center; gap:13px; min-width:0; }
.project-main div,.project-stage,.project-owner { display:flex; flex-direction:column; gap:5px; min-width:0; }
.project-main strong,.project-main span,.project-stage span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.project-main span,.project-stage small,.project-owner small { color:var(--muted); font-size:.78rem; }
.project-stage span,.project-owner span { font-size:.88rem; font-weight:700; }
.status-dot { width:9px; height:9px; border-radius:50%; flex:0 0 auto; background:#6b6d69; }
.status-dot.active { background:#38805a; }.status-dot.paused { background:#cc8e2e; }.status-dot.on_hold { background:#a94e3f; }.status-dot.closed { background:#737373; }
.row-progress { height:5px; background:var(--soft); border-radius:999px; overflow:hidden; }.row-progress i{display:block;height:100%;background:var(--accent);border-radius:inherit;}
.row-arrow { font-size:1.7rem; color:var(--muted); }
.empty-state,.dashboard-error { padding:30px; text-align:center; color:var(--muted); border:1px solid var(--line); border-radius:12px; background:var(--card); }
.dashboard-error { color:var(--error); margin-bottom:12px; background:#f8e9e6; }
.detail-backdrop { position:fixed; inset:0; z-index:20; background:rgba(20,20,18,.38); backdrop-filter:blur(2px); }
.project-detail { position:fixed; top:0; right:0; z-index:21; width:min(660px,100%); height:100vh; overflow:auto; padding:30px; background:var(--paper); box-shadow:-20px 0 60px rgba(0,0,0,.18); }
.detail-header { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:25px; }
.detail-header h2 { margin:0; font-size:clamp(1.8rem,4vw,2.7rem); font-weight:500; letter-spacing:-.035em; }
.close-button { width:44px; padding:0; font-size:1.6rem; }
.detail-summary { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:14px; }
.detail-summary>div { display:flex; flex-direction:column; gap:6px; padding:17px; border:1px solid var(--line); border-radius:10px; background:var(--card); }
.detail-summary span,.detail-summary small { color:var(--muted); font-size:.76rem; }.detail-summary strong { font-size:.9rem; }
.workflow-card,.detail-section { padding:22px; margin-top:14px; border:1px solid var(--line); border-radius:12px; background:var(--card); }
.workflow-card { display:grid; gap:17px; }.workflow-card h3,.detail-section h3 { margin:0 0 4px; font-size:1rem; }.two-col{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
.workflow-message { padding:12px; border-radius:8px; font-size:.86rem; }.success-message{color:#246541;background:#e5f3ea}.error-message{color:var(--error);background:#f8e9e6}
.detail-section>p { margin:12px 0 0; color:var(--muted); line-height:1.6; }
.timeline { margin-top:18px; }.timeline article { display:grid; grid-template-columns:12px 1fr; gap:12px; padding-bottom:18px; }.timeline i { width:9px;height:9px;margin-top:4px;border-radius:50%;background:var(--accent);}.timeline div{display:flex;flex-direction:column;gap:4px}.timeline span,.timeline p{color:var(--muted);font-size:.78rem}.timeline p{margin:4px 0 0;line-height:1.5}
.comm-list { margin-top:14px; }.comm-list article { display:flex;justify-content:space-between;gap:15px;padding:13px 0;border-top:1px solid var(--line);}.comm-list article>div{display:flex;flex-direction:column;gap:4px}.comm-list article span{color:var(--muted);font-size:.75rem}.comm-status{align-self:flex-start;padding:5px 8px;border-radius:999px;background:var(--soft);font-weight:700}.comm-status.sent,.comm-status.delivered{color:#246541;background:#e5f3ea}.comm-status.failed{color:var(--error);background:#f8e9e6}
.detail-loading { padding:50px 20px; text-align:center; color:var(--muted); }
.modal-backdrop{position:fixed;inset:0;z-index:30;background:rgba(20,20,18,.45);backdrop-filter:blur(3px)}.invite-modal{position:fixed;z-index:31;top:50%;left:50%;width:min(520px,calc(100% - 30px));max-height:calc(100vh - 30px);overflow:auto;transform:translate(-50%,-50%);padding:28px;border:1px solid var(--line);border-radius:16px;background:var(--card);box-shadow:0 24px 80px rgba(0,0,0,.2)}.modal-head{display:flex;justify-content:space-between;align-items:flex-start;gap:18px}.modal-head h2{margin:0;font-size:1.8rem;font-weight:500;letter-spacing:-.035em}.modal-copy{color:var(--muted);line-height:1.55}.invite-modal .login-form{margin-top:22px}.sign-in-link{display:inline-flex;align-items:center;justify-content:center;text-decoration:none}.state-card .sign-in-link{margin-top:10px}
.section-heading { display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:16px }.section-heading>div{display:flex;align-items:baseline;gap:10px}.section-heading h3{margin:0}.section-heading span{color:var(--muted);font-size:.75rem}
.request-form{display:grid;grid-template-columns:1fr auto;align-items:end;gap:10px;padding-bottom:18px}.request-form .button{white-space:nowrap}
.document-list article{display:grid;grid-template-columns:minmax(160px,1fr) auto;align-items:center;gap:8px;padding:14px 0;border-top:1px solid var(--line)}.document-request-copy{display:flex;flex-direction:column;gap:4px}.document-request-copy span{color:var(--muted);font-size:.73rem}.request-status{padding:5px 8px;border-radius:999px;background:var(--soft);font-size:.7rem;font-weight:700}.request-status.uploaded{color:#744914;background:#f5e8cf}.request-status.accepted{color:#246541;background:#e5f3ea}.file-button,.accept-document{grid-column:1 / -1;text-align:left;border:1px solid var(--line);border-radius:7px;background:#f7f5ef;padding:10px 12px;color:var(--ink);cursor:pointer;font:inherit;font-size:.8rem;font-weight:700}.accept-document{background:var(--ink);color:#fff;text-align:center}
.client-shell { width:min(1120px,calc(100% - 40px)); margin:4vh auto 9vh; }
.client-head { display:flex;align-items:flex-end;justify-content:space-between;gap:24px;margin-bottom:28px; }
.client-head h1 { font-size:clamp(2.7rem,7vw,5.2rem); }
.client-project { margin-bottom:28px; }
.client-project-title { display:flex;justify-content:space-between;align-items:flex-start;gap:24px;margin-bottom:18px; }
.client-project-title>div>span { color:var(--accent);font-size:.74rem;font-weight:800;letter-spacing:.13em;text-transform:uppercase; }
.client-project-title h2 { margin:8px 0 5px;font-size:clamp(1.8rem,4vw,3rem);font-weight:500;letter-spacing:-.04em; }
.client-project-title p { margin:0;color:var(--muted); }
.client-status { padding:8px 12px;border:1px solid var(--line);border-radius:999px;background:var(--card);font-size:.78rem;font-weight:700; }
.client-progress-card { padding:26px;border-radius:14px;background:var(--ink);color:#fff; }
.progress-copy { display:flex;justify-content:space-between;align-items:flex-end;gap:25px; }
.progress-copy span,.responsibility-card>span { color:#d59a79;font-size:.7rem;font-weight:800;letter-spacing:.15em; }
.progress-copy h3 { margin:8px 0 5px;font-size:clamp(1.45rem,3vw,2.2rem);font-weight:500; }.progress-copy p{margin:0;color:#aaa9a4;font-size:.84rem}.progress-copy>strong{font-size:2rem;font-weight:500}
.client-progress-track { height:7px;margin-top:24px;border-radius:999px;background:#3c3c39;overflow:hidden; }.client-progress-track i{display:block;height:100%;border-radius:inherit;background:var(--accent)}
.client-grid { display:grid;grid-template-columns:1fr 1.5fr;gap:12px;margin-top:12px; }
.responsibility-card,.project-facts,.client-panel { padding:24px;border:1px solid var(--line);border-radius:12px;background:var(--card); }
.responsibility-card h3 { margin:9px 0;font-size:1.4rem;font-weight:500; }.responsibility-card p{margin:0;color:var(--muted);line-height:1.55}
.project-facts { display:grid;grid-template-columns:repeat(3,1fr);gap:14px; }.project-facts div{display:flex;flex-direction:column;gap:7px}.project-facts span{color:var(--muted);font-size:.74rem}.project-facts strong{font-size:.86rem}
.client-content-grid { display:grid;grid-template-columns:.85fr 1.15fr;gap:12px;margin-top:12px;align-items:start; }.client-content-grid>div{display:grid;gap:12px}
.client-panel h3 { margin:0 0 18px;font-size:1rem; }
.stage-list { list-style:none;margin:0;padding:0; }.stage-list li{display:grid;grid-template-columns:34px 1fr;gap:11px;position:relative;padding-bottom:16px;color:var(--muted)}.stage-list li:before{content:"";position:absolute;left:14px;top:28px;bottom:2px;width:1px;background:var(--line)}.stage-list li:last-child:before{display:none}.stage-list li>span{display:grid;place-items:center;width:29px;height:29px;border:1px solid var(--line);border-radius:50%;background:var(--card);font-size:.67rem;font-weight:800}.stage-list li div{display:flex;flex-direction:column;gap:4px;padding-top:5px}.stage-list li strong{font-size:.84rem}.stage-list li small{color:var(--accent);font-size:.72rem}.stage-list li.complete{color:var(--ink)}.stage-list li.complete>span{color:#fff;border-color:var(--ink);background:var(--ink)}.stage-list li.current{color:var(--ink)}.stage-list li.current>span{color:#fff;border-color:var(--accent);background:var(--accent)}
.client-updates article { padding:16px 0;border-top:1px solid var(--line) }.client-updates article:first-child{padding-top:0;border-top:0}.client-updates article>div{display:flex;justify-content:space-between;gap:12px}.client-updates strong{font-size:.9rem}.client-updates span{color:var(--muted);font-size:.74rem;white-space:nowrap}.client-updates p{margin:9px 0 0;color:var(--muted);font-size:.86rem;line-height:1.55;white-space:pre-line}.muted-copy{color:var(--muted);font-size:.86rem}.client-timeline{margin-top:0}
.client-documents{margin-top:12px}.client-request-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.client-request{display:flex;flex-direction:column;align-items:flex-start;gap:9px;padding:17px;border:1px solid var(--line);border-radius:9px;background:#faf9f5}.client-request>div:first-child{display:flex;justify-content:space-between;gap:12px;width:100%}.client-request>div span{color:var(--muted);font-size:.7rem;text-transform:uppercase}.client-request>small{color:var(--muted);font-size:.7rem}.upload-control{position:relative;display:inline-flex}.upload-control input{position:absolute;opacity:0;width:1px;height:1px}.upload-control span{display:inline-block;padding:9px 12px;border-radius:7px;background:var(--ink);color:#fff;font-size:.78rem;font-weight:700;cursor:pointer}.upload-message{width:100%;padding:10px;border-radius:7px;font-size:.76rem}.client-file{width:100%;grid-column:auto}
.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; }

@media (max-width: 620px) {
  .site-header { padding: 22px; }
  main { margin-top: 3vh; }
  .card { border-radius: 12px; }
  .step { grid-template-columns: 1fr; }
  .full { grid-column: 1; }
  .form-topline { display: block; }
  .progress { margin-top: 20px; }
  .progress span { flex: 1; }
  .actions { justify-content: stretch; }
  .button { flex: 1; padding-inline: 12px; }
  .staff-shell { width:min(100% - 24px,1240px); }
  .client-shell{width:min(100% - 24px,1120px)}.client-head{align-items:flex-start}.client-project-title{flex-direction:column}.client-grid,.client-content-grid,.project-facts,.client-request-list{grid-template-columns:1fr}.progress-copy{align-items:flex-start}.progress-copy>strong{font-size:1.4rem}.client-progress-card,.responsibility-card,.project-facts,.client-panel{padding:20px}.request-form{grid-template-columns:1fr}
  .dashboard-head { align-items:flex-start; flex-direction:column; }.team-actions{flex-wrap:wrap}.team-actions>span{width:100%}
  .metrics { grid-template-columns:1fr 1fr; }.toolbar{grid-template-columns:1fr}.project-row{grid-template-columns:1fr 20px;padding:17px}.project-stage,.project-owner,.row-progress{grid-column:1}.row-arrow{grid-column:2;grid-row:1 / span 4}.project-detail{padding:22px}.detail-summary,.two-col{grid-template-columns:1fr}
}

@media (min-width: 621px) and (max-width: 960px) { .project-row{grid-template-columns:1fr 1fr 24px}.project-owner,.row-progress{grid-column:auto}.row-progress{grid-column:1 / 3}.row-arrow{grid-column:3;grid-row:1 / 3}.metrics{grid-template-columns:repeat(2,1fr)} }

@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
