@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500&family=Manrope:wght@500&display=swap');
:root{--paper:#f8f7f3;--surface:#fffefb;--ink:#262922;--muted:#73766d;--accent:#f06a32;--accent-soft:#fbe6dc;--line:#dedfd6;--hover:#efefe8;--font:'DM Sans',Arial,'PingFang SC','Microsoft YaHei',sans-serif;--heading:'Manrope',Arial,'PingFang SC',sans-serif;--mono:ui-monospace,SFMono-Regular,Menlo,monospace;--ok:#2f7a4b;--ok-soft:#e1efe5;--warn:#9a6212;--warn-soft:#f7ecd6;--bad:#b23a2a;--bad-soft:#f6e0dc;--info:#2d5f8a;--info-soft:#e0eaf3;--neutral-soft:#ecece6}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--paper);color:var(--ink);font:400 14px/1.5 var(--font);-webkit-font-smoothing:antialiased}
a{color:inherit;text-decoration:none}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
h1,h2,h3{font-family:var(--heading);font-weight:500;margin:0}
p{margin:0}
[hidden]{display:none!important}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
.skip{position:fixed;top:8px;left:8px;transform:translateY(-200%);z-index:100;background:var(--ink);color:#fff;padding:8px 12px;border-radius:6px}
.skip:focus{transform:none}

/* Top bar */
.bar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:24px;height:56px;padding:0 24px;background:#f8f7f3f2;backdrop-filter:blur(12px);border-bottom:1px solid var(--line)}
.brand{display:inline-flex;align-items:center;gap:8px;flex-shrink:0}
.brand-mark{display:inline-flex;width:24px;height:24px;border-radius:6px;background:var(--accent)}
.brand-name{font:500 18px/1 var(--heading);letter-spacing:-.6px}
.brand-sub{font-size:13px;color:var(--muted);padding-left:8px;border-left:1px solid var(--line)}
.tabs{display:flex;gap:4px;min-width:0;overflow-x:auto;scrollbar-width:none}
.tabs::-webkit-scrollbar{display:none}
.tabs a{height:32px;display:inline-flex;align-items:center;padding:0 12px;border-radius:6px;color:var(--muted);white-space:nowrap}
.tabs a:hover{background:var(--hover);color:var(--ink)}
.tabs a[aria-current]{color:var(--ink);background:var(--hover);font-weight:500}
.bar-end{margin-left:auto;display:flex;align-items:center;gap:8px}
.avatar{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;background:var(--accent-soft);color:#9b3f17;font-size:12px;font-weight:500}

/* Controls */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:32px;padding:0 12px;border-radius:6px;border:1px solid transparent;background:none;font-size:13px;font-weight:500;white-space:nowrap}
.btn.primary{background:var(--ink);color:var(--paper)}
.btn.primary:hover{background:#3a3e35}
.btn.header{height:36px;padding:0 16px}
.btn.ghost{border-color:var(--line);background:var(--surface)}
.btn.ghost:hover,.btn.quiet:hover{background:var(--hover)}
.btn.quiet{color:var(--muted)}
.btn.danger{color:var(--bad)}
.btn:disabled{opacity:.5;cursor:default}
.btn.primary:disabled{background:var(--ink)}
.btn.block{width:100%}
.icon-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:6px;border:0;background:none;color:var(--muted)}
.icon-btn:hover{background:var(--hover);color:var(--ink)}
.icon{width:16px;height:16px;flex-shrink:0}
input,select,textarea{width:100%;height:32px;padding:0 10px;border:1px solid var(--line);border-radius:6px;background:var(--surface);font-size:14px}
input[type=color]{width:56px;padding:3px;cursor:pointer}
textarea{height:auto;min-height:72px;padding:6px 10px;resize:vertical;line-height:1.5}
select{appearance:none;-webkit-appearance:none;padding-right:28px;background:var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2373766d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 8px center}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--ink)}
input[type=checkbox]{width:16px;height:16px;padding:0;accent-color:var(--ink);flex-shrink:0}
input[aria-invalid=true],textarea[aria-invalid=true]{border-color:var(--bad)}
.search{width:280px}
.filter{width:150px}

