:root {
  color-scheme: light;
  --font: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 999px;

  --text-title: #1f2937;
  --text-body: #4b5563;
  --text-muted: #9ca3af;
  --text-white: #ffffff;

  --bg-page:
    radial-gradient(circle at 12% 4%, rgba(211, 155, 190, 0.72) 0%, transparent 36%),
    radial-gradient(circle at 88% 8%, rgba(118, 139, 191, 0.62) 0%, transparent 38%),
    radial-gradient(circle at 78% 88%, rgba(224, 157, 184, 0.46) 0%, transparent 34%),
    linear-gradient(135deg, #cdbbce 0%, #bcc6df 42%, #dfbdcb 72%, #c1afce 100%);
  --bg-card: rgba(255, 255, 255, 0.5);
  --bg-card-hover: rgba(255, 255, 255, 0.66);
  --bg-input: rgba(255, 255, 255, 0.7);
  --bg-table-header: #f5f2f6;
  --bg-table-row-alt: #fbfafc;

  --primary: #765f79;
  --primary-rgb: 118, 95, 121;
  --primary-hover: #59445d;
  --primary-light: rgba(238, 225, 238, 0.74);
  --primary-text: #59445d;
  --secondary: #7486b5;
  --secondary-rgb: 116, 134, 181;
  --secondary-light: rgba(211, 219, 242, 0.72);
  --tertiary: #c9809f;
  --tertiary-light: rgba(246, 210, 224, 0.68);

  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --error: #ef4444;
  --error-light: #fee2e2;

  --shadow-sm: 0 2px 8px rgba(118, 95, 121, 0.06);
  --shadow-md: 0 4px 16px rgba(118, 95, 121, 0.1);
  --shadow-lg: 0 8px 28px rgba(118, 95, 121, 0.14);
  --border-color: rgba(118, 95, 121, 0.12);
  --glass-border-top: rgba(255, 255, 255, 0.8);
  --glass-border-bottom: rgba(255, 255, 255, 0.4);
  --glass-sidebar: rgba(255, 255, 255, 0.42);
  --glass-topbar: rgba(255, 255, 255, 0.46);
  --glass-modal: rgba(255, 255, 255, 0.62);
  --glass-control: rgba(255, 255, 255, 0.56);
  --glass-dropdown: rgba(255, 255, 255, 0.76);
  --bg-sidebar: var(--glass-sidebar);
  --border-card: var(--glass-border-top);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --text-placeholder: var(--text-muted);
  --border-divider: var(--border-color);
  --bg-tag-light: var(--primary-light);
  --color-primary: var(--primary);
  --color-primary-hover: var(--primary-hover);

  /* Legacy aliases keep the existing component layer and business templates unchanged. */
  --page: #cdbbce;
  --page-deep: #b6a3c4;
  --surface: var(--bg-card);
  --surface-solid: var(--bg-card-hover);
  --surface-muted: var(--bg-input);
  --text: var(--text-body);
  --muted: var(--text-muted);
  --line: var(--border-color);
  --primary-strong: var(--primary-hover);
  --primary-soft: var(--primary-light);
  --accent: var(--secondary);
  --on-primary: var(--text-white);
  --danger: var(--error);
  --shadow: var(--shadow-lg);
  --shadow-small: var(--shadow-sm);
}

html[data-theme="violet"] {
  --bg-page:
    radial-gradient(circle at 12% 4%, rgba(211, 155, 190, 0.72) 0%, transparent 36%),
    radial-gradient(circle at 88% 8%, rgba(118, 139, 191, 0.62) 0%, transparent 38%),
    radial-gradient(circle at 78% 88%, rgba(224, 157, 184, 0.46) 0%, transparent 34%),
    linear-gradient(135deg, #cdbbce 0%, #bcc6df 42%, #dfbdcb 72%, #c1afce 100%);
  --bg-card: rgba(255, 255, 255, 0.5);
  --bg-card-hover: rgba(255, 255, 255, 0.66);
  --bg-input: rgba(255, 255, 255, 0.7);
  --bg-table-header: #f5f2f6;
  --bg-table-row-alt: #fbfafc;
  --primary: #765f79;
  --primary-rgb: 118, 95, 121;
  --primary-hover: #59445d;
  --primary-light: rgba(238, 225, 238, 0.74);
  --primary-text: #59445d;
  --secondary: #7486b5;
  --secondary-rgb: 116, 134, 181;
  --secondary-light: rgba(211, 219, 242, 0.72);
  --tertiary: #c9809f;
  --tertiary-light: rgba(246, 210, 224, 0.68);
  --page: #cdbbce;
  --page-deep: #b6a3c4;
  --shadow-sm: 0 2px 8px rgba(118, 95, 121, 0.06);
  --shadow-md: 0 4px 16px rgba(118, 95, 121, 0.1);
  --shadow-lg: 0 8px 28px rgba(118, 95, 121, 0.14);
  --border-color: rgba(118, 95, 121, 0.12);
}

html[data-theme="rose"] {
  --bg-page:
    radial-gradient(circle at 10% 6%, rgba(238, 151, 178, 0.68) 0%, transparent 34%),
    radial-gradient(circle at 86% 12%, rgba(145, 116, 181, 0.58) 0%, transparent 38%),
    radial-gradient(circle at 72% 86%, rgba(238, 139, 112, 0.5) 0%, transparent 35%),
    linear-gradient(135deg, #e0afbf 0%, #c6b5d8 43%, #edb7ae 72%, #cda4b5 100%);
  --bg-card: rgba(255, 255, 255, 0.5);
  --bg-card-hover: rgba(255, 255, 255, 0.66);
  --bg-input: rgba(255, 255, 255, 0.7);
  --bg-table-header: #fdf2f8;
  --bg-table-row-alt: #fffbfd;
  --primary: #b85f7a;
  --primary-rgb: 184, 95, 122;
  --primary-hover: #91445e;
  --primary-light: rgba(252, 218, 230, 0.74);
  --primary-text: #6e2c45;
  --secondary: #8d72ac;
  --secondary-rgb: 141, 114, 172;
  --secondary-light: rgba(226, 213, 240, 0.72);
  --tertiary: #df7d68;
  --tertiary-light: rgba(252, 216, 205, 0.7);
  --page: #e0afbf;
  --page-deep: #c69aaa;
  --shadow-sm: 0 2px 8px rgba(184, 95, 122, 0.07);
  --shadow-md: 0 4px 16px rgba(184, 95, 122, 0.11);
  --shadow-lg: 0 8px 28px rgba(184, 95, 122, 0.15);
  --border-color: rgba(145, 68, 94, 0.18);
}

html[data-theme="mint"] {
  --bg-page: radial-gradient(circle at 15% 5%, #f7fcfb 0%, #e1f2ed 55%, #fff4d2 100%);
  --bg-sidebar: #d4e9e2;
  --bg-card: rgba(255, 255, 255, 0.82);
  --bg-card-hover: rgba(255, 255, 255, 0.92);
  --bg-input: rgba(255, 255, 255, 0.84);
  --bg-table-header: #edf8f4;
  --bg-table-row-alt: #fafcf7;
  --border-card: #d2e6df;
  --shadow-card: 0 3px 14px rgba(78, 132, 120, 0.07);
  --primary: #78b8aa;
  --primary-rgb: 120, 184, 170;
  --primary-hover: #5f9d90;
  --primary-light: #e4f3ef;
  --primary-text: #40514d;
  --secondary: #f0d889;
  --secondary-rgb: 240, 216, 137;
  --secondary-light: #fff4d2;
  --tertiary: #a7cac1;
  --tertiary-light: #e9f4f1;
  --on-primary: #263f39;
  --text-title: #40514d;
  --text-body: #5e6e69;
  --text-muted: #87958f;
  --text-placeholder: #87958f;
  --border-divider: #d7e9e3;
  --bg-tag-light: #fff4d2;
  --color-primary: #78b8aa;
  --color-primary-hover: #5f9d90;
  --glass-sidebar: #d4e9e2;
  --glass-topbar: rgba(255, 255, 255, 0.72);
  --glass-modal: rgba(255, 255, 255, 0.86);
  --glass-control: rgba(255, 255, 255, 0.78);
  --glass-dropdown: rgba(255, 255, 255, 0.9);
  --page: #e1f2ed;
  --page-deep: #d4e9e2;
  --shadow-sm: 0 2px 8px rgba(78, 132, 120, 0.05);
  --shadow-md: 0 3px 14px rgba(78, 132, 120, 0.07);
  --shadow-lg: 0 8px 24px rgba(78, 132, 120, 0.1);
  --border-color: #d2e6df;
}

html[data-theme="taro"] {
  --bg-page:
    radial-gradient(circle at 14% 5%, rgba(150, 155, 231, 0.82) 0%, transparent 38%),
    radial-gradient(circle at 86% 8%, rgba(238, 193, 205, 0.82) 0%, transparent 40%),
    radial-gradient(circle at 76% 88%, rgba(209, 208, 239, 0.7) 0%, transparent 34%),
    linear-gradient(135deg, #aeb2e4 0%, #e4b1c3 42%, #c3c1e5 72%, #e7d6e8 100%);
  --bg-card: rgba(255, 255, 255, 0.48);
  --bg-card-hover: rgba(255, 255, 255, 0.64);
  --bg-input: rgba(252, 248, 251, 0.72);
  --bg-table-header: #eeedf9;
  --bg-table-row-alt: #faf8fc;
  --primary: #7c83d3;
  --primary-rgb: 124, 131, 211;
  --primary-hover: #5f66b4;
  --primary-light: rgba(209, 208, 239, 0.76);
  --primary-text: #44498a;
  --secondary: #d998ae;
  --secondary-rgb: 217, 152, 174;
  --secondary-light: rgba(238, 193, 205, 0.72);
  --tertiary: #969be7;
  --tertiary-light: rgba(214, 216, 247, 0.7);
  --page: #aeb2e4;
  --page-deep: #9298d0;
  --shadow-sm: 0 2px 8px rgba(124, 131, 211, 0.07);
  --shadow-md: 0 4px 16px rgba(124, 131, 211, 0.11);
  --shadow-lg: 0 8px 28px rgba(124, 131, 211, 0.16);
  --border-color: rgba(95, 102, 180, 0.18);
}

html[data-theme="cream"] {
  --bg-page: radial-gradient(circle at 15% 5%, #fffcf7 0%, #fff3d9 55%, #ddecf8 100%);
  --bg-sidebar: #f7e8ca;
  --bg-card: rgba(255, 255, 255, 0.82);
  --bg-card-hover: rgba(255, 255, 255, 0.92);
  --bg-input: rgba(255, 255, 255, 0.84);
  --bg-table-header: #eaf3fa;
  --bg-table-row-alt: #fffcf7;
  --border-card: #e4e6df;
  --shadow-card: 0 3px 14px rgba(111, 139, 160, 0.07);
  --primary: #8eb7d8;
  --primary-rgb: 142, 183, 216;
  --primary-hover: #72a0c3;
  --primary-light: #e8f2fa;
  --primary-text: #43505c;
  --secondary: #eed39b;
  --secondary-rgb: 238, 211, 155;
  --secondary-light: #fff3d9;
  --tertiary: #bfd5e7;
  --tertiary-light: #edf5fb;
  --on-primary: #2f4353;
  --text-title: #43505c;
  --text-body: #606b75;
  --text-muted: #89949e;
  --text-placeholder: #89949e;
  --border-divider: #e7e3d7;
  --bg-tag-light: #fff3d9;
  --color-primary: #8eb7d8;
  --color-primary-hover: #72a0c3;
  --glass-sidebar: #f7e8ca;
  --glass-topbar: rgba(255, 255, 255, 0.72);
  --glass-modal: rgba(255, 255, 255, 0.86);
  --glass-control: rgba(255, 255, 255, 0.78);
  --glass-dropdown: rgba(255, 255, 255, 0.9);
  --page: #fff3d9;
  --page-deep: #ddecf8;
  --shadow-sm: 0 2px 8px rgba(111, 139, 160, 0.05);
  --shadow-md: 0 3px 14px rgba(111, 139, 160, 0.07);
  --shadow-lg: 0 8px 24px rgba(111, 139, 160, 0.1);
  --border-color: #e4e6df;
}
* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(circle at 10% -8%, color-mix(in srgb, var(--primary) 17%, transparent), transparent 32rem),
    radial-gradient(circle at 95% 8%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 27rem),
    linear-gradient(180deg, var(--page), var(--page-deep));
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.5;
}

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

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.is-hidden {
  display: none !important;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-card {
  width: min(100%, 430px);
  padding: 38px 28px 30px;
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  border-radius: 32px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(18px);
}

.brand-mark {
  display: grid;
  width: 66px;
  height: 66px;
  margin: 0 auto 24px;
  border-radius: 22px;
  color: var(--on-primary, #ffffff);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 2rem;
  background: linear-gradient(145deg, var(--primary), var(--primary-strong));
  box-shadow: 0 13px 28px color-mix(in srgb, var(--primary) 26%, transparent);
  place-items: center;
  transform: rotate(-3deg);
}

.login-card h1 {
  margin-bottom: 12px;
  font-size: clamp(1.8rem, 7vw, 2.45rem);
  letter-spacing: -0.04em;
}

.login-copy {
  margin-bottom: 26px;
  color: var(--muted);
  line-height: 1.75;
}

.login-form {
  display: grid;
  gap: 14px;
  text-align: left;
}

.login-field {
  gap: 7px;
}

.login-field > span {
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 750;
}

.login-field input {
  height: 48px;
  font-size: 1rem;
}

.login-form .primary-button {
  min-height: 48px;
  margin-top: 4px;
}

.login-error {
  margin: -3px 0 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--line));
  border-radius: 10px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
  font-size: 0.82rem;
  line-height: 1.5;
}

.micro-copy {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: min(100% - 24px, 1180px);
  margin: 0 auto;
  padding: 20px 0 12px;
  gap: 12px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.62rem, 6vw, 2.2rem);
  letter-spacing: -0.035em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-picker {
  display: flex;
  min-height: 40px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  box-shadow: var(--shadow-small);
}

.theme-picker select {
  max-width: 96px;
  padding: 7px 2px 7px 6px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-weight: 750;
}

.theme-picker option {
  color: var(--text);
  background: var(--surface-solid);
}

.icon-button,
.close-button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: var(--surface);
  box-shadow: var(--shadow-small);
  font-size: 0.86rem;
}

.demo-banner {
  display: flex;
  align-items: center;
  width: min(100% - 24px, 1180px);
  margin: 0 auto 14px;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 28%, var(--line));
  border-radius: 14px;
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 8%, var(--surface));
  font-size: 0.8rem;
  line-height: 1.5;
}

.demo-banner.is-real-mode {
  border-color: color-mix(in srgb, var(--success) 32%, var(--line));
  color: var(--success);
  background: color-mix(in srgb, var(--success) 8%, var(--surface));
}

.pulse-dot {
  width: 8px;
  height: 8px;
  margin-right: 9px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 12%, transparent);
  flex: 0 0 auto;
}

.content-shell {
  width: min(100% - 24px, 1180px);
  margin: 0 auto;
}

.view {
  animation: view-in 180ms ease-out;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-panel {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border-radius: var(--radius-xl);
  color: white;
  background: linear-gradient(135deg, var(--primary-strong), var(--primary) 63%, color-mix(in srgb, var(--primary) 72%, var(--accent)));
  box-shadow: 0 20px 46px color-mix(in srgb, var(--primary) 24%, transparent);
}

.hero-label {
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.84rem;
  font-weight: 760;
}

.hero-value {
  margin-bottom: 9px;
  font-size: clamp(2.25rem, 10vw, 3.35rem);
  font-weight: 840;
  letter-spacing: -0.06em;
}

.hero-note {
  max-width: 420px;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.86rem;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  margin-top: 15px;
  gap: 9px;
}

.hero-actions button {
  position: relative;
  z-index: 1;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 13px;
  color: white;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.88rem;
  font-weight: 780;
  backdrop-filter: blur(8px);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
  gap: 10px;
}

.metric-card,
.panel,
.device-card,
.availability-card,
.todo-card,
.customer-card,
.finance-card {
  border: 1px solid color-mix(in srgb, var(--line) 90%, transparent);
  background: var(--surface);
  box-shadow: var(--shadow-small);
  backdrop-filter: blur(13px);
}

.metric-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  min-height: 82px;
  align-content: center;
  padding: 13px;
  border-radius: var(--radius-lg);
  column-gap: 10px;
}

.metric-icon {
  display: grid;
  width: 34px;
  height: 34px;
  grid-row: 1 / 3;
  margin: 0;
  border-radius: 11px;
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 900;
  place-items: center;
}

.metric-label {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 720;
  line-height: 1.25;
}

.metric-value {
  margin: 0;
  font-size: 1.16rem;
  font-weight: 830;
  letter-spacing: -0.03em;
}

.section-block {
  margin-top: 20px;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}

.section-header h2 {
  margin-bottom: 0;
  font-size: 1.16rem;
  letter-spacing: -0.02em;
}

.section-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.text-button {
  padding: 7px 2px;
  border: 0;
  color: var(--primary);
  background: transparent;
  font-size: 0.84rem;
  font-weight: 760;
}

.status-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 8px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-small);
  gap: 2px;
}

