/* Mudan client portal — demo */
:root {
  --char: #0f0f0f; --char-2: #181716; --char-3: #24221f;
  --off: #f5f2ed; --paper: #faf8f4; --white: #fff;
  --line: #e2ddd3; --line-2: #d3cdc1;
  --ink: #201e1a; --ink-2: #4a463f; --muted: #6f6a60;
  --clay: #b8543a; --clay-soft: #d98a6c; --clay-bg: #f6e7e1;
  --ok: #2f6b4f; --ok-bg: #e3efe8; --warn: #8a5a12; --warn-bg: #f7ecd9; --bad: #9c3b2a; --bad-bg: #f6e1dc;
  --navy: #1b2a4a;
  --serif: 'Fraunces', Georgia, serif; --sans: 'Inter Tight', system-ui, sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace;
  --r: 4px; --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--off); -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.5; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }
p { margin: 0; }
button { font: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.eyebrow { color: var(--clay); }
[hidden] { display: none !important; }

.demo-ribbon { position: fixed; z-index: 200; bottom: 14px; left: 14px; background: var(--char); color: var(--off); font: 500 11px/1 var(--mono); letter-spacing: .06em; padding: 9px 14px; border-radius: 999px; box-shadow: 0 8px 30px rgba(0,0,0,.25); white-space: nowrap; }
@media (max-width: 900px) { .demo-ribbon { position: static; display: block; border-radius: 0; text-align: center; font-size: 10px; padding: 8px 10px; white-space: normal; box-shadow: none; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 42px; padding: .6rem 1.1rem; border-radius: var(--r); border: 1px solid var(--char); cursor: pointer; font-size: 14px; font-weight: 500; transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-dark { background: var(--char); color: var(--off); }
.btn-dark:hover { background: var(--clay); border-color: var(--clay); }
.btn-line { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-line:hover { border-color: var(--char); }
.btn-clay { background: var(--clay); color: #fff; border-color: var(--clay); }
.btn-clay:hover { background: #9c4530; }
.btn-sm { min-height: 34px; padding: .4rem .8rem; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; text-align: left; }

/* sign in */
.signin { min-height: 100svh; display: grid; grid-template-columns: 1.1fr 1fr; }
.signin-art { position: relative; background: var(--char); }
.signin-art img { width: 100%; height: 100%; object-fit: cover; opacity: .92; }
.signin-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,15,15,0) 50%, rgba(15,15,15,.55)); }
.signin-panel { padding: clamp(2rem, 6vw, 5rem); display: flex; flex-direction: column; justify-content: center; gap: 1rem; max-width: 560px; }
.signin-logo { height: 34px; width: auto; margin-bottom: 1.5rem; align-self: flex-start; }
.signin h1 { font-family: var(--serif); font-weight: 300; font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 1; letter-spacing: -.03em; }
.signin h1 em { font-style: italic; display: block; }
.signin-form { display: grid; gap: .5rem; margin-top: 1rem; }
.signin-form label { font-size: 12px; color: var(--muted); margin-top: .4rem; }
.signin-form input { min-height: 46px; border: 1px solid var(--line-2); border-radius: var(--r); padding: .6rem .8rem; font: inherit; background: var(--white); }
.signin-form .btn { margin-top: .5rem; min-height: 48px; }
@media (max-width: 860px) { .signin { grid-template-columns: 1fr; } .signin-art { height: 34svh; } }

/* app shell */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100svh; }
.side { background: var(--char); color: var(--off); display: flex; flex-direction: column; padding: 22px 16px; position: sticky; top: 0; height: 100svh; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 26px; }
.side-logo { height: 26px; width: auto; }
.side-role { font: 500 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; padding: 5px 8px; border: 1px solid rgba(245,242,237,.25); border-radius: 999px; color: var(--clay-soft); }
.side-nav { display: grid; gap: 2px; }
.side-nav button { display: flex; align-items: center; gap: .75rem; width: 100%; background: none; border: 0; color: rgba(245,242,237,.72); padding: .7rem .75rem; border-radius: var(--r); cursor: pointer; text-align: left; font-size: 14px; }
.side-nav button svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.side-nav button:hover { background: rgba(245,242,237,.06); color: var(--off); }
.side-nav button[aria-current="page"] { background: rgba(245,242,237,.1); color: var(--off); }
.side-nav .count { margin-left: auto; font: 500 10px/1 var(--mono); background: var(--clay); color: #fff; border-radius: 999px; padding: 4px 6px; }
.side-nav .sep { height: 1px; background: rgba(245,242,237,.1); margin: 10px 8px; }
.side-foot { margin-top: auto; display: grid; gap: .55rem; padding: 16px 8px 40px; border-top: 1px solid rgba(245,242,237,.1); font-size: 13px; color: rgba(245,242,237,.7); }
.who b { color: var(--off); font-weight: 500; display: block; }

.main { padding: 28px clamp(16px, 3vw, 40px) 90px; min-width: 0; outline: none; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.topbar h2 { font-family: var(--serif); font-weight: 300; font-size: clamp(1.7rem, 3vw, 2.4rem); letter-spacing: -.02em; line-height: 1.1; margin-top: 6px; }
.crumbs { color: var(--muted); }
.topbar-r { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
select.sel { min-height: 40px; border: 1px solid var(--line-2); border-radius: var(--r); padding: 0 .7rem; background: var(--white); font: inherit; font-size: 14px; max-width: 100%; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side, .main { min-width: 0; }
  .side { position: sticky; top: 0; z-index: 50; height: auto; padding: 12px; }
  .side-top { padding: 0 4px 10px; }
  .side-nav { display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav button { white-space: nowrap; padding: .55rem .7rem; width: auto; font-size: 13px; }
  .side-nav .sep { display: none; }
  .side-foot { display: none; }
  .main { padding-top: 20px; }
}

/* cards & grid */
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: 1.4fr 1fr; }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g-2 { grid-template-columns: 1fr; } .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .g-3, .g-4 { grid-template-columns: 1fr; } }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; }
.card h3 { font-family: var(--serif); font-size: 1.3rem; letter-spacing: -.01em; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 14px; flex-wrap: wrap; }
.kpi .lab { font: 500 10.5px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kpi .val { font-family: var(--serif); font-size: 2rem; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* project hero card */
.proj-hero { display: grid; grid-template-columns: 300px 1fr; gap: 0; padding: 0; overflow: hidden; }
.proj-hero img { width: 100%; height: 100%; object-fit: cover; min-height: 200px; }
.proj-hero .body { padding: 22px; display: grid; gap: 12px; align-content: start; }
.proj-hero h3 { font-size: 1.6rem; }
.meta-row { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: 13px; color: var(--ink-2); }
.meta-row span b { color: var(--ink); font-weight: 500; }
@media (max-width: 700px) { .proj-hero { grid-template-columns: 1fr; } .proj-hero img { height: 180px; min-height: 0; } }

/* pills */
.pill { display: inline-flex; align-items: center; gap: .35rem; font: 500 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 6px 8px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-ok { background: var(--ok-bg); color: var(--ok); }
.p-warn { background: var(--warn-bg); color: var(--warn); }
.p-bad { background: var(--bad-bg); color: var(--bad); }
.p-info { background: #e5e9f1; color: var(--navy); }
.p-muted { background: #eeebe5; color: var(--muted); }

/* timeline */
.timeline { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0; margin-top: 6px; }
.tl { position: relative; padding-top: 22px; font-size: 12.5px; color: var(--muted); }
.tl::before { content: ""; position: absolute; top: 7px; left: 0; right: 0; height: 2px; background: var(--line); }
.tl::after { content: ""; position: absolute; top: 1px; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--white); border: 2px solid var(--line-2); }
.tl.done::before { background: var(--char); }
.tl.done::after { background: var(--char); border-color: var(--char); }
.tl.now::before { background: linear-gradient(90deg, var(--clay) 50%, var(--line) 50%); }
.tl.now::after { background: var(--clay); border-color: var(--clay); box-shadow: 0 0 0 5px rgba(184,84,58,.18); }
.tl b { display: block; color: var(--ink); font-weight: 500; font-size: 13px; padding-right: 6px; }
.tl.now b { color: var(--clay); }
@media (max-width: 900px) {
  .timeline { grid-template-columns: 1fr; gap: 0; }
  .tl { padding: 0 0 14px 28px; }
  .tl::before { top: 0; bottom: 0; left: 6px; width: 2px; height: auto; right: auto; }
  .tl.now::before { background: linear-gradient(180deg, var(--clay) 50%, var(--line) 50%); }
  .tl::after { top: 2px; }
}

/* progress */
.meter { height: 8px; background: #efebe4; border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--char); border-radius: 999px; transition: width .6s var(--ease); }
.meter.clay i { background: var(--clay); }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--clay) calc(var(--p) * 1%), #efebe4 0); flex: none; }
.ring span { width: 92px; height: 92px; border-radius: 50%; background: var(--white); display: grid; place-items: center; font-family: var(--serif); font-size: 1.8rem; }

/* lists & tables */
.list { display: grid; }
.li { display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--off); color: var(--ink-2); flex: none; }
.li .ic svg { width: 16px; height: 16px; }
.li .t { font-weight: 500; }
.li .s { font-size: 12.5px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.tbl th { text-align: left; font: 500 10.5px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--paper); }
.tbl .num { font-variant-numeric: tabular-nums; }

/* documents */
.doc { display: grid; grid-template-columns: 1fr auto; gap: 1rem; padding: 16px 0; border-top: 1px solid var(--line); align-items: start; }
.doc:first-child { border-top: 0; }
.doc .name { font-weight: 500; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.doc .desc { font-size: 13px; color: var(--muted); margin-top: 3px; max-width: 70ch; }
.doc .files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: .4rem; font-size: 12.5px; background: var(--off); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 8px; }
.file-chip svg { width: 14px; height: 14px; }
.doc .note { font-size: 12.5px; margin-top: 8px; padding: 8px 10px; background: var(--warn-bg); color: var(--warn); border-radius: var(--r); }
.doc-actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.req { font: 500 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.filter { display: flex; gap: 4px; flex-wrap: wrap; }
.filter button { background: var(--white); border: 1px solid var(--line-2); border-radius: 999px; padding: .4rem .8rem; font-size: 13px; cursor: pointer; }
.filter button[aria-pressed="true"] { background: var(--char); color: var(--off); border-color: var(--char); }
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 18px; text-align: center; color: var(--muted); font-size: 13px; background: var(--paper); transition: border-color .2s, background .2s; }
.drop.over { border-color: var(--clay); background: var(--clay-bg); }
@media (max-width: 700px) { .doc { grid-template-columns: 1fr; } .doc-actions { justify-content: flex-start; } }

/* consent */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.fld { display: grid; gap: 5px; }
.fld label { font-size: 12px; color: var(--muted); }
.fld input, .fld textarea, .fld select { min-height: 42px; border: 1px solid var(--line-2); border-radius: var(--r); padding: .5rem .7rem; font: inherit; background: var(--white); width: 100%; }
.fld textarea { min-height: 90px; resize: vertical; }
.sigpad { border: 1px solid var(--line-2); border-radius: var(--r); background: var(--paper); height: 150px; width: 100%; touch-action: none; cursor: crosshair; display: block; }
.consent-doc { background: var(--white); border: 1px solid var(--line); padding: 28px; font-size: 14px; line-height: 1.65; }
.consent-doc h4 { font-family: var(--serif); font-size: 1.4rem; margin-bottom: 12px; }
.consent-doc .sig img { height: 70px; width: auto; border-bottom: 1px solid var(--ink); }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

/* messages */
.thread { display: grid; gap: 12px; max-height: 520px; overflow-y: auto; padding-right: 4px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 12px; background: var(--off); font-size: 14px; }
.msg.me { margin-left: auto; background: var(--char); color: var(--off); }
.msg .by { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.msg.me .by { color: rgba(245,242,237,.6); }
.composer { display: flex; gap: 8px; margin-top: 14px; }
.composer input { flex: 1; min-height: 44px; border: 1px solid var(--line-2); border-radius: var(--r); padding: 0 .8rem; font: inherit; min-width: 0; }

/* lodgement */
.pack-row { display: grid; grid-template-columns: 26px 1fr auto; gap: .8rem; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px; }
.pack-row:first-child { border-top: 0; }
.tick { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.tick.y { background: var(--ok); color: #fff; }
.tick.n { border: 1.5px solid var(--line-2); }
.tick svg { width: 13px; height: 13px; }
.portal-map { font: 400 12px/1.4 var(--mono); color: var(--muted); }
.status-feed { font-family: var(--mono); font-size: 12px; background: var(--char); color: #cfe7d6; border-radius: var(--r); padding: 14px; min-height: 120px; white-space: pre-wrap; overflow-x: auto; }

/* toast & modal */
.toast { position: fixed; z-index: 300; right: 18px; bottom: 60px; background: var(--char); color: var(--off); padding: 12px 16px; border-radius: var(--r); font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); transform: translateY(20px); opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s var(--ease); max-width: min(420px, calc(100vw - 36px)); }
.toast.on { opacity: 1; transform: none; }
.modal { border: 0; border-radius: 6px; padding: 0; width: min(560px, calc(100vw - 24px)); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.modal::backdrop { background: rgba(15,15,15,.55); }
.modal > div { padding: 24px; }
.modal h3 { font-family: var(--serif); font-size: 1.5rem; margin-bottom: 8px; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

.empty { padding: 30px; text-align: center; color: var(--muted); }
.row { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack { display: grid; gap: 10px; }
.hint { font-size: 12.5px; color: var(--muted); }
.callout { background: var(--clay-bg); border: 1px solid #ecc9bd; border-radius: var(--r); padding: 14px 16px; font-size: 14px; color: #6d2f20; }
.callout b { font-weight: 600; }
[hidden] { display: none !important; }
.is-live .demo-ribbon { display: none; }
a.file-chip { text-decoration: none; color: inherit; }
a.file-chip:hover { border-color: var(--clay, #b8543a); }
.lg-step { display: grid; gap: 10px; }
