:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --ink: #1f2933;
  --muted: #718096;
  --line: #e7ebef;
  --blue: #1d67d8;
  --blue-soft: #eaf2ff;
  --green: #16846a;
  --orange: #c76b1b;
  --danger: #b53b42;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mobile-app { min-height: 100vh; }
.screen { width: min(100%, 560px); margin: 0 auto; padding: 22px 18px 92px; }
.login-screen { min-height: 100vh; display: grid; align-content: center; padding-bottom: 20vh; }
.brand-mark { display: inline-grid; place-items: center; width: 58px; height: 58px; border-radius: 16px; background: #17324d; color: #fff; font-weight: 800; letter-spacing: 2px; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 12px; letter-spacing: .05em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 27px; line-height: 1.2; }
h2 { margin-bottom: 0; font-size: 18px; }
.muted { color: var(--muted); line-height: 1.6; }
.stack-form { display: grid; gap: 14px; margin-top: 28px; }
label { display: grid; gap: 7px; color: #485465; font-size: 13px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; color: var(--ink); background: var(--surface); outline: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29,103,216,.12); }
.primary-button, .secondary-button { min-height: 46px; border-radius: 9px; padding: 0 16px; border: 1px solid transparent; font-weight: 700; }
.primary-button:disabled, .secondary-button:disabled { cursor: wait; opacity: .62; }
.primary-button { background: var(--blue); color: #fff; }
.secondary-button { background: var(--surface); color: var(--blue); border-color: #bfd1ef; }
.form-error { min-height: 20px; margin: 0; color: var(--danger); font-size: 13px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar h1 { margin: 0; font-size: 24px; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); font-size: 21px; }
.context-strip { display: flex; align-items: center; gap: 7px; min-height: 34px; margin: 10px 0 14px; color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.link-button { border: 0; padding: 0; color: var(--blue); background: transparent; font-size: 13px; }
.context-strip .link-button { margin-left: auto; }
.draft-status { border: 0; padding: 3px 7px; border-radius: 999px; background: #fff4df; color: #9a6512; font-size: 11px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.metric { min-height: 76px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.metric span, .metric strong { display: block; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { margin-top: 8px; font-size: 22px; line-height: 1; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin: 14px 0 22px; }
.quick-button { display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; min-height: 76px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-align: left; }
.quick-button span { grid-row: span 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--blue-soft); color: var(--blue); font-weight: 800; }
.quick-button b { font-size: 14px; }
.quick-button small { color: var(--muted); font-size: 11px; }
.panel-section { margin-top: 22px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.customer-list, .simple-list { display: grid; gap: 8px; margin-top: 10px; }
.customer-item, .simple-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.customer-item-main { min-width: 0; }
.customer-item strong, .simple-item strong { display: block; font-size: 14px; }
.customer-item small, .simple-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.customer-item button { flex: 0 0 auto; border: 0; color: var(--blue); background: transparent; font-size: 12px; }
.empty-state { padding: 20px 8px; color: var(--muted); font-size: 13px; text-align: center; }
.bottom-nav { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(4, 1fr); width: min(100%, 560px); margin: 0 auto; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); }
.nav-button { display: grid; justify-items: center; gap: 3px; border: 0; background: transparent; color: var(--muted); font-size: 18px; }
.nav-button small { font-size: 11px; }
.nav-button.active { color: var(--blue); }
.sheet-backdrop { position: fixed; z-index: 30; inset: 0; background: rgba(20,30,40,.32); }
.sheet { position: fixed; z-index: 31; right: 0; bottom: 0; left: 0; max-height: 86vh; overflow: auto; width: min(100%, 560px); margin: 0 auto; padding: 8px 18px calc(20px + env(safe-area-inset-bottom)); border-radius: 14px 14px 0 0; background: var(--surface); box-shadow: 0 -10px 30px rgba(20,30,40,.12); }
.sheet-handle { width: 40px; height: 4px; margin: 0 auto 10px; border-radius: 2px; background: #ccd3dc; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-header h2 { font-size: 19px; }
.sheet-form { display: grid; gap: 13px; }
.sheet-form .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.sheet-form h3 { margin: 4px 0 -4px; font-size: 13px; }
.sheet-note { margin: -4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.draft-note { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid #f0d7a1; border-radius: 7px; background: #fffaf0; color: #76521b; font-size: 12px; line-height: 1.45; }
.draft-note .link-button { margin-left: auto; flex: 0 0 auto; color: #9a6512; font-size: 11px; }
.match-list { display: grid; gap: 8px; margin: 12px 0; }
.match-card { padding: 11px; border: 1px solid #f0c6c9; border-radius: 8px; background: #fff8f8; }
.match-card strong { display: block; }
.pass-code { margin: 16px 0 12px; padding: 14px 16px; border: 1px dashed var(--blue); background: var(--blue-soft); color: var(--blue); font-size: 26px; font-weight: 800; letter-spacing: 1px; text-align: center; }
.match-card small { color: var(--muted); }
.task-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.appointment-card { align-items: flex-start; }
.appointment-card > div:first-child { min-width: 0; }
.task-card + .task-card { margin-top: 8px; }
.task-card strong, .task-card small { display: block; }
.task-card small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.task-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.task-actions .secondary-button { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.toast { position: fixed; z-index: 50; right: 18px; bottom: 84px; left: 18px; width: min(calc(100% - 36px), 520px); margin: 0 auto; padding: 11px 14px; border-radius: 8px; background: #263442; color: #fff; font-size: 13px; text-align: center; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (min-width: 720px) { .bottom-nav { border: 1px solid var(--line); border-bottom: 0; } }