.status-summary-item {
  display: flex;
  min-width: 0;
  width: 100%;
  align-items: center;
  min-height: 43px;
  padding: 9px 10px;
  border: 0;
  border-radius: 14px;
  color: var(--text);
  background: transparent;
  text-align: left;
  gap: 10px;
}

.status-summary-item:hover {
  background: var(--surface-muted);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--status-color, var(--primary));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--status-color, var(--primary)) 12%, transparent);
  flex: 0 0 auto;
}

.status-summary-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-summary-count {
  margin-left: auto;
  font-weight: 820;
  font-size: 0.94rem;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quick-card {
  min-height: 80px;
  padding: 11px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-small);
  text-align: center;
}

.quick-card strong {
  display: grid;
  width: 32px;
  height: 32px;
  margin: 0 auto 6px;
  border-radius: 11px;
  color: var(--primary);
  background: var(--primary-soft);
  place-items: center;
}

.quick-card span {
  display: block;
  font-size: 0.8rem;
  font-weight: 750;
}

.toolbar {
  position: sticky;
  z-index: 8;
  top: 0;
  display: grid;
  padding: 10px 0 12px;
  background: linear-gradient(180deg, var(--page) 78%, transparent);
  gap: 10px;
}

.search-box {
  position: relative;
}

.search-box span {
  position: absolute;
  top: 50%;
  left: 14px;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-box input,
.filter-select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow-small);
  font-size: 0.94rem;
}

.search-box input {
  padding: 0 16px 0 42px;
}

.filter-row {
  display: flex;
  gap: 8px;
}

.filter-select {
  flex: 1;
  padding: 0 12px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  font-weight: 790;
  font-size: 0.9rem;
  transition: transform 120ms ease, opacity 120ms ease;
}

.primary-button:active,
.secondary-button:active,
.danger-button:active,
.card-action:active,
.quick-card:active {
  transform: scale(0.98);
}

.primary-button {
  border: 1px solid var(--primary);
  color: var(--on-primary, #ffffff);
  background: var(--primary);
  box-shadow: 0 9px 18px color-mix(in srgb, var(--primary) 20%, transparent);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface-solid);
}

.danger-button {
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
}

.full-width {
  width: 100%;
}

.device-grid {
  display: grid;
  gap: 12px;
}

.availability-panel {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.availability-panel .section-header { margin-bottom: 15px; }

.availability-filters,
.availability-list {
  display: grid;
  gap: 11px;
}

.availability-result-head { margin-top: 22px; }

.availability-card {
  padding: 17px;
  border-radius: var(--radius-lg);
}

.availability-card h3 { margin: 0 0 5px; font-size: 1rem; }

.availability-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.availability-price small { color: var(--muted); font-size: 0.78rem; }
.availability-price strong { font-size: 0.92rem; }

.device-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: var(--radius-lg);
}

.device-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--status-color, var(--primary));
  content: "";
}

.card-topline,
.customer-head,
.finance-head,
.todo-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.device-card h3,
.customer-card h3,
.todo-card h3 {
  margin-bottom: 5px;
  font-size: 1.04rem;
  line-height: 1.35;
}

.serial,
.subtle {
  color: var(--muted);
  font-size: 0.79rem;
}

.status-badge,
.mini-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--status-color, var(--primary));
  background: color-mix(in srgb, var(--status-color, var(--primary)) 11%, var(--surface));
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.device-specs {
  display: flex;
  flex-wrap: wrap;
  margin: 15px 0 12px;
  gap: 7px;
}

.spec-chip {
  padding: 7px 9px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 0.78rem;
  font-weight: 690;
}

.device-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.device-meta small {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.75rem;
}

.device-meta strong {
  display: block;
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  margin-top: 13px;
  gap: 8px;
}

.card-action {
  min-height: 39px;
  flex: 1 1 auto;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-solid);
  font-size: 0.82rem;
  font-weight: 760;
}

.card-action.primary {
  border-color: var(--primary);
  color: var(--on-primary, #ffffff);
  background: var(--primary);
}

.device-card .card-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.device-card .card-actions:has(> :first-child:last-child) {
  grid-template-columns: 1fr;
}

.device-card .card-actions:has(> :nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.device-card .card-actions:has(> :nth-child(4):last-child) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.device-card .card-actions:has(> :nth-child(5):last-child) {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.device-card .card-actions:has(> :nth-child(5):last-child) > .card-action {
  grid-column: span 2;
}

.device-card .card-actions:has(> :nth-child(5):last-child) > .card-action:nth-child(n + 4) {
  grid-column: span 3;
}

.empty-state {
  padding: 48px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 50px;
  height: 50px;
  margin: 0 auto 12px;
  border-radius: 17px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 1.3rem;
  place-items: center;
}

.todo-list,
.customer-list,
.finance-list {
  display: grid;
  gap: 11px;
}

.todo-card,
.customer-card,
.finance-card {
  padding: 17px;
  border-radius: var(--radius-lg);
}

.todo-card {
  border-left: 4px solid var(--todo-color, var(--warning));
}

.todo-type {
  margin-bottom: 4px;
  color: var(--todo-color, var(--warning));
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.todo-card p,
.customer-card p,
.finance-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.todo-date {
  color: var(--danger);
  font-size: 0.77rem;
  font-weight: 800;
  white-space: nowrap;
}

.customer-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 900;
  place-items: center;
  flex: 0 0 auto;
}

.customer-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.customer-tags {
  display: flex;
  flex-wrap: wrap;
  margin-top: 14px;
  gap: 7px;
}

.customer-rental-stats,
.form-callout {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.customer-rental-stats.has-customer {
  border-color: color-mix(in srgb, var(--success) 38%, var(--line));
  color: var(--success);
  background: color-mix(in srgb, var(--success) 8%, var(--surface));
  font-weight: 760;
}

.form-callout { margin: -3px 0 0; }

.customer-detail-hero {
  display: flex;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  gap: 12px;
}

.customer-detail-hero h3,
.customer-detail-hero p { margin: 0; }
.customer-detail-hero p { margin-top: 4px; color: var(--muted); font-size: 0.8rem; }

.customer-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.customer-stat-grid div { padding: 13px 9px; border-right: 1px solid var(--line); text-align: center; }
.customer-stat-grid div:last-child { border-right: 0; }
.customer-stat-grid small { display: block; color: var(--muted); font-size: 0.76rem; }
.customer-stat-grid strong { display: block; margin-top: 4px; font-size: 0.9rem; }

.customer-note-box { margin-top: 12px; padding: 13px; border-radius: 14px; background: var(--surface-muted); }
.customer-note-box small { color: var(--muted); font-size: 0.76rem; }
.customer-note-box p { margin: 4px 0 0; font-size: 0.82rem; line-height: 1.5; }

.mini-badge {
  color: var(--muted);
  background: var(--surface-muted);
}

.finance-amount {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 850;
  white-space: nowrap;
}

.finance-amount.receivable { color: var(--danger); }
.finance-amount.payable { color: var(--warning); }

.finance-progress {
  height: 7px;
  margin: 14px 0 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.finance-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-muted);
}

.segmented-control button {
  min-height: 38px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  font-size: 0.84rem;
  font-weight: 780;
}

.segmented-control button.is-active {
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow-small);
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 8px;
  bottom: calc(7px + env(safe-area-inset-bottom));
  left: 8px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  max-width: 720px;
  margin: auto;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
  box-shadow: 0 17px 48px rgba(20, 31, 45, 0.19);
  backdrop-filter: blur(20px);
}

.nav-item {
  position: relative;
  display: flex;
  min-height: 52px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 16px;
  color: var(--muted);
  background: transparent;
  font-size: 0.76rem;
  font-weight: 760;
  gap: 3px;
}

.nav-item.is-active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-icon {
  font-size: 1.12rem;
  font-weight: 900;
  line-height: 1;
}

#todo-badge:not(:empty) {
  position: absolute;
  top: 5px;
  right: calc(50% - 24px);
  display: grid;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  color: white;
  background: var(--danger);
  font-size: 0.6rem;
  place-items: center;
}

.modal {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

.modal::backdrop {
  background: rgba(12, 19, 29, 0.53);
  backdrop-filter: blur(5px);
}

.modal[open] {
  display: flex;
  align-items: flex-end;
}

.modal-frame {
  width: 100%;
  max-height: 94vh;
  overflow: hidden;
  border-radius: 28px 28px 0 0;
  background: var(--surface-solid);
  box-shadow: 0 -20px 55px rgba(7, 13, 20, 0.22);
  animation: modal-up 180ms ease-out;
}

@keyframes modal-up {
  from { transform: translateY(30px); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 13px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.32rem;
}

.close-button {
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.35rem;
}

.modal-body {
  max-height: calc(94vh - 82px);
  overflow-y: auto;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
}

.form-grid {
  display: grid;
  gap: 15px;
}

.form-section-title {
  display: flex;
  align-items: center;
  margin-top: 8px;
  padding: 13px 0 3px;
  border-top: 1px solid var(--line);
  gap: 10px;
}

.form-section-title:first-child {
  margin-top: -4px;
  padding-top: 0;
  border-top: 0;
}

.form-section-title > span {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 0.68rem;
  font-weight: 850;
  place-items: center;
}

.form-section-title strong,
.form-section-title small {
  display: block;
}

.form-section-title small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.form-section-title strong { font-size: 0.92rem; }

.field-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field label,
.form-legend {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 760;
}

.required-mark {
  margin-left: 3px;
  color: var(--danger);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: var(--surface-muted);
  font-size: 1rem;
}

.form-field select {
  appearance: none;
  padding-right: 44px;
  background-color: var(--surface-solid);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 16px;
}

.form-field select option {
  color: var(--text);
  background: var(--surface-solid);
}

.form-field input[type="date"],
.form-field input[type="datetime-local"] {
  min-height: 50px;
  padding-right: 12px;
  background: var(--surface-solid);
  color-scheme: light;
}

.form-field input[type="date"]::-webkit-calendar-picker-indicator,
.form-field input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  width: 20px;
  height: 20px;
  padding: 5px;
  border-radius: 9px;
  background-color: var(--primary-soft);
  cursor: pointer;
  opacity: 0.78;
}

.select-control select {
  min-height: 50px;
  border-color: color-mix(in srgb, var(--primary) 16%, var(--line));
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.model-picker-pair {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--primary-soft) 42%, var(--surface-solid));
}

.form-field textarea {
  min-height: 88px;
  resize: vertical;
}

.form-field input[readonly] {
  color: var(--muted);
  cursor: default;
}

.form-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.checkbox-field {
  display: flex;
  min-height: 46px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-muted);
  gap: 10px;
}

.checkbox-field input {
  width: 19px;
  height: 19px;
  accent-color: var(--primary);
}

.form-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  position: sticky;
  z-index: 4;
  bottom: calc(-24px - env(safe-area-inset-bottom));
  margin: 10px -20px calc(-24px - env(safe-area-inset-bottom));
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-solid) 96%, transparent);
  backdrop-filter: blur(16px);
  gap: 10px;
}

.detail-hero {
  padding: 20px;
  border-radius: var(--radius-lg);
  color: var(--on-primary, #ffffff);
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
}

.detail-hero h3 {
  margin: 8px 0 6px;
  font-size: 1.35rem;
}

.detail-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.76rem;
}

.detail-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-edit-button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 11px;
  color: white;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
  font-weight: 780;
}

.detail-section {
  margin-top: 20px;
}

.detail-section-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.detail-section-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.detail-item {
  min-width: 0;
  padding: 13px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-item:nth-child(2n) { border-right: 0; }
.detail-item:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  border-right: 0;
}
.detail-item small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.detail-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  line-height: 1.45;
}

.timeline {
  position: relative;
  margin-top: 19px;
  padding-left: 20px;
}

.timeline::before {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 5px;
  width: 2px;
  background: var(--line);
  content: "";
}

.timeline-item {
  position: relative;
  padding: 0 0 19px 9px;
}

.timeline-item::before {
  position: absolute;
  top: 5px;
  left: -19px;
  width: 11px;
  height: 11px;
  border: 3px solid var(--surface-solid);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
  content: "";
}

.timeline-item h4 {
  margin: 0 0 4px;
  font-size: 0.92rem;
}

.timeline-meta,
.timeline-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.5;
}

.toast-region {
  position: fixed;
  z-index: 80;
  top: 18px;
  right: 16px;
  left: 16px;
  display: grid;
  justify-items: center;
  pointer-events: none;
  gap: 8px;
}

.toast {
  width: min(100%, 430px);
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  font-size: 0.86rem;
  font-weight: 700;
  animation: toast-in 170ms ease-out;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.error { border-left: 4px solid var(--danger); }

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

@media (min-width: 680px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .status-summary { grid-template-columns: repeat(4, 1fr); }
  .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .availability-filters, .availability-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: 1fr auto; align-items: center; }
  .filter-select { min-width: 180px; }
  .customer-list, .finance-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal[open] { align-items: center; justify-content: center; padding: 24px; }
  .modal-frame { width: min(100%, 620px); max-height: 88vh; border-radius: 28px; }
  .modal-body { max-height: calc(88vh - 82px); }
}

@media (min-width: 980px) {
  .dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
    align-items: start;
    gap: 18px;
  }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .device-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .availability-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .customer-list, .finance-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar { padding-top: 34px; }
}

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

/* All themes share one component language; only the variables above change. */
/* ==========================================================
   桌面端新版布局：左侧竖向导航 + 营收横带 + 六宫格指标 + 双列区
   （移动端 <980px 保持原底部导航与纵向堆叠布局）
   ========================================================== */
.side-brand {
  display: none;
}

