:root {
  color-scheme: light;
  --brand-900: #0b2d63;
  --brand-800: #0e3f87;
  --brand-700: #1056bd;
  --brand-600: #1768e5;
  --brand-500: #2f7bf0;
  --brand-100: #dceaff;
  --brand-50: #f2f7ff;
  --ink-950: #101828;
  --ink-800: #263449;
  --ink-600: #526176;
  --ink-500: #66758a;
  --ink-400: #8592a6;
  --line: #e4eaf2;
  --line-strong: #d4ddea;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --success: #138a55;
  --success-bg: #eaf8f1;
  --warning: #b25d00;
  --warning-bg: #fff4df;
  --danger: #cf3d4d;
  --danger-bg: #fff0f1;
  --purple: #6c4dd3;
  --purple-bg: #f0edff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 12px 32px rgba(31, 52, 83, .10);
  --shadow-lg: 0 26px 70px rgba(16, 37, 69, .18);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --sidebar: 248px;
  --header: 72px;
  --font: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink-950);
  background: var(--canvas);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; }

button { color: inherit; }

a { color: inherit; text-decoration: none; }

svg { display: block; }

img { max-width: 100%; }

.skip-link {
  position: fixed;
  z-index: 9999;
  top: 12px;
  left: 12px;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand-700);
}

.skip-link:focus { transform: none; }

:focus-visible {
  outline: 3px solid #1768e5;
  outline-offset: 2px;
}

input::placeholder, textarea::placeholder { color: var(--ink-500); opacity: 1; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.noscript {
  margin: 32px;
  padding: 18px;
  border: 1px solid #ffd2d6;
  border-radius: 12px;
  color: var(--danger);
  background: var(--danger-bg);
}

/* Auth and first-run setup */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(440px, .95fr);
  background: #fff;
}

.auth-story {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: clamp(34px, 5vw, 72px);
  color: #fff;
  background:
    radial-gradient(circle at 14% 12%, rgba(90, 173, 255, .36), transparent 28%),
    linear-gradient(145deg, #082957 0%, #0d4da3 54%, #1768e5 100%);
}

.auth-story::before,
.auth-story::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
}

.auth-story::before { width: 540px; height: 540px; right: -250px; top: 8%; }
.auth-story::after { width: 360px; height: 360px; left: -160px; bottom: -130px; }