/* Layout */
.page{max-width:1280px;margin:0 auto;padding:24px 24px 96px}
.page.narrow{max-width:808px}
.head{display:flex;align-items:center;gap:12px;margin-bottom:16px;min-height:36px}
.head h1{font-size:22px;letter-spacing:-.3px}
.head .grow{flex:1}
.head.detail h1{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.field.read{padding:4px 0}
.field.read .value{padding-top:2px;white-space:pre-wrap;overflow-wrap:anywhere}
.field.read>.label{padding-top:2px}
.back{margin-left:-8px}
.card{background:var(--surface);border:1px solid var(--line);border-radius:10px}
.card+.card,.section+.section{margin-top:24px}
.card-head{display:flex;align-items:center;gap:8px;padding:12px 16px;border-bottom:1px solid var(--line)}
.card-head h2{font-size:17px;flex:1}
.card-body{padding:16px}
.muted{color:var(--muted)}
.meta{font-size:12px;color:var(--muted)}
.error{color:var(--bad);font-size:13px}
.notice{padding:8px 12px;border-radius:6px;background:var(--accent-soft);font-size:13px;display:flex;gap:8px;align-items:center}
.notice .btn{margin-left:auto}
.notice.intro{display:block;margin-bottom:8px;line-height:1.5;color:var(--ink)}

/* Rows */
.list{background:var(--surface);border:1px solid var(--line);border-radius:10px}
.row{display:flex;align-items:center;gap:12px;min-height:56px;padding:8px 8px 8px 16px;border-top:1px solid var(--line)}
.row:first-child{border-top:0}
a.row:hover,.row.link:hover{background:#fbfaf6}
.row .thumb{width:32px;height:32px;border-radius:6px;object-fit:cover;background:var(--accent-soft);display:inline-flex;align-items:center;justify-content:center;color:#9b3f17;font-weight:500;flex-shrink:0}
.row .text{flex:1;min-width:0}
.row .title{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .sub{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .amount{font-variant-numeric:tabular-nums;white-space:nowrap}
a.row .end,.row .end{display:flex;align-items:center;gap:12px}
.row .date{font-size:12px;color:var(--muted);width:72px;text-align:right;white-space:nowrap}
.chip{display:inline-flex;align-items:center;height:22px;padding:0 8px;border-radius:999px;font-size:12px;white-space:nowrap;background:var(--neutral-soft);color:#55584f}
.chip.success{background:var(--ok-soft);color:var(--ok)}
.chip.warning{background:var(--warn-soft);color:var(--warn)}
.chip.danger{background:var(--bad-soft);color:var(--bad)}
.chip.info{background:var(--info-soft);color:var(--info)}
.empty{display:flex;flex-direction:column;align-items:flex-start;gap:12px;padding:24px 16px}
.empty .icon{width:32px;height:32px;color:var(--muted)}
.pager{display:flex;justify-content:flex-end;align-items:center;gap:8px;margin-top:12px;font-size:12px;color:var(--muted)}

/* Menus */
.menu-wrap{position:relative}
.menu{position:absolute;right:0;top:calc(100% + 4px);z-index:30;min-width:200px;padding:4px;background:var(--surface);border:1px solid var(--line);border-radius:10px;box-shadow:0 8px 24px #26292214}
.menu a,.menu button{display:flex;align-items:center;width:100%;height:32px;padding:0 8px;border:0;border-radius:6px;background:none;font-size:13px;text-align:left}
.menu a:hover,.menu button:hover{background:var(--hover)}
.menu .danger{color:var(--bad)}
.menu .mobile-promote{display:none}
.menu-head{display:flex;flex-direction:column;padding:8px;border-bottom:1px solid var(--line);margin-bottom:4px;font-size:12px;color:var(--muted)}
.menu-head strong{font-weight:500;font-size:13px;color:var(--ink)}

/* Forms */
.form{display:flex;flex-direction:column}
.field{display:grid;grid-template-columns:160px minmax(0,1fr);gap:12px;align-items:start;padding:8px 0}
.field>label,.field>.label{padding-top:6px;font-size:13px;color:var(--muted)}
.field .hint{font-size:12px;color:var(--muted);margin-top:4px}
.inline{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.inline>*{flex:1;min-width:120px}
.inline>.fixed{flex:0 0 auto;min-width:0}
.check{display:flex;gap:8px;align-items:flex-start;font-size:13px;color:var(--muted)}
.check a{text-decoration:underline}
.segmented{display:inline-flex;padding:2px;border:1px solid var(--line);border-radius:6px;background:var(--surface)}
.segmented button{height:26px;padding:0 10px;border:0;border-radius:4px;background:none;font-size:13px;color:var(--muted)}
.segmented button[aria-pressed=true]{background:var(--hover);color:var(--ink);font-weight:500}
.images{display:flex;gap:8px;flex-wrap:wrap}
.image{position:relative;width:72px;height:72px;border-radius:6px;overflow:hidden;border:1px solid var(--line);background:var(--hover)}
.image img{width:100%;height:100%;object-fit:cover}
.image .remove{position:absolute;top:2px;right:2px;width:24px;height:24px;border-radius:6px;border:0;background:#262922b3;color:#fff;display:flex;align-items:center;justify-content:center}
.image .cover{position:absolute;left:2px;bottom:2px;height:18px;padding:0 6px;border-radius:999px;background:#262922b3;color:#fff;font-size:11px;display:flex;align-items:center}
.add-image{width:72px;height:72px;border:1px dashed var(--line);border-radius:6px;background:var(--surface);display:flex;align-items:center;justify-content:center;color:var(--muted)}
.add-image:hover{background:var(--hover);color:var(--ink)}

/* Details outline */
.outline{display:flex;flex-direction:column}
.node{display:grid;grid-template-columns:20px max(110px,calc(240px - var(--depth)*24px)) minmax(0,1fr) 32px;gap:8px;align-items:start;padding:3px 0 3px calc(var(--depth)*24px);background:linear-gradient(90deg,transparent calc(var(--depth)*24px - 15px),var(--line) 0,var(--line) calc(var(--depth)*24px - 14px),transparent 0)}
.node[style*="--depth:0"]{background:none}
.twisty{display:flex;align-items:center;justify-content:center;width:20px;height:32px;padding:0;border:0;border-radius:4px;background:none;color:var(--muted)}
button.twisty:hover{background:var(--hover);color:var(--ink)}
.twisty .icon{transition:transform .12s}
.twisty[aria-expanded=true] .icon{transform:rotate(90deg)}
.bullet{width:5px;height:5px;border-radius:50%;background:var(--muted)}
.node-name{display:flex;align-items:center;gap:4px;min-width:0}
.node-label{border-color:transparent;background:transparent;padding:0 6px}
.node-label:hover{border-color:var(--line)}
.node-label:focus{background:var(--surface)}
.node[data-kind=heading] .node-label{font-weight:500}
.node[data-hidden] .node-name,.node[data-hidden] .node-value{opacity:.55}
.node-name .chip{flex-shrink:0}
.node-value{display:flex;flex-direction:column;gap:4px;min-width:0}
.node-value>.meta{padding-top:6px}
.number{display:flex;gap:8px}
.number input{flex:1;min-width:0}
.number .unit{flex:0 0 96px}
.chips{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.chips button{height:28px;padding:0 10px;border:1px solid var(--line);border-radius:999px;background:var(--surface);font-size:13px;color:var(--muted)}
.chips button:hover{color:var(--ink)}
.chips button[aria-pressed=true]{background:var(--ink);border-color:var(--ink);color:var(--paper)}
.chips input{width:110px;height:28px;border-radius:999px;font-size:13px}
.node .segmented{align-self:flex-start;margin-top:1px}
.outline-foot{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:12px}
.outline-empty{display:flex;flex-direction:column;gap:12px}
.inline-actions{display:flex;gap:8px;flex-wrap:wrap}
.pv-root h3{font-size:15px;margin:12px 0 4px}
.pv-root>.pv:first-child>h3{margin-top:0}
.pv-root h4{font-size:14px;margin:6px 0 2px}
.pv-row{display:grid;grid-template-columns:200px minmax(0,1fr);gap:12px;padding:2px 0;overflow-wrap:anywhere}
.pv-label{color:var(--muted)}
.pv-children{padding-left:14px;border-left:1px solid var(--line)}
dialog.library{width:min(640px,calc(100vw - 32px));max-height:min(80vh,760px);padding:0;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);box-shadow:0 16px 48px #26292229}
dialog.library[open]{display:flex;flex-direction:column}
dialog.library::backdrop{background:#2629224d}
.library-body{overflow:auto;padding:12px 16px 16px}
.lib-group h3{font-size:14px;margin:16px 0 4px}
.lib-section{border-top:1px solid var(--line);padding:4px 0}
.lib-item{display:flex;align-items:center;gap:12px;min-height:36px;padding:2px 0 2px calc(var(--depth)*20px)}
.lib-item .text{flex:1;min-width:0}
.lib-item[style*="--depth:0"] .text>div:first-child{font-weight:500}
.lib-item .added{padding:0 12px}
.preview{margin:0;max-height:420px;overflow:auto;padding:12px;font:12px/1.6 var(--mono);white-space:pre;background:#f3f2ec;border-radius:6px}

/* Auth */
.auth{max-width:400px;margin:64px auto 96px;padding:0 16px}
.auth .card-body{display:flex;flex-direction:column;gap:12px;padding:24px}
.auth h1{font-size:22px}
.auth .lead{display:flex;align-items:center;gap:4px;color:var(--muted);font-size:13px}
.auth label{font-size:13px;color:var(--muted);display:flex;flex-direction:column;gap:4px}
.auth label.check{flex-direction:row;gap:8px}
.auth .switch{font-size:13px;color:var(--muted);display:flex;align-items:center;gap:4px;justify-content:center;margin-top:12px}
.auth.wide{max-width:560px}
.tip{position:relative;display:inline-flex;color:var(--muted)}
.tip .icon{width:14px;height:14px}
.tip span{position:absolute;left:50%;bottom:calc(100% + 6px);transform:translateX(-50%);width:240px;padding:8px 10px;border-radius:6px;background:var(--ink);color:var(--paper);font-size:12px;line-height:1.4;opacity:0;pointer-events:none;transition:opacity .12s;z-index:40}
.tip:hover span,.tip:focus span{opacity:1}

/* Stats */
.stats{display:flex;gap:0;flex-wrap:wrap}
.stat{flex:1;min-width:140px;padding:12px 16px;border-left:1px solid var(--line)}
.stat:first-child{border-left:0}
.stat strong{display:block;font:500 18px/1.3 var(--heading);font-variant-numeric:tabular-nums}

/* Support */
.tabs .badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;margin-left:6px;padding:0 5px;border-radius:999px;background:var(--accent);color:#fff;font-size:11px;font-weight:500;line-height:1}
.contact{display:grid;grid-template-columns:1fr 1fr}
.contact .option{display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:16px}
.contact .option+.option{border-left:1px solid var(--line)}
.contact h2{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:16px}
.contact p{flex:1;font-size:13px}
.head.sub-head{margin:24px 0 12px}
.head.sub-head h2{font-size:17px}
.presence{display:inline-flex;align-items:center;gap:6px;font:400 12px/1.4 var(--font);color:var(--muted);white-space:nowrap}
.presence .dot{width:8px;height:8px;border-radius:50%;background:#b9bab1}
.presence.online .dot{background:var(--ok)}
.presence.online{color:var(--ok)}
.dot.new{display:inline-block;width:8px;height:8px;margin-right:8px;border-radius:50%;background:var(--accent);vertical-align:middle}
.case-meta{display:flex;flex-wrap:wrap;align-items:center;gap:0 4px;margin:-8px 0 16px}
.case-meta a{text-decoration:underline}
.conversation{overflow:hidden}
.thread{display:flex;flex-direction:column;gap:12px;padding:16px;max-height:min(62vh,640px);overflow-y:auto}
.msg{max-width:min(560px,85%);align-self:flex-start}
.msg.mine{align-self:flex-end}
.msg-meta{font-size:12px;color:var(--muted);margin-bottom:4px}
.msg.mine .msg-meta{text-align:right}
.msg-body{padding:8px 12px;border-radius:10px;background:var(--hover);white-space:pre-wrap;overflow-wrap:anywhere}
.msg.mine .msg-body{background:var(--accent-soft)}
.msg-files{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}
.msg.mine .msg-files{justify-content:flex-end}
.shot{display:block;width:120px;height:90px;border-radius:6px;overflow:hidden;border:1px solid var(--line);background:var(--hover)}
.shot img{width:100%;height:100%;object-fit:cover}
.composer{display:flex;flex-direction:column;gap:8px;padding:12px 16px;border-top:1px solid var(--line)}
.composer-foot{display:flex;align-items:flex-start;gap:8px}
.composer-foot .grow{flex:1}
.composer .shortcut{align-self:center}
.notice.closed{margin:12px 16px 16px}
.attach{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.attach>.btn{margin-left:-8px}
.attachments{display:contents}
.attachment{display:inline-flex;align-items:center;gap:6px;max-width:100%;height:28px;padding:0 4px 0 8px;border:1px solid var(--line);border-radius:6px;background:var(--surface);font-size:12px}
a.attachment{padding-right:8px}
a.attachment:hover{background:var(--hover)}
.attachment .name{max-width:200px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.attachment button{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border:0;border-radius:4px;background:none;color:var(--muted)}
.attachment button:hover{background:var(--hover);color:var(--ink)}

.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:50;padding:8px 16px;border-radius:6px;background:var(--ink);color:var(--paper);font-size:13px;box-shadow:0 8px 24px #2629222e}

@media (max-width:767px){
.bar{gap:12px;padding:0 16px;height:auto;min-height:56px;flex-wrap:wrap}
.brand-sub{display:none}
.tabs{order:3;width:100%;margin:0 -4px 8px}
.tabs a{height:36px}
#promote{display:none}
.menu .mobile-promote{display:flex;min-height:44px}
.page{padding:16px 16px 96px}
.head{flex-wrap:wrap}
.head.detail{flex-wrap:nowrap;gap:8px}
.head.detail .chip{display:none}
.head h1{font-size:20px}
.search{width:auto;order:5;min-width:0;flex:1 1 calc(100% - 144px)}
.filter{width:auto;flex:0 0 132px;order:6}
.row .end{flex-direction:column;align-items:flex-end;gap:2px}
.btn,.icon-btn{min-height:36px}
.icon-btn{width:36px}
input,select{height:40px;font-size:16px}
textarea{font-size:16px}
.field{grid-template-columns:1fr;gap:4px;padding:6px 0}
.field>label,.field>.label{padding-top:0}
.row{min-height:64px;padding-left:12px}
.row .date{display:none}
.auth{margin-top:32px}
.stat{min-width:50%;border-left:0;border-top:1px solid var(--line)}
.stat:nth-child(-n+2){border-top:0}
.node{grid-template-columns:20px minmax(0,1fr) 36px;padding-left:calc(var(--depth)*14px);background:linear-gradient(90deg,transparent calc(var(--depth)*14px - 10px),var(--line) 0,var(--line) calc(var(--depth)*14px - 9px),transparent 0)}
.node-value{grid-column:2/4;grid-row:2;padding-left:6px}
.twisty{height:40px}
.node-label{height:40px}
.chips button,.chips input{height:34px}
.pv-row{grid-template-columns:1fr;gap:0}
dialog.library{max-height:calc(100vh - 32px)}
.contact{grid-template-columns:1fr}
.contact .option+.option{border-left:0;border-top:1px solid var(--line)}
.head.detail>.presence{display:none}
.thread{max-height:none}
.msg{max-width:92%}
.composer .shortcut{display:none}
.composer-foot{flex-wrap:wrap}
}