@media (min-width: 980px) {
  .app-shell {
    padding-left: 216px;
    padding-bottom: 48px;
  }

  .topbar,
  .demo-banner,
  .content-shell {
    width: min(100% - 56px, 1220px);
  }

  .side-brand {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 4px 8px 20px;
    border-bottom: 1px solid var(--line);
    gap: 11px;
  }

  .side-brand-mark {
    display: grid;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    color: var(--on-primary, #ffffff);
    background: linear-gradient(145deg, var(--primary), var(--primary-strong));
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 1.3rem;
    place-items: center;
    flex: 0 0 auto;
  }

  .side-brand-name {
    font-size: 0.92rem;
    font-weight: 850;
    letter-spacing: -0.01em;
  }

  .bottom-nav {
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    width: 216px;
    max-width: none;
    margin: 0;
    grid-template-columns: 1fr;
    align-content: start;
    padding: 20px 14px;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
    box-shadow: none;
    gap: 6px;
  }

  .nav-item {
    min-height: 48px;
    flex-direction: row;
    justify-content: flex-start;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 0.88rem;
    gap: 12px;
  }

  .nav-icon {
    font-size: 1rem;
  }

  #todo-badge:not(:empty) {
    position: static;
    margin-left: auto;
  }

  /* 看板：主要财务信息占宽栏，快捷操作和设备状态集中在右侧。 */
  .dashboard-layout {
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.84fr);
    gap: 20px;
  }

  .dashboard-primary,
  .dashboard-secondary {
    min-width: 0;
  }

  .hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "label actions"
      "value actions"
      "note actions";
    align-items: center;
    column-gap: 28px;
  }

  .hero-label { grid-area: label; }
  .hero-value { grid-area: value; margin-bottom: 6px; }
  .hero-note { grid-area: note; }

  .hero-actions {
    grid-area: actions;
    flex-direction: column;
    margin-top: 0;
  }

  .hero-actions button {
    width: 100%;
    min-width: 148px;
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 12px;
  }

  .metric-card {
    min-height: 86px;
  }

  .dashboard-quick-section {
    margin-top: 0;
  }

  .dashboard-secondary .quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-secondary .status-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-secondary .quick-card {
    min-height: 88px;
  }

  .todo-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

/* ==========================================================
   信息层级与响应式收口：不改变主题色，只统一密度、字号和阅读顺序
   ========================================================== */
.dashboard-quick-section {
  margin-top: 20px;
}

@media (max-width: 560px) {
  .topbar > div:first-child {
    min-width: 0;
  }

  .topbar-actions {
    flex: 0 0 auto;
  }

  .theme-picker {
    padding: 0 8px;
  }

  .theme-picker select {
    max-width: 88px;
  }

  .field-pair:has(input[type="date"]),
  .field-pair:has(input[type="datetime-local"]) {
    grid-template-columns: 1fr;
  }

  .modal-body {
    padding-top: 16px;
  }

  .device-card,
  .availability-card,
  .todo-card,
  .customer-card,
  .finance-card {
    padding: 15px;
  }
}

@media (max-width: 360px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .field-pair {
    grid-template-columns: 1fr;
  }

  .metric-card {
    grid-template-columns: 30px minmax(0, 1fr);
    padding: 11px;
  }

  .metric-icon {
    width: 30px;
    height: 30px;
  }

  .metric-value {
    font-size: 1.05rem;
  }

  .nav-item {
    font-size: 0.68rem;
  }
}

@media (min-width: 980px) {
  .topbar {
    padding-top: 26px;
    padding-bottom: 14px;
  }

  .dashboard-quick-section {
    margin-top: 0;
  }

  .dashboard-secondary {
    position: sticky;
    top: 18px;
  }

  .modal-frame {
    width: min(100%, 680px);
  }

  .form-actions {
    bottom: -24px;
    margin-bottom: -24px;
    padding-bottom: 12px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .metric-card,
  .quick-card,
  .device-card,
  .availability-card,
  .todo-card,
  .customer-card,
  .finance-card {
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  }

  .quick-card:hover,
  .device-card:hover,
  .availability-card:hover,
  .todo-card:hover,
  .customer-card:hover,
  .finance-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
  }
}

/* ==========================================================
   单一业务工作台：桌面主从布局，移动端保持原有业务顺序
   ========================================================== */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
}

.desktop-only {
  display: none;
}

.page-description {
  max-width: 560px;
  margin: var(--space-1) 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.topbar h1::after {
  display: block;
  width: 40px;
  height: 3px;
  margin-top: var(--space-2);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 28%, transparent));
  content: "";
}

.empty-state strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
}

.empty-state p {
  margin: var(--space-1) 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.customer-note,
.finance-category {
  margin-top: var(--space-2);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.search-box input:focus,
.filter-select:focus {
  border-color: var(--primary);
  outline: 1px solid var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.form-field input:disabled,
.form-field select:disabled,
.form-field textarea:disabled,
.form-field input[readonly] {
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-muted) 82%, var(--line));
  opacity: 0.82;
}

.inventory-tools {
  display: flex;
  min-width: 0;
  gap: var(--space-2);
}

.result-count {
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 979px) {
  .field-pair {
    grid-template-columns: 1fr;
  }

  .inventory-tools {
    width: 100%;
  }

  .inventory-tools .filter-select {
    min-width: 0;
    flex: 1;
  }

  .availability-toolbar .section-header {
    align-items: flex-start;
  }
}

@media (min-width: 980px) {
  .mobile-only {
    display: none;
  }

  .desktop-only {
    display: block;
  }

  .app-shell {
    padding-left: 216px;
    padding-bottom: var(--space-6);
  }

  .topbar,
  .demo-banner,
  .content-shell {
    width: min(100% - 64px, 1240px);
  }

  .topbar {
    align-items: center;
    padding-top: var(--space-5);
    padding-bottom: var(--space-3);
  }

  .topbar h1 {
    font-size: clamp(1.7rem, 2.2vw, 1.9rem);
    font-weight: 800;
  }

  .page-description {
    font-size: 0.86rem;
  }

  .content-shell {
    min-width: 0;
  }

  .section-header {
    align-items: center;
    margin-bottom: var(--space-3);
  }

  .section-header h2,
  .section-header h3 {
    margin: 0;
    color: var(--text);
  }

  .section-header h2 {
    font-size: 1.2rem;
  }

  .section-header h3 {
    font-size: 1.02rem;
  }

  .workbench-panel,
  .device-preview,
  .customer-business-panel {
    min-width: 0;
    padding: var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface-solid);
    box-shadow: var(--shadow-md);
  }

  .dashboard-summary {
    display: grid;
    grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.8fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface-solid);
    box-shadow: var(--shadow-lg);
  }

  .summary-primary {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-4);
    border-right: 1px solid var(--line);
    background: var(--primary-soft);
  }

  .summary-primary span,
  .summary-primary small,
  .summary-metric span {
    color: var(--muted);
    font-size: 0.78rem;
  }

  .summary-primary strong,
  .summary-metric strong,
  .number-cell,
  .customer-balance-strip strong {
    font-variant-numeric: tabular-nums;
  }

  .summary-primary strong {
    margin: var(--space-1) 0;
    color: var(--text);
    font-size: clamp(1.9rem, 3vw, 2.45rem);
    letter-spacing: -0.05em;
  }

  .summary-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: var(--space-2);
  }

  .summary-metric {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-3);
    border-right: 1px solid var(--line);
  }

  .summary-metric:nth-child(3n) {
    border-right: 0;
  }

  .summary-metric:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }

  .summary-metric strong {
    margin-top: var(--space-1);
    overflow-wrap: anywhere;
    font-size: 0.96rem;
  }

  .dashboard-business-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
    align-items: start;
    margin-top: var(--space-4);
    gap: 20px;
  }

  .dashboard-priority {
    min-height: 510px;
  }

  .dashboard-assistant {
    position: sticky;
    top: var(--space-3);
    display: grid;
    gap: var(--space-4);
  }

  .dashboard-assistant .quick-grid {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .dashboard-assistant .quick-card {
    display: flex;
    min-height: 52px;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    text-align: left;
    gap: var(--space-3);
  }

  .dashboard-assistant .quick-card strong {
    margin: 0;
  }

  .dashboard-assistant .status-summary {
    grid-template-columns: 1fr;
    padding: var(--space-1);
    border: 0;
    background: var(--surface-muted);
    box-shadow: none;
  }

  .todo-desktop-list {
    display: grid;
    gap: var(--space-2);
  }

  .todo-list-item {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr) 76px 104px;
    min-width: 0;
    align-items: center;
    padding: var(--space-3);
    border: 1px solid var(--line);
    border-left: 3px solid var(--warning);
    border-radius: var(--radius-md);
    background: var(--surface-solid);
    box-shadow: var(--shadow-sm);
    gap: var(--space-3);
  }

  .todo-list-item[data-kind="return"],
  .todo-list-item[data-kind="finance"] {
    border-left-color: var(--danger);
  }

  .todo-list-item[data-kind="follow-up"] {
    border-left-color: var(--primary);
  }

  .todo-list-item.is-overdue {
    background: color-mix(in srgb, var(--danger) 5%, var(--surface-solid));
  }

  .todo-list-item .todo-type {
    display: grid;
    margin: 0;
    color: var(--text);
    letter-spacing: 0;
    gap: var(--space-1);
  }

  .todo-list-item .todo-type small {
    color: var(--danger);
    font-size: 0.72rem;
  }

  .todo-main {
    min-width: 0;
  }

  .todo-title {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 0.98rem;
    line-height: 1.45;
  }

  .todo-detail {
    margin: var(--space-1) 0 0;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 0.8rem;
  }

  .todo-list-item .todo-date {
    text-align: right;
  }

  .todo-action .card-action {
    width: 100%;
  }

  .todo-filter-tabs,
  .view-mode-switch {
    display: inline-flex;
    padding: var(--space-1);
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-muted);
    gap: var(--space-1);
  }

  .todo-filter-tabs {
    margin-bottom: var(--space-3);
  }

  .todo-filter-tabs button,
  .view-mode-switch button {
    min-height: 36px;
    padding: 0 var(--space-3);
    border: 0;
    border-radius: 9px;
    color: var(--muted);
    background: transparent;
    font-size: 0.82rem;
    font-weight: 760;
  }

  .todo-filter-tabs button[aria-pressed="true"],
  .view-mode-switch button[aria-pressed="true"] {
    color: var(--text);
    background: var(--surface-solid);
    box-shadow: var(--shadow-sm);
  }

  .todos-workbench {
    min-height: 480px;
  }

  .inventory-toolbar {
    position: static;
    grid-template-columns: minmax(260px, 1fr) auto;
    padding: 0 0 var(--space-3);
    background: transparent;
  }

  .inventory-tools {
    align-items: center;
  }

  .inventory-tools .filter-select {
    width: 160px;
    min-width: 160px;
  }

  .inventory-workspace,
  .availability-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
    gap: 20px;
  }

  .inventory-results,
  .availability-results {
    overflow: hidden;
  }

  .inventory-table-wrap {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
  }

  .inventory-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
  }

  .inventory-table th {
    padding: 12px 10px;
    color: var(--muted);
    background: var(--surface-muted);
    font-size: 0.75rem;
    font-weight: 760;
    text-align: left;
  }

  .inventory-table td {
    min-width: 0;
    padding: 13px 10px;
    overflow: hidden;
    border-top: 1px solid var(--line);
    font-size: 0.79rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .inventory-table th:nth-child(1) { width: 18%; }
  .inventory-table th:nth-child(2) { width: 14%; }
  .inventory-table th:nth-child(3) { width: 15%; }
  .inventory-table th:nth-child(4) { width: 10%; }
  .inventory-table th:nth-child(5) { width: 13%; }
  .inventory-table th:nth-child(6) { width: 14%; }
  .inventory-table th:nth-child(7) { width: 16%; }

  .inventory-table tbody tr {
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
  }

  .inventory-table tbody tr.is-selected {
    background: var(--primary-soft);
    box-shadow: inset 3px 0 0 var(--primary);
  }

  .inventory-table tbody tr:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 24%, transparent);
    outline-offset: -3px;
  }

  .inventory-card-view {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-card-view .device-card.is-selected {
    border-color: color-mix(in srgb, var(--primary) 48%, var(--line));
    box-shadow: 0 0 0 2px var(--primary-soft), var(--shadow-md);
  }

  .device-preview {
    position: sticky;
    top: var(--space-3);
  }

  .preview-empty {
    min-height: 320px;
  }

  .preview-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--line);
    gap: var(--space-3);
  }

  .preview-heading h2,
  .customer-profile-summary h2 {
    margin: var(--space-1) 0;
    font-size: 1.24rem;
    line-height: 1.35;
  }

  .preview-heading p,
  .customer-profile-summary p {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
  }

  .preview-kicker {
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
  }

  .preview-specs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: var(--space-3) 0 0;
    gap: var(--space-2);
  }

  .preview-specs div {
    min-width: 0;
    padding: 10px;
    border-radius: 11px;
    background: var(--surface-muted);
  }

  .preview-specs .preview-wide {
    grid-column: 1 / -1;
  }

  .preview-specs dt {
    color: var(--muted);
    font-size: 0.72rem;
  }

  .preview-specs dd {
    margin: var(--space-1) 0 0;
    overflow-wrap: anywhere;
    font-size: 0.84rem;
    font-weight: 700;
  }

  .preview-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: var(--space-3);
    gap: var(--space-2);
  }

  .preview-actions .card-action {
    width: 100%;
  }

  .availability-toolbar {
    margin-bottom: var(--space-3);
    padding: var(--space-3);
  }

  .availability-toolbar .section-header {
    margin-bottom: var(--space-3);
  }

  .availability-toolbar .availability-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .availability-rows {
    display: grid;
    gap: var(--space-2);
  }

  .availability-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--text);
    background: var(--surface-solid);
    text-align: left;
    gap: var(--space-3);
  }

  .availability-row.is-selected {
    border-color: color-mix(in srgb, var(--primary) 48%, var(--line));
    background: var(--primary-soft);
    box-shadow: inset 3px 0 0 var(--primary);
  }

  .availability-row-main,
  .availability-row-meta {
    display: grid;
    min-width: 0;
    gap: var(--space-1);
  }

  .availability-row-main small,
  .availability-row-meta small {
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 0.76rem;
  }

  .availability-row-meta {
    text-align: right;
  }

  .customer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
  }

  .customer-toolbar div {
    display: grid;
    gap: var(--space-1);
  }

  .customer-toolbar span {
    color: var(--muted);
    font-size: 0.8rem;
  }

  .customer-workspace {
    display: grid;
    grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.4fr);
    align-items: start;
    gap: 20px;
  }

  .customer-directory {
    position: sticky;
    top: var(--space-3);
  }

  .customer-directory-list {
    display: grid;
    gap: var(--space-2);
  }

  .customer-list-item {
    display: grid;
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--text);
    background: var(--surface-solid);
    text-align: left;
    gap: 12px;
  }

  .customer-list-item.is-selected {
    border-color: color-mix(in srgb, var(--primary) 48%, var(--line));
    background: var(--primary-soft);
    box-shadow: inset 3px 0 0 var(--primary);
  }

  .customer-list-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--space-2);
  }

  .customer-list-heading > span:nth-child(2) {
    display: grid;
    min-width: 0;
    gap: 2px;
  }

  .customer-list-heading small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.76rem;
    text-overflow: ellipsis;
  }

  .customer-list-heading .status-badge {
    margin-left: auto;
  }

  .customer-list-stats {
    display: flex;
    flex-wrap: wrap;
    color: var(--muted);
    gap: var(--space-1) var(--space-2);
  }

  .customer-list-stats small {
    font-size: 0.73rem;
  }

  .customer-profile-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--line);
    gap: var(--space-3);
  }

  .customer-panel-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
  }

  .customer-balance-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: var(--space-3);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
  }

  .customer-balance-strip div {
    display: grid;
    padding: var(--space-3);
    border-right: 1px solid var(--line);
    gap: var(--space-1);
  }

  .customer-balance-strip div:last-child {
    border-right: 0;
  }

  .customer-balance-strip span {
    color: var(--muted);
    font-size: 0.75rem;
  }

  .customer-panel-section {
    margin-top: var(--space-4);
  }

  .related-device-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
  }

  .related-device-list > button {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--text);
    background: var(--surface-muted);
    text-align: left;
    gap: var(--space-2);
  }

  .related-device-list > button > span:first-child {
    display: grid;
    min-width: 0;
    gap: var(--space-1);
  }

  .related-device-list small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.73rem;
    text-overflow: ellipsis;
  }

  .compact-control {
    width: 180px;
    margin: 0;
  }

  .customer-finance-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customer-finance-list > .empty-state,
  .related-device-list > .empty-state {
    grid-column: 1 / -1;
  }

  .compact-timeline {
    display: grid;
    gap: var(--space-2);
  }

  .compact-timeline article {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    padding: 12px 0;
    border-top: 1px solid var(--line);
    gap: var(--space-3);
  }

  .compact-timeline article:first-child {
    border-top: 0;
  }

  .compact-timeline article > span {
    color: var(--muted);
    font-size: 0.75rem;
  }

  .compact-timeline p {
    margin: var(--space-1) 0 0;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 0.76rem;
  }

  .modal-frame {
    width: min(100%, 760px);
    box-shadow: var(--shadow-lg);
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
  }

  .form-section-title,
  .field-pair,
  .form-field-wide,
  .form-error,
  .form-actions,
  .form-callout,
  .customer-rental-stats,
  .form-field:has(textarea) {
    grid-column: 1 / -1;
  }

  .form-section-title {
    margin-top: var(--space-2);
    padding-top: var(--space-3);
  }

  .form-actions {
    bottom: -24px;
    margin-bottom: -24px;
    padding-bottom: 12px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .primary-button,
  .secondary-button,
  .danger-button,
  .card-action,
  .quick-card,
  .availability-row,
  .customer-list-item,
  .related-device-list > button {
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  }

  .primary-button:hover,
  .secondary-button:hover,
  .danger-button:hover,
  .card-action:hover {
    transform: translateY(-1px);
  }

  .quick-card:hover,
  .device-card:hover,
  .availability-card:hover,
  .todo-card:hover,
  .customer-card:hover,
  .finance-card:hover,
  .availability-row:hover,
  .customer-list-item:hover,
  .related-device-list > button:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
    box-shadow: var(--shadow-md);
  }

  .primary-button:active,
  .secondary-button:active,
  .danger-button:active,
  .card-action:active,
  .quick-card:active {
    transform: translateY(0);
  }
}