.brand-lockup { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(140deg, #2f8aff, #1056bd);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), 0 8px 20px rgba(6, 42, 94, .22);
}

.auth-story .brand-mark { background: rgba(255, 255, 255, .15); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }

.brand-name { font-weight: 780; letter-spacing: .02em; }
.brand-sub { color: inherit; opacity: .68; font-size: 13px; }

.story-copy { position: relative; z-index: 1; max-width: 650px; margin: 9vh 0; }
.story-kicker { margin: 0 0 14px; color: #a7d2ff; font-weight: 700; letter-spacing: .08em; }
.story-copy h1 { margin: 0 0 20px; max-width: 600px; font-size: clamp(38px, 5vw, 66px); line-height: 1.1; letter-spacing: -.04em; }
.story-copy > p { max-width: 580px; margin: 0; color: rgba(255,255,255,.77); font-size: 18px; line-height: 1.8; }
.story-flow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.story-flow span { padding: 8px 13px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(255,255,255,.08); font-size: 14px; }
.auth-foot { position: relative; z-index: 1; color: rgba(255,255,255,.6); font-size: 13px; }

.auth-panel { display: grid; place-items: center; padding: 36px clamp(24px, 6vw, 86px); background: linear-gradient(#fff, #fbfdff); }
.auth-card { width: min(100%, 480px); }
.auth-mobile-brand { display: none; margin-bottom: 34px; color: var(--brand-800); }
.auth-card h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.02em; }
.auth-intro { margin: 0 0 28px; color: var(--ink-500); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 24px; border-radius: 12px; background: #f0f3f8; }
.auth-tab { min-height: 42px; border: 0; border-radius: 9px; color: var(--ink-600); background: transparent; cursor: pointer; }
.auth-tab.active { color: var(--brand-700); background: #fff; box-shadow: var(--shadow-sm); font-weight: 700; }
.auth-form { display: grid; gap: 18px; }
.auth-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--ink-400); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.auth-help { margin-top: 22px; color: var(--ink-500); text-align: center; font-size: 14px; }
.link-button { padding: 0; border: 0; color: var(--brand-700); background: transparent; cursor: pointer; font-weight: 650; }

.setup-progress { display: flex; align-items: center; gap: 8px; margin: 24px 0 30px; }
.setup-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.setup-dot.active { width: 30px; border-radius: 99px; background: var(--brand-600); }
.setup-dot.done { background: var(--success); }
.setup-summary { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--brand-50); }
.setup-summary div { display: flex; justify-content: space-between; gap: 16px; }
.setup-summary span { color: var(--ink-500); }

/* App shell */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  z-index: 70;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  color: #dce8f7;
  background: #0a2d59;
  box-shadow: 6px 0 24px rgba(11, 45, 99, .08);
}

.sidebar-head { height: var(--header); display: flex; align-items: center; padding: 0 20px; border-bottom: 1px solid rgba(255,255,255,.08); color: #fff; }
.sidebar-head .brand-mark { width: 38px; height: 38px; }
.sidebar-head .brand-sub { color: #91a9c8; }
.sidebar-scroll { flex: 1; overflow: auto; padding: 16px 12px 20px; scrollbar-width: thin; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-label { margin: 0 10px 7px; color: #7895bb; font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 9px 11px; border-radius: 10px; color: #b9cbe1; cursor: pointer; transition: .16s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.075); }
.nav-item.active { color: #fff; background: linear-gradient(95deg, rgba(47,123,240,.48), rgba(47,123,240,.18)); font-weight: 650; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; width: 3px; height: 22px; border-radius: 0 4px 4px 0; background: #62a5ff; }
.nav-item .icon { width: 20px; height: 20px; opacity: .88; }
.nav-item .nav-badge { margin-left: auto; min-width: 21px; height: 20px; display: grid; place-items: center; padding: 0 6px; border-radius: 999px; color: #fff; background: #dc4655; font-size: 11px; font-weight: 700; }
.sidebar-user { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px; border: 0; border-radius: 10px; color: inherit; background: transparent; cursor: pointer; text-align: left; }
.user-chip:hover { background: rgba(255,255,255,.07); }
.avatar { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(145deg, #2c85fc, #744ff0); font-weight: 750; font-size: 14px; }
.user-meta { min-width: 0; flex: 1; }
.user-meta strong { display: block; overflow: hidden; color: #fff; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; }
.user-meta span { display: block; color: #8fa8c9; font-size: 12px; }

.app-main { min-height: 100vh; margin-left: var(--sidebar); }

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  height: var(--header);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.93);
  backdrop-filter: blur(14px);
}

.mobile-menu { display: none; }
.breadcrumb { min-width: 118px; font-weight: 750; letter-spacing: -.01em; }
.global-search { position: relative; width: min(520px, 46vw); margin-right: auto; }
.global-search .icon { position: absolute; left: 14px; top: 50%; width: 19px; height: 19px; color: var(--ink-400); transform: translateY(-50%); pointer-events: none; }
.global-search input { width: 100%; height: 42px; padding: 0 78px 0 43px; border: 1px solid var(--line); border-radius: 12px; background: #f7f9fc; }
.global-search input:focus { border-color: #86b6f9; background: #fff; outline: 3px solid rgba(23,104,229,.10); }
.search-key { position: absolute; top: 9px; right: 10px; padding: 2px 7px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--ink-400); background: #fff; font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { position: relative; width: 42px; height: 42px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 11px; color: var(--ink-600); background: #fff; cursor: pointer; }
.icon-button:hover { border-color: #b8d3f7; color: var(--brand-700); background: var(--brand-50); }
.icon-button .icon { width: 20px; height: 20px; }
.alert-dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border: 2px solid #fff; border-radius: 50%; background: #e44554; }
.connection-pill { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 11px; border: 1px solid #cdebdc; border-radius: 999px; color: var(--success); background: #f3fbf7; font-size: 13px; font-weight: 650; }
.connection-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(19,138,85,.12); }

.page { width: min(100%, 1560px); margin: 0 auto; padding: 28px 30px 54px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-heading h1 { margin: 0 0 5px; font-size: 26px; line-height: 1.3; letter-spacing: -.025em; }
.page-heading p { margin: 0; color: var(--ink-500); }
.heading-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

/* Components */
.icon { width: 1.2em; height: 1.2em; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.fill { fill: currentColor; stroke: none; }

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-weight: 680;
  line-height: 1.2;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: none; }
.button:disabled { opacity: .52; cursor: not-allowed; transform: none; }
.button .icon { width: 18px; height: 18px; }
.button.primary { color: #fff; background: linear-gradient(180deg, #2678ec, #1768e5); box-shadow: 0 6px 16px rgba(23,104,229,.22); }
.button.primary:hover { box-shadow: 0 9px 22px rgba(23,104,229,.26); }
.button.secondary { border-color: #bcd6fa; color: var(--brand-700); background: var(--brand-50); }
.button.ghost { border-color: var(--line); color: var(--ink-700); background: #fff; }
.button.ghost:hover { border-color: #b9cff0; background: #f8fbff; }
.button.danger { border-color: #f3c2c8; color: var(--danger); background: var(--danger-bg); }
.button.success { color: #fff; background: var(--success); }
.button.small { min-height: 34px; padding: 7px 11px; border-radius: 8px; font-size: 14px; }
.button.full { width: 100%; }
.button.loading { pointer-events: none; }
.spinner { width: 17px; height: 17px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .65s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: grid; gap: 7px; }
.field > label, .field-label { color: var(--ink-800); font-size: 14px; font-weight: 650; }
.required::after { content: " *"; color: var(--danger); }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink-950);
  background: #fff;
  transition: border .15s, box-shadow .15s;
}
.input, .select { height: 42px; padding: 0 12px; }
.textarea { min-height: 110px; padding: 11px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: #76aaf2; outline: none; box-shadow: 0 0 0 3px rgba(23,104,229,.10); }
.input::placeholder, .textarea::placeholder { color: #98a4b4; }
.field-help { color: var(--ink-500); font-size: 13px; }
.field-error { display: flex; align-items: center; gap: 5px; color: var(--danger); font-size: 13px; }
.input.invalid, .select.invalid, .textarea.invalid { border-color: #ed8994; background: #fffbfb; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.span-2 { grid-column: span 2; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 58px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-header h2, .card-header h3 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.card-header p { margin: 2px 0 0; color: var(--ink-500); font-size: 13px; }
.card-body { padding: 18px; }
.card-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 13px 18px; border-top: 1px solid var(--line); background: #fbfcfe; border-radius: 0 0 var(--radius) var(--radius); }
.link { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-700); cursor: pointer; font-size: 14px; font-weight: 650; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { position: relative; overflow: hidden; min-height: 132px; padding: 18px; }
.stat-card::after { content: ""; position: absolute; width: 90px; height: 90px; right: -35px; top: -32px; border-radius: 50%; background: var(--stat-tint, var(--brand-50)); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { color: var(--ink-500); font-size: 14px; }
.stat-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; color: var(--stat-color, var(--brand-700)); background: var(--stat-tint, var(--brand-50)); }
.stat-icon .icon { width: 19px; height: 19px; }
.stat-value { margin: 11px 0 5px; font-size: 30px; font-weight: 780; line-height: 1; letter-spacing: -.04em; }
.stat-note { color: var(--ink-500); font-size: 13px; }
.stat-note strong { color: var(--stat-color, var(--brand-700)); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(330px, .75fr); gap: 18px; }
.dashboard-stack { display: grid; align-content: start; gap: 18px; }
.hero-action { position: relative; overflow: hidden; padding: 22px; color: #fff; background: linear-gradient(125deg, #0d4a9d, #1768e5 68%, #2f83f4); }
.hero-action::after { content: "AI"; position: absolute; right: 20px; bottom: -24px; color: rgba(255,255,255,.08); font-size: 118px; font-weight: 900; line-height: 1; }
.hero-action h2 { position: relative; z-index: 1; margin: 0 0 7px; font-size: 22px; }
.hero-action p { position: relative; z-index: 1; max-width: 620px; margin: 0 0 17px; color: rgba(255,255,255,.78); }
.hero-action .button { position: relative; z-index: 1; color: var(--brand-800); background: #fff; }
.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.quick-action { min-height: 94px; display: grid; place-items: center; align-content: center; gap: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink-700); background: #fff; cursor: pointer; text-align: center; font-size: 14px; font-weight: 620; }
.quick-action:hover { border-color: #a8c9f7; color: var(--brand-700); background: var(--brand-50); }
.quick-action .icon { width: 22px; height: 22px; color: var(--brand-600); }

.list { margin: 0; padding: 0; list-style: none; }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row:first-child { padding-top: 0; }
.list-row:last-child { padding-bottom: 0; border-bottom: 0; }
.list-main { min-width: 0; flex: 1; }
.list-title { overflow: hidden; margin: 0; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; }
.list-sub { overflow: hidden; margin-top: 3px; color: var(--ink-500); white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.list-time { flex: 0 0 auto; color: var(--ink-500); font-size: 13px; }
.status-marker { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--brand-600); }
.status-marker.warning { background: #e6952f; }
.status-marker.danger { background: #df4a59; }
.status-marker.success { background: #24a76e; }

.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 25px; padding: 3px 8px; border-radius: 999px; color: var(--brand-700); background: var(--brand-50); font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.success { color: var(--success); background: var(--success-bg); }
.badge.warning { color: var(--warning); background: var(--warning-bg); }
.badge.danger { color: var(--danger); background: var(--danger-bg); }
.badge.purple { color: var(--purple); background: var(--purple-bg); }
.badge.neutral { color: var(--ink-600); background: #eef1f5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .78; }
.badge.no-dot::before { display: none; }

.progress { height: 7px; overflow: hidden; border-radius: 99px; background: #eaf0f7; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1768e5, #59a1ff); }
.progress.success > span { background: linear-gradient(90deg, #138a55, #36ba7d); }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid #bfdbfc; border-radius: 10px; color: #174f8e; background: #eff7ff; font-size: 14px; }
.alert .icon { width: 19px; height: 19px; flex: 0 0 auto; margin-top: 1px; }
.alert.warning { border-color: #f2d49e; color: #895012; background: var(--warning-bg); }
.alert.danger { border-color: #f0bcc2; color: #a72e3b; background: var(--danger-bg); }
.alert.success { border-color: #bce6d3; color: #087245; background: var(--success-bg); }

/* Tables, filters and records */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; }
.toolbar-search { position: relative; min-width: min(100%, 260px); flex: 1; max-width: 400px; }
.toolbar-search .input { width: 100%; padding-left: 38px; }
.toolbar-search .icon { position: absolute; left: 12px; top: 12px; color: var(--ink-400); }
.toolbar-spacer { flex: 1; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #f5f7fa; }
.segment { min-height: 34px; padding: 5px 11px; border: 0; border-radius: 7px; color: var(--ink-500); background: transparent; cursor: pointer; font-size: 14px; }
.segment.active { color: var(--brand-700); background: #fff; box-shadow: var(--shadow-sm); font-weight: 650; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.data-table { width: 100%; min-width: 780px; border-collapse: collapse; }
.data-table th { padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--ink-500); background: #f8fafc; text-align: left; font-size: 13px; font-weight: 680; white-space: nowrap; }
.data-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); color: var(--ink-800); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #fbfdff; }
.data-table .row-link { color: var(--brand-700); font-weight: 680; cursor: pointer; }
.data-table .muted { color: var(--ink-500); }
.table-actions { display: flex; align-items: center; gap: 6px; }
.money { font-variant-numeric: tabular-nums; font-weight: 680; }
.mobile-records { display: none; }
.record-card { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.record-card + .record-card { margin-top: 10px; }
.record-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.record-id { color: var(--brand-700); font-weight: 730; }
.record-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; color: var(--ink-500); font-size: 13px; }
.record-grid strong { display: block; color: var(--ink-800); font-size: 14px; }

/* Workflow */
.workflow-overview { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; }
.workflow-card { position: relative; min-height: 170px; padding: 17px; cursor: pointer; transition: .15s ease; }
.workflow-card:hover { border-color: #b0cff8; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.workflow-number { width: 34px; height: 34px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 10px; color: var(--brand-700); background: var(--brand-50); font-size: 14px; font-weight: 800; }
.workflow-card h3 { margin: 0 0 5px; font-size: 16px; }
.workflow-card p { margin: 0; color: var(--ink-500); font-size: 13px; line-height: 1.6; }
.workflow-card .workflow-foot { position: absolute; left: 17px; right: 17px; bottom: 14px; display: flex; align-items: center; justify-content: space-between; color: var(--ink-500); font-size: 13px; }
.workflow-card .workflow-foot strong { color: var(--brand-700); }

.stepper { display: flex; align-items: flex-start; overflow-x: auto; padding: 5px 2px 12px; }
.step { position: relative; min-width: 118px; flex: 1; color: var(--ink-400); text-align: center; font-size: 13px; }
.step:not(:last-child)::after { content: ""; position: absolute; z-index: 0; top: 15px; left: calc(50% + 16px); right: calc(-50% + 16px); height: 2px; background: var(--line-strong); }
.step.done:not(:last-child)::after { background: #65b98f; }
.step-dot { position: relative; z-index: 1; width: 31px; height: 31px; display: grid; place-items: center; margin: 0 auto 7px; border: 2px solid var(--line-strong); border-radius: 50%; background: #fff; font-weight: 750; }
.step.done { color: var(--success); }
.step.done .step-dot { border-color: var(--success); color: #fff; background: var(--success); }
.step.active { color: var(--brand-700); font-weight: 700; }
.step.active .step-dot { border-color: var(--brand-600); box-shadow: 0 0 0 4px var(--brand-100); }

/* AI intake */
.ai-layout { display: grid; grid-template-columns: minmax(340px, .82fr) minmax(480px, 1.18fr); gap: 18px; align-items: start; }
.ai-source { position: sticky; top: calc(var(--header) + 20px); }
.prompt-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 14px; }
.prompt-chip { min-height: 32px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-600); background: #fff; cursor: pointer; font-size: 13px; }
.prompt-chip:hover { border-color: #a8c8f4; color: var(--brand-700); background: var(--brand-50); }
.ai-input { min-height: 245px; line-height: 1.75; }
.drop-zone { display: grid; place-items: center; gap: 4px; min-height: 116px; margin-top: 12px; padding: 18px; border: 1.5px dashed #b6c9e1; border-radius: 12px; color: var(--ink-500); background: #f9fbfe; cursor: pointer; text-align: center; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--brand-500); color: var(--brand-700); background: var(--brand-50); }
.drop-zone .icon { width: 25px; height: 25px; margin-bottom: 3px; }
.drop-zone strong { color: var(--ink-800); font-size: 14px; }
.drop-zone span { font-size: 12px; }
.file-list { display: grid; gap: 7px; margin-top: 10px; }
.file-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: #f2f6fb; font-size: 13px; }
.file-item span { min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.preview-empty { min-height: 450px; display: grid; place-items: center; padding: 36px; text-align: center; }
.empty-visual { width: 74px; height: 74px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 22px; color: var(--brand-600); background: linear-gradient(145deg, var(--brand-50), #e5f1ff); }
.empty-visual .icon { width: 32px; height: 32px; }
.preview-empty h3 { margin: 0 0 7px; font-size: 18px; }
.preview-empty p { max-width: 360px; margin: 0; color: var(--ink-500); font-size: 14px; }
.preview-summary { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); background: #f8fbff; }
.confidence { width: 45px; height: 45px; display: grid; place-items: center; flex: 0 0 auto; border: 4px solid #b9e5d0; border-top-color: var(--success); border-radius: 50%; color: var(--success); font-size: 12px; font-weight: 750; transform: rotate(-25deg); }
.confidence span { transform: rotate(25deg); }
.preview-section { padding: 17px 18px; border-bottom: 1px solid var(--line); }
.preview-section:last-child { border-bottom: 0; }
.preview-section h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 15px; }
.detected { position: relative; }
.detected::after { content: "AI识别"; position: absolute; top: -7px; right: 8px; padding: 0 4px; color: var(--brand-700); background: #fff; font-size: 10px; }
.review-needed::after { content: "请核对"; color: var(--warning); }
.product-editor { overflow-x: auto; }
.product-entry { min-width: 960px; margin-bottom: 10px; }
.product-line { display: grid; grid-template-columns: 1.45fr .62fr .56fr .72fr .72fr .78fr .68fr auto; gap: 8px; align-items: center; min-width: 960px; }
.product-line-head { margin-bottom: 6px; color: var(--ink-500); font-size: 12px; font-weight: 650; }
.product-calc-hint { margin: 5px 0 0; color: var(--ink-500); font-size: 12px; }
.ai-actions { position: sticky; bottom: 0; z-index: 3; display: flex; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }

/* Order details and timeline */
.detail-head { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 18px; }
.back-button { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-600); background: #fff; cursor: pointer; }
.detail-title { min-width: 0; flex: 1; }
.detail-title h1 { margin: 0 0 6px; font-size: 24px; }
.detail-title p { margin: 0; color: var(--ink-500); }
.detail-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr); gap: 18px; align-items: start; }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 17px; }
.info-item span { display: block; margin-bottom: 4px; color: var(--ink-500); font-size: 13px; }
.info-item strong { display: block; overflow-wrap: anywhere; color: var(--ink-800); font-size: 14px; }
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; top: 10px; bottom: 10px; left: 10px; width: 2px; background: var(--line); }
.timeline-item { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 11px; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { z-index: 1; width: 22px; height: 22px; display: grid; place-items: center; border: 2px solid #c4d0df; border-radius: 50%; color: #fff; background: #fff; }
.timeline-item.done .timeline-dot { border-color: var(--success); background: var(--success); }
.timeline-item.current .timeline-dot { border-color: var(--brand-600); background: #fff; box-shadow: 0 0 0 4px var(--brand-100); }
.timeline-item.current .timeline-dot::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-600); }
.timeline-content strong { display: block; margin-bottom: 2px; font-size: 14px; }
.timeline-content p { margin: 0; color: var(--ink-500); font-size: 13px; }
.timeline-time { margin-top: 4px; color: var(--ink-400); font-size: 12px; }

/* Approvals */
.approval-layout { display: grid; grid-template-columns: minmax(360px, .9fr) minmax(460px, 1.1fr); gap: 18px; align-items: start; }
.approval-list { overflow: hidden; }
.approval-list-item { width: 100%; display: flex; gap: 12px; padding: 15px 16px; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left; }
.approval-list-item:last-child { border-bottom: 0; }
.approval-list-item:hover, .approval-list-item.active { background: #f6faff; }
.approval-list-item.active { box-shadow: inset 3px 0 var(--brand-600); }
.approval-type { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: var(--brand-700); background: var(--brand-50); }
.approval-detail { position: sticky; top: calc(var(--header) + 20px); }
.approval-route { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.route-node { padding: 5px 8px; border-radius: 7px; color: var(--ink-600); background: #eef2f7; font-size: 12px; }
.route-node.done { color: var(--success); background: var(--success-bg); }
.route-node.current { color: var(--brand-700); background: var(--brand-100); font-weight: 700; }
.route-arrow { color: var(--ink-400); }

/* Quote and contract templates */
.template-layout { display: grid; grid-template-columns: minmax(310px, .7fr) minmax(620px, 1.3fr); gap: 18px; align-items: start; }
.template-editor { position: sticky; top: calc(var(--header) + 20px); }
.document-stage { overflow: auto; padding: 24px; border-radius: var(--radius); background: #e8edf4; }
.doc-sheet { width: 760px; min-height: 1020px; margin: 0 auto; padding: 48px 52px; color: #18202d; background: #fff; box-shadow: 0 9px 30px rgba(29,45,67,.14); font-family: "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; }
.doc-brand { color: var(--brand-800); font-size: 14px; font-weight: 800; letter-spacing: .12em; }
.doc-title { margin: 22px 0 7px; text-align: center; font-size: 28px; letter-spacing: .18em; }
.doc-subtitle { margin-bottom: 28px; color: #647083; text-align: center; font-size: 12px; }
.doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 26px; margin-bottom: 20px; font-size: 13px; }
.doc-meta div { display: flex; gap: 7px; }
.doc-meta span { flex: 0 0 auto; color: #697587; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.doc-table th, .doc-table td { padding: 9px 8px; border: 1px solid #aeb7c3; text-align: center; }
.doc-table th { background: #f0f3f7; font-weight: 700; }
.doc-table td:nth-child(2) { text-align: left; }
.doc-total { display: flex; justify-content: flex-end; gap: 28px; margin: 13px 0 25px; font-size: 14px; }
.doc-total strong { font-size: 17px; }
.doc-terms { display: grid; gap: 8px; padding: 18px 20px; border: 1px solid #cbd2dc; font-size: 12px; line-height: 1.7; }
.doc-terms h3 { margin: 0 0 3px; font-size: 14px; }
.doc-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; margin-top: 38px; font-size: 13px; }
.doc-signatures section { min-height: 130px; border-top: 1px solid #9ca7b5; padding-top: 10px; }
.doc-signatures p { margin: 7px 0; }
.seal-placeholder { width: 108px; height: 68px; display: grid; place-items: center; margin-top: 14px; border: 1px dashed #b7c0cc; border-radius: 6px; color: #8b96a5; background: #fafbfc; font-size: 11px; text-align: center; }
.doc-footer { margin-top: 34px; padding-top: 10px; border-top: 1px solid #d1d7df; color: #7b8797; text-align: center; font-size: 10px; }
.template-note { display: flex; align-items: flex-start; gap: 7px; color: var(--ink-500); font-size: 13px; }

/* Reports */
.chart { min-height: 250px; display: flex; align-items: flex-end; gap: 16px; padding: 24px 8px 4px; border-bottom: 1px solid var(--line); }
.bar-group { min-width: 36px; flex: 1; height: 210px; display: flex; align-items: flex-end; justify-content: center; gap: 5px; position: relative; }
.bar { width: min(22px, 38%); min-height: 4px; border-radius: 6px 6px 2px 2px; background: linear-gradient(#5fa2fa, #1768e5); }
.bar.secondary { background: linear-gradient(#a5b6cb, #66758a); }
.bar-label { position: absolute; top: calc(100% + 8px); left: 50%; color: var(--ink-500); font-size: 12px; transform: translateX(-50%); white-space: nowrap; }
.legend { display: flex; gap: 16px; margin-top: 28px; color: var(--ink-500); font-size: 13px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--brand-600); }
.legend .gray { background: var(--ink-400); }
.donut { width: 142px; height: 142px; display: grid; place-items: center; margin: 8px auto 18px; border-radius: 50%; background: conic-gradient(var(--brand-600) 0 61%, #32b57a 61% 83%, #f0ad44 83% 94%, #e5eaf1 94%); }
.donut::after { content: "94%\A履约率"; white-space: pre; width: 94px; height: 94px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-800); background: #fff; text-align: center; font-weight: 750; line-height: 1.35; }

/* Integrations and settings */
.integration-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.integration-card { padding: 17px; }
.integration-head { display: flex; align-items: flex-start; gap: 12px; }
.integration-logo { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #1768e5, #0b418a); font-size: 13px; font-weight: 800; }
.integration-logo.wecom { background: linear-gradient(145deg, #1abb79, #078e55); }
.integration-logo.ai { background: linear-gradient(145deg, #684be3, #4130a8); }
.integration-logo.browser { background: linear-gradient(145deg, #2d3545, #111827); }
.integration-main { min-width: 0; flex: 1; }
.integration-main h3 { margin: 0 0 2px; font-size: 16px; }
.integration-main p { margin: 0; color: var(--ink-500); font-size: 12px; }
.integration-meta { display: grid; gap: 8px; margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.integration-meta div { display: flex; justify-content: space-between; gap: 10px; color: var(--ink-500); font-size: 13px; }
.integration-meta strong { color: var(--ink-800); }

.settings-layout { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 18px; }
.settings-nav { padding: 8px; align-self: start; }
.settings-link { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 0; border-radius: 8px; color: var(--ink-600); background: transparent; cursor: pointer; text-align: left; }
.settings-link.active, .settings-link:hover { color: var(--brand-700); background: var(--brand-50); }
.settings-link .icon { width: 18px; height: 18px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 60px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-copy strong { display: block; font-size: 14px; }
.switch-copy span { display: block; color: var(--ink-500); font-size: 13px; }
.switch { position: relative; width: 44px; height: 24px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 99px; background: #c8d1dd; cursor: default; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: transform .18s; }
.switch.on { background: var(--brand-600); }
.switch.on::after { transform: translateX(20px); }

.role-matrix { display: grid; grid-template-columns: minmax(160px, 1.5fr) repeat(5, minmax(76px,.7fr)); min-width: 700px; }
.matrix-cell { min-height: 46px; display: grid; place-items: center; padding: 9px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 13px; text-align: center; }
.matrix-cell:nth-child(6n) { border-right: 0; }
.matrix-head { color: var(--ink-500); background: #f8fafc; font-weight: 700; }
.matrix-label { justify-items: start; color: var(--ink-800); font-weight: 650; }
.check { width: 19px; height: 19px; accent-color: var(--brand-600); }

/* Empty, loading, overlays */
.empty-state { padding: 50px 22px; text-align: center; }
.empty-state h3 { margin: 14px 0 5px; font-size: 17px; }
.empty-state p { margin: 0 0 17px; color: var(--ink-500); font-size: 14px; }

.skeleton { position: relative; overflow: hidden; border-radius: 8px; background: #e9eef5; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent); animation: shimmer 1.25s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.page-loading { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
.page-loading .skeleton { height: 130px; }

.toast-region { position: fixed; z-index: 200; right: 20px; bottom: 22px; display: grid; gap: 9px; pointer-events: none; }
.toast { width: min(360px, calc(100vw - 34px)); display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow-lg); animation: toast-in .22s ease; pointer-events: auto; }
.toast .icon { flex: 0 0 auto; margin-top: 2px; color: var(--brand-600); }
.toast.success .icon { color: var(--success); }
.toast.warning .icon { color: var(--warning); }
.toast.danger .icon { color: var(--danger); }
.toast strong { display: block; font-size: 14px; }
.toast span { display: block; color: var(--ink-500); font-size: 13px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.modal-backdrop { position: fixed; z-index: 180; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(7, 22, 43, .48); backdrop-filter: blur(3px); }
.modal { width: min(100%, 520px); max-height: min(90vh, 760px); overflow: auto; border-radius: 16px; background: #fff; box-shadow: var(--shadow-lg); animation: modal-in .18s ease; }
.modal.wide { width: min(100%, 760px); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 19px; }
.modal-header p { margin: 3px 0 0; color: var(--ink-500); font-size: 13px; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fbfcfe; }
@keyframes modal-in { from { opacity: 0; transform: scale(.98) translateY(5px); } }

.search-overlay { position: fixed; z-index: 160; inset: 0; display: grid; align-items: start; justify-items: center; padding: 90px 18px 20px; background: rgba(7,22,43,.38); backdrop-filter: blur(3px); }
.search-palette { width: min(700px, 100%); overflow: hidden; border-radius: 16px; background: #fff; box-shadow: var(--shadow-lg); }
.search-palette-head { position: relative; padding: 14px; border-bottom: 1px solid var(--line); }
.search-palette-head .icon { position: absolute; left: 28px; top: 28px; color: var(--ink-400); }
.search-palette-head input { width: 100%; height: 48px; padding: 0 44px 0 44px; border: 1px solid var(--line-strong); border-radius: 11px; }
.search-palette-body { max-height: min(60vh, 540px); overflow: auto; padding: 8px; }
.search-group-label { padding: 8px 10px 5px; color: var(--ink-400); font-size: 12px; font-weight: 750; letter-spacing: .06em; }
.search-result { width: 100%; display: flex; align-items: center; gap: 11px; min-height: 54px; padding: 9px 10px; border: 0; border-radius: 9px; background: #fff; cursor: pointer; text-align: left; }
.search-result:hover, .search-result:focus { background: var(--brand-50); }
.search-result:focus-visible { outline: 3px solid #1768e5; outline-offset: 2px; }
.search-result .result-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--brand-700); background: #eaf2ff; }
.search-result .list-main { font-size: 14px; }
.search-foot { display: flex; justify-content: space-between; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--ink-400); background: #fafbfd; font-size: 12px; }

.mobile-nav { display: none; }
.sidebar-backdrop { display: none; }
.demo-ribbon { position: fixed; z-index: 75; right: 0; top: 102px; padding: 5px 10px; border-radius: 8px 0 0 8px; color: #765000; background: #ffe7a9; box-shadow: var(--shadow-sm); font-size: 12px; font-weight: 700; }

/* Utility */
.muted { color: var(--ink-500); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-brand { color: var(--brand-700); }
.text-small { font-size: 13px; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-18 { margin-top: 18px; }
.mb-0 { margin-bottom: 0; }
.mb-12 { margin-bottom: 12px; }
.gap-grid { display: grid; gap: 18px; }
.two-cols { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.three-cols { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.wrap { flex-wrap: wrap; }
.divider { height: 1px; margin: 16px 0; background: var(--line); }
.source-preview { max-height: 180px; overflow: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-800); background: var(--canvas); white-space: pre-wrap; word-break: break-word; }

@media (max-width: 1260px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .workflow-overview { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .integration-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .quick-actions { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .info-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 1020px) {
  :root { --sidebar: 0px; }
  .sidebar { width: 260px; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { position: fixed; z-index: 65; inset: 0; display: block; border: 0; background: rgba(5,20,39,.42); }
  .mobile-menu { display: inline-grid; }
  .app-main { margin-left: 0; }
  .dashboard-grid, .detail-grid { grid-template-columns: 1fr; }
  .ai-layout, .approval-layout { grid-template-columns: 1fr; }
  .ai-source, .approval-detail { position: static; }
  .template-layout { grid-template-columns: 1fr; }
  .template-editor { position: static; }
  .connection-pill { display: none; }
}

@media (max-width: 760px) {
  :root { --header: 62px; }
  body { font-size: 16px; }
  .auth-page { display: block; min-height: 100vh; background: #f7faff; }
  .auth-story { display: none; }
  .auth-panel { min-height: 100vh; padding: 28px 20px 46px; align-content: center; }
  .auth-mobile-brand { display: flex; }
  .auth-card h2 { font-size: 27px; }
  .topbar { padding: 0 14px; gap: 9px; }
  .breadcrumb { min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .global-search { display: none; }
  .top-actions .icon-button:first-child { display: inline-grid; }
  .page { padding: 20px 14px 92px; }
  .page-heading { align-items: stretch; flex-direction: column; margin-bottom: 17px; }
  .page-heading h1 { font-size: 23px; }
  .heading-actions { justify-content: flex-start; }
  .heading-actions .button { flex: 1; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .stat-card { min-height: 118px; padding: 14px; }
  .stat-value { font-size: 27px; }
  .stat-note { line-height: 1.35; }
  .dashboard-grid, .dashboard-stack, .gap-grid { gap: 13px; }
  .hero-action { padding: 19px; }
  .hero-action h2 { font-size: 20px; }
  .hero-action::after { font-size: 90px; }
  .quick-actions { gap: 8px; }
  .quick-action { min-height: 84px; }
  .workflow-overview { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .workflow-card { min-height: 174px; padding: 14px; }
  .workflow-card .workflow-foot { left: 14px; right: 14px; }
  .integration-grid, .three-cols, .two-cols { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .card-header { padding: 13px 14px; }
  .card-body { padding: 14px; }
  .card-footer { padding: 12px 14px; }
  .table-wrap.desktop-only { display: none; }
  .mobile-records { display: block; }
  .toolbar { align-items: stretch; }
  .toolbar > .select, .toolbar > .input, .toolbar-search { width: 100%; max-width: none; }
  .toolbar-spacer { display: none; }
  .segmented { width: 100%; overflow-x: auto; }
  .segment { flex: 1; white-space: nowrap; }
  .info-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .detail-head { flex-wrap: wrap; }
  .detail-actions { width: 100%; }
  .detail-actions .button { flex: 1; }
  .approval-layout { gap: 13px; }
  .document-stage { margin: 0 -14px; padding: 14px; border-radius: 0; }
  .doc-sheet { width: 100%; min-height: auto; padding: 24px 18px; transform: none; }
  .approval-detail { display: none; }
  .approval-detail.mobile-open { display: block; position: fixed; z-index: 120; inset: 0; overflow: auto; padding: 14px; background: var(--canvas); }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { display: flex; overflow-x: auto; gap: 5px; }
  .settings-link { width: auto; flex: 0 0 auto; white-space: nowrap; }
  .mobile-nav { position: fixed; z-index: 60; inset: auto 0 0 0; height: calc(69px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 5px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
  .mobile-nav-item { min-width: 0; display: grid; place-items: center; align-content: center; gap: 3px; padding: 4px; border: 0; border-radius: 9px; color: var(--ink-500); background: transparent; cursor: pointer; font-size: 11px; }
  .mobile-nav-item .icon { width: 21px; height: 21px; }
  .mobile-nav-item.active { color: var(--brand-700); background: var(--brand-50); font-weight: 700; }
  .toast-region { right: 17px; bottom: 82px; }
  .search-overlay { padding-top: 20px; }
  .search-palette { max-height: calc(100vh - 40px); }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .demo-ribbon { top: 78px; }
}

@media (max-width: 440px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-icon { width: 31px; height: 31px; }
  .stat-card::after { display: none; }
  .workflow-overview { grid-template-columns: 1fr; }
  .workflow-card { min-height: 150px; }
  .info-grid { grid-template-columns: 1fr; }
  .auth-actions { align-items: flex-start; flex-direction: column; }
  .record-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .sidebar, .topbar, .mobile-nav, .heading-actions, .demo-ribbon, .toast-region { display: none !important; }
  .app-main { margin: 0; }
  .page { width: 100%; padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
  body.document-previewing .app-shell, body.document-previewing .toast-region { display: none !important; }
  body.document-previewing #modal-root, body.document-previewing .modal-backdrop, body.document-previewing .modal { display: block !important; position: static !important; width: 100% !important; max-width: none !important; max-height: none !important; padding: 0 !important; overflow: visible !important; border: 0 !important; box-shadow: none !important; background: #fff !important; }
  body.document-previewing .modal-header, body.document-previewing .modal-footer { display: none !important; }
  body.document-previewing .modal-body { padding: 0 !important; overflow: visible !important; }
  body.document-previewing .order-document-preview { width: 100% !important; min-height: 0 !important; box-shadow: none !important; }
}
