@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url(/static/fonts/space-grotesk-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 600; font-display: swap; src: url(/static/fonts/space-grotesk-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url(/static/fonts/space-grotesk-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(/static/fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(/static/fonts/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(/static/fonts/inter-latin-600-normal.woff2) format("woff2"); }

/* Maxinest brand tokens (from maxinest.co.uk) */
:root {
  --bg: #F6F1E8; --alt: #EEE7D9; --card: #FFFFFF; --field: #FBF8F2;
  --line: #E4DCCB; --border: #DCD2BC; --dots: #DDD4C0;
  --accent: #B8912E; --accent-text: #8F6E1C; --hover: #9A7622; --on-accent: #1C1A16; --pill: #EFE4C4;
  --text: #1C1A16; --muted: #55524B; --dim: #7A766D;
  --me: #1C1A16; --me-ink: #F6F1E8;
  --sos-bg: #F6E4DC; --sos-ink: #8E2F1F;
  --em: #A3341F; --em-bg: #FBEAE5; --ur: #9A5B12; --ur-bg: #F8ECD9;
  --ok: #3F7A4E;
  --shadow: 0 18px 50px -24px rgba(60, 45, 15, .35);
  --head: "Space Grotesk", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1C1A16; --alt: #23201B; --card: #26231E; --field: #201D19;
    --line: #3A362E; --border: #46413A; --dots: #2C2924;
    --accent: #D4B25A; --accent-text: #D4B25A; --hover: #E3C978; --on-accent: #1C1A16; --pill: #3A3324;
    --text: #F6F1E8; --muted: #C9C3B5; --dim: #A39D8F;
    --me: #D4B25A; --me-ink: #1C1A16;
    --sos-bg: #3A1F18; --sos-ink: #F2B8A8;
    --em: #F2A08C; --em-bg: #3A1F18; --ur: #F0C27A; --ur-bg: #3A2E18; --ok: #8FD0A0;
    --shadow: 0 18px 50px -24px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background-color: var(--bg);
  background-image: radial-gradient(var(--dots) 1px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.5;
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--bg); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo { width: 34px; height: 34px; }
.wordmark { font-family: var(--head); font-weight: 700; font-size: 17px; letter-spacing: .26em; color: var(--accent-text); }
.seg { display: flex; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600;
  color: var(--muted); cursor: pointer; min-width: 44px; }
.seg button[aria-pressed="true"] { background: var(--alt); color: var(--text); }

.sos { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin: 12px 16px 0; padding: 9px 12px;
  border-radius: 14px; background: var(--sos-bg); color: var(--sos-ink); text-decoration: none; font-size: 13px; }
.sos-nums { margin-left: auto; white-space: nowrap; }
.sos b { font-family: var(--head); font-weight: 700; }

.view { flex: 1; display: flex; flex-direction: column; padding: 8px 16px 16px; }

/* Start */
.hello { padding: 18px 2px 6px; }
.eyebrow { margin: 0 0 10px; font-family: var(--head); font-weight: 600; font-size: 12px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent-text); }
h1 { font-family: var(--head); font-weight: 700; font-size: 32px; line-height: 1.08; letter-spacing: -.02em; margin: 0 0 12px; }
html[lang="zh-CN"] h1 { font-size: 28px; letter-spacing: 0; line-height: 1.25; }
.lead { margin: 0 0 16px; color: var(--muted); font-size: 16px; line-height: 1.55; }
.unit-found { display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px 9px 9px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border); font-size: 14.5px; margin-bottom: 6px; }
.unit-found b { font-family: var(--head); }
.tick { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); flex: 0 0 24px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.form { padding: 20px 18px; display: grid; gap: 16px; margin-top: 10px; }
.form label { display: grid; gap: 7px; font-size: 14px; font-weight: 600; }
.form input { font-size: 16px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--field); width: 100%; }
.form input:focus, .composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.primary { display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 15px 20px;
  background: var(--accent); color: var(--on-accent); font-family: var(--head); font-weight: 600; font-size: 16.5px; cursor: pointer; }
.primary:active { background: var(--hover); }
.primary:disabled { opacity: .6; }
.fine { font-size: 12.5px; color: var(--dim); margin: -4px 0 0; text-align: center; }
.err { color: var(--em); margin: 0; font-size: 14px; }
.perks { list-style: none; padding: 0; margin: 20px 4px 4px; display: grid; gap: 9px; font-size: 14px; color: var(--muted); }
.perks li { display: flex; align-items: center; gap: 10px; }
.perks .dot { width: 7px; height: 7px; transform: rotate(45deg); background: var(--accent); flex: 0 0 7px; }

/* Chat */
.chat { padding-top: 12px; }
.agent { display: flex; align-items: center; gap: 12px; padding: 4px 2px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.avatar { width: 30px; height: 30px; border-radius: 10px; background: #1C1A16; display: grid; place-items: center; flex: 0 0 30px; }
.avatar svg { width: 22px; height: 22px; }
.avatar.lg { width: 44px; height: 44px; border-radius: 14px; flex-basis: 44px; }
.avatar.lg svg { width: 32px; height: 32px; }
.agent-name { font-family: var(--head); font-weight: 700; font-size: 16.5px; }
.agent-sub { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }

.msgs { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 12px 0; }
.row { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.row.bot { align-self: flex-start; }
.row.me { align-self: flex-end; justify-content: flex-end; }
.row.bot.cont .avatar { visibility: hidden; }
.msg { padding: 11px 14px; border-radius: 20px; line-height: 1.55; font-size: 15.5px; word-wrap: break-word; overflow-wrap: anywhere; }
.bot .msg { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: 0 6px 18px -14px rgba(60,45,15,.4); }
.me .msg { background: var(--me); color: var(--me-ink); border-bottom-right-radius: 6px; }
.msg ol, .msg ul { margin: 6px 0; padding-left: 20px; }
.msg li { margin: 3px 0; }
.msg li::marker { color: var(--accent-text); font-weight: 600; }
.msg p { margin: 0 0 7px; } .msg p:last-child { margin: 0; }
.msg strong { font-weight: 600; }
.msg a { color: var(--accent-text); font-weight: 600; }
.me .msg a { color: inherit; }
.msg img { display: block; max-width: 200px; border-radius: 12px; margin-top: 6px; }
.typing { display: inline-flex; gap: 5px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: .35; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; } }

/* Ticket card (mirrors the "Your move, tracked" card on maxinest.co.uk) */
.ticket { align-self: stretch; padding: 16px 16px 14px; margin: 4px 0 6px; border-top: 3px solid var(--accent); }
.ticket.em { border-top-color: var(--em); }
.t-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.t-label { font-size: 13px; color: var(--dim); }
.t-ref { font-family: var(--head); font-weight: 700; font-size: 28px; letter-spacing: -.01em; line-height: 1.1; }
.t-pill { font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--pill); color: var(--accent-text); white-space: nowrap; }
.t-pill.em { background: var(--em-bg); color: var(--em); } .t-pill.ur { background: var(--ur-bg); color: var(--ur); }
.steps { list-style: none; margin: 14px 0 10px; padding: 0; }
.steps li { position: relative; display: flex; gap: 12px; padding-bottom: 12px; font-size: 14.5px; }
.steps li:last-child { padding-bottom: 0; }
.steps li::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: -2px; width: 2px; background: var(--line); }
.steps li:last-child::before { display: none; }
.s-dot { width: 22px; height: 22px; border-radius: 50%; flex: 0 0 22px; display: grid; place-items: center; border: 2px solid var(--border); background: var(--card); z-index: 1; }
.done .s-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.now .s-dot { border-color: var(--text); background: var(--text); }
.steps .later { color: var(--dim); }
.steps b { font-weight: 600; }
.t-note { margin: 4px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 10px; }
.chip { font-size: 14px; border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.chip:active { background: var(--alt); }

.pending { display: flex; gap: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.pending .thumb { position: relative; }
.pending img { width: 58px; height: 58px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.pending button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: var(--text); color: var(--bg); font-size: 13px; line-height: 22px; padding: 0; }

.composer { position: sticky; bottom: 0; display: flex; align-items: flex-end; gap: 8px; padding: 8px; margin: 0 -8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom)); background: var(--bg); background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.iconbtn { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); color: var(--accent-text); }
.composer textarea { flex: 1; font-size: 16px; resize: none; max-height: 130px; padding: 12px 16px; border: 1px solid var(--border);
  border-radius: 23px; background: var(--card); line-height: 1.4; }
.send { width: 46px; height: 46px; flex: 0 0 46px; border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; cursor: pointer; }
.send:disabled { opacity: .45; }

.foot { display: flex; justify-content: space-between; padding: 10px 18px 16px; font-size: 12px; color: var(--dim); }
.foot a { text-decoration: none; }
#chatView:not([hidden]) ~ .foot { display: none; }
[hidden] { display: none !important; }
@media (min-width: 600px) { .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 70%, transparent); } }