/* ==========================================================
   Shared finish layer: one professional component language for every theme
   ========================================================== */
html,
body {
  min-height: 100%;
}

body {
  color: var(--text-body);
  background: var(--bg-page);
  background-attachment: fixed;
  background-position: center top;
  background-size: 135% 135%;
}

body,
.app-shell,
.topbar,
.bottom-nav,
.theme-picker,
.icon-button,
.modal-frame,
.toast,
.metric-card,
.panel,
.device-card,
.availability-card,
.todo-card,
.customer-card,
.finance-card,
.quick-card,
.availability-panel,
.status-summary,
.workbench-panel,
.device-preview,
.customer-business-panel,
.dashboard-summary,
input,
select,
textarea,
button {
  transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

body {
  transition: color 0.25s ease, background 0.25s ease;
}

h1,
h2,
h3,
h4,
.metric-value,
.summary-primary strong,
.summary-metric strong,
.finance-amount,
.customer-balance-strip strong {
  color: var(--text-title);
}

.page-description,
.section-note,
.serial,
.subtle,
.metric-label,
.summary-primary span,
.summary-primary small,
.summary-metric span {
  color: var(--text-muted);
}

.login-card,
.metric-card,
.panel,
.device-card,
.availability-card,
.todo-card,
.customer-card,
.finance-card,
.quick-card,
.availability-panel,
.status-summary,
.workbench-panel,
.device-preview,
.customer-business-panel,
.dashboard-summary,
.modal-frame,
.toast {
  border: 1px solid var(--border-card);
  border-bottom-color: color-mix(in srgb, var(--border-card) 72%, var(--glass-border-bottom));
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
}

.dashboard-summary,
.login-card {
  border-radius: var(--radius-xl);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 12px 32px rgba(0, 0, 0, 0.08);
}

.topbar {
  padding-right: var(--space-3);
  padding-left: var(--space-3);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-bottom-color: rgba(255, 255, 255, 0.42);
  border-radius: var(--radius-lg);
  background: var(--glass-topbar);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
}

.modal-frame {
  border-color: rgba(255, 255, 255, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-xl);
  background: var(--glass-modal);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06), 0 24px 48px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.primary-button,
.card-action.primary,
.hero-actions button,
.detail-edit-button {
  border: 0;
  border-radius: var(--radius-md);
  color: var(--on-primary);
  background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 62%, var(--secondary)) 54%, var(--primary-hover) 100%);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.35);
  font-weight: 500;
}

.secondary-button,
.card-action:not(.primary),
.icon-button,
.close-button,
.related-device-list > button,
.availability-row,
.customer-list-item {
  border: 1px solid var(--glass-border-top);
  border-bottom-color: var(--glass-border-bottom);
  border-radius: var(--radius-md);
  color: var(--text-body);
  background: var(--glass-control);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.danger-button {
  border-color: color-mix(in srgb, var(--error) 34%, var(--border-color));
  border-radius: var(--radius-md);
  color: var(--error);
  background: var(--error-light);
}

.status-badge,
.mini-badge {
  min-height: 28px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  color: var(--primary-text);
  background: var(--bg-tag-light);
  font-size: 13px;
}

.status-badge[style*="--status-color:var(--success)"] {
  color: var(--success);
  background: var(--success-light);
}

.status-badge[style*="--status-color:var(--warning)"] {
  color: var(--warning);
  background: var(--warning-light);
}

.status-badge[style*="--status-color:var(--danger)"],
.status-badge[style*="--status-color:var(--error)"] {
  color: var(--error);
  background: var(--error-light);
}

.search-box input,
.filter-select,
.form-field input,
.form-field select,
.form-field textarea,
.checkbox-field {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-body);
  background: var(--bg-input);
  box-shadow: none;
}

.theme-picker,
.theme-picker select,
.filter-select {
  background: var(--glass-dropdown);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.theme-picker {
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.search-box input,
.filter-select,
.form-field input,
.form-field select,
.checkbox-field {
  height: 40px;
  min-height: 40px;
}

.form-field textarea {
  min-height: 88px;
}

.search-box input:focus,
.filter-select:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--primary);
  outline: 1px solid var(--primary);
  outline-offset: 0;
  box-shadow: 0 0 0 3px var(--primary-light);
}

.inventory-table-wrap {
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.inventory-table {
  background: #fff;
}

.inventory-table th {
  height: 48px;
  color: var(--text-body);
  background: var(--bg-table-header);
  font-weight: 500;
}

.inventory-table td {
  height: 48px;
}

.inventory-table tbody tr:nth-child(even) {
  background: var(--bg-table-row-alt);
}

.inventory-table tbody tr.is-selected {
  background: var(--primary-light);
  box-shadow: inset 3px 0 0 var(--primary);
}

.bottom-nav {
  border-color: rgba(255, 255, 255, 0.6);
  background: var(--bg-sidebar);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-placeholder);
}

.nav-item {
  border-radius: var(--radius-md);
}

.nav-item.is-active {
  color: var(--primary-text);
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
}

.summary-primary {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light) 58%, color-mix(in srgb, var(--bg-card) 72%, transparent));
}

.summary-metric,
.metric-card {
  position: relative;
  overflow: hidden;
}

.summary-metric::after,
.metric-card::after {
  position: absolute;
  top: -26px;
  right: -22px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--secondary-light) 0%, var(--tertiary-light) 42%, transparent 72%);
  content: "";
  pointer-events: none;
}

.metric-label,
.summary-metric span {
  font-size: 13px;
}

.metric-value,
.summary-metric strong {
  font-size: 24px;
  font-weight: 600;
}

.hero-panel,
.detail-hero {
  color: var(--on-primary);
  background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--secondary) 42%, var(--primary-hover)) 58%, var(--primary-hover) 100%);
  box-shadow: var(--shadow-lg);
}

.hero-panel .hero-label,
.hero-panel .hero-note,
.detail-hero p {
  color: color-mix(in srgb, var(--on-primary) 86%, transparent);
}

.hero-panel .hero-value,
.detail-hero h3 {
  color: var(--on-primary);
}

@media (min-width: 980px) {
  .topbar,
  .demo-banner,
  .content-shell {
    width: min(100% - 80px, 1240px);
  }

  .topbar {
    padding-right: var(--space-4);
    padding-left: var(--space-4);
  }

  .bottom-nav {
    border-right: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: var(--shadow-sm);
  }

  .nav-item.is-active {
    box-shadow: inset 3px 0 0 var(--primary);
  }
}

@media (hover: hover) and (pointer: fine) {
  .metric-card:hover,
  .panel:hover,
  .device-card:hover,
  .availability-card:hover,
  .todo-card:hover,
  .customer-card:hover,
  .finance-card:hover,
  .quick-card:hover {
    border-color: rgba(255, 255, 255, 0.9);
    border-bottom-color: rgba(255, 255, 255, 0.5);
    background: var(--bg-card-hover);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 12px 32px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
  }

  .primary-button:hover,
  .card-action.primary:hover,
  .hero-actions button:hover,
  .detail-edit-button:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, color-mix(in srgb, var(--secondary) 34%, var(--primary-hover)) 48%, color-mix(in srgb, var(--primary-hover) 82%, var(--text-title)) 100%);
    box-shadow: 0 6px 18px rgba(var(--primary-rgb), 0.42);
    transform: translateY(-1px);
  }

  .secondary-button:hover,
  .card-action:not(.primary):hover,
  .icon-button:hover,
  .close-button:hover,
  .related-device-list > button:hover,
  .availability-row:hover,
  .customer-list-item:hover {
    color: var(--primary-text);
    background: var(--primary-light);
  }

  .inventory-table tbody tr:not(.is-selected):hover {
    background: color-mix(in srgb, var(--primary-light) 40%, var(--bg-card));
  }

  .nav-item:hover:not(.is-active) {
    background: rgba(0, 0, 0, 0.03);
  }
}

/* Paired palettes keep action gradients clean; companion colors stay in tags and decorative accents. */
html[data-theme="cream"] .primary-button,
html[data-theme="cream"] .card-action.primary,
html[data-theme="cream"] .hero-actions button,
html[data-theme="cream"] .detail-edit-button {
  background: linear-gradient(135deg, #8eb7d8 0%, #72a0c3 100%);
}

html[data-theme="mint"] .primary-button,
html[data-theme="mint"] .card-action.primary,
html[data-theme="mint"] .hero-actions button,
html[data-theme="mint"] .detail-edit-button {
  background: linear-gradient(135deg, #78b8aa 0%, #5f9d90 100%);
}

/* Functional additions: finance ledger, device earnings, and type-aware todo actions. */
.bottom-nav {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  max-width: 720px;
}

.device-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.device-earnings {
  color: var(--success);
}

.device-earnings.is-negative,
.is-negative {
  color: var(--danger) !important;
}

.card-action.todo-action-button {
  border: 1px solid color-mix(in srgb, var(--todo-action-color) 34%, var(--line));
  color: var(--todo-action-color);
  background: color-mix(in srgb, var(--todo-action-color) 10%, var(--surface-solid));
  box-shadow: none;
}

@media (min-width: 980px) {
  .todo-list-item,
  .todo-list-item[data-kind="return"],
  .todo-list-item[data-kind="finance"],
  .todo-list-item[data-kind="follow-up"] {
    border-left-color: var(--todo-color);
  }
}

.detail-calculation-note {
  margin: -8px 0 20px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.data-quality-note {
  margin-top: var(--space-2);
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--warning) 26%, var(--line));
  border-radius: var(--radius-md);
  color: color-mix(in srgb, var(--warning) 78%, var(--text));
  background: color-mix(in srgb, var(--warning) 9%, var(--surface-solid));
  font-size: 0.76rem;
  font-weight: 700;
}

.preview-quality {
  margin-top: var(--space-3);
}

.earning-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.earning-breakdown.compact {
  margin-top: var(--space-3);
}

.earning-breakdown > div {
  min-width: 0;
  padding: 9px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.earning-breakdown span,
.earning-breakdown strong {
  display: block;
}

.earning-breakdown span {
  color: var(--muted);
  font-size: 0.7rem;
}

.earning-breakdown strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--text-title);
  font-size: 0.82rem;
}

.data-review-toggle.is-active {
  border-color: color-mix(in srgb, var(--warning) 38%, var(--line));
  color: color-mix(in srgb, var(--warning) 78%, var(--text));
  background: color-mix(in srgb, var(--warning) 12%, var(--surface-solid));
}

.section-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.finance-settlement-summary {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.settlement-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-column: 1 / -1;
  gap: var(--space-2);
}

.settlement-summary-grid > div {
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.settlement-summary-grid small,
.settlement-summary-grid strong {
  display: block;
}

.settlement-summary-grid small {
  color: var(--muted);
  font-size: 0.74rem;
}

.settlement-summary-grid strong {
  margin-top: var(--space-1);
  color: var(--text-title);
  font-size: 1rem;
}

.finance-filter-panel {
  margin-bottom: var(--space-3);
}

.finance-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.finance-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: var(--space-3);
  gap: var(--space-2);
}

.finance-metrics article {
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.finance-metrics span,
.finance-metrics strong {
  display: block;
}

.finance-metrics span {
  color: var(--muted);
  font-size: 0.76rem;
}

.finance-metrics strong {
  margin-top: var(--space-1);
  color: var(--text-title);
  font-size: 1.16rem;
}

@media (min-width: 980px) {
  .bottom-nav {
    max-width: none;
    grid-template-columns: 1fr;
  }

  .finance-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
  }

  .finance-metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .finance-table-wrap {
    overflow: auto;
    border-radius: var(--radius-lg);
  }

  .finance-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
    background: var(--surface-solid);
  }

  .finance-table th,
  .finance-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    font-size: 0.78rem;
    text-align: left;
    vertical-align: middle;
  }

  .finance-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--muted);
    background: var(--surface-muted);
    font-weight: 760;
  }

  .finance-table td strong,
  .finance-table td small {
    display: block;
  }

  .finance-table td small {
    margin-top: 3px;
    color: var(--muted);
  }

  .finance-table tbody tr:hover {
    background: color-mix(in srgb, var(--primary-soft) 42%, var(--surface-solid));
  }

  .finance-status {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 760;
  }

  .finance-status.is-settled {
    color: var(--success);
    background: color-mix(in srgb, var(--success) 10%, var(--surface-solid));
  }

  .finance-status.is-open {
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 10%, var(--surface-solid));
  }

  .compact-action {
    min-height: 32px;
    padding: 5px 10px;
  }

  .inventory-table th:nth-child(1) { width: 18%; }
  .inventory-table th:nth-child(2) { width: 13%; }
  .inventory-table th:nth-child(3) { width: 20%; }
  .inventory-table th:nth-child(4) { width: 12%; }
  .inventory-table th:nth-child(5) { width: 12%; }
  .inventory-table th:nth-child(6) { width: 12%; }
  .inventory-table th:nth-child(7) { width: 13%; }
}

@media (hover: hover) and (pointer: fine) {
  .card-action.todo-action-button:hover {
    border-color: var(--todo-action-color);
    color: var(--todo-action-color);
    background: color-mix(in srgb, var(--todo-action-color) 16%, var(--surface-solid));
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
  }
}

