:root {
  --canvas: #f3f6ff;
  --canvas-deep: #e9efff;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --ink: #20233d;
  --ink-soft: #606681;
  --muted: #9298b2;
  --line: #e8ebf6;
  --line-strong: #dbe1f4;
  --primary: #6174f3;
  --primary-dark: #4f60d9;
  --primary-soft: #edf0ff;
  --mint: #45cbaa;
  --mint-soft: #e9fbf6;
  --peach: #f5a766;
  --peach-soft: #fff5ea;
  --pink: #f76f9d;
  --pink-soft: #fff0f5;
  --danger: #e95c70;
  --shadow-sm: 0 4px 12px rgba(71, 89, 151, .07);
  --shadow: 0 16px 34px rgba(71, 89, 151, .11);
  --radius: 8px;
  --ease: cubic-bezier(.2,.75,.25,1);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(135deg, var(--canvas-deep) 0%, #f9fbff 50%, #eef7ff 100%);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(97,116,243,.22); outline-offset: 2px; }
::selection { color: #fff; background: var(--primary); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { color: var(--ink); font-weight: 750; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 17px; line-height: 1.3; }
h3 { font-size: 14px; line-height: 1.3; }
.muted { color: var(--muted); font-size: 12.5px; }

/* Authentication */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(145deg, #e7ecff, #f9fbff 55%, #e9f8ff); }
.auth-card { width: min(430px,100%); padding: 31px; border: 1px solid rgba(255,255,255,.9); border-radius: 12px; background: rgba(255,255,255,.88); box-shadow: 0 24px 58px rgba(91,108,172,.16); }
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; min-width: 0; }
.brand-mark { width: 42px; height: 42px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 11px; color: #fff; background: var(--primary); box-shadow: 0 10px 18px rgba(97,116,243,.28); font-size: 18px; font-weight: 800; }
.brand-copy { min-width: 0; }
.brand-copy h2 { color: #fff; font-size: 18px; }
.brand-caption { margin-top: 2px; color: rgba(255,255,255,.7); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.auth .brand h1 { font-size: 22px; }
.auth .brand .muted { margin-top: 3px; }

/* Frame */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; z-index: 30; height: 100vh; display: flex; flex-direction: column; overflow: hidden; padding: 22px 13px 14px; color: rgba(255,255,255,.86); background: var(--primary); box-shadow: 8px 0 28px rgba(87,106,203,.14); }
.sidebar-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 0 5px; }
.sidebar .brand { margin: 0 0 29px; }
.sidebar .brand-mark { width: 37px; height: 37px; color: var(--primary); background: #fff; box-shadow: none; border-radius: 10px; }
.nav { display: grid; gap: 19px; overflow-y: auto; padding: 0 3px 16px; }
.nav-group { display: grid; gap: 4px; }
.nav-label { padding: 0 10px 6px; color: rgba(255,255,255,.62); font-size: 10px; font-weight: 700; letter-spacing: .11em; }
.nav button { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 8px 10px; border: 0; border-radius: 7px; color: rgba(255,255,255,.86); background: transparent; cursor: pointer; text-align: left; font-size: 13px; font-weight: 650; transition: background .16s var(--ease), transform .16s var(--ease), color .16s var(--ease); }
.nav button:hover { color: #fff; background: rgba(255,255,255,.13); transform: translateX(2px); }
.nav button.active { color: var(--primary); background: #fff; box-shadow: 0 7px 16px rgba(65,78,166,.17); }
.nav-glyph { width: 24px; height: 24px; display: grid; flex: 0 0 auto; place-items: center; border: 1px solid rgba(255,255,255,.26); border-radius: 7px; color: #fff; background: rgba(255,255,255,.12); font-size: 10px; font-weight: 800; }
.nav button.active .nav-glyph { color: var(--primary); border-color: #dde2ff; background: var(--primary-soft); }
.sidebar-user { display: grid; grid-template-columns: 35px minmax(0,1fr) auto; align-items: center; gap: 9px; margin-top: auto; padding: 14px 5px 3px; border-top: 1px solid rgba(255,255,255,.24); }
.user-avatar { width: 35px; height: 35px; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.6); border-radius: 50%; color: var(--primary); background: #fff; font-size: 12px; font-weight: 800; }
.user-copy { min-width: 0; display: grid; gap: 1px; }
.user-copy strong { overflow: hidden; color: #fff; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.user-copy span { color: rgba(255,255,255,.7); font-size: 10.5px; }
.sidebar-logout { padding: 6px; border: 0; border-radius: 6px; color: rgba(255,255,255,.8); background: transparent; cursor: pointer; font-size: 11px; }
.sidebar-logout:hover { color: var(--primary); background: #fff; }

/* Workspace */
.main { width: 100%; max-width: 1660px; margin: 0 auto; padding: 29px 34px 48px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.topbar-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title h1 { font-size: 26px; }
.topbar-title .muted { margin-top: 4px; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.role-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 11px; border: 1px solid #e7eaff; border-radius: 99px; color: var(--ink-soft); background: rgba(255,255,255,.8); font-size: 12px; font-weight: 650; }
.role-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px var(--mint-soft); }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; cursor: pointer; transition: box-shadow .16s var(--ease), transform .16s var(--ease); }
.icon-btn:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.menu-toggle, .sidebar-close, .sidebar-scrim { display: none; }
.menu-toggle { flex-direction: column; gap: 4px; }
.menu-toggle span { width: 17px; height: 2px; background: currentColor; }
.sidebar-close { color: var(--primary); background: #fff; font-size: 21px; }

/* Panels */
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.grid.four { grid-template-columns: repeat(4,minmax(0,1fr)); align-items: end; }
.stat, .panel, .table-wrap { border: 1px solid rgba(255,255,255,.9); border-radius: var(--radius); background: rgba(255,255,255,.9); box-shadow: var(--shadow-sm); }
.stat { position: relative; min-height: 133px; padding: 19px 20px; overflow: hidden; }
.stat:nth-child(1) { background: #eef0ff; }
.stat:nth-child(2) { background: #eafbf8; }
.stat:nth-child(3) { background: #fff5e9; }
.stat .muted { display: block; padding-right: 38px; color: var(--ink-soft); font-weight: 650; }
.stat strong { display: block; margin-top: 12px; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-icon { position: absolute; top: 18px; right: 19px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--primary); background: rgba(255,255,255,.75); box-shadow: 0 6px 12px rgba(85,105,190,.11); font-size: 11px; font-weight: 800; }
.stat:nth-child(2) .stat-icon { color: #18a98c; }
.stat:nth-child(3) .stat-icon { color: #d88942; }
.panel { padding: 20px; }
.panel + .panel, .panel + .table-wrap, .table-wrap + .panel, .table-wrap + .table-wrap { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.toolbar, .row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quota-panel { display: flex; align-items: center; justify-content: space-between; gap: 22px; border-left: 4px solid var(--primary); background: #f5f6ff; }
.quota-panel strong, .quota-card strong { display: block; margin: 7px 0; font-size: 27px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.quota-card { min-height: 170px; background: #f1fbff; }
.dashboard-layout { display: grid; grid-template-columns: minmax(0,1fr) 292px; gap: 16px; }
.dashboard-feature, .dashboard-quota { border: 1px solid rgba(255,255,255,.95); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.dashboard-feature { min-height: 208px; padding: 23px 24px 20px; background: #eef1ff; }
.dashboard-feature-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dashboard-feature-head h2 { font-size: 19px; }
.dashboard-feature-head .muted { margin-top: 4px; }
.dashboard-quick-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dashboard-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin-top: 27px; }
.dashboard-metric { min-width: 0; padding: 0 18px; border-left: 1px solid #d9def9; }
.dashboard-metric:first-child { padding-left: 0; border-left: 0; }
.dashboard-metric span, .dashboard-metric small { display: block; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.dashboard-metric small { margin-top: 3px; color: var(--muted); font-weight: 500; }
.dashboard-metric strong { display: block; margin-top: 8px; color: var(--primary); font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.dashboard-quota { position: relative; display: flex; flex-direction: column; align-items: flex-start; padding: 22px; overflow: hidden; background: #fff; }
.dashboard-quota::before { content: ""; position: absolute; top: 0; right: 0; width: 80px; height: 4px; background: var(--primary); }
.dashboard-quota-icon { width: 31px; height: 31px; display: grid; place-items: center; margin-bottom: 17px; border-radius: 8px; color: var(--primary); background: var(--primary-soft); font-size: 11px; font-weight: 800; }
.dashboard-quota strong { display: block; margin: 7px 0 5px; font-size: 27px; line-height: 1.1; }
.dashboard-quota .btn { margin-top: auto; width: 100%; }
.dashboard-recent { margin-top: 16px; }

/* Controls */
.btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 13px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink); background: #fff; cursor: pointer; font-size: 13px; font-weight: 680; transition: box-shadow .15s var(--ease), transform .15s var(--ease), background .15s var(--ease); }
.btn:hover { background: #fff; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { color: #fff; border-color: var(--primary); background: var(--primary); box-shadow: 0 7px 15px rgba(97,116,243,.25); }
.btn.primary:hover { color: #fff; border-color: var(--primary-dark); background: var(--primary-dark); }
.btn.danger { color: #d65268; border-color: #ffd6df; background: #fff4f7; box-shadow: none; }
.btn.danger:hover { color: #fff; border-color: var(--danger); background: var(--danger); }
.btn.active { color: #278a77; border-color: #bcefe5; background: var(--mint-soft); box-shadow: none; }
.btn.small { min-height: 32px; padding: 6px 10px; border-radius: 6px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field span { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.field-note { color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.input, .select, textarea { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 7px; outline: 0; color: var(--ink); background: #fbfcff; transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease); }
.input:hover, .select:hover, textarea:hover { border-color: #bec8ef; background: #fff; }
.input:focus, .select:focus, textarea:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(97,116,243,.12); }
.input::placeholder, textarea::placeholder { color: #b2b8cc; }
textarea { min-height: 98px; resize: vertical; line-height: 1.55; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 20px; padding: 4px; border: 1px solid #e5e9f9; border-radius: 8px; background: #eef1fd; }
.tabs button { min-height: 39px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 680; }
.tabs button.active { color: var(--primary); background: #fff; box-shadow: var(--shadow-sm); }

/* Tables and contacts */
.table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; min-width: 740px; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 13px; }
th { position: sticky; top: 0; z-index: 1; color: #8c93ad; background: #f7f8ff; font-size: 11px; font-weight: 760; letter-spacing: .06em; }
tbody tr { transition: background .14s var(--ease); }
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border: 1px solid #d7defd; border-radius: 99px; color: #5367d9; background: #f0f2ff; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge.ok { color: #218a76; border-color: #bcefe5; background: var(--mint-soft); }
.badge.warn { color: #b8741e; border-color: #fde0b5; background: var(--peach-soft); }
.badge.err { color: #cf5267; border-color: #ffd2dc; background: var(--pink-soft); }
.account-cell { display: inline-flex; align-items: center; gap: 10px; }
.account-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px var(--mint-soft); }
.account-table tbody tr.is-expanded { background: #f6f7ff; }
.account-expand-row td { padding: 0 16px 16px; background: #fff; }
.inline-contact-panel { padding-top: 16px; border-top: 1px solid var(--line); }
.inline-contact-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.inline-contact-grid, .contact-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(235px,1fr)); gap: 9px; max-height: 360px; overflow: auto; padding: 2px; }
.contact-item, .inline-contact-card { display: flex; align-items: center; gap: 10px; min-width: 0; border: 1px solid #edf0fb; border-radius: 7px; background: #fbfcff; }
.contact-item { padding: 10px; cursor: pointer; }
.contact-item:hover, .inline-contact-card:hover { border-color: #ced7fb; background: #fff; box-shadow: 0 7px 14px rgba(90,108,177,.08); }
.contact-item input { accent-color: var(--primary); }
.inline-contact-card { min-height: 62px; padding: 10px; }
.inline-contact-main { min-width: 0; }
.inline-contact-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 36px; height: 36px; flex: 0 0 auto; border: 2px solid #fff; border-radius: 50%; object-fit: cover; background: #e8edff; box-shadow: 0 2px 6px rgba(82,97,163,.12); }
.avatar-fallback { display: inline-grid; place-items: center; color: var(--primary); font-weight: 800; }
.inline-loading, .empty { padding: 28px; border: 1px dashed #c9d2f3; border-radius: 8px; color: var(--muted); background: #f6f8ff; text-align: center; }
.empty { padding: 42px 24px; }
.empty.compact { padding: 22px; }
.panel.empty { border-style: dashed; }

/* Dialogs */
.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(68,81,145,.25); backdrop-filter: blur(5px); animation: fade-in .16s ease both; }
.modal { width: min(760px,100%); max-height: calc(100vh - 40px); overflow: auto; border: 1px solid rgba(255,255,255,.9); border-radius: 10px; background: #fff; box-shadow: 0 28px 72px rgba(59,75,142,.2); animation: modal-in .22s var(--ease) both; }
.modal.qr-modal { width: min(920px,100%); }
.modal.screenshot-modal { width: min(1000px,100%); }
.modal-head, .modal-body { padding: 18px 20px; }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #edf0fb; background: #fafbff; }
.modal-kicker { display: block; margin-bottom: 3px; color: var(--primary); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.task-modal { width: min(940px,100%); }
.task-modal-head { padding: 17px 22px; background: #f3f5ff; }
.task-modal-close { width: 34px; height: 34px; border-radius: 50%; color: var(--primary); font-size: 21px; line-height: 1; }
.task-form { display: grid; gap: 2px; }
.task-form-grid { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(150px,.8fr); gap: 14px; }
.task-message { margin-top: 2px; }
.task-options { display: grid; grid-template-columns: minmax(160px,.52fr) minmax(0,1fr); align-items: end; gap: 14px; padding: 14px; margin: 3px 0 16px; border: 1px solid #e1e7fb; border-radius: 8px; background: #f7f8ff; }
.task-options .field { margin: 0; }
.switch-row { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 2px 3px; cursor: pointer; user-select: none; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-control { position: relative; width: 38px; height: 22px; flex: 0 0 auto; border-radius: 99px; background: #ccd3ec; transition: background .18s var(--ease); }
.switch-control::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(60,73,137,.2); transition: transform .18s var(--ease); }
.switch-row input:checked + .switch-control { background: var(--primary); }
.switch-row input:checked + .switch-control::after { transform: translateX(16px); }
.switch-row input:focus-visible + .switch-control { outline: 3px solid rgba(97,116,243,.22); outline-offset: 2px; }
.switch-row strong { display: block; color: var(--ink); font-size: 13px; }
.switch-row small { display: block; margin-top: 1px; color: var(--muted); font-size: 11.5px; }
.task-targets-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.task-targets-head > span { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.task-targets-head em { color: var(--muted); font-size: 11.5px; font-style: normal; }
.task-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; margin-top: 2px; border-top: 1px solid var(--line); }
.qr-layout { display: grid; grid-template-columns: minmax(270px,350px) minmax(0,1fr); gap: 24px; align-items: start; }
.qr-side { display: grid; gap: 12px; }
.qr-box { display: grid; place-items: center; min-height: 280px; padding: 16px; border: 1px dashed #c7d1f4; border-radius: 8px; background: #f4f6ff; }
.qr-box img { width: 238px; height: 238px; max-width: 100%; padding: 8px; border-radius: 6px; object-fit: contain; background: #fff; box-shadow: var(--shadow-sm); }
.verify-hint { margin-top: 10px; padding: 10px 12px; border: 1px solid #fde0b5; border-radius: 7px; color: #ad7422; background: var(--peach-soft); font-size: 12.5px; }
.verify-panel { padding: 14px; border: 1px solid #e1e7fb; border-radius: 8px; background: #f7f8ff; }
.screenshot-box { display: grid; place-items: center; min-height: 360px; overflow: auto; border: 1px solid #26304f; border-radius: 8px; background: #1f263f; }
.screenshot-box img { display: block; max-width: 100%; height: auto; }
.code-input { letter-spacing: .1em; text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 700; }
code { padding: 3px 6px; border: 1px solid #e3e8f9; border-radius: 5px; color: #5261b9; background: #f2f4ff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: min(420px,calc(100vw - 32px)); padding: 13px 15px; border: 1px solid rgba(255,255,255,.7); border-left: 4px solid #fff; border-radius: 8px; color: #fff; background: var(--primary); box-shadow: 0 16px 32px rgba(75,93,183,.3); font-size: 13px; animation: toast-in .22s var(--ease) both; }
form.panel .panel-head:not(:first-child) { margin-top: 10px; padding-top: 19px; border-top: 1px solid var(--line); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1100px) { .main { padding: 24px 24px 42px; } .grid.four { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 900px) {
  body.sidebar-open { overflow: hidden; }
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(82vw,300px); height: 100dvh; transform: translateX(-104%); transition: transform .22s var(--ease); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close, .menu-toggle { display: inline-flex; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 20; display: block; border: 0; opacity: 0; pointer-events: none; background: rgba(57,69,124,.32); transition: opacity .2s ease; }
  .sidebar-scrim.show { opacity: 1; pointer-events: auto; }
  .main { max-width: none; padding: 20px 18px 36px; }
  .grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .dashboard-layout { grid-template-columns: minmax(0,1fr) 240px; }
  .qr-layout { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  h1, .topbar-title h1 { font-size: 22px; }
  .auth { padding: 16px; }
  .auth-card { padding: 25px 20px; border-radius: 10px; }
  .main { padding: 16px 12px 30px; }
  .topbar { align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
  .topbar-title { width: 100%; }
  .topbar-title > div:last-child { min-width: 0; }
  .topbar-title .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions { width: 100%; }
  .top-actions .btn { flex: 1 1 auto; min-height: 42px; }
  .role-chip { display: none; }
  .grid.two, .grid.three, .grid.four, .task-form-grid, .task-options { grid-template-columns: 1fr; gap: 12px; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .dashboard-feature { min-height: 0; padding: 18px; }
  .dashboard-feature-head { flex-direction: column; }
  .dashboard-quick-actions { width: 100%; justify-content: stretch; }
  .dashboard-quick-actions .btn { flex: 1 1 auto; }
  .dashboard-metrics { gap: 13px; margin-top: 21px; }
  .dashboard-metric { padding: 0 10px; }
  .dashboard-metric strong { font-size: 27px; }
  .stat { min-height: 118px; padding: 17px; }
  .stat strong { font-size: 30px; }
  .panel { padding: 16px; }
  .quota-panel { align-items: flex-start; flex-direction: column; }
  .panel-head { align-items: flex-start; flex-wrap: wrap; }
  .btn { min-height: 42px; }
  .btn.small { min-height: 34px; }
  .row-actions { width: 100%; }
  .row-actions .btn { flex: 1 1 auto; }
  .contact-list, .inline-contact-grid { grid-template-columns: 1fr; }
  .task-options { align-items: start; padding: 13px; }
  .task-form-footer { align-items: stretch; flex-direction: column; }
  .task-form-footer .btn { width: 100%; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal, .modal.qr-modal, .modal.screenshot-modal { width: 100%; max-height: 92dvh; border-radius: 10px 10px 0 0; }
  .modal-head, .modal-body { padding: 16px; }
  .qr-box { min-height: 230px; }
  .qr-box img { width: min(220px,70vw); height: min(220px,70vw); }
  .screenshot-box { min-height: 260px; }
  .table-wrap { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  table { display: block; min-width: 0; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; }
  tbody tr { display: block; overflow: hidden; border: 1px solid #e7ebfa; border-radius: 8px; background: #fff; box-shadow: var(--shadow-sm); }
  tbody tr:hover { background: #fff; }
  td { display: grid; grid-template-columns: 86px minmax(0,1fr); gap: 10px; align-items: center; padding: 10px 12px; text-align: right; font-size: 12.5px; }
  td::before { content: attr(data-label); color: var(--muted); text-align: left; font-weight: 700; }
  td > * { min-width: 0; }
  td .row-actions { justify-content: flex-end; }
  td[colspan] { display: block; padding: 0; text-align: left; }
  td[colspan]::before { display: none; }
  .account-cell { justify-content: flex-end; }
  .account-expand-row { margin-top: -10px; border-top: 0; border-radius: 0 0 8px 8px; }
  .account-table tbody tr.is-expanded { border-radius: 8px 8px 0 0; }
  .account-expand-row td { padding: 0; }
  .inline-contact-panel { padding: 14px; }
  .inline-contact-head { align-items: flex-start; }
  .toast { right: 12px; bottom: 12px; left: 12px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* Premium product surface: restrained neutral system with a single cobalt accent. */
:root {
  --canvas: #f3f5f8;
  --canvas-deep: #f3f5f8;
  --surface: #ffffff;
  --surface-soft: #f8f9fb;
  --ink: #17191d;
  --ink-soft: #555c67;
  --muted: #858c97;
  --line: #e5e8ec;
  --line-strong: #d9dee5;
  --primary: #3159df;
  --primary-dark: #2447bc;
  --primary-soft: #edf1ff;
  --mint: #16866f;
  --mint-soft: #ebf8f5;
  --peach: #a56718;
  --peach-soft: #fff7e8;
  --pink: #c94760;
  --pink-soft: #fff0f2;
  --danger: #c94760;
  --shadow-sm: 0 1px 2px rgba(23,25,29,.035), 0 8px 22px rgba(23,25,29,.045);
  --shadow: 0 18px 44px rgba(23,25,29,.09);
  --radius: 10px;
}
body { background: var(--canvas); font-family: "SF Pro Display", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
.auth { background: #101114; }
.auth-card { border-color: rgba(255,255,255,.78); border-radius: 12px; background: #fff; box-shadow: 0 32px 80px rgba(0,0,0,.28); }
.brand-mark { border-radius: 9px; background: var(--primary); box-shadow: none; }

.sidebar { background: #17191d; box-shadow: none; border-right: 1px solid #292d33; }
.sidebar .brand-mark { color: #fff; background: var(--primary); }
.sidebar .brand-copy h2 { color: #fff; }
.brand-caption, .nav-label { color: #838a96; }
.nav button { border-radius: 7px; color: #b7bdc7; }
.nav button:hover { color: #fff; background: #24272c; transform: none; }
.nav button.active { color: #fff; background: #292c32; box-shadow: inset 3px 0 0 var(--primary); }
.nav-glyph { border-color: #343940; color: #9ba3af; background: #202329; }
.nav button.active .nav-glyph { color: #fff; border-color: rgba(49,89,223,.56); background: var(--primary); }
.sidebar-user { border-top-color: #2d3137; }
.user-avatar { color: #fff; border-color: #414752; background: #2b3038; }
.sidebar-logout:hover { color: #fff; background: #2b3038; }

.main { max-width: 1600px; padding: 32px 38px 54px; }
.topbar { margin-bottom: 30px; }
.topbar-title h1 { font-size: 27px; font-weight: 760; letter-spacing: .005em; }
.role-chip { border-color: var(--line); border-radius: 99px; background: #fff; box-shadow: none; }
.icon-btn { border-color: var(--line); border-radius: 8px; background: #fff; box-shadow: none; }
.icon-btn:hover { border-color: #bfc6cf; box-shadow: var(--shadow-sm); transform: none; }

.stat, .panel, .table-wrap { border-color: var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.stat { min-height: 126px; }
.stat:nth-child(1), .stat:nth-child(2), .stat:nth-child(3) { background: #fff; }
.stat::before { width: 3px; height: calc(100% - 36px); top: 18px; left: 0; border-radius: 0 3px 3px 0; background: var(--primary); }
.stat:nth-child(2)::before { background: var(--mint); }
.stat:nth-child(3)::before { background: #c69038; }
.stat-icon { border-radius: 7px; color: var(--primary); background: var(--primary-soft); box-shadow: none; }
.stat:nth-child(2) .stat-icon { color: var(--mint); background: var(--mint-soft); }
.stat:nth-child(3) .stat-icon { color: #a56718; background: var(--peach-soft); }
.stat strong { color: var(--ink); }
.panel { padding: 22px; }
.panel-head { margin-bottom: 18px; }
.quota-panel, .quota-card { border: 1px solid var(--line); background: #fff; }
.quota-panel { border-left: 3px solid var(--primary); }

.dashboard-layout { grid-template-columns: minmax(0,1fr) 300px; gap: 18px; }
.dashboard-feature, .dashboard-quota { border-color: var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.dashboard-feature { padding: 27px 28px 24px; background: #fff; }
.dashboard-feature-head h2 { font-size: 20px; letter-spacing: .005em; }
.dashboard-feature-head .muted { max-width: 38ch; }
.dashboard-metrics { margin-top: 30px; }
.dashboard-metric { padding: 0 23px; border-left-color: var(--line); }
.dashboard-metric:first-child { padding-left: 0; }
.dashboard-metric strong { color: var(--ink); font-size: 36px; font-weight: 760; }
.dashboard-metric span { color: var(--ink-soft); }
.dashboard-quota { background: #1d2025; color: #fff; box-shadow: 0 16px 34px rgba(22,26,32,.16); }
.dashboard-quota::before { background: var(--primary); }
.dashboard-quota .muted { color: #aeb5c0; }
.dashboard-quota strong { color: #fff; }
.dashboard-quota-icon { color: #bfd0ff; border: 1px solid rgba(255,255,255,.1); border-radius: 7px; background: rgba(49,89,223,.28); }
.dashboard-quota .btn { color: #fff; border-color: #353b45; background: #2a2f37; }
.dashboard-quota .btn:hover { background: #343b45; box-shadow: none; }
.dashboard-recent { margin-top: 18px; }

.btn { border-color: var(--line-strong); border-radius: 8px; background: #fff; box-shadow: none; }
.btn:hover { border-color: #b8c0c9; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn.primary { border-color: var(--primary); background: var(--primary); box-shadow: none; }
.btn.primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); box-shadow: 0 7px 16px rgba(49,89,223,.18); }
.btn.danger { color: var(--danger); border-color: #f0cbd2; background: #fff; }
.btn.danger:hover { color: #fff; border-color: var(--danger); background: var(--danger); }
.input, .select, textarea { border-color: var(--line-strong); border-radius: 8px; background: #fff; }
.input:hover, .select:hover, textarea:hover { border-color: #b7c0ca; }
.input:focus, .select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(49,89,223,.12); }
.tabs { border-color: var(--line); background: #f4f6f8; }
.tabs button.active { color: var(--ink); background: #fff; box-shadow: var(--shadow-sm); }

th { color: #777f8b; background: #fafbfc; }
tbody tr:hover { background: #fafbfc; }
.badge { color: #4662c4; border-color: #dce4ff; background: #f2f5ff; }
.badge.ok { color: #147b66; border-color: #c7e9e1; background: var(--mint-soft); }
.badge.warn { color: #94601a; border-color: #f2dfbe; background: var(--peach-soft); }
.badge.err { color: #b13e54; border-color: #f0cbd2; background: var(--pink-soft); }
.contact-item, .inline-contact-card { border-color: var(--line); border-radius: 8px; background: #fff; }
.contact-item:hover, .inline-contact-card:hover { border-color: #c9d0d8; background: #fff; box-shadow: var(--shadow-sm); }
.avatar { background: #eef1f5; box-shadow: none; }

.modal-backdrop { background: rgba(18,22,29,.42); backdrop-filter: blur(3px); }
.modal { border-color: #fff; border-radius: 12px; background: #fff; box-shadow: 0 28px 74px rgba(12,16,22,.24); }
.modal-head, .task-modal-head { border-bottom-color: var(--line); background: #fff; }
.modal-kicker { color: var(--primary); }
.task-options { border-color: var(--line); border-radius: 9px; background: #f8f9fb; }
.switch-control { background: #c8ced7; }
.switch-row input:checked + .switch-control { background: var(--primary); }
.qr-box, .verify-panel { border-color: var(--line); background: #fafbfc; }
.toast { border-radius: 9px; border-left-color: var(--primary); background: #20242a; box-shadow: 0 18px 40px rgba(15,18,23,.2); }
.field-note { color: #7d8490; }

@media (max-width: 900px) { .main { padding: 24px 20px 40px; } .dashboard-layout { grid-template-columns: minmax(0,1fr) 260px; } }
@media (max-width: 680px) {
  .main { padding: 18px 12px 32px; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .dashboard-feature { padding: 20px; }
  .dashboard-metric { padding: 0 10px; }
  .dashboard-metric strong { font-size: 29px; }
  .dashboard-quota { min-height: 190px; }
}

/* Calm Chinese SaaS system: light rail, open canvas, one indigo accent. */
:root {
  --canvas: #f6f7fb;
  --canvas-deep: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f9faff;
  --ink: #20222a;
  --ink-soft: #606574;
  --muted: #9298a8;
  --line: #e8eaf0;
  --line-strong: #d9dde6;
  --primary: #5b5bd6;
  --primary-dark: #4949be;
  --primary-soft: #f0efff;
  --mint: #14806b;
  --mint-soft: #eaf8f4;
  --peach: #9a691d;
  --peach-soft: #fff8e8;
  --pink: #c54e6b;
  --pink-soft: #fff0f4;
  --danger: #c54e6b;
  --shadow-sm: 0 1px 2px rgba(36,40,51,.025), 0 5px 15px rgba(36,40,51,.04);
  --shadow: 0 16px 34px rgba(36,40,51,.08);
  --radius: 8px;
}
body { background: var(--canvas); color: var(--ink); }
.auth { background: #f3f2ff; }
.auth-card { border: 1px solid #fff; border-radius: 10px; box-shadow: 0 18px 48px rgba(70,67,144,.12); }
.brand-mark { border-radius: 8px; background: var(--primary); }

.app-shell { grid-template-columns: 224px minmax(0,1fr); }
.sidebar { color: var(--ink); background: #fff; border-right: 1px solid var(--line); box-shadow: none; }
.sidebar .brand-mark { color: #fff; background: var(--primary); }
.sidebar .brand-copy h2 { color: var(--ink); }
.brand-caption, .nav-label { color: #9ba1b2; }
.nav button { color: #606574; font-weight: 620; }
.nav button:hover { color: #303342; background: #f6f6fb; }
.nav button.active { color: var(--primary); background: var(--primary-soft); box-shadow: none; }
.nav button.active::before { content: ""; position: absolute; left: -10px; width: 3px; height: 20px; border-radius: 3px; background: var(--primary); }
.nav-glyph { color: #878da0; border-color: transparent; background: transparent; }
.nav button.active .nav-glyph { color: var(--primary); border-color: transparent; background: transparent; }
.sidebar-user { border-top-color: var(--line); }
.user-avatar { color: var(--primary); border: 0; background: var(--primary-soft); }
.user-copy strong { color: var(--ink); }
.user-copy span { color: var(--muted); }
.sidebar-logout { color: var(--muted); }
.sidebar-logout:hover { color: var(--primary); background: var(--primary-soft); }

.main { max-width: 1540px; padding: 32px 40px 56px; }
.topbar { margin-bottom: 34px; }
.topbar-title h1 { color: #20222a; font-size: 25px; font-weight: 720; }
.topbar-title .muted { color: #9a9faf; }
.role-chip { border-color: transparent; color: #73798a; background: transparent; }
.icon-btn { border-color: var(--line); border-radius: 7px; }

.stat, .panel, .table-wrap { border-color: var(--line); border-radius: var(--radius); box-shadow: none; }
.panel { padding: 22px; }
.panel:hover, .table-wrap:hover { border-color: #dde0ea; }
.dashboard-layout { grid-template-columns: minmax(0,1fr) 272px; gap: 18px; }
.dashboard-feature, .dashboard-quota { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.dashboard-feature { padding: 25px 26px 22px; background: #fff; }
.dashboard-feature-head h2 { font-size: 19px; font-weight: 720; }
.dashboard-feature-head .muted { color: #979dab; }
.dashboard-metrics { margin-top: 26px; }
.dashboard-metric { padding: 0 20px; border-left-color: var(--line); }
.dashboard-metric strong { color: var(--ink); font-size: 32px; font-weight: 720; }
.dashboard-metric span { color: #777d8c; font-weight: 600; }
.dashboard-metric small { color: #a0a5b2; }
.dashboard-quota { color: var(--ink); background: #f2f1ff; }
.dashboard-quota::before { width: 3px; height: 42px; top: 22px; left: 0; right: auto; background: var(--primary); }
.dashboard-quota .muted { color: #777999; }
.dashboard-quota strong { color: #313149; }
.dashboard-quota-icon { color: var(--primary); border: 0; border-radius: 8px; background: #fff; }
.dashboard-quota .btn { color: var(--primary); border-color: transparent; background: #fff; }
.dashboard-quota .btn:hover { color: #fff; background: var(--primary); }
.dashboard-recent { margin-top: 18px; }

.btn { border-radius: 7px; font-weight: 620; }
.btn.primary { background: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { background: #fff; }
.input, .select, textarea { border-color: var(--line-strong); border-radius: 7px; background: #fff; }
.input:focus, .select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,91,214,.12); }
.tabs { background: #f4f4f8; }
.tabs button.active { color: var(--primary); }

th { color: #8b90a0; background: #fafafd; }
tbody tr:hover { background: #fafaff; }
.badge { color: var(--primary); border-color: #e0dfff; background: var(--primary-soft); }
.contact-item, .inline-contact-card { border-color: #edf0f5; background: #fff; }
.contact-item:hover, .inline-contact-card:hover { border-color: #daddE8; box-shadow: none; }
.account-table tbody tr.is-expanded { background: #fafaff; }
.account-expand-row td { background: #fff; }

.modal-backdrop { background: rgba(31,33,42,.28); backdrop-filter: blur(2px); }
.modal { border-radius: 10px; box-shadow: 0 24px 62px rgba(25,27,34,.17); }
.modal-head, .task-modal-head { background: #fff; }
.task-modal-head { border-top: 3px solid var(--primary); }
.task-options { background: #fafaff; }
.switch-row input:checked + .switch-control { background: var(--primary); }
.toast { background: #2a2b33; border-left-color: var(--primary); }

@media (max-width: 900px) {
  .sidebar { box-shadow: 12px 0 32px rgba(25,27,34,.14); }
  .sidebar-close { color: var(--primary); background: var(--primary-soft); }
  .sidebar-scrim { background: rgba(31,33,42,.22); }
  .main { padding: 24px 20px 42px; }
}

/* Announcement */
.announcement { display: grid; grid-template-columns: 34px minmax(0,1fr) 28px; align-items: center; gap: 12px; margin: -10px 0 20px; padding: 12px 14px; border: 1px solid #e3e1ff; border-radius: 8px; color: #3d3d69; background: #f7f6ff; }
.announcement-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; color: var(--primary); background: #eae8ff; font-size: 12px; font-weight: 800; }
.announcement-copy { min-width: 0; }
.announcement-copy strong { display: block; color: #37365e; font-size: 13px; }
.announcement-copy p { margin-top: 2px; color: #74749a; font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; }
.announcement-close { width: 28px; height: 28px; border: 0; border-radius: 6px; color: #8787a8; background: transparent; cursor: pointer; font-size: 20px; line-height: 1; }
.announcement-close:hover { color: var(--primary); background: #ecebff; }
@media (max-width: 680px) {
  .announcement { align-items: flex-start; margin: -4px 0 16px; grid-template-columns: 30px minmax(0,1fr) 26px; gap: 9px; padding: 11px; }
  .announcement-mark { width: 28px; height: 28px; }
}

/* Keep the dashboard as a real single-column workspace on phones. These rules
   intentionally live last because the desktop design layers above redefine it. */
@media (max-width: 680px) {
  .main { padding: 16px 14px 30px; }
  .topbar { gap: 12px; margin-bottom: 18px; }
  .topbar-title { width: 100%; }
  .top-actions { width: 100%; }

  .dashboard-layout { grid-template-columns: minmax(0,1fr); gap: 14px; }
  .dashboard-feature { min-height: 0; padding: 18px; }
  .dashboard-feature-head { flex-direction: column; gap: 14px; }
  .dashboard-quick-actions { width: 100%; justify-content: stretch; }
  .dashboard-quick-actions .btn { flex: 1 1 0; }
  .dashboard-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0; margin-top: 22px; }
  .dashboard-metric { padding: 0 8px; }
  .dashboard-metric:first-child { padding-left: 0; }
  .dashboard-metric:last-child { padding-right: 0; }
  .dashboard-metric span, .dashboard-metric small { font-size: 11px; line-height: 1.45; }
  .dashboard-metric strong { margin-top: 7px; font-size: 27px; }
  .dashboard-quota { min-height: 176px; padding: 20px; }

  .inline-contact-grid, .contact-list { grid-template-columns: 1fr; }
  .panel-head .toolbar, .panel-head .row-actions { width: 100%; }
  .panel-head .toolbar .btn, .panel-head .row-actions .btn { flex: 1 1 auto; }
}
