:root {
  color-scheme: light;
  --bg: #edf2f0;
  --surface: #ffffff;
  --surface-soft: #f5f8f7;
  --sidebar: #e8f0ed;
  --line: #d9e3df;
  --text: #17221e;
  --muted: #6d7e77;
  --green: #10aa70;
  --green-dark: #087a4f;
  --green-soft: #dff6ed;
  --red: #d94b4b;
  --orange: #c27b19;
  --shadow: 0 16px 45px rgba(23, 34, 30, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; color: var(--text); background: var(--bg); }
button, input, textarea { font: inherit; }
button { min-height: 36px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface); cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--green); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { color: white; border-color: var(--green); background: var(--green); }
button.ghost { border: 0; background: transparent; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface); outline: none; }
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(16, 170, 112, .12); }
textarea { padding: 10px; resize: vertical; }
.hidden { display: none !important; }
.login-view { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: radial-gradient(circle at 50% 10%, #d8f6e9, var(--bg) 45%); }
.login-panel { width: min(390px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.login-panel .brand-mark { margin: 0 auto 16px; }
.login-panel h1 { margin: 0; font-size: 22px; text-align: center; }
.login-panel p { margin: 8px 0 24px; color: var(--muted); text-align: center; }
.login-panel label { display: grid; gap: 7px; margin: 14px 0; }
.login-panel input { height: 42px; padding: 0 11px; }
.login-panel button { width: 100%; margin-top: 8px; }
.error { min-height: 22px; margin-top: 10px; color: var(--red); }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: white; background: var(--green); font-weight: 700; }
.brand-mark.small { width: 34px; height: 34px; border-radius: 9px; }
.app-view { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 22px; height: 62px; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 250px; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); }
.metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.metrics span { padding: 6px 9px; border-radius: 8px; color: var(--muted); background: var(--surface-soft); }
.metrics b { color: var(--text); }
.metrics .attention b { color: var(--red); }
.account { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.workspace { display: grid; grid-template-columns: 260px minmax(420px, 1fr) 340px; min-height: calc(100vh - 62px); }
.instance-pane, .action-pane { min-width: 0; background: var(--surface); }
.instance-pane { border-right: 1px solid var(--line); }
.action-pane { border-left: 1px solid var(--line); }
.pane-heading, .screen-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.pane-heading strong, .pane-heading small, .screen-heading strong, .screen-heading small { display: block; }
.pane-heading small, .screen-heading small { margin-top: 3px; color: var(--muted); }
.icon-button { width: 36px; padding: 0; font-size: 20px; }
.search { height: 38px; padding: 0 10px; }
.instance-pane > .search { width: calc(100% - 24px); margin: 12px; }
.instance-tree { padding: 0 8px 18px; }
.city-group { margin: 5px 0 12px; }
.city-title { display: flex; justify-content: space-between; padding: 8px; color: var(--muted); font-size: 13px; }
.instance-item { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 9px; align-items: center; width: 100%; min-height: 56px; margin: 3px 0; padding: 8px; border: 0; text-align: left; background: transparent; }
.instance-item.active { color: var(--green-dark); background: var(--green-soft); }
.instance-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--surface-soft); }
.instance-item.active .instance-icon { background: rgba(255,255,255,.7); }
.instance-copy { min-width: 0; }
.instance-copy strong, .instance-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.instance-copy small { color: var(--muted); margin-top: 3px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.status-dot.offline { background: var(--red); }
.screen-pane { min-width: 0; background: var(--surface-soft); }
.screen-tools { display: flex; align-items: center; gap: 8px; }
.toggle { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.toggle input { width: auto; }
.screen-stage { position: relative; display: grid; place-items: center; min-height: calc(100vh - 168px); padding: 16px; overflow: hidden; }
.screen-stage img { display: block; max-width: 100%; max-height: calc(100vh - 205px); border-radius: 8px; box-shadow: var(--shadow); user-select: none; }
.screen-stage.control-enabled img { cursor: crosshair; }
.empty-state { color: var(--muted); text-align: center; }
.empty-icon { font-size: 48px; opacity: .35; }
.screen-status { display: flex; justify-content: space-between; min-height: 42px; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); background: var(--surface); }
.click-marker { position: absolute; width: 20px; height: 20px; margin: -10px; border: 2px solid var(--red); border-radius: 50%; pointer-events: none; animation: marker .65s ease-out forwards; }
@keyframes marker { to { transform: scale(2); opacity: 0; } }
.tabs { display: grid; grid-template-columns: 1fr 1fr 1fr; border-bottom: 1px solid var(--line); }
.tab { border: 0; border-radius: 0; background: transparent; }
.tab.active { color: var(--green-dark); box-shadow: inset 0 -2px var(--green); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.action-section { padding: 15px; border-bottom: 1px solid var(--line); }
.action-section h2 { margin: 0 0 12px; font-size: 15px; }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.safety-note { margin: 8px 0; color: var(--orange); font-size: 13px; }
.reply-actions { display: flex; justify-content: flex-end; gap: 8px; }
.details { display: grid; grid-template-columns: 78px 1fr; gap: 8px; margin: 0; font-size: 13px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; word-break: break-word; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-row h2 { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.ocr-result { min-height: 200px; margin-top: 10px; padding: 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-word; background: var(--surface-soft); }
.task-list { display: grid; gap: 8px; }
.task-item { padding: 10px; border-radius: 8px; background: var(--surface-soft); }
.task-row { display: flex; justify-content: space-between; gap: 8px; }
.task-item small { display: block; margin-top: 4px; color: var(--muted); }
.status-success { color: var(--green-dark); }
.status-failed, .status-unknown { color: var(--red); }
.status-pending, .status-delivered { color: var(--orange); }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 20; max-width: 420px; padding: 12px 16px; border-radius: 9px; color: white; background: #25342f; box-shadow: var(--shadow); }
@media (max-width: 1050px) {
  .workspace { grid-template-columns: 220px minmax(380px, 1fr) 300px; }
  .metrics span:nth-child(3) { display: none; }
}
@media (max-width: 800px) {
  .workspace { grid-template-columns: 190px minmax(360px, 1fr); overflow-x: auto; }
  .action-pane { min-width: 320px; }
  .metrics { display: none; }
}