@media (max-width: 520px) {
  .nav-item {
    font-size: 0.68rem;
  }

  .device-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-tools,
  .section-header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .inventory-tools > *,
  .section-header-actions > * {
    flex: 1 1 auto;
  }

  .settlement-summary-grid {
    grid-template-columns: 1fr;
  }
}

.market-shell {
  overflow: hidden;
}

.market-header {
  align-items: flex-start;
  gap: var(--space-3);
}

.market-schedule-note {
  display: block;
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: 0.76rem;
}

.market-brand-filters {
  display: flex;
  overflow-x: auto;
  margin: 0 calc(var(--space-2) * -1) var(--space-4);
  padding: 0 var(--space-2) var(--space-2);
  scrollbar-width: none;
  gap: var(--space-2);
}

.market-brand-filters::-webkit-scrollbar {
  display: none;
}

.market-brand-filter {
  --brand-color: var(--primary);
  display: inline-flex;
  min-height: 36px;
  flex: 0 0 auto;
  align-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-solid);
  font-size: 0.8rem;
  font-weight: 700;
  gap: 7px;
}

.market-brand-filter i {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  box-shadow: 0 0 0 3px color-mix(in srgb, #9ca3af 14%, transparent);
}

.market-brand-filter.is-active {
  border-color: color-mix(in srgb, var(--brand-color) 36%, var(--line));
  color: var(--brand-color);
  background: color-mix(in srgb, var(--brand-color) 10%, transparent);
  box-shadow: var(--shadow-sm);
}

.market-brand-filter.is-active i {
  background: var(--brand-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-color) 14%, transparent);
}

[data-brand-key="huawei"] { --brand-color: #cf0a2c; }
[data-brand-key="oppo"] { --brand-color: #00a650; }
[data-brand-key="vivo"] { --brand-color: #415fff; }
[data-brand-key="samsung"] { --brand-color: #1428a0; }
[data-brand-key="xiaomi"] { --brand-color: #ff6900; }
[data-brand-key="apple"] { --brand-color: #555555; }
[data-brand-key="other"] { --brand-color: #9ca3af; }

.market-brand-groups {
  display: grid;
  gap: 32px;
}

.market-brand-section {
  min-width: 0;
}

.market-brand-section::before {
  display: block;
  height: 2px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand-color) 30%, transparent), transparent);
  content: "";
}

.market-brand-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: var(--space-3);
}

.market-brand-heading h3 {
  display: flex;
  align-items: center;
  margin: 0;
  color: var(--brand-color);
  font-size: 15px;
  font-weight: 600;
  gap: 8px;
}

.market-brand-heading i {
  display: block;
  width: 4px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 2px;
  background: var(--brand-color);
}

.market-brand-heading span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.market-brand-heading b {
  color: var(--brand-color);
  font: inherit;
}

.market-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 285px), 1fr));
  gap: var(--space-3);
}

.market-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px) saturate(140%);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.market-card.is-market-empty {
  border-color: color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--surface-muted) 86%, transparent);
  opacity: 0.55;
}

.market-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.market-card-heading,
.market-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.market-card-heading h3 {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.market-sample-count {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--primary-strong, var(--primary));
  background: var(--primary-soft);
  font-size: 0.72rem;
  font-weight: 750;
}

.market-sample-count.is-empty {
  color: var(--muted);
  background: var(--surface-muted);
}

.market-price-grid {
  display: flex;
  margin: var(--space-4) 0;
  padding: 0 4px;
  gap: 8px;
}

.market-price-grid > div {
  flex: 1;
  min-width: 0;
  padding: 12px 3px 10px;
  border-radius: 10px;
  text-align: center;
}

.market-price-grid > div:nth-child(1) {
  background: #fef2f2;
}

.market-price-grid > div:nth-child(2) {
  background: #ecfdf5;
}

.market-price-grid > div:nth-child(3) {
  background: #f5f3ff;
}