/* ---------- Repair hub ---------- */
.sec { font-family: var(--head); font-weight: 700; font-size: 18px; letter-spacing: -.01em; margin: 22px 2px 10px; }
.repairs .sec { margin-top: 14px; }
.rep-list { display: grid; gap: 10px; }
.rep { display: block; width: 100%; text-align: left; cursor: pointer; padding: 14px 16px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--line); box-shadow: 0 6px 18px -14px rgba(60,45,15,.4); }
.rep:active { background: var(--alt); }
.rep-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rep-ref { font-family: var(--head); font-weight: 700; font-size: 13px; color: var(--accent-text); letter-spacing: .04em; }
.rep-title { font-weight: 600; font-size: 15.5px; margin: 3px 0 10px; }
.rep.closed { opacity: .72; }
.mini { display: flex; gap: 6px; align-items: center; }
.mini i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.mini i.on { background: var(--accent); }
.rep-status { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--dim); }
.rep-status b { color: var(--text); font-weight: 600; }
.flag { color: var(--ur) !important; }
.empty { color: var(--dim); font-size: 14px; padding: 4px 2px; }

.profile { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-radius: 20px; margin-bottom: -2px; }
.p-label { font-size: 12.5px; color: var(--dim); }
.p-name { font-weight: 600; }
.link { border: 0; background: none; color: var(--accent-text); font-weight: 600; font-size: 14px; cursor: pointer; padding: 6px; }
.who { display: grid; gap: 16px; }
.who[hidden] { display: none !important; }

.back { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--accent-text);
  font-weight: 600; font-size: 15px; padding: 14px 2px 10px; cursor: pointer; }
.back.icon { padding: 6px; margin-left: -8px; color: var(--text); }
.actions { display: grid; gap: 10px; margin-top: 14px; }
.secondary { border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 999px;
  padding: 13px 18px; font-family: var(--head); font-weight: 600; font-size: 15.5px; cursor: pointer; }
.secondary:active { background: var(--alt); }
.after { display: flex; gap: 8px; flex-wrap: wrap; padding: 2px 0 12px; }
.after .secondary { flex: 1; min-width: 150px; padding: 11px 14px; font-size: 14.5px; }

.t-title { font-weight: 600; font-size: 16px; margin-top: 6px; }
.t-update { margin: 10px 0 0; padding: 10px 12px; border-radius: 14px; background: var(--pill); color: var(--text); font-size: 14.5px; }
.t-update b { color: var(--accent-text); font-weight: 600; }
.t-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--dim); margin-top: 10px; }
.done-all .s-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.steps .waiting b { color: var(--ur); }
