:root {
  --bg: #f5f3ef; --panel: #fff; --ink: #23201b; --muted: #7a7368; --line: #e4dfd6;
  --accent: #a4622a; --accent-ink: #fff; --accent-soft: #f6ead9;
  --ok: #2e7d4f; --warn: #b7791f; --bad: #b83232; --info: #2b6cb0;
  --radius: 8px; --shadow: 0 1px 2px rgba(40, 30, 10, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; }
p { margin: 0 0 8px; }
small, .muted { color: var(--muted); }
.shell { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
.side { background: #2a251e; color: #d9d2c5; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 600; font-size: 15px; padding: 4px 10px 14px; }
.side .brand:hover { text-decoration: none; }
.mark { width: 17px; height: 21px; flex: none; }
.mark .w { fill: #fff; }
.mark .g { fill: #ff5b1f; }
.auth h1 .mark { width: 26px; height: 32.5px; }
.auth h1 .mark .w { fill: var(--ink); }
td.inq-msg { min-width: 240px; width: 38%; }
.side nav a { display: flex; justify-content: space-between; align-items: center; color: #d9d2c5; padding: 7px 10px; border-radius: 6px; margin-bottom: 2px; }
.side nav a:hover { background: #3a342b; text-decoration: none; }
.side nav a.active { background: var(--accent); color: #fff; }
.side .who { margin-top: 18px; padding: 10px; border-top: 1px solid #40392f; font-size: 13px; }
.side .who button { background: none; border: 0; color: #b7ae9f; cursor: pointer; padding: 0; font-size: 13px; }
.main { padding: 18px 22px 60px; min-width: 0; }
.topbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.topbar h1 { margin: 0; flex: 1; min-width: 160px; }
.search input { width: 300px; max-width: 100%; }
.count { background: var(--bad); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; line-height: 18px; min-width: 18px; text-align: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px; }
.card > h2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 12px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=url], input[type=tel], input[type=time], select, textarea {
  width: 100%; padding: 6px 9px; border: 1px solid #cfc8bb; border-radius: 6px; background: #fff; min-height: 34px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.field { margin-bottom: 10px; min-width: 0; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline > * { flex: 0 0 auto; }
.inline input, .inline select { width: auto; }
.grow { flex: 1 1 160px !important; min-width: 0; }
.inline > span.muted { flex: 0 1 auto; min-width: 0; }
.btn { display: inline-block; padding: 6px 13px; border-radius: 6px; border: 1px solid #cfc8bb; background: #fff; cursor: pointer; white-space: nowrap; line-height: 1.4; }
.btn:hover { background: #faf7f2; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #8f5322; }
.btn-danger { color: var(--bad); border-color: #e3bcbc; }
.btn-sm { padding: 2px 8px; font-size: 12px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: inherit; }
.linkbtn.danger { color: var(--bad); }
.badge { display: inline-block; padding: 0 7px; border-radius: 10px; font-size: 12px; line-height: 20px; background: #eee9df; color: #5d564b; white-space: nowrap; }
.badge.hi { background: #fbe3e3; color: var(--bad); }
.badge.mid { background: #fdf0d5; color: var(--warn); }
.badge.lo { background: #e8eef5; color: #51607a; }
.badge.ok { background: #dff3e6; color: var(--ok); }
.badge.info { background: #e1ecf9; color: var(--info); }
.overdue { color: var(--bad); font-weight: 600; }
.today { color: var(--warn); font-weight: 600; }
.night { color: #a9a294; }
.flash { background: #dff3e6; border: 1px solid #b9dfc6; color: #1f5c38; padding: 8px 12px; border-radius: 6px; margin-bottom: 14px; }
.flash.err { background: #fbe3e3; border-color: #efbdbd; color: #8a2020; }
.alert { background: #fdf0d5; border: 1px solid #efd9a3; color: #6d4a0c; padding: 8px 12px; border-radius: 6px; margin-bottom: 8px; }
.empty { color: var(--muted); padding: 10px 0; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 7px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
details > summary { cursor: pointer; color: var(--accent); margin-bottom: 8px; }
details[open] > summary { margin-bottom: 10px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 2px solid var(--line); padding: 0 0 14px 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline li.email::before { background: var(--info); }
.timeline li.wa::before { background: var(--ok); }
.timeline .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kanban { display: flex; gap: 10px; overflow-x: auto; align-items: flex-start; padding-bottom: 20px; }
.kcol { flex: 0 0 240px; background: #ebe7df; border-radius: var(--radius); padding: 8px; max-height: calc(100vh - 150px); display: flex; flex-direction: column; }
.kcol h3 { display: flex; justify-content: space-between; padding: 2px 4px 6px; margin: 0; }
.kcol .sum { font-size: 12px; color: var(--muted); font-weight: 400; padding: 0 4px 6px; }
.klist { min-height: 40px; overflow-y: auto; flex: 1; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-bottom: 7px; cursor: grab; box-shadow: var(--shadow); }
.kcard.sortable-ghost { opacity: .4; }
.kcard .t { font-weight: 600; display: block; color: var(--ink); }
.kcard .c { font-size: 12px; color: var(--muted); }
.kcard .f { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; margin-top: 5px; align-items: center; flex-wrap: wrap; }
.suggest { border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-top: 4px; max-height: 220px; overflow-y: auto; }
.suggest:empty { display: none; }
.suggest button { display: block; width: 100%; text-align: left; padding: 6px 10px; border: 0; background: none; cursor: pointer; border-bottom: 1px solid var(--line); }
.suggest button:hover { background: var(--accent-soft); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.thumb { border: 1px solid var(--line); border-radius: 6px; padding: 6px; background: #fff; font-size: 12px; overflow: hidden; }
.thumb img { width: 100%; height: 96px; object-fit: cover; border-radius: 4px; display: block; background: #f1eee8; }
.thumb .ph { height: 96px; display: flex; align-items: center; justify-content: center; background: #f1eee8; border-radius: 4px; color: var(--muted); font-weight: 600; }
.thumb .n { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.drop { border: 2px dashed #cfc8bb; border-radius: 8px; padding: 14px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.chat { display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 78%; padding: 6px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--line); align-self: flex-start; }
.msg.me { align-self: flex-end; background: #e3f4dc; border-color: #cbe5c0; }
.msg .when { font-size: 11px; color: var(--muted); margin-top: 2px; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.bar { height: 8px; background: #eee9df; border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.auth { max-width: 360px; margin: 9vh auto; padding: 0 16px; }
.auth h1 { display: flex; align-items: center; justify-content: center; gap: 12px; }
dialog { border: 1px solid var(--line); border-radius: 10px; padding: 18px; max-width: 92vw; width: 380px; }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.code { white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.mt { margin-top: 10px; }
.qr svg { width: 240px; height: 240px; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 8px; display: flex; align-items: center; gap: 6px; overflow-x: auto; }
  .side .brand { padding: 4px 8px; white-space: nowrap; }
  .side nav { display: flex; gap: 2px; }
  .side nav a { white-space: nowrap; margin: 0; gap: 4px; }
  .side .who { margin: 0; border: 0; padding: 4px 8px; white-space: nowrap; display: flex; gap: 8px; }
  .main { padding: 12px 12px 60px; }
  .grid2, .grid3, .cols { grid-template-columns: 1fr; }
  .search input { width: 100%; }
  .msg { max-width: 92%; }
  td.inq-msg { min-width: 0; width: auto; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tiles .card { padding: 10px; margin-bottom: 14px; }
  .tiles h2 { font-size: 12px; }
  .tiles small { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: 3px 0; }
  table.stack td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 64px; color: var(--muted); font-size: 12px; }
  table.stack td.pre[data-label]::before { display: block; }
  input, select, textarea { font-size: 16px; }
}