.market-price-grid strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.market-price-grid > div:nth-child(1) strong { color: #ef4444; }
.market-price-grid > div:nth-child(2) strong { color: #10b981; }
.market-price-grid > div:nth-child(3) strong { color: #8b5cf6; }

.market-price-grid span {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
}

.market-price-grid > div:nth-child(1) span { color: #991b1b; }
.market-price-grid > div:nth-child(2) span { color: #065f46; }
.market-price-grid > div:nth-child(3) span { color: #5b21b6; }

.market-card.is-market-empty .market-price-grid > div { background: #f9fafb; }
.market-card.is-market-empty .market-price-grid strong { color: #d1d5db; }
.market-card.is-market-empty .market-price-grid span { color: #9ca3af; }

.market-card-footer small {
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.market-refresh-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--primary);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
  font-size: 1.15rem;
  font-weight: 800;
  place-items: center;
}

.market-refresh-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: rotate(18deg);
}

.market-empty {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  padding: var(--space-5);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  gap: var(--space-2);
}

.market-empty span {
  color: var(--primary);
  font-size: 2rem;
}

.market-empty strong {
  color: var(--text);
}

.market-empty p,
.market-disclaimer {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.market-disclaimer {
  margin-top: var(--space-4);
  text-align: center;
}

@media (max-width: 640px) {
  .market-header {
    align-items: stretch;
    flex-direction: column;
  }

  .market-header .section-header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .market-card {
    padding: 16px;
  }

  .market-price-grid strong {
    font-size: 16px;
  }
}

html[data-theme="cream"] .hero-panel,
html[data-theme="cream"] .detail-hero {
  background: linear-gradient(135deg, #8eb7d8 0%, #72a0c3 100%);
}

html[data-theme="mint"] .hero-panel,
html[data-theme="mint"] .detail-hero {
  background: linear-gradient(135deg, #78b8aa 0%, #5f9d90 100%);
}

@media (hover: hover) and (pointer: fine) {
  html[data-theme="cream"] .primary-button:hover,
  html[data-theme="cream"] .card-action.primary:hover,
  html[data-theme="cream"] .hero-actions button:hover,
  html[data-theme="cream"] .detail-edit-button:hover {
    background: linear-gradient(135deg, #82acd0 0%, #6694b9 100%);
  }

  html[data-theme="mint"] .primary-button:hover,
  html[data-theme="mint"] .card-action.primary:hover,
  html[data-theme="mint"] .hero-actions button:hover,
  html[data-theme="mint"] .detail-edit-button:hover {
    background: linear-gradient(135deg, #6faf9f 0%, #548f83 100%);
  }
}

/* Navigation clarity: shared line icons and stronger desktop hierarchy. */
.nav-icon {
  display: grid;
  width: 22px;
  height: 22px;
  color: var(--primary);
  place-items: center;
  flex: 0 0 auto;
}

.nav-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item {
  min-width: 0;
  color: var(--text);
}

@media (min-width: 980px) {
  .bottom-nav {
    padding: 20px 14px;
    gap: 7px;
  }

  .side-brand {
    margin-bottom: 12px;
  }

  .side-brand-name {
    color: var(--text);
    font-size: 0.96rem;
    font-weight: 800;
  }

  .nav-item {
    min-height: 52px;
    padding: 0 12px;
    border: 1px solid transparent;
    color: var(--text);
    font-size: 0.94rem;
    font-weight: 700;
    opacity: 1;
  }

  .nav-item .nav-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: var(--primary-soft);
  }

  .nav-item.is-active {
    border-color: color-mix(in srgb, var(--primary) 22%, var(--line));
    color: var(--text);
    background: var(--surface-solid);
    box-shadow: inset 3px 0 0 var(--primary), var(--shadow-sm);
    font-weight: 800;
    opacity: 1;
  }

  .nav-item.is-active .nav-icon {
    color: var(--on-primary, var(--surface-solid));
    background: var(--primary);
    box-shadow: var(--shadow-sm);
  }
}

/* 2026-08-18: account controls belong to the sidebar; titles stay clean until a direction is approved. */
.topbar h1,
.section-header h2,
.section-header h3,
.panel-title,
.market-brand-heading h2 {
  font-family: inherit;
  text-wrap: balance;
}

.topbar h1 {
  color: var(--text-title, var(--text));
  font-size: clamp(1.9rem, 4vw, 2.25rem);
  font-weight: 850;
  letter-spacing: -0.035em;
  line-height: 1.18;
  text-shadow: none;
}

.topbar h1::after {
  width: 48px;
  height: 3px;
  margin-top: 8px;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 26%, transparent));
  box-shadow: none;
  transform: none;
}

.section-header h2,
.section-header h3 {
  position: relative;
  color: var(--text-title, var(--text));
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.section-header h2 {
  font-size: clamp(1.22rem, 1.7vw, 1.38rem);
}

.section-header h3 {
  font-size: clamp(1.08rem, 1.4vw, 1.18rem);
}

.section-header h2::before,
.section-header h3::before {
  display: none;
  width: 4px;
  height: 0.9em;
  margin-right: 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), color-mix(in srgb, var(--primary) 28%, transparent));
  box-shadow: 5px 0 0 color-mix(in srgb, var(--primary) 10%, transparent);
  content: "";
  transform: rotate(8deg);
}

@media (min-width: 980px) {
  .bottom-nav {
    display: flex;
    flex-direction: column;
    padding: 20px 14px 14px;
  }

  .bottom-nav .topbar-actions {
    position: static;
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-top: auto;
    padding: 10px;
    border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
    gap: 8px;
  }

  .topbar-actions .theme-picker {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-between;
    box-shadow: none;
  }

  .topbar-actions .theme-picker select {
    max-width: 112px;
  }

  .topbar-actions .icon-button {
    min-width: 0;
    padding: 0 10px;
    box-shadow: none;
  }

  .topbar-actions [data-action="account-settings"] {
    width: 100%;
  }
}

@media (max-width: 979px) {
  .topbar {
    flex-wrap: wrap;
    padding-top: 72px;
  }

  .bottom-nav .topbar-actions {
    position: fixed;
    z-index: 40;
    top: 12px;
    right: 12px;
    bottom: auto;
    left: auto;
    display: flex;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    justify-content: flex-end;
  }
}

/* Inventory uses the same brand language as market reference, while keeping device-level operations. */
.inventory-brand-filters {
  width: 100%;
  margin: 4px 0 18px;
}

.inventory-brand-filter b {
  color: inherit;
  font: inherit;
  font-weight: 800;
}

.inventory-brand-groups {
  display: grid;
  gap: 32px;
}

.inventory-brand-section .inventory-table-wrap {
  margin: 0;
}

.inventory-brand-section .inventory-card-view {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mobile-inventory-brand-groups {
  display: grid;
  gap: 12px;
}

.mobile-inventory-brand {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface-solid) 90%, transparent);
  box-shadow: var(--shadow-sm);
}

.mobile-inventory-brand > summary {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  gap: 12px;
}

.mobile-inventory-brand > summary::-webkit-details-marker {
  display: none;
}

.mobile-inventory-brand > summary span {
  display: flex;
  align-items: center;
  color: var(--brand-color);
  font-weight: 800;
  gap: 9px;
}

.mobile-inventory-brand > summary i {
  width: 4px;
  height: 20px;
  border-radius: 999px;
  background: var(--brand-color);
}

.mobile-inventory-brand > summary b {
  color: var(--muted);
  font-size: 0.78rem;
}

.mobile-inventory-brand[open] > summary {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--brand-color) 6%, var(--surface-solid));
}

.mobile-inventory-brand > .device-grid {
  padding: 12px;
}

@media (max-width: 1180px) and (min-width: 980px) {
  .inventory-brand-section .inventory-card-view {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================
   2026-08-18 official UI: neutral workspace + full theme accent
   ========================================================== */
html[data-theme] {
  --bg-page: #f6f7fb;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-input: #ffffff;
  --bg-table-header: #f7f8fb;
  --bg-table-row-alt: #fbfbfd;
  --text-title: #252a3d;
  --text-body: #525b71;
  --text-muted: #7c849d;
  --text-placeholder: #9ba1b3;
  --primary: #4f47bd;
  --primary-rgb: 79, 71, 189;
  --primary-hover: #423c9a;
  --primary-light: #ecebf8;
  --primary-text: #423c9a;
  --secondary: #4f47bd;
  --secondary-rgb: 79, 71, 189;
  --secondary-light: #ecebf8;
  --tertiary: #f36f79;
  --tertiary-light: #fff1f2;
  --on-primary: #ffffff;
  --page: #f6f7fb;
  --page-deep: #f6f7fb;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-muted: #f7f8fb;
  --line: #e9ebf2;
  --border-color: #e9ebf2;
  --border-card: #e9ebf2;
  --border-divider: #e9ebf2;
  --glass-border-bottom: #e9ebf2;
  --glass-sidebar: #ffffff;
  --glass-topbar: transparent;
  --glass-modal: #ffffff;
  --glass-control: #ffffff;
  --glass-dropdown: #ffffff;
  --shadow-sm: 0 2px 8px rgba(37, 42, 61, 0.04);
  --shadow-md: 0 5px 18px rgba(37, 42, 61, 0.055);
  --shadow-lg: 0 12px 32px rgba(37, 42, 61, 0.08);
  --shadow-card: 0 5px 18px rgba(37, 42, 61, 0.045);
  --nav-accent: #4f47bd;
  --nav-accent-soft: #ecebf8;
  --dash-coral: #f36f79;
  --dash-coral-soft: #fff1f2;
  --dash-orange: #f59c52;
  --dash-orange-soft: #fff7e9;
  --dash-green: #29ad78;
  --dash-green-soft: #ecfaf4;
  --dash-violet: #8a72e8;
  --dash-violet-soft: #f4f1ff;
  --dash-blue: #5d8dea;
  --dash-blue-soft: #eef5ff;
  --dash-yellow: #c69838;
  --dash-yellow-soft: #fff8e5;
}

html[data-theme="rose"] {
  --primary: #f28295;
  --primary-rgb: 242, 130, 149;
  --primary-hover: #c16a7b;
  --primary-light: #fef1f3;
  --primary-text: #a84f62;
  --secondary: #f28295;
  --secondary-rgb: 242, 130, 149;
  --secondary-light: #fef1f3;
  --nav-accent: #f28295;
  --nav-accent-soft: #fef1f3;
}

html[data-theme="honey"] {
  --primary: #4fd86b;
  --primary-rgb: 79, 216, 107;
  --primary-hover: #42ad5a;
  --primary-light: #ecfbef;
  --primary-text: #27843b;
  --secondary: #4fd86b;
  --secondary-rgb: 79, 216, 107;
  --secondary-light: #ecfbef;
  --on-primary: #203426;
  --nav-accent: #4fd86b;
  --nav-accent-soft: #ecfbef;
}

html[data-theme="mist"] {
  --primary: #36c0e2;
  --primary-rgb: 54, 192, 226;
  --primary-hover: #2f9ab7;
  --primary-light: #e9f8fc;
  --primary-text: #247e96;
  --secondary: #36c0e2;
  --secondary-rgb: 54, 192, 226;
  --secondary-light: #e9f8fc;
  --nav-accent: #36c0e2;
  --nav-accent-soft: #e9f8fc;
}

html[data-theme="emerald"] {
  --primary: #239a74;
  --primary-rgb: 35, 154, 116;
  --primary-hover: #207c61;
  --primary-light: #e7f4f0;
  --primary-text: #17664f;
  --secondary: #239a74;
  --secondary-rgb: 35, 154, 116;
  --secondary-light: #e7f4f0;
  --nav-accent: #239a74;
  --nav-accent-soft: #e7f4f0;
}

.nav-item.is-active {
  color: var(--nav-accent);
  background: var(--nav-accent-soft);
}

@media (max-width: 979px) {
  .nav-icon { color: var(--nav-accent); }
}

body {
  color: var(--text-body);
  background: var(--bg-page);
  background-image: none;
}

.ui-icon,
.brand-mark svg,
.side-brand-mark svg,
.login-phone-screen svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar {
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.topbar h1::after {
  display: none;
}

.primary-button,
.card-action.primary,
.hero-actions button,
.detail-edit-button {
  background: var(--primary);
  box-shadow: 0 5px 14px rgba(108, 99, 232, 0.2);
}

/* Login: quiet two-column shell with a single large device illustration. */
.login-shell {
  padding: 24px;
  background: #f6f7fb;
}

.login-layout {
  display: grid;
  width: min(100%, 1080px);
  min-height: min(700px, calc(100vh - 48px));
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  overflow: hidden;
  border: 1px solid #e9ebf2;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(37, 42, 61, 0.09);
}

.login-visual {
  position: relative;
  display: grid;
  overflow: hidden;
  min-height: 540px;
  background: #fafafe;
  place-items: center;
}

.login-orbit {
  position: absolute;
  border: 1px solid #e9ebf2;
  border-radius: 50%;
}

.login-orbit-outer { width: 460px; height: 460px; }
.login-orbit-inner { width: 300px; height: 300px; }

.login-phone {
  position: relative;
  z-index: 2;
  width: 184px;
  height: 350px;
  padding: 12px;
  border: 8px solid #252a3d;
  border-radius: 32px;
  background: #ffffff;
  box-shadow: 24px 30px 54px rgba(37, 42, 61, 0.14);
  transform: rotate(-7deg);
}

.login-phone-speaker {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 50%;
  width: 56px;
  height: 13px;
  border-radius: 999px;
  background: #252a3d;
  transform: translateX(-50%);
}

.login-phone-screen {
  display: grid;
  width: 100%;
  height: 100%;
  border-radius: 19px;
  color: #ffffff;
  background: #f0efff;
  place-items: center;
}

.login-phone-screen svg {
  width: 58px;
  height: 58px;
  padding: 15px;
  border-radius: 18px;
  background: #6c63e8;
  box-shadow: 0 12px 26px rgba(108, 99, 232, 0.23);
}

.login-orb {
  position: absolute;
  z-index: 1;
  border-radius: 50%;
  box-shadow: 0 8px 22px rgba(37, 42, 61, 0.1);
}

.login-orb-coral { top: 23%; left: 17%; width: 28px; height: 28px; background: var(--dash-coral); }
.login-orb-green { top: 18%; right: 19%; width: 18px; height: 18px; background: var(--dash-green); }
.login-orb-yellow { right: 16%; bottom: 22%; width: 24px; height: 24px; background: var(--dash-orange); }

.login-card {
  width: 100%;
  padding: 56px;
  align-self: center;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
  text-align: left;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  margin: 0 0 24px;
  border-radius: 11px;
  background: #6c63e8;
  box-shadow: 0 9px 20px rgba(108, 99, 232, 0.2);
  transform: none;
}

.brand-mark svg { width: 22px; height: 22px; }
.login-card h1 { margin-bottom: 8px; font-size: clamp(2rem, 4vw, 2.45rem); }
.login-copy { margin-bottom: 28px; line-height: 1.65; }
.login-field input { border-color: #e9ebf2; background: #ffffff; }

@media (max-width: 760px) {
  .login-shell { padding: 16px; }
  .login-layout { min-height: calc(100vh - 32px); grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-card { padding: 38px 26px; }
}

@media (min-width: 980px) {
  .app-shell {
    padding-left: 196px;
    padding-bottom: 26px;
  }

  .bottom-nav {
    width: 196px;
    height: 100dvh;
    padding: 18px 12px 12px;
    overflow: hidden;
    border-right: 1px solid #e9ebf2;
    background: #ffffff;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    gap: 4px;
  }

  .side-brand {
    min-height: 52px;
    margin: 0 0 16px;
    padding: 2px 8px 12px;
    border: 0;
  }

  .side-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    color: #ffffff;
    background: var(--nav-accent);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--nav-accent) 23%, transparent);
  }

  .side-brand-mark svg { width: 20px; height: 20px; }

  .nav-item {
    min-height: 44px;
    padding: 0 10px;
    border: 0;
    border-radius: 9px;
    color: #626b83;
    font-size: 0.9rem;
    font-weight: 700;
    gap: 10px;
  }

  .nav-item .nav-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: #7b8398;
    background: transparent;
  }

  .nav-item.is-active {
    border: 0;
    color: var(--nav-accent);
    background: var(--nav-accent-soft);
    box-shadow: none;
  }

  .nav-item.is-active .nav-icon {
    color: var(--nav-accent);
    background: color-mix(in srgb, var(--nav-accent) 9%, #ffffff);
    box-shadow: none;
  }

  .nav-item:hover:not(.is-active) {
    color: #252a3d;
    background: #f7f8fb;
  }

  .bottom-nav .topbar-actions {
    grid-template-columns: minmax(0, 1fr) auto;
    margin-top: auto;
    padding: 8px;
    border: 1px solid #e9ebf2;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: none;
    gap: 6px;
  }

  .topbar-actions .theme-picker {
    min-height: 34px;
    padding: 0 7px;
    border-radius: 8px;
    background: #f7f8fb;
    font-size: 0.72rem;
  }

  .topbar-actions .theme-picker select { max-width: 100px; padding-right: 0; }
  .topbar-actions .icon-button { min-height: 34px; border-radius: 8px; font-size: 0.75rem; }

  .demo-banner {
    position: fixed;
    z-index: 31;
    bottom: 122px;
    left: 12px;
    width: 172px;
    margin: 0;
    padding: 9px 10px;
    border-color: #e9ebf2;
    border-radius: 9px;
    color: #687187;
    background: #f8faf9;
    font-size: 0;
    line-height: 1.35;
  }

  .demo-banner::after {
    color: #7c849d;
    font-size: 0.68rem;
    content: "真实数据 · 实时更新";
  }

  .demo-banner:not(.is-real-mode)::after { content: "演示数据 · 本地预览"; }
  .demo-banner .pulse-dot { width: 7px; height: 7px; margin-right: 8px; color: var(--success); }

  .topbar,
  .content-shell {
    width: min(100% - 42px, 1320px);
  }

  .topbar {
    min-height: 86px;
    padding: 18px 0 12px;
  }

  .topbar h1 { font-size: 1.5rem; letter-spacing: -0.025em; }
  .page-description { margin-top: 4px; font-size: 0.78rem; }

  body[data-active-view="dashboard"] { overflow: hidden; }
  body[data-active-view="dashboard"] .app-shell { height: 100dvh; padding-bottom: 0; overflow: hidden; }
  body[data-active-view="dashboard"] .content-shell { height: calc(100dvh - 86px); overflow: hidden; }
  body[data-active-view="dashboard"] #view-dashboard { height: 100%; }

  .dashboard-workbench {
    display: grid;
    height: 100%;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) 150px;
    padding-bottom: 14px;
    gap: 14px;
  }

  .dashboard-overview-grid {
    display: grid;
    min-height: 0;
    grid-template-columns: minmax(0, 1.48fr) minmax(350px, 0.82fr);
    gap: 14px;
  }

  .dashboard-main-column {
    display: grid;
    min-height: 0;
    grid-template-rows: minmax(210px, 0.9fr) minmax(150px, 1.1fr);
    gap: 9px;
  }

  .workbench-panel,
  .dashboard-summary {
    border: 1px solid #e9ebf2;
    border-radius: 13px;
    background: #ffffff;
    box-shadow: 0 5px 18px rgba(37, 42, 61, 0.045);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .dashboard-summary {
    display: grid;
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(210px, 0.72fr) minmax(0, 1.8fr);
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  .summary-primary {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    border: 0;
    border-right: 1px solid #e9ebf2;
    background: #ffffff;
    gap: 13px;
  }

  .summary-primary-icon,
  .summary-metric-icon {
    display: grid;
    place-items: center;
  }

  .summary-primary-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    color: var(--dash-coral);
    background: var(--dash-coral-soft);
    flex: 0 0 auto;
  }

  .summary-primary-icon .ui-icon { width: 23px; height: 23px; }
  .summary-primary strong { display: block; margin: 2px 0 0; font-size: clamp(1.8rem, 2.6vw, 2.4rem); }
  .summary-primary small { display: block; margin-top: 2px; }

  .summary-metrics {
    display: grid;
    min-height: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    padding: 10px;
    gap: 8px;
  }

  .summary-metric {
    position: relative;
    display: grid;
    min-height: 0;
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    align-items: center;
    padding: 10px;
    overflow: hidden;
    border: 1px solid #eef0f5;
    border-radius: 10px;
    background: #ffffff;
    gap: 2px 8px;
  }

  .summary-metric::after {
    position: absolute;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: 3px;
    border-radius: 0;
    background: var(--tone);
    content: "";
  }

  .summary-metric:nth-child(3n),
  .summary-metric:nth-child(n + 4) {
    border: 1px solid #eef0f5;
  }

  .summary-metric-icon {
    width: 28px;
    height: 28px;
    grid-row: 1 / 3;
    border-radius: 8px;
    color: var(--tone);
    background: var(--tone-soft);
  }

  .summary-metric-icon .ui-icon { width: 15px; height: 15px; }
  .summary-metric > span:not(.summary-metric-icon) { align-self: end; font-size: 0.7rem; }
  .summary-metric strong { align-self: start; margin: 0; font-size: clamp(0.9rem, 1.25vw, 1.08rem); }

  .dashboard-tone-coral { --tone: var(--dash-coral); --tone-soft: var(--dash-coral-soft); }
  .dashboard-tone-orange { --tone: var(--dash-orange); --tone-soft: var(--dash-orange-soft); }
  .dashboard-tone-green { --tone: var(--dash-green); --tone-soft: var(--dash-green-soft); }
  .dashboard-tone-violet { --tone: var(--dash-violet); --tone-soft: var(--dash-violet-soft); }
  .dashboard-tone-blue { --tone: var(--dash-blue); --tone-soft: var(--dash-blue-soft); }
  .dashboard-tone-yellow { --tone: var(--dash-yellow); --tone-soft: var(--dash-yellow-soft); }

  .dashboard-focus-column {
    display: grid;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 9px;
  }

  .dashboard-focus-column .workbench-panel { min-height: 0; padding: 11px 12px; }
  .dashboard-focus-column .section-header { margin-bottom: 8px; }
  .dashboard-focus-column .section-header h2 { font-size: 0.96rem; }
  .dashboard-focus-column .section-note { font-size: 0.68rem; }

  .dashboard-focus-panel {
    border-color: color-mix(in srgb, var(--primary) 15%, #e9ebf2);
    box-shadow: 0 8px 24px rgba(74, 68, 151, 0.075);
  }

  .dashboard-focus-panel .section-header h2::after {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 7px;
    border-radius: 50%;
    background: var(--dash-coral);
    content: "";
    vertical-align: middle;
  }

  .dashboard-quick-panel .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .dashboard-quick-panel .quick-card {
    display: flex;
    min-height: 40px;
    align-items: center;
    padding: 6px 9px;
    border: 1px solid #eef0f5;
    border-radius: 9px;
    text-align: left;
    gap: 8px;
  }

  .dashboard-quick-panel .quick-card strong {
    display: grid;
    width: 25px;
    height: 25px;
    margin: 0;
    border-radius: 7px;
    color: var(--quick-tone);
    background: var(--quick-soft);
    place-items: center;
  }

  .dashboard-quick-panel .quick-card .ui-icon { width: 14px; height: 14px; }
  .dashboard-quick-panel .quick-card span { font-size: 0.73rem; font-weight: 750; }
  .quick-coral { --quick-tone: var(--dash-coral); --quick-soft: var(--dash-coral-soft); }
  .quick-violet { --quick-tone: var(--dash-violet); --quick-soft: var(--dash-violet-soft); }
  .quick-green { --quick-tone: var(--dash-green); --quick-soft: var(--dash-green-soft); }
  .quick-orange { --quick-tone: var(--dash-orange); --quick-soft: var(--dash-orange-soft); }

  .dashboard-priority { overflow: hidden; }
  .dashboard-priority .todo-desktop-list { gap: 5px; }
  .dashboard-priority .todo-list-item {
    grid-template-columns: 70px minmax(0, 1fr) 62px;
    min-height: 40px;
    padding: 6px 7px;
    border-radius: 8px;
    box-shadow: none;
    gap: 7px;
  }

  .dashboard-priority .todo-list-item .todo-date { display: none; }
  .dashboard-priority .todo-type { gap: 0; }
  .dashboard-priority .todo-type span { font-size: 0.68rem; white-space: nowrap; }
  .dashboard-priority .todo-type small { font-size: 0.6rem; }
  .dashboard-priority .todo-title { overflow: hidden; font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
  .dashboard-priority .todo-detail { overflow: hidden; margin: 1px 0 0; font-size: 0.62rem; text-overflow: ellipsis; white-space: nowrap; }
  .dashboard-priority .todo-action .card-action { min-height: 27px; padding: 0 5px; font-size: 0.64rem; }
  .dashboard-priority .empty-state { min-height: 92px; padding: 12px; }
  .dashboard-priority .todo-list-item:nth-child(n + 5) { display: none; }

  .dashboard-status-panel .status-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    gap: 4px 8px;
  }

  .dashboard-status-panel .status-summary-item {
    min-height: 24px;
    padding: 3px 5px;
    border: 0;
    border-radius: 7px;
    background: #f8f9fb;
    font-size: 0.68rem;
  }

  .dashboard-status-panel .status-summary-count { font-size: 0.76rem; }

  .dashboard-monthly-panel {
    min-height: 0;
    padding: 11px 16px 9px;
    overflow: hidden;
  }

  .dashboard-monthly-panel .section-header { margin-bottom: 3px; }
  .dashboard-monthly-panel .section-header h2 { font-size: 0.94rem; }
  .dashboard-monthly-panel .section-note { font-size: 0.66rem; }

  .dashboard-monthly-chart {
    display: grid;
    height: calc(100% - 42px);
    min-height: 74px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: end;
    gap: 16px;
  }

  .monthly-day {
    display: grid;
    height: 100%;
    grid-template-rows: minmax(0, 1fr) 18px;
    color: #7c849d;
    font-size: 0.64rem;
    text-align: center;
  }

  .monthly-bars {
    display: flex;
    height: 100%;
    align-items: end;
    justify-content: center;
    border-bottom: 1px solid #e9ebf2;
    background: linear-gradient(to top, transparent 49%, #f1f2f6 50%, transparent 51%);
    gap: 7px;
  }

  .monthly-bar {
    display: block;
    width: min(14px, 28%);
    height: var(--monthly-height);
    border-radius: 5px 5px 0 0;
  }

  .monthly-rent { background: var(--dash-violet); }
  .monthly-sale { background: var(--dash-green); }

  .dashboard-trend-panel {
    min-height: 0;
    padding: 11px 16px 9px;
    overflow: hidden;
  }

  .dashboard-trend-panel .section-header { margin-bottom: 3px; }
  .dashboard-trend-panel .section-header h2 { font-size: 0.94rem; }
  .dashboard-trend-panel .section-note { font-size: 0.66rem; }

  .trend-legend {
    display: flex;
    color: #7c849d;
    font-size: 0.65rem;
    gap: 12px;
  }

  .trend-legend span { display: flex; align-items: center; gap: 5px; }
  .trend-legend i { width: 7px; height: 7px; border-radius: 50%; }
  .trend-rent { background: var(--dash-violet); }
  .trend-recover { background: var(--dash-coral); }
  .trend-sale { background: var(--dash-green); }

  .dashboard-trend-chart {
    display: grid;
    height: 82px;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-items: end;
    gap: 14px;
  }

  .trend-day {
    display: grid;
    height: 100%;
    grid-template-rows: minmax(0, 1fr) 16px;
    color: #7c849d;
    font-size: 0.62rem;
    text-align: center;
  }

  .trend-bars {
    display: flex;
    height: 100%;
    align-items: end;
    justify-content: center;
    border-bottom: 1px solid #e9ebf2;
    background: linear-gradient(to top, transparent 49%, #f1f2f6 50%, transparent 51%);
    gap: 5px;
  }

  .trend-bar {
    display: block;
    width: min(11px, 22%);
    height: var(--trend-height);
    min-height: 0;
    border-radius: 4px 4px 0 0;
  }
}

@media (min-width: 980px) and (max-height: 860px) {
  .dashboard-priority .todo-list-item:nth-child(n + 4) { display: none; }
}

@media (min-width: 980px) and (max-height: 720px) {
  .topbar { min-height: 76px; padding-top: 13px; }
  body[data-active-view="dashboard"] .content-shell { height: calc(100dvh - 76px); }
  .dashboard-workbench { grid-template-rows: minmax(0, 1fr) 132px; gap: 10px; }
  .dashboard-trend-chart { height: 68px; }
  .summary-primary { padding: 14px 20px; }
  .summary-primary strong { font-size: 2rem; }
  .dashboard-focus-column { gap: 6px; }
  .dashboard-focus-column .workbench-panel { padding-top: 8px; padding-bottom: 8px; }
  .dashboard-focus-column .section-note { display: none; }
  .dashboard-quick-panel .quick-card { min-height: 34px; }
  .dashboard-focus-column .dashboard-priority { padding-top: 4px; padding-bottom: 4px; }
  .dashboard-priority .section-header { margin-bottom: 4px; }
  .dashboard-priority .todo-desktop-list { gap: 4px; }
  .dashboard-priority .todo-list-item { min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
  .dashboard-status-panel .status-summary-item { min-height: 22px; }
}

/* 2026-08-18 usability pass: loading feedback, grouped availability, searchable workspaces and finance hierarchy. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dashboard-loading {
  display: flex;
  min-height: min(420px, calc(100dvh - 150px));
  align-items: center;
  justify-content: center;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow-md);
  text-align: left;
  gap: 18px;
}

.dashboard-loading strong { font-size: 1.05rem; }
.dashboard-loading p { margin: 5px 0 0; color: var(--muted); }
.dashboard-loading .primary-button { margin-top: 14px; }

.loading-spinner {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 3px solid color-mix(in srgb, var(--primary) 16%, var(--line));
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

.loading-error-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface-solid));
  font-weight: 900;
  place-items: center;
}

@keyframes loading-spin { to { transform: rotate(360deg); } }

.sync-data-button.is-syncing { opacity: 0.7; }
.demo-banner { font-size: 0.68rem; }
.demo-banner::after { content: none !important; }
.demo-banner.is-syncing .pulse-dot { animation: loading-pulse 0.8s ease-in-out infinite alternate; }
.demo-banner.is-sync-error { border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); color: var(--danger); }

@keyframes loading-pulse { to { opacity: 0.25; transform: scale(0.75); } }

.dashboard-range-switch {
  display: inline-flex;
  align-self: flex-start;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
  gap: 2px;
}

.dashboard-range-switch button {
  min-height: 25px;
  padding: 0 7px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.65rem;
  font-weight: 760;
}

.dashboard-range-switch button[aria-pressed="true"] {
  color: var(--primary);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}

.availability-brand-filters {
  width: 100%;
  margin: 14px 0 0;
}

.availability-brand-filter b,
.availability-brand-filters b { color: inherit; font: inherit; font-weight: 850; }
.availability-brand-section + .availability-brand-section { margin-top: 28px; }
.availability-brand-section .market-brand-heading { margin-bottom: 12px; }
.availability-mobile-brand + .availability-mobile-brand { margin-top: 20px; }
.availability-mobile-brand .market-brand-heading { margin-bottom: 10px; }

.todo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  gap: 12px;
}

.todo-toolbar .todo-filter-tabs { margin-bottom: 0; overflow-x: auto; }
.todo-filter-tabs button { display: inline-flex; align-items: center; white-space: nowrap; gap: 5px; }
.todo-filter-tabs button b {
  min-width: 18px;
  padding: 2px 5px;
  border-radius: 999px;
  color: inherit;
  background: color-mix(in srgb, currentColor 8%, transparent);
  font-size: 0.68rem;
}

.todo-search,
.customer-search {
  display: block;
  min-width: min(260px, 100%);
}

.todo-search input,
.customer-search input {
  width: 100%;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: var(--surface-solid);
}

.todo-search input:focus,
.customer-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

.customer-toolbar-actions { display: flex; align-items: center; gap: 10px; }

.finance-preset-tabs {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 12px;
  gap: 6px;
}

.finance-preset-tabs button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface-solid);
  font-size: 0.76rem;
  font-weight: 760;
}

.finance-preset-tabs button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--primary) 34%, var(--line));
  color: var(--primary);
  background: var(--primary-soft);
}

.finance-advanced { margin-top: 12px; border-top: 1px solid var(--line); }
.finance-advanced summary {
  width: max-content;
  padding: 11px 0 5px;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 760;
}
.finance-advanced-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding-top: 7px; gap: 10px; }

.finance-metric-card {
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  color: var(--text);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.finance-metric-card span,
.finance-metric-card strong { display: block; }
.finance-metric-card span { color: var(--muted); font-size: 0.74rem; }
.finance-metric-card span i { margin-left: 4px; font-style: normal; opacity: 0.7; }
.finance-metric-card strong { margin-top: 6px; color: var(--text-title); font-size: 1.12rem; }
.finance-metric-card.is-primary { border-color: color-mix(in srgb, var(--primary) 24%, var(--line)); background: color-mix(in srgb, var(--primary) 5%, var(--surface-solid)); }
.finance-metric-card.is-primary strong { font-size: 1.34rem; }
.finance-metric-card.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 10%, transparent); }

.finance-insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
  margin-bottom: var(--space-3);
  gap: var(--space-3);
}

.finance-trend-panel,
.finance-priority-panel { min-width: 0; padding: 16px; }
.finance-trend-chart {
  display: grid;
  height: 142px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 16px;
}
.finance-trend-month { display: grid; height: 100%; grid-template-rows: minmax(0, 1fr) 18px; color: var(--muted); font-size: 0.68rem; text-align: center; }
.finance-trend-bars { display: flex; height: 100%; align-items: end; justify-content: center; border-bottom: 1px solid var(--line); gap: 7px; }
.finance-trend-bars i { display: block; width: min(16px, 28%); height: var(--finance-height); border-radius: 5px 5px 0 0; }

.finance-priority-list { display: grid; gap: 7px; }
.finance-priority-item {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warning);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface-solid);
  text-align: left;
  gap: 10px;
}
.finance-priority-item.is-overdue { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 4%, var(--surface-solid)); }
.finance-priority-item span { display: grid; min-width: 0; gap: 2px; }
.finance-priority-item strong { overflow: hidden; font-size: 0.76rem; text-overflow: ellipsis; white-space: nowrap; }
.finance-priority-item small { color: var(--muted); font-size: 0.68rem; }
.finance-priority-item b { color: var(--danger); font-size: 0.8rem; white-space: nowrap; }

.finance-ledger { margin-top: 0; }

@media (min-width: 980px) {
  .summary-primary { position: relative; padding-bottom: 44px; }
  .dashboard-range-switch { position: absolute; bottom: 12px; left: 20px; }

  .customer-workspace {
    height: calc(100dvh - 220px);
    min-height: 420px;
    align-items: stretch;
  }
  .customer-directory {
    position: static;
    display: flex;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
  }
  .customer-directory > .section-header { flex: 0 0 auto; }
  .customer-directory-list {
    min-height: 0;
    overflow-y: auto;
    padding-right: 5px;
    scrollbar-gutter: stable;
  }
  .customer-business-panel {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
  }
  .customer-profile-summary {
    position: sticky;
    z-index: 2;
    top: calc(var(--space-4) * -1);
    padding-top: var(--space-4);
    background: var(--surface-solid);
  }

  .finance-filters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .finance-search-field { grid-column: span 2; }
  .finance-metrics { grid-template-columns: 1.35fr repeat(5, minmax(0, 1fr)); }
  .finance-table-wrap { max-height: 480px; overflow: auto; scrollbar-gutter: stable; }
}

@media (min-width: 980px) and (max-width: 1180px) {
  .todo-toolbar { align-items: stretch; flex-direction: column; }
  .todo-search { width: 100%; }
  .finance-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .finance-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .finance-insight-grid { grid-template-columns: 1fr; }
}

@media (max-width: 979px) {
  .bottom-nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .sync-data-button { min-width: 58px; }
  .demo-banner { font-size: 0.72rem; }
  .dashboard-range-switch { margin-top: 10px; }
  .availability-brand-filters { overflow-x: auto; flex-wrap: nowrap; }
  .todo-search,
  .customer-search { width: 100%; margin-bottom: 12px; }
  .finance-filters,
  .finance-advanced-grid { grid-template-columns: 1fr; }
  .finance-filter-panel .section-header { align-items: flex-start; flex-direction: column; }
  .finance-filter-panel .section-header-actions {
    display: grid;
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  }
  .finance-filter-panel .section-header-actions > * { min-width: 0; }
  .finance-filter-panel .section-header-actions .secondary-button { padding: 0 7px; font-size: 0.7rem; white-space: nowrap; }
  .finance-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-metric-card.is-primary { grid-column: 1 / -1; }
}

/* 2026-08-18 dashboard workflow: tasks first, full-width work areas, existing theme colors. */
.dashboard-v2 {
  display: grid;
  padding-bottom: 28px;
  gap: 18px;
}

.dashboard-v2 .workbench-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.dashboard-v2 .section-header {
  align-items: center;
  margin-bottom: 14px;
}

.dashboard-v2 .section-header h2 {
  font-size: 1.08rem;
}

.dashboard-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--primary);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.dashboard-priority-wide {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-color: color-mix(in srgb, var(--primary) 20%, var(--line)) !important;
}

.dashboard-priority-wide::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  content: "";
}

.dashboard-priority-wide .section-note {
  color: color-mix(in srgb, var(--danger) 76%, var(--muted));
  font-weight: 720;
}

.dashboard-priority-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.dashboard-priority-grid .todo-list-item {
  display: grid;
  min-width: 0;
  min-height: 68px;
  grid-template-columns: 82px minmax(0, 1fr) 74px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  box-shadow: none;
  gap: 10px;
}

.dashboard-priority-grid .todo-list-item[data-kind="return"],
.dashboard-priority-grid .todo-list-item[data-kind="finance"] {
  border-left-color: var(--danger);
}

.dashboard-priority-grid .todo-list-item[data-kind="follow-up"] {
  border-left-color: var(--primary);
}

.dashboard-priority-grid .todo-list-item.is-overdue {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
  border-left-color: var(--danger);
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 6%, var(--surface-solid));
}

.dashboard-priority-grid .todo-type {
  display: grid;
  margin: 0;
  color: inherit;
  gap: 2px;
}

.dashboard-priority-grid .todo-type span {
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-priority-grid .todo-type small {
  color: inherit;
  font-size: 0.64rem;
  opacity: 0.7;
}

.dashboard-priority-grid .todo-main {
  min-width: 0;
}

.dashboard-priority-grid .todo-title {
  overflow: hidden;
  color: inherit;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-priority-grid .todo-detail {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-priority-grid .todo-list-item.is-overdue .todo-detail {
  color: color-mix(in srgb, var(--danger) 70%, var(--muted));
}

.dashboard-priority-grid .todo-date {
  display: none;
}

.dashboard-priority-grid .todo-action .card-action {
  width: 100%;
  min-height: 32px;
  padding: 0 7px;
  border-radius: var(--radius-sm);
  font-size: 0.67rem;
}

.dashboard-priority-grid > .empty-state {
  grid-column: 1 / -1;
}

.dashboard-core-section {
  min-width: 0;
}

.dashboard-core-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-core-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 132px;
  grid-template-columns: minmax(0, 1fr) 36px;
  grid-template-rows: auto 1fr auto;
  padding: 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-small);
  gap: 5px 10px;
}

.dashboard-core-card::after {
  position: absolute;
  right: -28px;
  bottom: -42px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--tone-soft);
  content: "";
  opacity: 0.56;
}

.dashboard-core-icon {
  display: grid;
  width: 36px;
  height: 36px;
  grid-column: 2;
  grid-row: 1 / 3;
  border-radius: var(--radius-sm);
  color: var(--tone);
  background: var(--tone-soft);
  place-items: center;
}

.dashboard-core-icon .ui-icon {
  width: 18px;
  height: 18px;
}

.dashboard-core-label {
  align-self: center;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 720;
}

.dashboard-core-card strong {
  align-self: end;
  overflow: hidden;
  font-size: clamp(1.28rem, 2vw, 1.7rem);
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-core-card small {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-core-card.is-risk {
  border-color: color-mix(in srgb, var(--danger) 23%, var(--line));
  background: color-mix(in srgb, var(--danger) 5%, var(--surface));
}

.dashboard-core-card.is-risk strong {
  color: var(--danger);
}

.dashboard-quick-wide,
.dashboard-status-wide {
  padding: 17px;
}

.dashboard-quick-wide .quick-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-quick-wide .quick-card {
  display: grid;
  min-height: 72px;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  text-align: left;
  gap: 11px;
}

.dashboard-quick-wide .quick-card strong {
  width: 40px;
  height: 40px;
  margin: 0;
  border-radius: var(--radius-sm);
  color: var(--quick-tone, var(--primary));
  background: var(--quick-soft, var(--primary-soft));
}

.dashboard-quick-wide .quick-card span {
  font-size: 0.82rem;
}

.dashboard-charts {
  padding: 0;
  overflow: hidden;
}

.dashboard-charts > summary {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 17px;
  cursor: pointer;
  list-style: none;
  gap: 14px;
}

.dashboard-charts > summary::-webkit-details-marker {
  display: none;
}

.dashboard-charts > summary > span {
  display: grid;
}

.dashboard-charts > summary strong {
  font-size: 1.08rem;
}

.dashboard-charts > summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.dashboard-charts > summary b {
  display: flex;
  align-items: center;
  color: var(--primary);
  font-size: 0.74rem;
  gap: 5px;
}

.dashboard-charts > summary .ui-icon {
  width: 16px;
  height: 16px;
  transform: rotate(180deg);
  transition: transform 160ms ease;
}

.dashboard-charts:not([open]) > summary .ui-icon {
  transform: none;
}

.dashboard-charts .charts-closed-label {
  display: none;
}

.dashboard-charts:not([open]) .charts-open-label {
  display: none;
}

.dashboard-charts:not([open]) .charts-closed-label {
  display: inline;
}

.dashboard-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 12px 12px;
  gap: 10px;
}

.dashboard-chart-card {
  min-width: 0;
  min-height: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.dashboard-chart-card .section-header {
  margin-bottom: 4px;
}

.dashboard-chart-card .section-header h2 {
  font-size: 0.9rem;
}

.dashboard-chart-card .section-note,
.dashboard-chart-card .trend-legend {
  font-size: 0.64rem;
}

.dashboard-chart-card .dashboard-monthly-chart,
.dashboard-chart-card .dashboard-trend-chart {
  display: grid;
  height: 118px;
  align-items: end;
  gap: 12px;
}

.dashboard-chart-card .dashboard-monthly-chart {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.dashboard-chart-card .dashboard-trend-chart {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.dashboard-chart-card .monthly-day,
.dashboard-chart-card .trend-day {
  display: grid;
  height: 100%;
  grid-template-rows: minmax(0, 1fr) 17px;
  color: var(--muted);
  font-size: 0.61rem;
  text-align: center;
}

.dashboard-chart-card .monthly-bars,
.dashboard-chart-card .trend-bars {
  display: flex;
  height: 100%;
  align-items: end;
  justify-content: center;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(to top, transparent 49%, color-mix(in srgb, var(--line) 60%, transparent) 50%, transparent 51%);
  gap: 5px;
}

.dashboard-chart-card .monthly-bar,
.dashboard-chart-card .trend-bar {
  display: block;
  min-height: 0;
  border-radius: 4px 4px 0 0;
}

.dashboard-chart-card .monthly-bar {
  width: min(13px, 28%);
  height: var(--monthly-height);
}

.dashboard-chart-card .trend-bar {
  width: min(10px, 22%);
  height: var(--trend-height);
}

.dashboard-status-wide .status-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.dashboard-status-wide .status-summary-item {
  min-height: 48px;
  border-right: 1px solid var(--line);
  border-radius: 0;
}

.dashboard-status-wide .status-summary-item:last-child {
  border-right: 0;
}

.dashboard-more-intro {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.dashboard-more-grid {
  display: grid;
  gap: 9px;
}

.dashboard-more-grid article {
  display: grid;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  gap: 4px;
}

.dashboard-more-grid article span,
.dashboard-more-grid article small {
  color: var(--muted);
  font-size: 0.72rem;
}

.dashboard-more-grid article strong {
  font-size: 1.16rem;
}

@media (min-width: 980px) {
  body[data-active-view="dashboard"] {
    overflow: auto;
  }

  body[data-active-view="dashboard"] .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  body[data-active-view="dashboard"] .content-shell,
  body[data-active-view="dashboard"] #view-dashboard {
    height: auto;
    overflow: visible;
  }
}

@media (max-width: 1100px) and (min-width: 980px) {
  .dashboard-priority-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-core-grid,
  .dashboard-quick-wide .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 979px) {
  .dashboard-v2 {
    gap: 16px;
  }

  .dashboard-priority-wide,
  .dashboard-quick-wide,
  .dashboard-status-wide {
    padding: 15px;
  }

  .dashboard-priority-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-core-grid,
  .dashboard-quick-wide .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .dashboard-chart-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-status-wide .status-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-status-wide .status-summary-item:nth-child(2) {
    border-right: 0;
  }
}

@media (max-width: 560px) {
  .dashboard-v2 {
    gap: 14px;
  }

  .dashboard-priority-wide,
  .dashboard-quick-wide,
  .dashboard-status-wide {
    padding: 13px;
  }

  .dashboard-priority-grid .todo-list-item {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 8px;
  }

  .dashboard-priority-grid .todo-action {
    grid-column: 2;
  }

  .dashboard-priority-grid .todo-action .card-action {
    min-height: 30px;
  }

  .dashboard-core-grid {
    gap: 8px;
  }

  .dashboard-core-card {
    min-height: 120px;
    grid-template-columns: minmax(0, 1fr) 30px;
    padding: 13px 11px;
  }

  .dashboard-core-icon {
    width: 30px;
    height: 30px;
  }

  .dashboard-core-card strong {
    font-size: clamp(1.04rem, 5.2vw, 1.28rem);
  }

  .dashboard-core-card small {
    font-size: 0.61rem;
  }

  .dashboard-quick-wide .quick-card {
    min-height: 64px;
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 9px;
    gap: 8px;
  }

  .dashboard-quick-wide .quick-card strong {
    width: 34px;
    height: 34px;
  }

  .dashboard-charts > summary {
    min-height: 60px;
    padding: 12px 13px;
  }

  .dashboard-charts > summary small {
    display: none;
  }

  .dashboard-chart-grid {
    padding: 0 8px 8px;
    gap: 8px;
  }

  .dashboard-chart-card {
    min-height: 175px;
    padding: 11px;
  }

  .dashboard-chart-card .trend-legend {
    gap: 7px;
  }

  .dashboard-status-wide .status-summary-item {
    min-height: 43px;
  }
}

/* Reference-approved dashboard composition: 70/30 summary and priority rail. */
.side-brand > span:last-child {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.side-brand > span:last-child small {
  color: var(--muted);
  font-size: 0.66rem;
}

.dashboard-hero-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 7fr) minmax(340px, 3fr);
  align-items: stretch;
  gap: 14px;
}

.dashboard-hero-grid .dashboard-core-section {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.dashboard-hero-grid .dashboard-core-grid {
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-hero-grid .dashboard-core-card {
  min-height: 136px;
}

.dashboard-priority-side {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 18px;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--primary) 72%, var(--line)) !important;
  color: var(--on-primary, #ffffff) !important;
  background: linear-gradient(145deg, var(--primary-strong), var(--primary)) !important;
  box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 22%, transparent) !important;
}

.dashboard-priority-side .section-header {
  align-items: flex-start;
  margin-bottom: 7px;
}

.dashboard-priority-side .dashboard-kicker,
.dashboard-priority-side .section-note {
  color: color-mix(in srgb, var(--on-primary, #ffffff) 68%, transparent);
}

.dashboard-priority-side .section-header h2 {
  color: var(--on-primary, #ffffff);
  font-size: 1.18rem;
}

.dashboard-task-count {
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid color-mix(in srgb, var(--on-primary, #ffffff) 22%, transparent);
  border-radius: 999px;
  color: var(--on-primary, #ffffff);
  background: color-mix(in srgb, var(--on-primary, #ffffff) 9%, transparent);
  font-size: 0.67rem;
  font-weight: 780;
}

.dashboard-priority-side .dashboard-priority-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: 1fr;
  flex: 1;
  gap: 0;
}

.dashboard-priority-side .dashboard-priority-grid .todo-list-item {
  min-height: 57px;
  grid-template-columns: 72px minmax(0, 1fr) 66px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--on-primary, #ffffff) 13%, transparent);
  border-radius: 0;
  color: var(--on-primary, #ffffff);
  background: transparent;
  gap: 8px;
}

.dashboard-priority-side .dashboard-priority-grid .todo-list-item.is-overdue {
  border-bottom-color: color-mix(in srgb, var(--on-primary, #ffffff) 13%, transparent);
  color: #ffd1d1;
  background: transparent;
}

.dashboard-priority-side .todo-type span {
  color: inherit;
  font-size: 0.68rem;
}

.dashboard-priority-side .todo-type small,
.dashboard-priority-side .todo-detail {
  color: color-mix(in srgb, currentColor 67%, transparent);
}

.dashboard-priority-side .todo-title {
  color: inherit;
  font-size: 0.73rem;
}

.dashboard-priority-side .todo-action .card-action {
  min-height: 29px;
  padding: 0 5px;
  border-color: color-mix(in srgb, var(--on-primary, #ffffff) 24%, transparent);
  color: var(--on-primary, #ffffff);
  background: color-mix(in srgb, var(--on-primary, #ffffff) 9%, transparent);
  box-shadow: none;
  font-size: 0.63rem;
}

.dashboard-priority-all {
  display: flex;
  min-height: 35px;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  border: 1px solid color-mix(in srgb, var(--on-primary, #ffffff) 22%, transparent);
  border-radius: var(--radius-sm);
  color: var(--on-primary, #ffffff);
  background: color-mix(in srgb, var(--on-primary, #ffffff) 8%, transparent);
  font-size: 0.68rem;
  font-weight: 780;
  gap: 7px;
}

.dashboard-priority-all:hover {
  background: color-mix(in srgb, var(--on-primary, #ffffff) 14%, transparent);
}

.dashboard-priority-all .ui-icon {
  width: 14px;
  height: 14px;
  transform: rotate(-90deg);
}

@media (max-width: 1180px) and (min-width: 980px) {
  .dashboard-hero-grid {
    grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.85fr);
  }

  .dashboard-priority-side {
    padding: 14px;
  }

  .dashboard-priority-side .dashboard-priority-grid .todo-list-item {
    grid-template-columns: 66px minmax(0, 1fr) 61px;
    gap: 6px;
  }
}

@media (max-width: 979px) {
  .dashboard-hero-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-priority-side {
    order: -1;
    min-height: 0;
  }

  .dashboard-hero-grid .dashboard-core-card {
    min-height: 126px;
  }
}

@media (max-width: 560px) {
  .dashboard-priority-side {
    padding: 14px;
  }

  .dashboard-priority-side .dashboard-priority-grid .todo-list-item {
    grid-template-columns: 70px minmax(0, 1fr);
    padding: 10px 0;
  }

  .dashboard-priority-side .todo-action {
    grid-column: 2;
  }

  .dashboard-priority-side .todo-action .card-action {
    width: 100%;
  }
}

/* Full-width desktop workspace: remove the shared 1320px cap on every feature page. */
@media (min-width: 980px) {
  .topbar,
  .content-shell {
    width: calc(100% - 40px);
    max-width: none;
  }
}

/* Priority card: light surface with restrained semantic color accents. */
.dashboard-priority-side {
  border-color: var(--line) !important;
  color: var(--text) !important;
  background: var(--surface-solid) !important;
  box-shadow: 0 4px 16px rgba(37, 42, 61, 0.055) !important;
}

.dashboard-priority-side .dashboard-kicker,
.dashboard-priority-side .section-header h2 {
  color: var(--primary);
}

.dashboard-priority-side .section-note {
  color: var(--muted);
  font-weight: 600;
}

.dashboard-priority-side .dashboard-task-count {
  border-color: color-mix(in srgb, var(--primary) 18%, var(--line));
  color: var(--primary);
  background: var(--primary-light);
}

.dashboard-priority-side .dashboard-priority-grid {
  gap: 6px;
}

.dashboard-priority-side .dashboard-priority-grid .todo-list-item {
  min-height: 55px;
  padding: 8px;
  border: 1px solid var(--line);
  border-left: 2px solid color-mix(in srgb, var(--primary) 48%, var(--line));
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-solid);
}

.dashboard-priority-side .dashboard-priority-grid .todo-list-item[data-kind="return"],
.dashboard-priority-side .dashboard-priority-grid .todo-list-item[data-kind="finance"],
.dashboard-priority-side .dashboard-priority-grid .todo-list-item[data-kind="find-device"] {
  border-left-color: var(--primary);
}

.dashboard-priority-side .dashboard-priority-grid .todo-list-item.is-overdue {
  border-color: color-mix(in srgb, var(--danger) 24%, var(--line));
  border-left-color: var(--danger);
  color: var(--text);
  background: color-mix(in srgb, var(--danger) 3%, var(--surface-solid));
}

.dashboard-priority-side .todo-type span {
  color: var(--primary);
  font-weight: 800;
}

.dashboard-priority-side .todo-type small {
  width: fit-content;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-muted);
  font-weight: 700;
  opacity: 1;
}

.dashboard-priority-side .todo-list-item.is-overdue .todo-type small {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 9%, var(--surface-solid));
}

.dashboard-priority-side .todo-title {
  color: var(--text-title);
}

.dashboard-priority-side .todo-detail,
.dashboard-priority-side .todo-list-item.is-overdue .todo-detail {
  color: var(--muted);
}

.dashboard-priority-side .todo-action .card-action {
  border-color: color-mix(in srgb, var(--primary) 18%, var(--line));
  color: var(--primary-text);
  background: var(--primary-light);
  box-shadow: none;
}

.dashboard-priority-side .todo-list-item[data-kind="follow-up"] .todo-action .card-action {
  border-color: var(--line);
  color: var(--muted);
  background: var(--surface-muted);
}

.dashboard-priority-side .dashboard-priority-all {
  border-color: color-mix(in srgb, var(--primary) 20%, var(--line));
  color: var(--primary);
  background: var(--primary-light);
}

.dashboard-priority-side .dashboard-priority-all:hover {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface-solid));
}

.dashboard-priority-side {
  background: var(--primary-light) !important;
}

.dashboard-priority-side .todo-action .card-action {
  border-color: color-mix(in srgb, var(--primary) 32%, var(--line));
  color: var(--primary-hover);
  background: color-mix(in srgb, var(--primary) 18%, var(--surface-solid));
}

.dashboard-priority-side .todo-list-item[data-kind="follow-up"] .todo-action .card-action {
  border-color: var(--line);
  color: var(--muted);
  background: var(--surface-muted);
}

.dashboard-priority-side .dashboard-priority-all {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
  color: var(--primary-hover);
  background: color-mix(in srgb, var(--primary) 16%, var(--surface-solid));
}

.dashboard-priority-side .dashboard-priority-all:hover {
  background: color-mix(in srgb, var(--primary) 22%, var(--surface-solid));
}

@media (min-width: 980px) {
  .demo-banner {
    bottom: 174px;
  }
}

/* Todo workspace: compact cards replace long desktop rows. */
.todo-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  align-items: stretch;
  gap: 12px;
}

.todo-card-grid > .empty-state {
  grid-column: 1 / -1;
}

.todo-work-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 168px;
  flex-direction: column;
  padding: 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 3px solid var(--todo-color, var(--primary));
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}

.todo-work-card.is-overdue {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
  border-top-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 4%, var(--surface-solid));
}

.todo-work-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.todo-work-type {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.todo-work-type span,
.todo-work-type small {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 0.68rem;
  font-weight: 780;
  line-height: 1.2;
}

.todo-work-type span {
  color: var(--todo-color, var(--primary));
  background: color-mix(in srgb, var(--todo-color, var(--primary)) 9%, var(--surface-solid));
}

.todo-work-type small {
  color: var(--muted);
  background: var(--surface-muted);
}

.todo-work-card.is-overdue .todo-work-type small {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface-solid));
}

.todo-work-card time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.todo-work-card.is-overdue time {
  color: var(--danger);
}

.todo-work-main {
  min-width: 0;
  margin: 17px 0 14px;
}

.todo-work-main h3 {
  overflow: hidden;
  color: var(--text-title);
  font-size: 0.94rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-work-main p {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.todo-work-card footer {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.todo-work-card .todo-action-button {
  min-width: 96px;
  min-height: 34px;
  border-color: color-mix(in srgb, var(--todo-action-color, var(--primary)) 24%, var(--line));
  border-radius: var(--radius-sm);
  color: var(--todo-action-color, var(--primary));
  background: color-mix(in srgb, var(--todo-action-color, var(--primary)) 9%, var(--surface-solid));
  box-shadow: none;
  font-size: 0.72rem;
  font-weight: 780;
}

.todo-work-card .todo-action-button:hover {
  background: color-mix(in srgb, var(--todo-action-color, var(--primary)) 15%, var(--surface-solid));
}

@media (min-width: 980px) and (max-width: 1180px) {
  .todo-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Type filters inherit semantic colors: muted at rest, vivid when selected. */
.todo-filter-tabs button {
  color: var(--muted);
  transition: color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.todo-filter-tabs button b {
  color: color-mix(in srgb, var(--filter-color, var(--primary)) 40%, var(--muted));
  background: color-mix(in srgb, var(--filter-color, var(--primary)) 7%, var(--surface-muted));
  transition: color 140ms ease, background 140ms ease;
}

.todo-filter-tabs button[aria-pressed="true"] {
  color: var(--filter-color, var(--primary));
  background: color-mix(in srgb, var(--filter-color, var(--primary)) 10%, var(--surface-solid));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--filter-color, var(--primary)) 18%, var(--line)), var(--shadow-sm);
}

.todo-filter-tabs button[aria-pressed="true"] b {
  color: var(--on-primary, #ffffff);
  background: var(--filter-color, var(--primary));
}

.todo-filter-tabs button:not([aria-pressed="true"]):hover {
  color: color-mix(in srgb, var(--filter-color, var(--primary)) 56%, var(--muted));
  background: color-mix(in srgb, var(--filter-color, var(--primary)) 5%, transparent);
}
