:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-soft: #f7faff;
  --line: #dfe7f2;
  --text: #18243a;
  --muted: #667085;
  --blue: #246bfe;
  --green: #22a66a;
  --orange: #f97316;
  --pink: #e94d86;
  --purple: #7255e8;
  --red: #e65050;
  --shadow: 0 14px 38px rgba(25, 42, 70, 0.08);
  --shadow-soft: 0 6px 20px rgba(25, 42, 70, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, #f8fbff 0, var(--bg) 220px),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(47, 124, 246, 0.12), rgba(48, 191, 100, 0.1)),
    var(--bg);
}

.login-panel {
  width: min(440px, 100%);
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.login-panel p {
  margin: 0 0 24px;
  color: var(--muted);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  transition: grid-template-columns 0.18s ease;
}

.app-shell.record-shell {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 12px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f7faff 52%, #f1f6fd 100%);
  color: var(--text);
  border-right: 1px solid rgba(216, 226, 240, 0.9);
  box-shadow: 10px 0 30px rgba(25, 42, 70, 0.06);
  overflow: hidden;
}

.brand {
  margin: 2px 2px 18px;
  padding: 12px 10px;
  border: 1px solid rgba(216, 226, 240, 0.88);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-row > span {
  min-width: 0;
}

.brand-title {
  color: #111827;
  letter-spacing: 0;
  font-size: 16px;
  font-weight: 800;
}

.brand-sub {
  margin-top: 4px;
  color: #7a8aa0;
  font-size: 12px;
}

.sidebar-toggle {
  width: 32px;
  min-width: 32px;
  height: 32px;
  border: 1px solid rgba(216, 226, 240, 0.95);
  border-radius: 10px;
  color: #3b82f6;
  background: #f6f9ff;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(25, 42, 70, 0.06);
}

.sidebar-toggle:hover {
  background: #eaf2ff;
  border-color: rgba(36, 107, 254, 0.24);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-section {
  display: grid;
  gap: 4px;
}

.nav-section-label {
  margin: 0 10px 2px;
  color: #8b9ab0;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.nav button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 13px;
  text-align: left;
  color: #52637a;
  background: transparent;
  font-weight: 750;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav button.active,
.nav button:hover {
  color: #1d4ed8;
  border-color: rgba(36, 107, 254, 0.12);
  background: rgba(36, 107, 254, 0.07);
}

.nav button:hover {
  transform: translateX(2px);
}

.nav button.active {
  color: #155eef;
  border-color: rgba(36, 107, 254, 0.2);
  background: #eaf2ff;
  box-shadow: inset 3px 0 0 var(--blue), 0 10px 22px rgba(36, 107, 254, 0.08);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar-collapsed .sidebar {
  padding: 14px 9px;
}

.sidebar-collapsed .brand {
  margin: 2px 0 14px;
  padding: 9px 8px;
}

.sidebar-collapsed .brand-row {
  justify-content: center;
  align-items: center;
}

.sidebar-collapsed .brand-row > span,
.sidebar-collapsed .nav button span {
  display: none;
}

.sidebar-collapsed .nav {
  gap: 8px;
}

.sidebar-collapsed .nav-section {
  gap: 6px;
}

.sidebar-collapsed .nav-section-label {
  display: none;
}

.sidebar-collapsed .nav button {
  justify-content: center;
  min-height: 40px;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 850;
}

.sidebar-collapsed .nav button::before {
  content: attr(data-short);
}

.sidebar-collapsed .nav button.active {
  box-shadow: inset 0 -3px 0 var(--blue), 0 10px 22px rgba(36, 107, 254, 0.08);
}

.main {
  min-width: 0;
  padding: 24px 26px 36px;
}

.record-shell .main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 14px 20px 12px;
}

.app-shell.record-shell.table-settings-open {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

.table-settings-open .record-main,
.table-settings-open .record-workspace {
  height: auto;
  min-height: 0;
  overflow: visible;
}

.table-settings-open .record-table-panel {
  flex: 0 0 auto;
  overflow: visible;
}

.table-settings-open .record-table-panel .smart-table-wrap {
  flex: 0 0 auto;
  height: auto;
  max-height: 68vh;
}

.global-header {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin: -24px -26px 20px;
  padding: 14px 26px;
  border-bottom: 1px solid rgba(223, 231, 242, 0.72);
  background: rgba(248, 251, 255, 0.88);
  backdrop-filter: blur(12px);
}

.global-header-info {
  min-width: 0;
}

.global-header-info h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: 0;
}

.global-header-actions {
  align-items: center;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.module-actions,
.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-actions .btn,
.account-actions .role-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 64px;
  min-height: 38px;
  padding: 0 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.record-shell .global-header {
  position: static;
  flex: 0 0 auto;
  margin: -14px -20px 8px;
  padding: 11px 20px 8px;
}

.record-shell .global-header-info h1 {
  font-size: 22px;
}

.role-pill {
  padding: 6px 10px;
  border-radius: 999px;
  color: #1d4ed8;
  background: #eaf1ff;
  font-size: 13px;
  font-weight: 700;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid rgba(214, 226, 242, 0.95);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.92));
  box-shadow: 0 12px 28px rgba(31, 47, 70, 0.07);
}

.filters .date-picker-input,
.filters input[type="month"] {
  color-scheme: light;
  font-variant-numeric: tabular-nums;
  background: #fff;
}

.filters .field:has(.date-picker-input) .input,
.filters .field:has(input[type="month"]) .input {
  border-color: #cfddf1;
  border-radius: 8px;
}

.filters .field:has(.date-picker-input) .input:hover,
.filters .field:has(input[type="month"]) .input:hover {
  border-color: rgba(47, 124, 246, 0.45);
}

.date-preset-field {
  grid-column: span 2;
  min-width: 300px;
}

.date-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
  gap: 6px;
}

.record-month-panel {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 7px 12px;
  margin: 0 0 9px;
  padding: 8px 10px;
  border: 1px solid rgba(221, 231, 244, 0.92);
  border-radius: 10px;
  background: #fff;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.record-workspace {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.record-fixed-area {
  flex: 0 0 auto;
  display: grid;
  gap: 9px;
  min-width: 0;
  z-index: 3;
}

.record-toolbar {
  grid-template-columns: minmax(290px, 0.85fr) minmax(360px, 1.25fr) minmax(200px, 0.62fr) minmax(150px, auto);
  align-items: stretch;
  gap: 8px;
}

.record-fixed-area .quick-search-panel,
.record-fixed-area .record-month-panel,
.record-fixed-area .create-panel {
  margin-bottom: 0;
}

.record-toolbar .quick-search-panel,
.record-toolbar .record-month-panel,
.record-toolbar .record-create-panel {
  margin-top: 0;
}

.record-toolbar .quick-search-panel {
  min-width: 0;
  padding: 7px 9px;
  gap: 9px;
  border-radius: 10px;
  box-shadow: none;
}

.record-toolbar .quick-search-title {
  flex: 0 0 96px;
}

.record-toolbar .quick-search-title strong {
  font-size: 13px;
}

.record-toolbar .quick-search-title span {
  font-size: 11px;
  white-space: nowrap;
}

.record-toolbar .quick-search-box {
  height: 36px;
  width: 100%;
  border-radius: 10px;
}

.record-toolbar .record-month-panel {
  min-width: 0;
  height: 52px;
  padding: 6px 8px;
  border-radius: 10px;
  box-shadow: none;
}

.record-toolbar .record-month-head {
  min-height: 27px;
}

.record-date-presets {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 52px;
  padding: 6px 8px;
  border: 1px solid rgba(221, 231, 244, 0.92);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}

.record-date-presets strong {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.record-date-preset-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  flex: 1 1 auto;
  min-width: 0;
}

.record-date-preset {
  min-width: 0;
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid rgba(201, 216, 236, 0.95);
  border-radius: 8px;
  color: #31506f;
  background: #fff;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.record-date-preset:hover,
.record-date-preset.active {
  border-color: rgba(47, 124, 246, 0.48);
  color: #155eef;
  background: #edf4ff;
}

.record-toolbar .record-create-panel {
  min-width: 150px;
  align-self: stretch;
  box-shadow: none;
}

.record-toolbar .record-create-panel summary {
  min-height: 52px;
  padding: 8px 10px;
}

.record-toolbar .record-create-panel summary span {
  gap: 1px;
}

.record-toolbar .record-create-panel summary strong {
  font-size: 13px;
  white-space: nowrap;
}

.record-toolbar .record-create-panel summary em {
  display: none;
}

.record-toolbar .record-create-panel summary b {
  min-height: 27px;
  padding: 3px 9px;
  white-space: nowrap;
}

.record-toolbar .record-create-panel[open] {
  grid-column: 1 / -1;
}

.record-toolbar .record-create-panel[open] summary {
  min-height: 46px;
}

.record-toolbar .record-create-panel[open] summary em {
  display: block;
}

.record-table-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px;
  overflow: hidden;
}

.record-table-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}

.record-table-panel h2 {
  flex: 0 0 auto;
  margin: 0;
  font-size: 15px;
}

.record-table-panel .smart-table-toolbar-wrap {
  flex: 0 0 auto;
  margin: 0 0 8px;
}

.record-table-panel .smart-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}

.record-table-panel .smart-table th {
  top: 0;
  z-index: 4;
}

.record-table-panel .smart-table th,
.record-table-panel .smart-table td {
  padding-left: 7px;
  padding-right: 7px;
}

.record-table-panel .th-button {
  min-height: 34px;
  gap: 4px;
  padding: 7px 7px;
}

.record-table-panel .smart-th {
  min-width: 88px;
}

.record-table-panel .smart-th.col-customer_no,
.record-table-panel .smart-table .col-customer_no {
  min-width: 82px;
  width: 90px;
  max-width: 96px;
}

.record-table-panel .smart-table td.col-customer_no,
.smart-table td.col-customer_no,
.smart-table td.col-id {
  overflow: visible;
  text-overflow: clip;
}

.smart-table .link-cell-btn {
  min-height: 30px;
  min-width: 70px;
  max-width: 100%;
  padding: 5px 9px;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  white-space: nowrap;
}

.record-table-panel .smart-th.col-name,
.record-table-panel .smart-table .col-name {
  min-width: 78px;
  width: 90px;
  max-width: 104px;
}

.record-table-panel .smart-th.col-phone,
.record-table-panel .smart-table .col-phone {
  min-width: 112px;
  width: 124px;
  max-width: 134px;
}

.record-table-panel .phone-cell {
  gap: 4px;
}

.record-table-panel .phone-cell > span {
  min-width: 64px;
}

.record-table-panel .smart-th.col-gender,
.record-table-panel .smart-table .col-gender {
  min-width: 52px;
  width: 58px;
  max-width: 64px;
}

.record-table-panel .smart-th.col-age,
.record-table-panel .smart-table .col-age {
  min-width: 58px;
  width: 66px;
  max-width: 76px;
  text-align: center;
}

.record-table-panel .smart-th.col-lead_date,
.record-table-panel .smart-th.col-consult_date,
.record-table-panel .smart-th.col-first_consult_date,
.record-table-panel .smart-table .col-lead_date,
.record-table-panel .smart-table .col-consult_date,
.record-table-panel .smart-table .col-first_consult_date {
  min-width: 94px;
  width: 102px;
  max-width: 112px;
}

.record-table-panel .smart-th.col-first_consult_month,
.record-table-panel .smart-table .col-first_consult_month {
  min-width: 86px;
  width: 96px;
  max-width: 106px;
}

.record-table-panel .smart-th.col-channel,
.record-table-panel .smart-table .col-channel {
  min-width: 82px;
  width: 96px;
  max-width: 112px;
}

.record-table-panel .smart-th.col-assistant,
.record-table-panel .smart-th.col-consultant,
.record-table-panel .smart-table .col-assistant,
.record-table-panel .smart-table .col-consultant {
  min-width: 80px;
  width: 92px;
  max-width: 108px;
}

.record-table-panel .smart-th.col-is_valid,
.record-table-panel .smart-th.col-arrived,
.record-table-panel .smart-th.col-is_signed,
.record-table-panel .smart-table .col-is_valid,
.record-table-panel .smart-table .col-arrived,
.record-table-panel .smart-table .col-is_signed {
  min-width: 62px;
  width: 70px;
  max-width: 78px;
}

.record-table-panel .smart-th.col-direction,
.record-table-panel .smart-table .col-direction,
.record-table-panel .smart-th.col-customer_type,
.record-table-panel .smart-table .col-customer_type,
.record-table-panel .smart-th.col-consult_status,
.record-table-panel .smart-table .col-consult_status,
.record-table-panel .smart-th.col-payment_method,
.record-table-panel .smart-table .col-payment_method {
  min-width: 84px;
  width: 98px;
  max-width: 118px;
}

.record-table-panel .smart-th.col-specific_issues,
.record-table-panel .smart-table .col-specific_issues {
  min-width: 118px;
  width: 148px;
  max-width: 178px;
}

.record-table-panel .smart-th.col-first_price,
.record-table-panel .smart-th.col-next_price,
.record-table-panel .smart-th.col-renewal_price,
.record-table-panel .smart-th.col-paid_today,
.record-table-panel .smart-th.col-accounting_amount,
.record-table-panel .smart-th.col-total_sessions,
.record-table-panel .smart-th.col-consumed_sessions,
.record-table-panel .smart-th.col-remaining_sessions,
.record-table-panel .smart-table .col-first_price,
.record-table-panel .smart-table .col-next_price,
.record-table-panel .smart-table .col-renewal_price,
.record-table-panel .smart-table .col-paid_today,
.record-table-panel .smart-table .col-accounting_amount,
.record-table-panel .smart-table .col-total_sessions,
.record-table-panel .smart-table .col-consumed_sessions,
.record-table-panel .smart-table .col-remaining_sessions {
  min-width: 76px;
  width: 88px;
  max-width: 104px;
}

.record-table-panel .smart-th.col-notes,
.record-table-panel .smart-table .col-notes {
  min-width: 104px;
  width: 122px;
  max-width: 154px;
}

.record-table-panel .smart-th.col-action,
.record-table-panel .smart-table .col-action {
  min-width: 168px;
  width: 176px;
  max-width: 190px;
}

.record-table-panel .smart-th.col-action,
.record-table-panel .smart-table td.col-action {
  position: sticky;
  right: 0;
  z-index: 5;
  overflow: visible;
  background: #fff;
}

.record-table-panel .smart-th.col-action {
  z-index: 35;
  background: #f7faff;
}

.record-table-panel .row-actions {
  justify-content: flex-end;
  gap: 4px;
}

.record-table-panel .mini-btn {
  min-height: 28px;
  padding: 5px 7px;
  font-size: 12px;
}

.record-month-head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 28px;
}

.record-month-year-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
}

.record-month-head div {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.record-month-head strong,
.record-month-year-head strong {
  color: var(--text);
  font-size: 13px;
}

.record-month-head span {
  color: var(--muted);
  font-size: 12px;
}

.record-month-years {
  display: flex;
  flex: 1 0 auto;
  flex-wrap: nowrap;
  gap: 7px 12px;
  min-width: max-content;
}

.record-month-year {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  min-height: 28px;
}

.record-month-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
}

.record-month-year.collapsed .record-month-grid {
  display: none;
}

.month-year-fold {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 27px;
  padding: 3px 8px;
  border: 1px solid rgba(201, 216, 236, 0.95);
  border-radius: 7px;
  color: #27496a;
  background: #f8fbff;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.month-year-fold strong {
  font-size: 12px;
}

.month-year-fold span {
  color: var(--muted);
  font-size: 12px;
}

.month-year-fold:hover,
.record-month-year.open .month-year-fold {
  border-color: rgba(47, 124, 246, 0.42);
  color: #155eef;
  background: #f2f7ff;
}

.record-month-year.open .month-year-fold span {
  color: #31506f;
}

.month-check-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 27px;
  padding: 3px 7px;
  border: 1px solid #d8e2f0;
  border-radius: 7px;
  color: #344054;
  background: #fff;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.month-check-chip input {
  width: 13px;
  height: 13px;
  margin: 0;
}

.month-check-chip:hover,
.month-check-chip.active {
  border-color: rgba(47, 124, 246, 0.42);
  color: #155eef;
  background: #f5f9ff;
}

.month-check-chip.active {
  box-shadow: 0 0 0 2px rgba(47, 124, 246, 0.07);
}

.month-mini-action {
  min-height: 27px;
  padding: 3px 8px;
  border: 1px solid rgba(201, 216, 236, 0.95);
  border-radius: 7px;
  color: #31506f;
  background: #fff;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.month-mini-action:hover,
.month-mini-action.active {
  border-color: rgba(47, 124, 246, 0.48);
  color: #155eef;
  background: #edf4ff;
}

.preset-btn {
  height: 34px;
  border: 1px solid rgba(201, 216, 236, 0.9);
  border-radius: 10px;
  color: #31506f;
  background: rgba(255, 255, 255, 0.92);
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.preset-btn:hover {
  border-color: rgba(47, 124, 246, 0.42);
  color: #1d4ed8;
  background: #f5f9ff;
}

.preset-btn.clear-preset {
  color: #64748b;
  background: #f8fafc;
}

.table-filters {
  display: grid;
  grid-template-columns: repeat(8, minmax(110px, 1fr));
  align-items: end;
  gap: 8px;
  margin: 10px 0 12px;
  padding: 14px;
  border: 1px solid rgba(223, 231, 242, 0.88);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
}

.table-filter-search {
  grid-column: span 2;
}

.quick-search-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
}

.quick-search-title {
  flex: 0 0 156px;
}

.quick-search-title strong {
  display: block;
  color: #1f2a44;
  font-size: 14px;
}

.quick-search-title span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.quick-search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  width: min(780px, 100%);
  height: 44px;
  padding: 0 7px 0 14px;
  border: 1px solid #dbe5f3;
  border-radius: 13px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.02);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.quick-search-box:focus-within {
  border-color: rgba(47, 124, 246, 0.68);
  box-shadow: 0 0 0 4px rgba(47, 124, 246, 0.1);
}

.quick-search-icon {
  position: relative;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.quick-search-icon::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 10px;
  height: 10px;
  border: 2px solid #94a3b8;
  border-radius: 50%;
}

.quick-search-icon::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 2px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: #94a3b8;
  transform: rotate(45deg);
}

.quick-search-input {
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.quick-search-input:focus {
  box-shadow: none;
}

.quick-search-clear {
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 999px;
  color: #1d4ed8;
  background: #edf4ff;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.quick-search-clear:hover:not(:disabled) {
  color: #fff;
  background: var(--blue);
  transform: translateY(-1px);
}

.quick-search-clear:disabled {
  cursor: not-allowed;
  color: #98a2b3;
  background: #f2f5f9;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: #52637a;
  font-size: 12px;
  font-weight: 700;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #d8e2f0;
  border-radius: 9px;
  color: var(--text);
  background: #fff;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.02);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(47, 124, 246, 0.65);
  box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.12);
}

.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.select.native-select-hidden {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
}

.custom-select-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #d8e2f0;
  border-radius: 9px;
  color: var(--text);
  background: #fff;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.02);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.custom-select-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-button i {
  width: 8px;
  height: 8px;
  justify-self: center;
  border-right: 2px solid #7a8aa0;
  border-bottom: 2px solid #7a8aa0;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.custom-select-button:hover:not(:disabled),
.custom-select.is-open .custom-select-button {
  border-color: rgba(47, 124, 246, 0.65);
  background: #fbfdff;
  box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.1);
}

.custom-select.is-open .custom-select-button i {
  border-color: var(--blue);
  transform: rotate(225deg) translate(-2px, -1px);
}

.custom-select-button.is-placeholder {
  color: #7a8aa0;
}

.custom-select-button:disabled {
  cursor: not-allowed;
  color: #98a2b3;
  background: #f3f6fa;
}

.custom-select-popover {
  position: fixed;
  z-index: 5200;
  display: grid;
  gap: 4px;
  padding: 8px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #d9e4f2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(31, 47, 70, 0.18);
}

.custom-select-popover button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #344054;
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 750;
}

.custom-select-popover button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-popover button b {
  color: var(--blue);
  font-size: 13px;
}

.custom-select-popover button:hover:not(:disabled) {
  background: #eef5ff;
}

.custom-select-popover button.selected {
  color: #155eef;
  border-color: rgba(47, 124, 246, 0.2);
  background: #edf4ff;
}

.custom-select-popover button.muted {
  color: #7a8aa0;
}

.custom-select-popover button:disabled {
  cursor: not-allowed;
  color: #a7b2c2;
}

.date-picker-input,
.month-picker-input {
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.date-picker-input.is-open,
.month-picker-input.is-open {
  border-color: rgba(47, 124, 246, 0.7);
  box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.12);
}

.date-picker-popover,
.month-picker-popover {
  position: fixed;
  z-index: 5000;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d9e4f2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(31, 47, 70, 0.18);
}

.date-picker-head {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 8px;
}

.date-picker-head strong {
  text-align: center;
  color: #18243a;
  font-size: 15px;
}

.date-picker-head button,
.date-picker-actions button,
.date-picker-grid button {
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

.date-picker-head button {
  height: 34px;
  color: #2f5fb8;
  background: #f2f6fd;
  font-size: 20px;
  font-weight: 800;
}

.date-picker-head button:hover,
.date-picker-actions button:hover,
.date-picker-grid button:hover {
  background: #eef5ff;
}

.date-picker-week,
.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.date-picker-week span {
  padding: 4px 0;
  color: #7a8aa0;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.date-picker-grid {
  gap: 4px;
}

.date-picker-grid button {
  height: 36px;
  color: #344054;
  font-size: 14px;
  font-weight: 750;
}

.date-picker-grid button.muted {
  color: #a7b2c2;
}

.date-picker-grid button.today {
  border-color: rgba(47, 124, 246, 0.35);
}

.date-picker-grid button.selected {
  color: #fff;
  background: var(--blue);
}

.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.month-picker-grid button {
  min-height: 42px;
  border: 1px solid #e1e9f5;
  border-radius: 7px;
  color: #344054;
  background: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.month-picker-grid button:hover {
  border-color: rgba(47, 124, 246, 0.35);
  background: #eef5ff;
}

.month-picker-grid button.today {
  border-color: rgba(47, 124, 246, 0.45);
}

.month-picker-grid button.selected {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.date-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #eef2f7;
}

.date-picker-actions button {
  min-height: 30px;
  padding: 5px 10px;
  color: #2f5fb8;
  background: #f4f8ff;
  font-weight: 800;
}

.permission-field-select {
  min-height: 76px;
  padding: 6px;
}

.account-settings-grid {
  grid-template-columns: 1fr;
}

.account-detail .account-form,
.account-detail .permission-list {
  padding: 14px;
}

.permission-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 14px;
  padding: 10px 12px;
  border: 1px solid #e1e9f5;
  border-radius: 12px;
  background: #f8fbff;
}

.permission-toolbar strong {
  display: block;
  color: #1f2a44;
  font-size: 13px;
}

.permission-toolbar span {
  color: var(--muted);
  font-size: 12px;
}

.permission-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.permission-list {
  display: grid;
  gap: 8px;
}

.permission-card {
  display: grid;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e1e9f5;
  border-radius: 12px;
  background: #fbfdff;
}

.permission-card-off {
  background: #f8fafc;
}

.permission-module-detail {
  min-width: 0;
}

.permission-module-detail summary {
  list-style: none;
}

.permission-module-detail summary::-webkit-details-marker {
  display: none;
}

.permission-card-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  padding: 10px 14px;
  cursor: pointer;
}

.permission-card-summary:hover {
  background: #f5f9ff;
}

.permission-module-detail[open] .permission-card-summary {
  border-bottom: 1px solid #e1e9f5;
  background: #f7fbff;
}

.permission-summary-main {
  min-width: 180px;
  flex: 1 1 auto;
}

.permission-summary-main strong {
  display: block;
  margin-bottom: 4px;
  color: #14213d;
  font-size: 15px;
}

.permission-summary-main span,
.permission-section-title span {
  color: var(--muted);
  font-size: 12px;
}

.permission-summary-main span {
  display: block;
  max-width: 560px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.permission-summary-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 1 auto;
  flex-wrap: wrap;
}

.permission-badge {
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #475467;
  background: #eef4fb;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.permission-badge.level-manage {
  color: #155eef;
  background: #e8f1ff;
}

.permission-badge.level-edit {
  color: #067647;
  background: #e7f8ef;
}

.permission-badge.level-view {
  color: #7a4b00;
  background: #fff4d6;
}

.permission-badge.level-none {
  color: #667085;
  background: #eef0f4;
}

.permission-expand-text {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.permission-module-detail[open] .permission-expand-text {
  font-size: 0;
}

.permission-module-detail[open] .permission-expand-text::after {
  content: "收起";
  font-size: 12px;
}

.permission-card-body {
  display: grid;
  gap: 12px;
  padding: 12px 14px 14px;
}

.permission-controls,
.permission-condition-grid {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(180px, 240px) 1fr;
  gap: 10px;
}

.permission-controls {
  grid-template-columns: repeat(2, minmax(180px, 240px));
}

.permission-condition {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed #d9e4f2;
  border-radius: 10px;
  background: #f7faff;
}

.permission-condition.is-active {
  border-style: solid;
  border-color: rgba(47, 124, 246, 0.36);
  background: #f3f8ff;
  box-shadow: inset 3px 0 0 rgba(47, 124, 246, 0.7);
}

.permission-condition.is-muted,
.field-permission-grid.is-muted {
  opacity: 0.58;
}

.permission-condition.is-muted .input,
.permission-condition.is-muted .select {
  background: #f2f5f9;
}

.permission-condition [data-permission-value-wrap] {
  display: block;
  min-width: 0;
}

.permission-card-actions {
  display: flex;
  justify-content: flex-end;
}

.permission-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.permission-section-title strong {
  color: #1f2a44;
  font-size: 13px;
}

.field-permission-grid {
  overflow: hidden;
  border: 1px solid #e1e9f5;
  border-radius: 10px;
  background: #fff;
}

.field-permission-head,
.field-permission-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 120px 120px;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
}

.field-permission-head {
  color: #667085;
  background: #f5f8fc;
  font-size: 12px;
  font-weight: 800;
}

.field-permission-row {
  border-top: 1px solid #edf2f8;
  color: #26364f;
  font-size: 13px;
}

.field-permission-row:hover {
  background: #f9fbff;
}

.field-permission-row span {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.field-permission-row .field-name {
  font-weight: 700;
}

.field-permission-row input {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
}

.month-select {
  min-height: 74px;
}

.dropdown-field {
  position: relative;
}

.check-dropdown {
  position: relative;
}

.check-dropdown summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #d8e2f0;
  border-radius: 9px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  list-style: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.check-dropdown summary::-webkit-details-marker {
  display: none;
}

.check-dropdown summary::after {
  content: "⌄";
  margin-left: auto;
  color: var(--muted);
}

.check-dropdown[open] summary {
  border-color: rgba(47, 124, 246, 0.65);
  box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.12);
}

.check-menu {
  position: absolute;
  z-index: 12;
  top: calc(100% + 6px);
  left: 0;
  width: min(280px, 86vw);
  max-height: 280px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(16, 24, 40, 0.16);
}

.check-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 5px 6px;
  border-radius: 6px;
  color: #344054;
  font-size: 13px;
}

.check-option:hover {
  background: #f5f8ff;
}

.check-option input {
  width: 14px;
  height: 14px;
}

.multi-select-field {
  align-self: stretch;
}

.multi-option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 38px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.multi-option {
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid #dbe7f5;
  background: #fff;
}

.check-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.btn {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(36, 107, 254, 0.18);
  font-weight: 800;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(36, 107, 254, 0.22);
}

.btn.secondary {
  color: var(--text);
  border-color: #dbe5f3;
  background: #f1f5fb;
  box-shadow: none;
}

.btn.secondary:hover {
  background: #eaf1fb;
  box-shadow: 0 8px 16px rgba(25, 42, 70, 0.08);
}

.btn.danger {
  background: var(--red);
  box-shadow: 0 8px 18px rgba(230, 80, 80, 0.18);
}

.mini-btn {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.immutable-input {
  color: #667085;
  background: #f8fbff;
  cursor: default;
}

.field-note {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
}

.people-metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.metric {
  min-width: 0;
  min-height: 132px;
  display: grid;
  align-content: center;
  padding: 18px;
  text-align: left;
}

.compact-metric {
  min-height: 106px;
  padding: 14px 16px;
}

.people-analysis-section {
  margin-top: 12px;
}

.people-month-section .smart-table-wrap {
  max-height: none;
  overscroll-behavior: auto;
}

.people-month-section .smart-table th {
  top: 0;
}

.filter-hint {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fbff;
  font-size: 13px;
}

.metric-button {
  width: 100%;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.metric-button:hover {
  border-color: rgba(47, 124, 246, 0.4);
  box-shadow: 0 10px 24px rgba(47, 124, 246, 0.1);
  transform: translateY(-1px);
}

.inline-metric-link {
  min-height: 0;
  padding: 0;
  border: 0;
  color: #1d5fd3;
  background: transparent;
  font: inherit;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
}

.inline-metric-link:hover {
  color: #0f4ab2;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.metric-label {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.metric-value {
  min-width: 0;
  max-width: 100%;
  margin-top: 20px;
  color: var(--blue);
  font-size: 38px;
  font-weight: 800;
  line-height: 1.08;
  overflow-wrap: anywhere;
  white-space: nowrap;
  overflow: hidden;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.metric:nth-child(4n) .metric-value {
  color: var(--orange);
}

.metric:nth-child(5n) .metric-value {
  color: var(--purple);
}

.finance-board {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.finance-kpi-group {
  margin: 0;
}

.compact-head {
  margin-bottom: 10px;
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
}

.finance-kpi-card {
  min-height: 108px;
  padding: 14px;
  box-shadow: none;
}

.finance-kpi-card .metric-value {
  margin-top: 12px;
  font-size: 28px;
}

.negative-value {
  color: var(--red) !important;
}

.finance-method-note {
  margin-bottom: 14px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.chart-card {
  min-height: 260px;
  padding: 18px;
}

.chart-card h2,
.panel h2 {
  margin: 0 0 14px;
  font-size: 15px;
  color: #1f2f46;
  font-weight: 800;
}

.trend-card {
  margin-top: 12px;
}

.trend-collapsible {
  display: block;
}

.trend-collapsible > summary {
  cursor: pointer;
  list-style: none;
  margin-bottom: 12px;
}

.trend-collapsible > summary::-webkit-details-marker {
  display: none;
}

.trend-summary span {
  display: grid;
  gap: 4px;
}

.trend-summary h2 {
  margin: 0;
}

.trend-summary em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

.trend-summary b {
  color: var(--blue);
  font-size: 12px;
}

.trend-wrap {
  overflow-x: auto;
  padding: 6px 2px 0;
}

.trend-wrap svg {
  width: 100%;
  min-width: 720px;
  height: 260px;
}

.trend-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.trend-mini-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e2ebf7;
  border-radius: 12px;
  background: #fff;
  overflow: auto;
}

.trend-mini-card h3 {
  margin: 0 0 8px;
  color: #24324a;
  font-size: 13px;
  font-weight: 850;
}

.trend-mini-card svg {
  width: 100%;
  min-width: 520px;
  height: 230px;
  display: block;
}

.trend-axis {
  stroke: #dce6f3;
  stroke-width: 1;
}

.trend-line {
  fill: none;
  stroke: var(--item-color);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-point {
  fill: #fff;
  stroke: var(--item-color);
  stroke-width: 2.4;
}

.trend-bar {
  fill: var(--item-color);
  opacity: 0.88;
}

.trend-value-label {
  fill: var(--item-color);
  font-size: 11px;
  font-weight: 850;
}

.trend-month {
  fill: #8090a6;
  font-size: 11px;
}

.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 6px;
}

.trend-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #4b5d75;
  font-size: 12px;
  font-weight: 700;
}

.trend-legend i {
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: var(--item-color);
}

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

.section-head h2 {
  margin-bottom: 4px;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 18px;
}

.donut {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: conic-gradient(var(--blue) 0deg, var(--blue) 110deg, var(--green) 110deg, var(--green) 220deg, var(--orange) 220deg, var(--orange) 310deg, #ffd24a 310deg);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 42px;
  border-radius: 50%;
  background: #fff;
}

.legend {
  display: grid;
  gap: 9px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  background: var(--blue);
}

.bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 96px 1fr 72px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  font-size: 13px;
  text-align: left;
}

.bar-button:hover {
  background: var(--item-bg);
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #eef2f8;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--item-color, var(--orange));
}

.split-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.appointment-day {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.appointment-day h3 {
  margin: 0;
  font-size: 15px;
}

.appointment-list {
  display: grid;
  gap: 8px;
}

.appointment-item {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.appointment-item > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendar-shell {
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.calendar-side {
  position: sticky;
  top: 92px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.compact-panel {
  margin-top: 0;
}

.form-grid.one-col {
  grid-template-columns: 1fr;
}

.calendar-side > .field,
.mini-calendar,
.calendar-filter-list,
.compact-panel {
  padding: 14px;
  border: 1px solid rgba(214, 226, 242, 0.95);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.mini-calendar-title,
.calendar-filter-title {
  margin-bottom: 10px;
  font-weight: 800;
}

.calendar-filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.calendar-filter-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.mini-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.mini-days button {
  height: 28px;
  border-radius: 999px;
  color: var(--text);
  background: transparent;
  font-size: 12px;
}

.mini-days button.muted {
  color: #b3bccb;
}

.mini-days button.today {
  color: #fff;
  background: var(--blue);
}

.calendar-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 2px 4px;
  border-radius: 10px;
  color: #344054;
  font-size: 13px;
}

.calendar-check span {
  width: 11px;
  height: 11px;
  border-radius: 999px;
}

.calendar-check:hover {
  background: #f6f9fe;
}

.calendar-main {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #e7eef8;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

.calendar-title-group,
.calendar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-title-group h2 {
  min-width: 138px;
  margin: 0;
  text-align: center;
  color: #18243a;
  font-size: 20px;
  letter-spacing: 0;
}

.calendar-title-group .btn,
.calendar-actions .btn {
  border-radius: 999px;
}

.compact-input {
  width: 132px;
}

.active-soft {
  color: #fff !important;
  background: var(--blue) !important;
}

.calendar-week-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  border-bottom: 1px solid #e8eef7;
  color: #667085;
  background: #fbfdff;
  font-size: 12px;
  font-weight: 700;
}

.calendar-week-row div {
  padding: 11px 12px;
  border-right: 1px solid #edf2f8;
}

.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.calendar-cell {
  min-height: clamp(154px, 11.8vh, 172px);
  padding: 8px;
  border-right: 1px solid #edf2f8;
  border-bottom: 1px solid #edf2f8;
  background: #fff;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.calendar-cell:hover {
  background: #fbfdff;
}

.calendar-cell.outside {
  color: #98a2b3;
  background: #f7f9fc;
}

.calendar-cell.today-cell {
  position: relative;
  background: #f2f8ff;
  box-shadow: inset 0 0 0 2px rgba(47, 124, 246, 0.52), inset 4px 0 0 var(--blue);
}

.calendar-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.calendar-date-mark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.calendar-date-mark strong {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  color: #344054;
  font-size: 13px;
}

.calendar-date-mark span {
  padding: 2px 6px;
  border-radius: 999px;
  color: #1d4ed8;
  background: #dbeafe;
  font-size: 11px;
  font-weight: 850;
}

.today-cell .calendar-date-mark strong {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 3px 8px rgba(47, 124, 246, 0.25);
}

.calendar-add {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  color: var(--blue);
  background: #edf4ff;
  font-weight: 800;
  opacity: 0.78;
  transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.calendar-cell:hover .calendar-add {
  opacity: 1;
  background: #dfeeff;
  transform: scale(1.04);
}

.calendar-events {
  display: grid;
  gap: 3px;
}

.calendar-event {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  overflow: hidden;
  min-height: 38px;
  padding: 6px 9px 6px 0;
  border: 1px solid rgba(47, 124, 246, 0.12);
  border-radius: 8px;
  color: #1f2937;
  background: var(--event-bg, #f4f7fb);
  text-align: left;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.dense-events .calendar-event {
  grid-template-columns: 3px minmax(0, 1fr);
  min-height: 27px;
  padding: 4px 7px 4px 0;
  border-radius: 6px;
}

.calendar-event:hover {
  border-color: color-mix(in srgb, var(--event-color, var(--blue)) 42%, #dce7f5);
  filter: saturate(1.04);
  box-shadow: 0 5px 12px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}

.calendar-event-accent {
  align-self: stretch;
  width: 4px;
  border-radius: 8px 0 0 8px;
  background: var(--event-color);
}

.calendar-event-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.dense-events .calendar-event-copy {
  display: flex;
  align-items: center;
  gap: 4px;
}

.calendar-event-copy strong,
.calendar-event-copy em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-copy strong {
  color: #111827;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.2;
}

.dense-events .calendar-event-copy strong {
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1.05;
}

.calendar-event-copy em {
  color: #4b5563;
  font-size: 13px;
  font-style: normal;
  font-weight: 650;
  line-height: 1.25;
}

.dense-events .calendar-event-copy em {
  font-size: 12px;
  line-height: 1.05;
}

.calendar-more {
  width: 100%;
  min-height: 24px;
  padding: 4px 7px;
  border: 1px dashed rgba(47, 124, 246, 0.34);
  border-radius: 8px;
  color: var(--blue);
  background: rgba(47, 124, 246, 0.06);
  text-align: center;
  font-size: 12px;
  font-weight: 850;
}

.calendar-more:hover {
  background: rgba(47, 124, 246, 0.11);
}

.appointment-day-drawer {
  max-width: 620px;
}

.appointment-day-detail-list {
  display: grid;
  gap: 10px;
}

.appointment-day-detail-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(47, 124, 246, 0.1);
  border-radius: 8px;
  background: var(--event-bg, #f7faff);
  box-shadow: none;
}

.appointment-day-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--event-color, var(--blue));
}

.appointment-day-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.appointment-day-main strong,
.appointment-day-main span,
.appointment-day-main em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-day-main strong {
  color: #18243a;
  font-size: 14px;
}

.appointment-day-main span {
  color: #344054;
  font-size: 13px;
  font-weight: 750;
}

.appointment-day-main em {
  color: #667085;
  font-size: 12px;
  font-style: normal;
}

.appointment-day-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 14px;
}

.year-card {
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.year-card strong,
.year-card span {
  display: block;
}

.year-card span {
  margin-top: 18px;
  color: var(--blue);
  font-weight: 800;
}

.person-card {
  width: 100%;
  padding: 16px;
  border-color: color-mix(in srgb, var(--item-color, #2f7cf6) 18%, var(--line));
  color: var(--text);
  text-align: left;
}

.person-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.consultant-display-card {
  grid-column: 1 / -1;
}

.compact-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 4px 10px;
}

.consultant-display-manager {
  display: grid;
  gap: 10px;
}

.consultant-display-add {
  display: grid;
  grid-template-columns: minmax(180px, 280px) auto;
  justify-content: start;
  align-items: center;
  gap: 8px;
}

.consultant-display-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.consultant-display-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px 4px 10px;
  border: 1px solid #dce8f7;
  border-radius: 999px;
  color: #29415f;
  background: #f8fbff;
  font-size: 12px;
  font-weight: 800;
}

.consultant-display-chip.is-history {
  color: #7a5b17;
  background: #fff8e7;
  border-color: #f3dfad;
}

.consultant-display-chip button {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #64748b;
  background: rgba(100, 116, 139, 0.12);
  font-size: 14px;
  line-height: 1;
}

.consultant-display-chip button:hover {
  color: #fff;
  background: #ef4444;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mini-stat {
  padding: 9px;
  border-radius: 10px;
  background: var(--panel-soft);
}

.mini-stat-button {
  width: 100%;
  border: 1px solid transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.mini-stat-button:hover {
  border-color: rgba(47, 124, 246, 0.28);
  background: #fff;
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.mini-stat strong {
  display: block;
  margin-top: 4px;
  color: var(--blue);
  font-size: 19px;
}

.panel {
  margin-top: 12px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

.create-panel {
  padding: 0;
  overflow: visible;
}

.create-panel summary {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
}

.create-panel summary::-webkit-details-marker {
  display: none;
}

.create-panel summary span {
  display: grid;
  gap: 3px;
}

.create-panel summary strong {
  color: #1f2f46;
  font-size: 15px;
}

.create-panel summary em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.create-panel summary b {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  color: #2457a6;
  background: #edf4ff;
  font-size: 12px;
}

.create-panel[open] summary {
  border-bottom: 1px solid var(--line);
  background: #f7faff;
}

.create-panel[open] summary b {
  font-size: 0;
}

.create-panel[open] summary b::after {
  content: "收起";
  font-size: 12px;
}

.create-panel form {
  padding: 14px 16px 16px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  scrollbar-gutter: stable both-edges;
}

.table-wrap:not(.smart-table-wrap) {
  max-height: var(--table-max-height, min(62dvh, 680px));
}

.drawer .table-wrap:not(.smart-table-wrap) {
  max-height: var(--table-max-height, min(48dvh, 520px));
}

.table-wrap:not(.smart-table-wrap) table {
  width: max-content;
  min-width: 100%;
}

.profile-table-head,
.profile-row {
  display: grid;
  grid-template-columns: 110px 90px 110px 82px 76px 76px 76px 76px 76px 76px 76px 82px minmax(220px, 1fr) 70px 70px;
  gap: 6px;
  align-items: center;
  min-width: 1320px;
}

.profile-table-head {
  margin-top: 16px;
  padding: 8px 10px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
}

.profile-list {
  overflow: auto;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: #fff;
}

.profile-row {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.profile-row.is-saved {
  background: #f6fef9;
}

.profile-row:last-child {
  border-bottom: 0;
}

.profile-row .input,
.profile-row .select,
.profile-row .custom-select-button,
.profile-row .textarea {
  min-height: 34px;
  padding: 7px 8px;
  font-size: 12px;
}

.profile-formula {
  min-height: 34px;
  resize: vertical;
}

.payroll-manual-input {
  min-width: 96px;
  max-width: 140px;
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.profile-row .btn.is-saved,
.payroll-manual-input.is-saved {
  border-color: #86efac;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.12);
}

.payroll-variable-guide {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
}

.payroll-variable-guide summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #24364f;
  font-weight: 850;
}

.payroll-variable-guide summary span {
  color: #7a8ca5;
  font-size: 12px;
  font-weight: 700;
}

.formula-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0;
}

.formula-chip-list code {
  padding: 5px 8px;
  border: 1px solid #d9e6f7;
  border-radius: 999px;
  color: #155eef;
  background: #fff;
  font-size: 12px;
  font-weight: 850;
}

.payroll-reminder {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  color: #9a3412;
  background: #fff7ed;
  font-size: 13px;
  font-weight: 800;
}

.payroll-total-box {
  min-height: 42px;
  padding: 6px 11px;
  border: 1px solid #cfe0f5;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f6f9ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.payroll-total-box strong {
  display: block;
  color: #155eef;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.15;
}

.payroll-total-box span {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
}

.section-tabs {
  position: sticky;
  top: 86px;
  z-index: 7;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: -4px 0 14px;
  padding: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 22px rgba(25, 42, 70, 0.08);
  scrollbar-width: thin;
  backdrop-filter: blur(14px);
}

.section-tabs::-webkit-scrollbar {
  height: 5px;
}

.section-tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.section-tab:hover {
  color: #155eef;
  background: #f1f6ff;
}

.section-tab.active {
  color: #155eef;
  border-color: rgba(36, 107, 254, 0.18);
  background: #eaf2ff;
  box-shadow: inset 0 -2px 0 var(--blue);
}

.payroll-content-panel[hidden],
.finance-stats-content-panel[hidden],
.settings-content-panel[hidden] {
  display: none !important;
}

.settings-editor-panel {
  padding: 16px 18px 18px;
  margin-bottom: 14px;
}

.settings-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.settings-editor-head h2 {
  margin: 0;
}

.settings-editor-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.settings-context-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid #cfe0f5;
  border-radius: 999px;
  color: #155eef;
  background: #eff6ff;
  font-size: 12px;
  font-weight: 800;
}

.settings-option-create-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 2fr) minmax(150px, 0.6fr);
  align-items: end;
  gap: 12px;
  margin-top: 14px;
}

.settings-option-create-copy {
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid #dbe7f5;
  border-radius: 10px;
  background: #f7faff;
}

.settings-option-create-copy strong {
  color: #183b70;
  font-size: 14px;
}

.settings-option-create-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.settings-option-create-input {
  margin: 0;
}

.settings-option-create-input .textarea,
.settings-option-create-submit {
  min-height: 72px;
}

.settings-option-create-submit {
  width: 100%;
}

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

.direction-create-form {
  grid-template-columns: minmax(170px, 0.9fr) minmax(220px, 1.4fr) minmax(130px, 0.55fr);
  margin-top: 0;
}

.direction-topic-create-fields {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(180px, 1.2fr);
  gap: 8px;
}

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

.direction-config-item {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--item-bg, #f7f9fd);
}

.direction-primary-row {
  margin: 0;
  border: 0;
  background: transparent;
}

.direction-topic-list {
  display: grid;
  gap: 6px;
  padding: 8px 8px 2px 28px;
  border-top: 1px dashed var(--line);
}

.direction-topic-row {
  display: grid;
  grid-template-columns: 86px minmax(150px, 1fr) 66px 66px;
  align-items: center;
  gap: 8px;
}

.direction-topic-parent {
  color: var(--muted);
  font-size: 12px;
}

.direction-empty-topic {
  padding: 4px 0;
}

.settings-detail .option-list {
  margin-top: 0;
}

.payroll-section {
  margin-top: 16px;
}

.payroll-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #182b49;
  font-size: 15px;
  font-weight: 900;
}

.payroll-section-title em {
  padding: 4px 9px;
  border-radius: 999px;
  color: #2563eb;
  background: #eff6ff;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.payroll-column-head,
.payroll-column-row {
  display: grid;
  grid-template-columns: 110px 130px 90px 96px 80px 70px minmax(220px, 0.8fr) minmax(240px, 1fr) 70px 70px;
  gap: 6px;
  align-items: center;
  min-width: 1440px;
}

.payroll-column-head {
  margin-top: 16px;
  padding: 8px 10px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
}

.payroll-column-list {
  overflow: auto;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: #fff;
}

.payroll-column-row {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.payroll-column-row:last-child {
  border-bottom: 0;
}

.payroll-column-row .input,
.payroll-column-row .select,
.payroll-column-row .custom-select-button,
.payroll-column-row .textarea {
  min-height: 34px;
  padding: 7px 8px;
  font-size: 12px;
}

.payroll-column-row input[readonly] {
  color: #667085;
  background: #f8fbff;
}

.payroll-column-notes {
  min-height: 34px;
  resize: vertical;
}

.finance-stat-column-panel .payroll-column-head,
.finance-stat-column-row {
  grid-template-columns: 130px 150px 100px 80px 70px minmax(220px, 0.8fr) minmax(240px, 1fr) 70px 70px;
  min-width: 1080px;
}

.formula-help {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  color: #52637a;
  font-size: 12px;
}

.finance-stat-manual-input {
  max-width: 140px;
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.fixed-expense-list {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.fixed-expense-head,
.fixed-expense-row {
  display: grid;
  grid-template-columns: 92px repeat(4, minmax(95px, 1fr)) 90px minmax(180px, 1.2fr) 68px;
  gap: 8px;
  align-items: center;
  min-width: 960px;
  padding: 8px 10px;
}

.fixed-expense-head {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  background: #f7faff;
  border-bottom: 1px solid var(--line);
}

.fixed-expense-row {
  border-bottom: 1px solid var(--line);
}

.fixed-expense-row:last-child {
  border-bottom: 0;
}

.fixed-expense-row .input {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.fixed-expense-total {
  color: #16345d;
  font-weight: 900;
}

.dashboard-preview-metrics {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.text-danger {
  color: #e5484d;
  font-weight: 800;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}

td {
  color: #24324a;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #344054;
  background: #f7faff;
  font-weight: 800;
}

tr:hover td {
  background: #f9fcff;
}

.smart-table-toolbar-wrap {
  position: relative;
  margin: 6px 0 10px;
}

.smart-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7faff;
}

.smart-table-status,
.smart-table-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.smart-table-status {
  color: var(--muted);
  font-size: 12px;
}

.smart-table-status strong {
  color: var(--text);
  font-size: 14px;
}

.toolbar-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #2457a6;
  background: #edf4ff;
  font-weight: 700;
}

.smart-table-pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 2px 2px;
  color: var(--muted);
  font-size: 12px;
}

.smart-table-wrap {
  position: relative;
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.smart-table-wrap.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.clickable-trend-point,
.clickable-trend-label {
  cursor: pointer;
}

.clickable-trend-point:hover {
  filter: brightness(0.92);
}

.smart-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.smart-table th {
  position: sticky;
  top: 0;
  padding: 0;
  overflow: visible;
  z-index: 30;
  background: #f7faff;
  isolation: isolate;
}

.smart-table th::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: #f7faff;
}

.smart-table th[style]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: inherit;
}

.smart-table th > * {
  position: relative;
  z-index: 1;
}

.smart-table td {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smart-table tbody td {
  position: relative;
  z-index: 0;
}

.smart-table tbody tr[data-smart-table-row][style] td {
  background: inherit;
}

.smart-table tbody tr[data-smart-table-row][style]:hover td {
  background: inherit;
}

.smart-table tbody tr[data-smart-table-row] td[style] {
  background: revert;
}

.empty-table-row td {
  height: 96px;
  color: var(--muted);
  text-align: center;
  background: #fbfdff;
  font-weight: 700;
}

.progressive-table-row td {
  height: 48px;
  color: var(--muted);
  text-align: center;
  background: #fbfdff;
  font-weight: 700;
}

.smart-th {
  min-width: 108px;
}

.smart-th.col-customer_no,
.smart-th.col-id,
.smart-table .col-customer_no,
.smart-table .col-id {
  min-width: 78px;
  width: 86px;
  max-width: 92px;
}

.smart-th.col-name,
.smart-th.col-customer_name,
.smart-table .col-name,
.smart-table .col-customer_name {
  min-width: 118px;
  max-width: 170px;
}

.smart-th.col-phone,
.smart-table .col-phone {
  min-width: 156px;
  width: 174px;
  max-width: 190px;
}

.phone-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}

.phone-cell > span {
  flex: 1 1 auto;
  min-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sensitive-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.sensitive-chip {
  color: #64748b;
  background: #eef3f8;
}

.phone-eye {
  flex: 0 0 auto;
  min-height: 22px;
  min-width: 24px;
  padding: 2px 6px;
  border: 1px solid #d8e5f6;
  border-radius: 999px;
  color: #2563eb;
  background: #f4f8ff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.phone-eye:hover {
  border-color: #a8c7ff;
  background: #eaf2ff;
}

.smart-th.col-assistant,
.smart-th.col-consultant,
.smart-table .col-assistant,
.smart-table .col-consultant {
  min-width: 96px;
  max-width: 126px;
}

.smart-th.col-paid_today,
.smart-th.col-accounting_amount,
.smart-th.col-actual_paid,
.smart-th.col-current_amount,
.smart-table .col-paid_today,
.smart-table .col-accounting_amount,
.smart-table .col-actual_paid,
.smart-table .col-current_amount {
  min-width: 92px;
  max-width: 118px;
}

.smart-th.col-notes,
.smart-th.col-remark,
.smart-table .col-notes,
.smart-table .col-remark {
  min-width: 150px;
  max-width: 320px;
}

/* Consultation records contain many short categorical fields; keep them readable without oversized columns. */
.smart-table[data-smart-table="consultations"] .smart-th.col-customer_no,
.smart-table[data-smart-table="consultations"] .col-customer_no {
  min-width: 68px;
  width: 76px;
  max-width: 84px;
}

.smart-table[data-smart-table="consultations"] .smart-th.col-name,
.smart-table[data-smart-table="consultations"] .col-name {
  min-width: 78px;
  width: 92px;
  max-width: 110px;
}

.smart-table[data-smart-table="consultations"] .smart-th.col-consult_date,
.smart-table[data-smart-table="consultations"] .col-consult_date,
.smart-table[data-smart-table="consultations"] .smart-th.col-first_consult_month,
.smart-table[data-smart-table="consultations"] .col-first_consult_month {
  min-width: 78px;
  width: 90px;
  max-width: 102px;
}

.smart-table[data-smart-table="consultations"] .smart-th.col-customer_type,
.smart-table[data-smart-table="consultations"] .col-customer_type,
.smart-table[data-smart-table="consultations"] .smart-th.col-consult_status,
.smart-table[data-smart-table="consultations"] .col-consult_status {
  min-width: 82px;
  width: 94px;
  max-width: 108px;
}

.smart-table[data-smart-table="consultations"] .smart-th.col-consultant,
.smart-table[data-smart-table="consultations"] .col-consultant,
.smart-table[data-smart-table="consultations"] .smart-th.col-assistant,
.smart-table[data-smart-table="consultations"] .col-assistant {
  min-width: 76px;
  width: 86px;
  max-width: 98px;
}

.smart-table[data-smart-table="consultations"] .smart-th.col-direction,
.smart-table[data-smart-table="consultations"] .col-direction {
  min-width: 82px;
  width: 94px;
  max-width: 112px;
}

.smart-table[data-smart-table="consultations"] .smart-th.col-specific_issues,
.smart-table[data-smart-table="consultations"] .col-specific_issues {
  min-width: 112px;
  width: 132px;
  max-width: 160px;
}

.smart-table[data-smart-table="consultations"] .smart-th.col-total_sessions,
.smart-table[data-smart-table="consultations"] .col-total_sessions,
.smart-table[data-smart-table="consultations"] .smart-th.col-consumed_sessions,
.smart-table[data-smart-table="consultations"] .col-consumed_sessions,
.smart-table[data-smart-table="consultations"] .smart-th.col-remaining_sessions,
.smart-table[data-smart-table="consultations"] .col-remaining_sessions {
  min-width: 68px;
  width: 78px;
  max-width: 88px;
}

.th-button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  color: #344054;
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.th-button:hover,
.th-button.is-active {
  color: #1d5fd3;
  background: rgba(238, 245, 255, 0.92);
}

.smart-th[style] .th-button {
  background: transparent;
}

.th-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.th-button i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--blue);
}

.th-button b {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.column-menu {
  position: absolute;
  z-index: 18;
  top: calc(100% + 4px);
  left: 8px;
  width: 270px;
  max-height: min(460px, 72vh);
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(16, 24, 40, 0.18);
}

.floating-column-menu {
  position: fixed;
  z-index: 120;
}

.floating-column-menu .column-menu {
  position: static;
  top: auto;
  left: auto;
  max-height: var(--menu-max-height, min(460px, calc(100vh - 96px)));
  box-shadow: 0 22px 52px rgba(16, 24, 40, 0.22);
}

.column-menu-title {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.column-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
}

.column-stats div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.column-stats span {
  color: var(--muted);
  font-size: 11px;
}

.column-stats strong {
  color: var(--text);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-section {
  display: grid;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.menu-section-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.menu-action,
.menu-close {
  min-height: 32px;
  padding: 7px 9px;
  border-radius: 8px;
  color: #344054;
  background: transparent;
  text-align: left;
  font-size: 13px;
}

.menu-action:hover,
.menu-action.active,
.menu-close:hover {
  color: #1d5fd3;
  background: #eef5ff;
}

.menu-action.subtle {
  color: var(--muted);
  background: #f5f7fb;
}

.number-filter-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.number-filter-op {
  padding-inline: 8px;
  text-align: center;
}

.number-filter-row .number-filter-op:only-child {
  grid-column: 1 / -1;
}

.number-filter-input {
  min-width: 0;
}

.menu-close {
  width: 100%;
  margin-top: 4px;
  color: var(--muted);
  text-align: center;
}

.month-checks {
  max-height: 180px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
}

.check-option.compact {
  min-height: 28px;
  padding: 3px 4px;
}

.filter-mini-summary {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.table-menu-actions {
  margin-top: 8px;
}

.group-row td {
  padding: 0;
  background: var(--group-bg, #f3f8ff);
}

.group-row:hover td {
  background: var(--group-bg, #f0f6ff);
}

.group-row-inner {
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(220px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  color: var(--group-color, var(--text));
  background: var(--group-bg, #f3f8ff);
}

.group-toggle {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  color: inherit;
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.group-toggle span {
  color: var(--muted);
  font-size: 13px;
}

.group-toggle strong {
  font-size: 14px;
}

.group-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.group-stats span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  color: #52637a;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.group-color-input {
  justify-self: end;
}

.table-settings-panel {
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.table-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.table-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.table-settings-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
}

.table-settings-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.table-settings-save-state {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid rgba(52, 199, 89, 0.22);
  border-radius: 999px;
  color: #248a3d;
  background: rgba(52, 199, 89, 0.1);
  font-size: 12px;
  font-weight: 800;
}

.table-settings-section {
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 14px;
  position: relative;
  border: 1px solid var(--line);
  border-top-width: 3px;
  border-radius: 12px;
  background: #fbfdff;
  box-shadow: 0 3px 12px rgba(31, 47, 70, 0.04);
}

.table-settings-section-overview {
  border-color: #c8dcfa;
  border-top-color: #4c8df6;
  background: #f7faff;
}

.table-settings-section-rules {
  border-color: #d8eadf;
  border-top-color: #35a66f;
  background: #f8fdf9;
}

.table-settings-section-custom {
  border-color: #e0d6f7;
  border-top-color: #8064df;
  background: #fbf9ff;
}

.settings-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(125, 145, 170, 0.22);
}

.table-settings-section h3,
.table-settings-section h4 {
  margin: 0;
  color: #1f2f46;
  font-size: 15px;
}

.table-settings-section p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.settings-section-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.table-settings-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.table-settings-subhead h5 {
  margin: 0;
  color: #1f2f46;
  font-size: 13px;
}

.table-settings-subhead span {
  color: var(--muted);
  font-size: 12px;
}

.table-settings-record-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: min(100%, 1120px);
  padding-top: 2px;
  color: #52637a;
  font-size: 12px;
}

.table-settings-section > .setting-record-list {
  width: min(100%, 1120px);
}

.table-settings-record-head strong {
  color: #1f2f46;
  font-size: 13px;
}

.column-quick-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 9px;
  max-height: 360px;
  overflow: auto;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
}

.column-quick-item {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 9px;
  border: 1px solid #e5edf8;
  border-radius: 10px;
  background: #fff;
}

.column-quick-main,
.column-quick-controls,
.table-setting-color-controls {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.column-quick-main {
  justify-content: space-between;
}

.column-quick-controls {
  justify-content: space-between;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}

.column-quick-controls > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.column-quick-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.column-visibility-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #53657f;
  font-size: 12px;
  font-weight: 800;
}

.column-visibility-toggle input {
  accent-color: var(--blue);
}

.mini-color {
  width: 34px;
  min-width: 34px;
}

.table-setting-form,
.table-fill-form {
  display: grid;
  width: min(100%, 1120px);
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
}

.table-setting-form-fields,
.table-fill-form-fields {
  display: grid;
  align-items: end;
  gap: 10px;
}

.table-setting-form-fields {
  grid-template-columns: minmax(220px, 1.35fr) minmax(160px, 1fr) minmax(160px, 1fr) minmax(80px, auto) auto;
}

.table-fill-form-fields {
  grid-template-columns: minmax(220px, 1.15fr) minmax(140px, 0.75fr) minmax(170px, 1fr) minmax(90px, auto);
  grid-template-areas:
    "column type op color"
    "value value value submit";
}

.table-fill-form-fields > :nth-child(1) { grid-area: column; }
.table-fill-form-fields > :nth-child(2) { grid-area: type; }
.table-fill-form-fields > :nth-child(3) { grid-area: op; }
.table-fill-form-fields > :nth-child(4) { grid-area: value; }
.table-fill-form-fields > :nth-child(5) { grid-area: color; }
.table-fill-form-fields > :nth-child(6) { grid-area: submit; }

.table-setting-field {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.table-setting-field > span:first-child {
  color: #52637a;
  font-size: 11px;
  font-weight: 800;
}

.table-setting-color-field {
  min-width: 0;
}

.table-setting-color-controls {
  min-height: 34px;
}

.table-setting-color-controls .color-input {
  width: 42px;
  min-width: 42px;
}

.table-setting-color-controls .custom-select,
.table-setting-color-controls .select {
  min-width: 0;
  flex: 1 1 auto;
}

.table-setting-submit {
  align-self: end;
  min-height: 34px;
  white-space: nowrap;
}

.table-rule-value-field {
  grid-column: auto;
}

.table-rule-value-field > span:last-child,
.table-rule-value-field .input,
.table-rule-value-field .custom-select {
  min-width: 0;
  width: 100%;
}

.table-custom-field-form {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
}

.custom-field-main {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 130px minmax(210px, 1fr) 86px;
  align-items: end;
  gap: 8px;
}

.custom-field-main .field span,
.custom-field-advanced .field span {
  color: #52637a;
  font-size: 12px;
  font-weight: 800;
}

.custom-field-advanced {
  padding: 8px 10px;
  border: 1px dashed #cfe0f6;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.custom-field-advanced summary {
  cursor: pointer;
  color: #2457a6;
  font-size: 12px;
  font-weight: 850;
}

.custom-field-advanced-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(200px, 1fr) minmax(200px, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.custom-field-options-input {
  min-height: 84px;
}

.custom-field-wide {
  grid-column: 1 / -1;
}

.custom-field-section {
  grid-column: 1 / -1;
}

.custom-field-record {
  grid-template-columns: 34px minmax(120px, 1fr) 70px minmax(120px, 1fr) 22px 54px;
}

.filter-choice-list {
  display: grid;
  gap: 6px;
  max-height: 230px;
  overflow: auto;
  padding: 4px;
}

.filter-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 9px;
  color: #344054;
  font-weight: 700;
}

.filter-choice:hover,
.filter-choice.active {
  background: #f0f6ff;
}

.filter-choice input {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
}

.table-fill-form [data-table-rule-value-wrap] {
  min-width: 0;
}

.setting-record-list {
  display: grid;
  gap: 7px;
}

.setting-record-row {
  display: grid;
  grid-template-columns: 34px minmax(90px, 1fr) 78px minmax(90px, 1fr) 22px 54px;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  font-size: 12px;
}

.setting-record-row strong,
.setting-record-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setting-record-type {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 22px;
  border-radius: 999px;
  color: #1d4ed8;
  background: #eaf2ff;
  font-weight: 900;
}

.fill-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.1);
}

.field-type-pill {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 32px;
  padding: 0 9px;
  border-radius: 999px;
  color: #155eef;
  background: #eaf2ff;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.finance-source-card .detail-grid {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.finance-rule-panel {
  margin-bottom: 14px;
}

.metric-rule-grid,
.dashboard-builder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 12px;
}

.metric-rule-card,
.dashboard-widget-config {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.metric-rule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-rule-head strong {
  color: #1f2f46;
  font-size: 14px;
}

.metric-rule-head span,
.metric-rule-meta span,
.rule-condition-list span {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #52637a;
  background: #eef4fb;
  font-size: 12px;
  font-weight: 760;
}

.metric-rule-detail {
  display: grid;
  gap: 8px;
}

.metric-rule-detail p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.metric-rule-meta,
.rule-condition-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rule-formula {
  padding: 9px 10px;
  border-radius: 10px;
  color: #155eef;
  background: #edf5ff;
  font-weight: 850;
  line-height: 1.5;
}

.dashboard-builder {
  margin-bottom: 14px;
}

.dashboard-visual-editor {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 14px;
  margin: 12px 0 16px;
}

.dashboard-editor-side,
.dashboard-editor-preview,
.dashboard-widget-list {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbff;
}

.dashboard-editor-side {
  display: grid;
  gap: 14px;
  align-content: start;
}

.builder-step-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.builder-step-strip span {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #6f8098;
  background: #fff;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.builder-step-strip span.active {
  color: #155eef;
  border-color: #c8dcff;
  background: #edf5ff;
}

.editor-block {
  display: grid;
  gap: 8px;
}

.editor-block h4 {
  margin: 0;
  color: #1f2f46;
}

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

.chart-type-option {
  appearance: none;
  cursor: pointer;
  min-height: 54px;
  display: grid;
  place-items: center;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #52637a;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.chart-type-option i {
  width: 24px;
  height: 18px;
  border-radius: 5px;
  background:
    linear-gradient(90deg, #2f7cf6 0 28%, transparent 28% 36%, #28bf72 36% 64%, transparent 64% 72%, #f7b731 72% 100%);
}

.chart-type-option.active {
  color: #155eef;
  border-color: #b9d3ff;
  background: #eef5ff;
}

.chart-type-option:hover {
  border-color: #8bbcff;
  background: #f6faff;
}

.editor-field-grid {
  display: grid;
  gap: 8px;
  margin: 8px 0 10px;
}

.editor-field-grid div {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.8);
}

.editor-field-grid span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.editor-field-grid strong {
  display: block;
  overflow: hidden;
  color: #20314a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-editor-preview {
  display: grid;
  gap: 12px;
}

.dashboard-widget-list {
  margin-top: 12px;
}

.dashboard-widget-add {
  display: grid;
  gap: 8px;
}

.compact-head {
  margin-bottom: 10px;
}

.widget-source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.widget-source-grid div {
  min-width: 0;
  padding: 9px;
  border-radius: 10px;
  background: #f3f7fd;
}

.widget-source-grid span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.widget-source-grid strong {
  display: block;
  overflow: hidden;
  color: #20314a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-preview {
  max-height: 230px;
  overflow: auto;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(223, 231, 242, 0.8);
}

.widget-preview.large {
  max-height: 360px;
  min-height: 240px;
}

.mini-color {
  width: 34px;
  height: 34px;
}

.mini-select {
  min-height: 34px;
  padding: 5px 7px;
  font-size: 12px;
}

.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
}

.muted-action {
  color: var(--muted);
  font-size: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #1f7a45;
  background: #e8f7ef;
  font-size: 12px;
  font-weight: 700;
}

.status.warn {
  color: #9a5a00;
  background: #fff4de;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  margin: 2px 4px 2px 0;
  max-width: 180px;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  justify-items: end;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(2px);
}

.drawer {
  width: min(780px, 100%);
  height: 100%;
  overflow: auto;
  padding: 24px;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 44px rgba(16, 24, 40, 0.18);
}

.drawer-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.drawer-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.drawer-head h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.customer-detail-drawer .table-wrap:not(.smart-table-wrap) {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.detail-quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

.status-chip-stack {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-item {
  min-height: 72px;
  padding: 10px;
  border: 1px solid #e8eef8;
  border-radius: 10px;
  background: #f8fbff;
}

.detail-grid .wide {
  grid-column: 1 / -1;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-item strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* Keep short-entry forms dense without making notes and reports cramped. */
.compact-entry-form {
  width: 100%;
  max-width: none;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
}

.compact-entry-form > .field:has([name="customer_no"]) {
  grid-column: span 4;
}

.compact-entry-form > .field:has([name="consult_date"]) {
  grid-column: span 2;
}

.consultation-entry-form > .field:has([name="consultant"]),
.consultation-entry-form > .field:has([name="customer_type"]),
.consultation-entry-form > .field:has([name="consult_status"]) {
  grid-column: span 2;
}

.consultation-entry-form > .field:has([name="payment_method"]) {
  grid-column: span 4;
}

.lead-entry-form {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.lead-entry-form > .field:has([name="name"]),
.lead-entry-form > .field:has([name="phone"]) {
  grid-column: span 2;
}

.lead-entry-form > .field:has([name="lead_date"]),
.lead-entry-form > .field:has([name="first_consult_date"]) {
  grid-column: span 2;
}

.lead-entry-form > .field:has([name="direction"]) {
  grid-column: span 2;
}

.finance-entry-form {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.finance-entry-form > .field:has([name="fee_rate_custom"]),
.finance-entry-form > .field:has([name="fee_amount"]) {
  grid-column: span 1;
}

.compact-entry-form > button,
.compact-entry-form > .field.full {
  grid-column: 1 / -1;
}

.compact-entry-form .input,
.compact-entry-form .select {
  min-height: 38px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

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

.option-panel {
  min-height: 190px;
}

.settings-detail {
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
}

.settings-detail > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  background: #fff;
}

.settings-detail > summary::-webkit-details-marker {
  display: none;
}

.settings-detail > summary h2 {
  margin: 0 0 4px;
}

.settings-detail > summary em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.settings-detail > summary > strong {
  color: var(--blue);
  font-size: 12px;
}

.settings-detail[open] > summary {
  border-bottom: 1px solid var(--line);
  background: #f7faff;
}

.settings-detail[open] > summary > strong {
  font-size: 0;
}

.settings-detail[open] > summary > strong::after {
  content: "收起";
  font-size: 12px;
}

.settings-detail .option-list {
  padding: 14px;
}

.option-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 14px;
}

.option-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(140px, 1fr) 42px 84px 66px 66px;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--item-bg, #f7f9fd);
}

.option-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #344054;
  background: #f7f9fd;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.color-input {
  width: 38px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.density-select {
  min-width: 76px;
}

.option-name-input {
  min-width: 140px;
}

.option-name-field {
  display: grid;
  gap: 4px;
}

.option-name-field span {
  color: var(--muted);
  font-size: 11px;
}

.lookup-preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 13px;
}

.lookup-preview .wide {
  grid-column: span 4;
}

.consultation-lookup-preview,
.consultation-customer-preview {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
}

.consultation-lookup-preview .detail-item,
.consultation-customer-preview .detail-item {
  min-height: 0;
  padding: 7px 8px;
  border-radius: 8px;
}

.consultation-lookup-preview .detail-item span,
.consultation-customer-preview .detail-item span {
  display: inline;
  margin-right: 6px;
  font-size: 11px;
}

.consultation-lookup-preview .detail-item strong,
.consultation-customer-preview .detail-item strong {
  display: inline;
  margin-top: 0;
  font-size: 13px;
}

.consultation-lookup-preview .wide,
.consultation-customer-preview .wide {
  grid-column: 1 / -1;
}

.appointment-lookup-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 9px;
  border: 1px solid #d8e5f6;
  border-radius: 10px;
  color: var(--muted);
  background: #f8fbff;
}

.appointment-customer-field {
  position: relative;
}

.appointment-search-results {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 6px;
  max-height: 230px;
  overflow: auto;
  border: 1px solid #d8e5f6;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(42, 71, 112, 0.12);
}

.appointment-search-result {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #f8fbff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.appointment-search-result:hover {
  border-color: #b8d2ff;
  background: #eef6ff;
}

.appointment-search-result strong,
.appointment-search-result span,
.appointment-search-result em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-search-result strong {
  font-size: 13px;
  font-weight: 850;
}

.appointment-search-result span {
  color: #66778f;
  font-size: 12px;
}

.appointment-search-result em,
.appointment-search-empty {
  color: #7a8aa0;
  font-size: 12px;
  font-style: normal;
}

.appointment-search-empty {
  padding: 9px 10px;
}

.appointment-lookup-strip.is-empty {
  line-height: 1.6;
  color: #71839b;
  font-size: 12px;
}

.appointment-lookup-pill {
  min-width: 0;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid #dfe9f7;
  border-radius: 999px;
  background: #fff;
}

.appointment-lookup-pill.wide {
  flex: 1 1 220px;
}

.appointment-lookup-pill em {
  color: #7a8aa0;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.appointment-lookup-pill strong {
  min-width: 0;
  overflow: hidden;
  color: #24324a;
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-duration-field {
  min-width: 0;
}

.appointment-start-field {
  min-width: 0;
}

.appointment-start-control {
  display: grid;
  grid-template-columns: minmax(136px, 1.2fr) minmax(96px, 0.8fr);
  gap: 8px;
}

.duration-control {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 92px;
  gap: 8px;
}

.duration-custom-input:disabled {
  color: #98a2b3;
  background: #f3f6fb;
  cursor: not-allowed;
}

.lookup-action-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  gap: 10px;
}

.lookup-action-item span {
  margin: 0;
}

.drawer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.notice {
  padding: 12px;
  border-radius: 10px;
  color: #174a2d;
  background: #eaf8f0;
  border: 1px solid #c9ecd8;
}

.error {
  padding: 12px;
  border-radius: 10px;
  color: #8a1f1f;
  background: #fdecec;
  border: 1px solid #f7caca;
}

.word-cloud {
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.word {
  color: var(--blue);
  font-weight: 800;
}

.hidden {
  display: none !important;
}

.input-suffix-wrap {
  position: relative;
}

.input-suffix-wrap .input {
  padding-right: 34px;
}

.input-suffix {
  position: absolute;
  top: 50%;
  right: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%);
}

@media (max-width: 1100px) {
  .app-shell.record-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .record-shell .main {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding: 14px;
  }

  .record-workspace {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .record-table-panel {
    display: block;
    overflow: visible;
  }

  .record-table-panel .smart-table-wrap {
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar-toggle {
    display: none;
  }

  .sidebar-collapsed .brand-row > span,
  .sidebar-collapsed .nav button span {
    display: block;
  }

  .sidebar-collapsed .nav button::before {
    content: none;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .nav-section {
    display: contents;
  }

  .nav-section-label {
    display: none;
  }

  .filters {
    grid-template-columns: repeat(3, 1fr);
  }

  .table-filters {
    grid-template-columns: repeat(3, 1fr);
  }

  .record-toolbar {
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.3fr);
  }

  .record-toolbar .record-create-panel {
    grid-column: 1 / -1;
  }

  .record-toolbar .record-create-panel summary {
    min-height: 46px;
  }

  .record-toolbar .record-create-panel summary em {
    display: block;
  }

  .grid-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .finance-board {
    grid-template-columns: 1fr;
  }

  .split-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .table-settings-grid,
  .dashboard-visual-editor,
  .group-row-inner {
    grid-template-columns: 1fr;
  }

  .permission-card-summary,
  .permission-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .permission-summary-badges,
  .permission-toolbar-actions {
    justify-content: flex-start;
  }

  .group-color-input {
    justify-self: start;
  }
}

@media (max-width: 720px) {
  body {
    background:
      linear-gradient(180deg, #f8fbff 0, #eef5ff 180px),
      #f4f7fb;
  }

  .main {
    padding: 12px;
  }

  .record-shell .main {
    display: block;
    height: auto;
    overflow: visible;
    padding: 12px;
  }

  .global-header,
  .record-shell .global-header {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin: -12px -12px 12px;
    padding: 12px;
  }

  .global-header-info h1 {
    font-size: 21px;
  }

  .record-shell .global-header-info h1 {
    font-size: 20px;
  }

  .global-header-actions {
    gap: 6px;
  }

  .account-actions .btn,
  .account-actions .role-pill {
    width: 56px;
    min-height: 36px;
    padding: 0 6px;
    font-size: 12px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 12;
    padding: 10px 10px 8px;
    border-right: 0;
    border-bottom: 1px solid rgba(216, 226, 240, 0.86);
    box-shadow: 0 8px 22px rgba(25, 42, 70, 0.06);
  }

  .brand {
    margin: 0 0 8px;
    padding: 9px 10px;
    border-radius: 14px;
  }

  .brand-title {
    font-size: 15px;
  }

  .brand-sub {
    font-size: 11px;
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav button {
    flex: 1 0 calc((100% - 40px) / 6);
    justify-content: center;
    width: auto;
    min-width: 0;
    max-width: calc((100% - 40px) / 6);
    min-height: 36px;
    padding: 7px 4px;
    border-radius: 999px;
    white-space: nowrap;
    font-size: 12px;
  }

  .nav button span,
  .sidebar-collapsed .nav button span {
    display: none;
  }

  .nav button::before,
  .sidebar-collapsed .nav button::before {
    content: attr(data-short);
  }

  .nav button:hover {
    transform: none;
  }

  .nav button.active {
    box-shadow: inset 0 -2px 0 var(--blue), 0 8px 18px rgba(36, 107, 254, 0.08);
  }

  .nav,
  .filters,
  .quick-search-panel,
  .table-filters,
  .grid-cards,
  .chart-grid,
  .split-cards,
  .calendar-shell,
  .appointment-item,
  .form-grid,
  .settings-grid,
  .lookup-preview,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .date-preset-field {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .quick-search-panel {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .record-toolbar {
    grid-template-columns: 1fr;
  }

  .record-toolbar .record-month-panel {
    height: auto;
  }

  .record-toolbar .quick-search-title {
    flex: 0 1 auto;
  }

  .appointment-start-control {
    grid-template-columns: 1fr;
  }

  .quick-search-title {
    flex: 0 1 auto;
  }

  .quick-search-box {
    width: 100%;
  }

  .table-filter-search {
    grid-column: auto;
  }

  .option-row {
    grid-template-columns: 1fr 42px 76px;
  }

  .settings-editor-head {
    flex-direction: column;
    gap: 8px;
  }

  .settings-option-create-form {
    grid-template-columns: 1fr;
  }

  .settings-option-create-copy,
  .settings-option-create-input .textarea {
    min-height: 48px;
  }

  .settings-option-create-submit {
    min-height: 42px;
  }

  .direction-create-grid,
  .direction-topic-create-fields {
    grid-template-columns: 1fr;
  }

  .direction-topic-list {
    padding-left: 8px;
  }

  .direction-topic-row {
    grid-template-columns: 1fr 66px 66px;
  }

  .direction-topic-parent {
    grid-column: 1 / -1;
  }

  .option-row .btn {
    grid-column: 1 / -1;
  }

  .calendar-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .calendar-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .calendar-title-group {
    width: 100%;
    justify-content: space-between;
  }

  .calendar-title-group h2 {
    min-width: 0;
    flex: 1;
    font-size: 18px;
  }

  .calendar-title-group .btn,
  .calendar-actions .btn {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .calendar-main {
    order: 1;
    overflow: hidden;
    border-radius: 16px;
  }

  .calendar-week-row,
  .calendar-month-grid {
    min-width: 0;
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .calendar-week-row {
    font-size: 10px;
  }

  .calendar-week-row div {
    padding: 8px 2px;
    text-align: center;
  }

  .calendar-cell {
    min-height: 148px;
    padding: 6px 4px;
  }

  .calendar-cell-head {
    margin-bottom: 3px;
  }

  .calendar-date-mark {
    gap: 2px;
  }

  .calendar-date-mark strong {
    min-width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .calendar-date-mark span {
    padding: 1px 4px;
    font-size: 9px;
  }

  .calendar-add {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }

  .calendar-events {
    gap: 3px;
  }

  .calendar-event {
    min-height: 30px;
    padding: 4px 6px 4px 0;
    border-radius: 7px;
    line-height: 1.2;
  }

  .calendar-event-accent {
    width: 3px;
  }

  .calendar-event-copy strong {
    font-size: 13px;
  }

  .calendar-event-copy em {
    font-size: 12px;
  }

  .calendar-more {
    min-height: 24px;
    padding: 3px 5px;
    font-size: 12px;
  }

  .appointment-day-detail-item {
    grid-template-columns: 8px minmax(0, 1fr);
    gap: 8px;
  }

  .appointment-day-actions {
    grid-column: 1 / -1;
    flex-wrap: wrap;
    padding-left: 18px;
  }

  .calendar-side {
    order: 2;
    position: static;
    gap: 10px;
  }

  .calendar-side > .field,
  .mini-calendar,
  .calendar-filter-list,
  .compact-panel {
    padding: 12px;
    border-radius: 15px;
  }

  .calendar-filter-list {
    max-height: 220px;
    overflow: auto;
  }

  .calendar-filter-title {
    position: sticky;
    top: -12px;
    z-index: 1;
    margin: -12px -12px 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid rgba(223, 231, 242, 0.72);
  }

  .calendar-filter-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .calendar-check {
    min-height: 28px;
    font-size: 12px;
  }

  .appointment-lookup-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .appointment-lookup-strip.is-empty {
    display: block;
    min-height: 42px;
    white-space: normal;
  }

  .appointment-lookup-pill,
  .appointment-lookup-pill.wide {
    width: 100%;
    min-width: 0;
  }

  .year-grid {
    grid-template-columns: 1fr;
  }

  .table-setting-form,
  .table-fill-form,
  .table-custom-field-form,
  .custom-field-main,
  .custom-field-advanced-grid,
  .setting-record-row,
  .permission-controls,
  .permission-condition-grid,
  .field-permission-head,
  .field-permission-row {
    grid-template-columns: 1fr;
  }

  .permission-summary-main {
    min-width: 0;
  }

  .permission-summary-main span {
    white-space: normal;
  }

  .appointment-item > div:first-child {
    align-items: flex-start;
    flex-direction: column;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .metric {
    min-height: 110px;
  }

  .metric-value {
    font-size: 32px;
  }
}

/* Apple-like visual theme v1: macOS-style utility app skin. */
:root {
  --bg: #f5f5f7;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --panel-soft: #f9f9fb;
  --line: rgba(0, 0, 0, 0.1);
  --line-soft: rgba(0, 0, 0, 0.06);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --blue: #007aff;
  --green: #248a3d;
  --orange: #bf5b00;
  --pink: #d70060;
  --purple: #8e44ad;
  --red: #d70015;
  --shadow: 0 22px 58px rgba(0, 0, 0, 0.1);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.06);
  --apple-control-bg: rgba(255, 255, 255, 0.74);
  --apple-toolbar-bg: rgba(245, 245, 247, 0.82);
  --apple-sidebar-bg: rgba(242, 242, 247, 0.78);
  --apple-focus: rgba(0, 122, 255, 0.18);
  --apple-blue-soft: rgba(0, 122, 255, 0.1);
}

html {
  background: var(--bg);
}

body {
  color: var(--text);
  background:
    linear-gradient(180deg, #fbfbfd 0, #f5f5f7 220px),
    var(--bg);
  letter-spacing: 0;
}

::selection {
  color: #fff;
  background: rgba(0, 122, 255, 0.78);
}

button,
input,
select,
textarea {
  letter-spacing: 0;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.login-shell {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(245, 245, 247, 0.92)),
    var(--bg);
}

.login-panel,
.panel,
.card,
.record-table-panel,
.table-wrap,
.smart-table-wrap,
.table-settings-panel,
.settings-detail,
.dashboard-editor-side,
.dashboard-editor-preview,
.dashboard-widget-list,
.metric-rule-card,
.compact-panel,
.calendar-side > .field,
.mini-calendar,
.calendar-filter-list,
.record-month-panel,
.quick-search-panel,
.table-filters,
.filters,
.permission-card,
.permission-toolbar,
.field-permission-grid,
.profile-list,
.payroll-column-list,
.fixed-expense-list {
  border-color: var(--line-soft);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.panel,
.card,
.record-table-panel,
.table-wrap,
.smart-table-wrap,
.settings-detail,
.table-settings-panel,
.calendar-side > .field,
.mini-calendar,
.calendar-filter-list,
.compact-panel,
.quick-search-panel,
.table-filters,
.filters,
.login-panel {
  border-radius: 16px;
}

.app-shell {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(245, 245, 247, 0.92)),
    var(--bg);
}

.sidebar {
  background: var(--apple-sidebar-bg);
  border-right-color: var(--line-soft);
  box-shadow: none;
  backdrop-filter: blur(26px) saturate(1.35);
  -webkit-backdrop-filter: blur(26px) saturate(1.35);
}

.brand {
  border-color: var(--line-soft);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.brand-title {
  color: var(--text);
  font-weight: 760;
}

.brand-sub,
.global-header p,
.quick-search-title span,
.create-panel summary em,
.record-month-head span,
.field-note {
  color: var(--muted);
}

.sidebar-toggle {
  border-color: var(--line-soft);
  border-radius: 999px;
  color: var(--blue);
  background: rgba(255, 255, 255, 0.66);
  box-shadow: none;
}

.sidebar-toggle:hover {
  background: rgba(0, 122, 255, 0.1);
  border-color: rgba(0, 122, 255, 0.18);
}

.nav {
  gap: 4px;
}

.nav-section {
  display: grid;
  gap: 4px;
}

.nav-section-label {
  margin: 8px 10px 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.nav-section:first-child .nav-section-label {
  margin-top: 0;
}

.nav button {
  min-height: 38px;
  border-radius: 10px;
  color: #4a4a4f;
  font-weight: 650;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav button:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.045);
  border-color: transparent;
  transform: none;
}

.nav button.active {
  color: #0040dd;
  border-color: rgba(0, 122, 255, 0.12);
  background: rgba(0, 122, 255, 0.13);
  box-shadow: none;
}

.sidebar-collapsed .nav button.active {
  box-shadow: none;
}

@media (max-width: 1100px) {
  .nav {
    display: block;
    gap: 8px;
  }

  .nav-section {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }

  .nav-section-label {
    display: block;
    grid-column: 1 / -1;
    margin: 4px 10px 0;
  }
}

.main {
  padding-top: 22px;
}

.record-shell .main {
  background: var(--bg);
}

.global-header {
  border-bottom-color: var(--line-soft);
  background: var(--apple-toolbar-bg);
  box-shadow: none;
  backdrop-filter: blur(24px) saturate(1.45);
  -webkit-backdrop-filter: blur(24px) saturate(1.45);
}

.global-header-info h1 {
  color: var(--text);
  font-weight: 780;
}

.role-pill,
.toolbar-chip,
.field-type-pill,
.setting-record-type,
.payroll-section-title em {
  color: #0040dd;
  background: rgba(0, 122, 255, 0.1);
}

.btn {
  min-height: 38px;
  border-color: transparent;
  border-radius: 10px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(0, 122, 255, 0.18);
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: none;
  background: #006ee6;
  box-shadow: 0 10px 24px rgba(0, 122, 255, 0.2);
}

.btn.secondary,
.preset-btn,
.month-mini-action,
.month-year-fold,
.quick-search-clear,
.calendar-title-group .btn,
.calendar-actions .btn,
.phone-eye,
.menu-action,
.menu-close {
  border-color: var(--line-soft);
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.btn.secondary:hover,
.preset-btn:hover,
.month-mini-action:hover,
.month-mini-action.active,
.month-year-fold:hover,
.record-month-year.open .month-year-fold,
.calendar-title-group .btn:hover,
.calendar-actions .btn:hover,
.phone-eye:hover,
.menu-action:hover,
.menu-action.active,
.menu-close:hover {
  color: #0040dd;
  border-color: rgba(0, 122, 255, 0.22);
  background: rgba(0, 122, 255, 0.09);
  box-shadow: none;
}

.quick-search-clear:hover:not(:disabled) {
  color: #0040dd;
  background: rgba(0, 122, 255, 0.1);
  transform: none;
}

.btn.danger {
  color: #fff;
  background: #ff3b30;
  box-shadow: 0 8px 18px rgba(255, 59, 48, 0.16);
}

.btn.danger:hover {
  background: #e92920;
}

.input,
.select,
.textarea,
.custom-select-button,
.check-dropdown summary,
.quick-search-box,
.payroll-total-box,
.filter-hint,
.immutable-input {
  border-color: rgba(0, 0, 0, 0.12);
  border-radius: 11px;
  color: var(--text);
  background: var(--apple-control-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.input:hover,
.select:hover,
.textarea:hover,
.custom-select-button:hover:not(:disabled),
.check-dropdown summary:hover,
.quick-search-box:hover {
  border-color: rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.86);
}

.input:focus,
.select:focus,
.textarea:focus,
.quick-search-box:focus-within,
.custom-select.is-open .custom-select-button,
.date-picker-input.is-open,
.month-picker-input.is-open,
.check-dropdown[open] summary {
  border-color: rgba(0, 122, 255, 0.58);
  box-shadow: 0 0 0 4px var(--apple-focus);
  background: #fff;
}

.field label,
.custom-field-main .field span,
.custom-field-advanced .field span,
.permission-toolbar strong,
.quick-search-title strong,
.create-panel summary strong,
.record-month-head strong,
.record-month-year-head strong,
.panel h2,
.chart-card h2,
.table-settings-section h3,
.table-settings-section h4 {
  color: var(--text);
  font-weight: 700;
}

.custom-select-popover,
.date-picker-popover,
.month-picker-popover,
.check-menu,
.column-menu,
.appointment-search-results {
  border-color: var(--line-soft);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(24px) saturate(1.35);
  -webkit-backdrop-filter: blur(24px) saturate(1.35);
}

.custom-select-popover button,
.date-picker-grid button,
.month-picker-grid button,
.check-option,
.filter-choice {
  border-radius: 10px;
}

.custom-select-popover button:hover:not(:disabled),
.custom-select-popover button.selected,
.date-picker-head button:hover,
.date-picker-actions button:hover,
.date-picker-grid button:hover,
.month-picker-grid button:hover,
.check-option:hover,
.filter-choice:hover,
.filter-choice.active,
.appointment-search-result:hover {
  color: #0040dd;
  background: rgba(0, 122, 255, 0.09);
}

.custom-select-popover button.selected,
.month-picker-grid button.selected,
.date-picker-grid button.selected {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.date-picker-head button,
.date-picker-actions button {
  color: var(--blue);
  background: rgba(0, 122, 255, 0.08);
}

.month-picker-grid button {
  border-color: var(--line-soft);
}

.record-toolbar .quick-search-panel,
.record-toolbar .record-month-panel,
.record-toolbar .record-create-panel,
.record-fixed-area .quick-search-panel,
.record-fixed-area .record-month-panel,
.record-fixed-area .create-panel {
  box-shadow: none;
}

.record-month-panel {
  background: rgba(255, 255, 255, 0.7);
}

.finance-period-switcher {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 8px;
  padding: 7px 9px;
  border: 1px solid rgba(221, 231, 244, 0.92);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
}

.finance-period-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.finance-period-note {
  color: var(--muted);
  font-size: 12px;
}

.month-check-chip,
.option-chip,
.tag-chip,
.status,
.permission-badge,
.group-stats span,
.metric-rule-head span,
.metric-rule-meta span,
.rule-condition-list span {
  border-color: transparent;
  border-radius: 999px;
  font-weight: 650;
}

.month-check-chip {
  color: #4a4a4f;
  background: rgba(255, 255, 255, 0.72);
}

.month-check-chip:hover,
.month-check-chip.active {
  color: #0040dd;
  border-color: rgba(0, 122, 255, 0.2);
  background: rgba(0, 122, 255, 0.1);
  box-shadow: none;
}

.month-check-chip input,
.filter-choice input,
.check-option input,
.column-visibility-toggle input,
.field-permission-row input {
  accent-color: var(--blue);
}

.status {
  color: #248a3d;
  background: rgba(52, 199, 89, 0.13);
}

.status.warn {
  color: #9a5a00;
  background: rgba(255, 159, 10, 0.16);
}

.tag-chip,
.option-chip {
  color: #3a3a3c;
  background: rgba(0, 0, 0, 0.055);
}

.sensitive-chip {
  color: var(--muted);
  background: rgba(0, 0, 0, 0.06);
}

.notice {
  color: #1f6f38;
  border-color: rgba(52, 199, 89, 0.22);
  background: rgba(52, 199, 89, 0.12);
}

.error {
  color: #b3261e;
  border-color: rgba(255, 59, 48, 0.22);
  background: rgba(255, 59, 48, 0.1);
}

.mini-stat,
.column-stats,
.metric-rule-card,
.dashboard-widget-config,
.dashboard-editor-side,
.dashboard-editor-preview,
.dashboard-widget-list,
.table-setting-form,
.table-fill-form,
.table-custom-field-form,
.setting-record-row,
.permission-condition,
.lookup-preview,
.appointment-lookup-strip,
.appointment-search-result,
.finance-rule-panel,
.payroll-variable-guide,
.formula-help,
.widget-source-grid div,
.editor-field-grid div {
  border-color: var(--line-soft);
  background: rgba(249, 249, 251, 0.86);
}

.smart-table-toolbar {
  border-color: var(--line-soft);
  background: rgba(249, 249, 251, 0.82);
}

table,
.smart-table {
  background: var(--panel-solid);
}

th,
.smart-table th,
.smart-table th::before,
.record-table-panel .smart-th.col-action {
  color: #3a3a3c;
  background: #f8f8fa;
}

td {
  color: #2c2c2e;
}

th,
td,
.smart-table th,
.smart-table td,
.profile-row,
.payroll-column-row,
.fixed-expense-row,
.field-permission-row {
  border-bottom-color: var(--line-soft);
}

.smart-table tbody tr:nth-child(even) td,
tbody tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.012);
}

tr:hover td,
.smart-table tbody tr:hover td,
.field-permission-row:hover {
  background: rgba(0, 122, 255, 0.045);
}

.smart-table tbody tr[data-smart-table-row][style]:hover td {
  filter: brightness(0.985);
}

.record-table-panel .smart-th.col-action,
.record-table-panel .smart-table td.col-action {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: -1px 0 0 var(--line-soft);
}

.record-table-panel .smart-th.col-action {
  background: #f8f8fa;
}

.th-button {
  color: #3a3a3c;
  font-weight: 700;
}

.th-button:hover,
.th-button.is-active {
  color: #0040dd;
  background: rgba(0, 122, 255, 0.08);
}

.th-button i {
  background: var(--blue);
}

.link-cell-btn,
.smart-table .link-cell-btn {
  border-color: rgba(0, 0, 0, 0.08);
  color: var(--text);
  background: rgba(0, 0, 0, 0.035);
  box-shadow: none;
}

.link-cell-btn:hover,
.smart-table .link-cell-btn:hover {
  color: #0040dd;
  border-color: rgba(0, 122, 255, 0.2);
  background: rgba(0, 122, 255, 0.09);
}

.calendar-main,
.calendar-toolbar,
.calendar-week-row,
.calendar-month-grid {
  border-color: var(--line-soft);
}

.calendar-main {
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--panel-solid);
  box-shadow: var(--shadow-soft);
}

.calendar-toolbar {
  background: rgba(249, 249, 251, 0.86);
}

.calendar-title-group h2 {
  color: var(--text);
  font-weight: 760;
}

.calendar-week-row {
  color: var(--muted);
  background: #f8f8fa;
}

.calendar-week-row div,
.calendar-cell {
  border-color: var(--line-soft);
}

.calendar-cell {
  background: #fff;
}

.calendar-cell:hover {
  background: rgba(0, 122, 255, 0.035);
}

.calendar-cell.outside {
  background: #fafafa;
}

.calendar-cell.today-cell {
  background: rgba(0, 122, 255, 0.075);
  box-shadow: inset 0 0 0 2px rgba(0, 122, 255, 0.5);
}

.today-cell .calendar-date-mark strong {
  background: var(--blue);
  box-shadow: none;
}

.calendar-date-mark span {
  color: #0040dd;
  background: rgba(0, 122, 255, 0.12);
}

.calendar-add {
  color: var(--blue);
  background: rgba(0, 122, 255, 0.1);
  box-shadow: none;
}

.calendar-cell:hover .calendar-add {
  background: rgba(0, 122, 255, 0.16);
  transform: none;
}

.calendar-event {
  border-color: rgba(0, 0, 0, 0.06);
  border-radius: 9px;
  box-shadow: none;
}

.calendar-event:hover {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  transform: none;
}

.calendar-more {
  color: #0040dd;
  border-color: rgba(0, 122, 255, 0.22);
  background: rgba(0, 122, 255, 0.08);
}

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

.drawer {
  width: min(800px, calc(100% - 18px));
  height: calc(100% - 18px);
  margin: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: -18px 0 54px rgba(0, 0, 0, 0.18);
}

.drawer-head,
.settings-detail[open] > summary,
.create-panel[open] summary,
.permission-module-detail[open] .permission-card-summary {
  border-bottom-color: var(--line-soft);
  background: rgba(249, 249, 251, 0.82);
}

.drawer-head h2 {
  color: var(--text);
  font-weight: 780;
}

.detail-item {
  border-color: var(--line-soft);
  background: rgba(249, 249, 251, 0.88);
  border-radius: 14px;
}

.detail-item strong {
  color: var(--text);
}

.create-panel summary b {
  color: #0040dd;
  background: rgba(0, 122, 255, 0.09);
}

.create-panel[open] summary {
  border-radius: 16px 16px 0 0;
}

.permission-badge.level-manage {
  color: #0040dd;
  background: rgba(0, 122, 255, 0.1);
}

.permission-badge.level-edit {
  color: #248a3d;
  background: rgba(52, 199, 89, 0.13);
}

.permission-badge.level-view {
  color: #9a5a00;
  background: rgba(255, 159, 10, 0.16);
}

.permission-badge.level-none {
  color: var(--muted);
  background: rgba(0, 0, 0, 0.055);
}

.option-row,
.column-quick-item,
.profile-table-head,
.payroll-column-head,
.fixed-expense-head,
.field-permission-head {
  border-color: var(--line-soft);
  background: rgba(249, 249, 251, 0.9);
}

.profile-row.is-saved {
  background: rgba(52, 199, 89, 0.08);
}

.payroll-reminder {
  color: #9a5a00;
  border-color: rgba(255, 159, 10, 0.22);
  background: rgba(255, 159, 10, 0.12);
}

.payroll-total-box strong {
  color: var(--blue);
}

.active-soft {
  background: var(--blue) !important;
}

@media (max-width: 900px) {
  .panel,
  .card,
  .record-table-panel,
  .table-wrap,
  .smart-table-wrap,
  .settings-detail,
  .table-settings-panel,
  .calendar-main,
  .quick-search-panel,
  .table-filters,
  .filters {
    border-radius: 14px;
  }

  .drawer {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    border-right: 0;
    border-top: 0;
    border-bottom: 0;
  }

  .sidebar {
    background: rgba(242, 242, 247, 0.92);
  }
}

.calendar-mobile-header,
.mobile-global-bar,
.mobile-agenda-panel {
  display: none;
}

.calendar-date-trigger {
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.calendar-date-mark i {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  color: #0040dd;
  background: rgba(0, 122, 255, 0.1);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.calendar-cell.selected-cell {
  background: rgba(0, 122, 255, 0.05);
  box-shadow: inset 0 0 0 2px rgba(0, 122, 255, 0.28);
}

.calendar-cell.selected-cell .calendar-date-mark strong {
  color: #fff;
  background: var(--blue);
}

@media (max-width: 720px) {
  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
    scrollbar-width: none;
  }

  .nav-section {
    display: contents;
  }

  .nav-section-label {
    display: none;
  }

  .nav button {
    flex: 1 0 calc((100% - 40px) / 6);
    justify-content: center;
    width: auto;
    min-width: 0;
    max-width: calc((100% - 40px) / 6);
    min-height: 36px;
    padding: 7px 4px;
    border-radius: 999px;
    white-space: nowrap;
    font-size: 12px;
  }

  .nav button span,
  .sidebar-collapsed .nav button span {
    display: none;
  }

  .nav button::before,
  .sidebar-collapsed .nav button::before {
    content: attr(data-short);
  }

  .app-shell.view-appointments {
    display: block;
    min-height: 100dvh;
    background: #f5f5f7;
  }

  .app-shell.view-appointments .sidebar {
    display: none;
  }

  .app-shell.view-appointments .global-header {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 0;
    padding: 10px 12px;
  }

  .app-shell.view-appointments .main {
    min-height: 100dvh;
    padding: 0;
    overflow: visible;
    background: #f5f5f7;
  }

  .app-shell.view-appointments .message,
  .app-shell.view-appointments .error {
    margin: 10px 12px;
  }

  .view-appointments .calendar-shell {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 100dvh;
  }

  .calendar-mobile-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 60px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(245, 245, 247, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .calendar-mobile-title {
    display: grid;
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
  }

  .calendar-mobile-title span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  .calendar-mobile-title strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 20px;
    font-weight: 760;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .calendar-mobile-icon,
  .calendar-mobile-add,
  .calendar-mobile-today,
  .calendar-mobile-menu summary {
    display: inline-grid;
    place-items: center;
    height: 38px;
    border: 0;
    border-radius: 999px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    font-weight: 760;
  }

  .calendar-mobile-icon,
  .calendar-mobile-add,
  .calendar-mobile-menu summary {
    width: 38px;
    font-size: 26px;
    line-height: 1;
  }

  .calendar-mobile-icon.next {
    order: 6;
  }

  .calendar-mobile-today {
    width: auto;
    padding: 0 10px;
    color: #0040dd;
    font-size: 13px;
  }

  .calendar-mobile-add {
    color: #fff;
    background: var(--blue);
    box-shadow: none;
  }

  .calendar-mobile-menu {
    position: relative;
    flex: 0 0 auto;
  }

  .calendar-mobile-menu summary {
    list-style: none;
    cursor: pointer;
    font-size: 22px;
  }

  .calendar-mobile-menu summary::-webkit-details-marker {
    display: none;
  }

  .calendar-mobile-menu > div {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    display: grid;
    gap: 4px;
    width: 174px;
    padding: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.14);
  }

  .calendar-mobile-menu button {
    justify-content: flex-start;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    color: var(--text);
    background: transparent;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
  }

  .calendar-mobile-menu button.active {
    color: #0040dd;
    background: rgba(0, 122, 255, 0.1);
  }

  .view-appointments .calendar-main {
    order: 1;
    border: 0;
    border-radius: 0;
    background: #f5f5f7;
    box-shadow: none;
  }

  .view-appointments .calendar-toolbar {
    display: none;
  }

  .view-appointments .calendar-week-row {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 8px 12px 4px;
    border-bottom: 0;
    color: var(--muted);
    background: #f5f5f7;
    font-size: 12px;
    font-weight: 650;
  }

  .view-appointments .calendar-week-row div {
    padding: 4px 0;
    border-right: 0;
    text-align: center;
  }

  .view-appointments .week-prefix {
    display: none;
  }

  .view-appointments .calendar-month-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px 0;
    padding: 0 12px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: #f5f5f7;
  }

  .view-appointments .calendar-cell {
    min-height: 65px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .view-appointments .calendar-cell:hover {
    background: transparent;
  }

  .view-appointments .calendar-cell.outside {
    background: transparent;
  }

  .view-appointments .calendar-cell.today-cell {
    background: transparent;
    box-shadow: none;
  }

  .view-appointments .calendar-cell-head {
    justify-content: center;
    margin: 0;
  }

  .view-appointments .calendar-add,
  .view-appointments .calendar-events {
    display: none;
  }

  .view-appointments .calendar-date-mark {
    display: grid;
    justify-items: center;
    gap: 3px;
    width: 100%;
    min-height: 61px;
    padding: 4px 0;
  }

  .view-appointments .calendar-date-mark strong {
    min-width: 36px;
    height: 36px;
    color: #1d1d1f;
    background: transparent;
    font-size: 21px;
    font-weight: 560;
  }

  .view-appointments .calendar-cell.outside .calendar-date-mark strong {
    color: #b0b3ba;
  }

  .view-appointments .calendar-date-mark span {
    min-height: 13px;
    padding: 0;
    color: #0040dd;
    background: transparent;
    font-size: 10px;
    font-weight: 760;
  }

  .view-appointments .calendar-date-mark i {
    width: 5px;
    min-width: 5px;
    height: 5px;
    padding: 0;
    color: transparent;
    background: #c2c7cf;
    font-size: 0;
  }

  .view-appointments .calendar-cell.selected-cell .calendar-date-mark strong {
    color: #fff;
    background: var(--blue);
    box-shadow: 0 8px 18px rgba(0, 122, 255, 0.22);
  }

  .view-appointments .calendar-cell.selected-cell .calendar-date-mark span {
    color: #0040dd;
  }

  .view-appointments .calendar-cell.selected-cell .calendar-date-mark i {
    background: var(--blue);
  }

  .mobile-agenda-panel {
    display: block;
    background: #fff;
  }

  .mobile-agenda-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff;
  }

  .mobile-agenda-head h3 {
    margin: 0;
    color: var(--text);
    font-size: 22px;
    font-weight: 780;
  }

  .mobile-agenda-head span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-agenda-list {
    display: grid;
    padding: 0 18px 22px;
    background: #fff;
  }

  .mobile-agenda-item {
    display: grid;
    grid-template-columns: 72px 4px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 16px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff;
  }

  .mobile-agenda-time {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.2;
  }

  .mobile-agenda-time strong {
    color: #1d1d1f;
    font-size: 18px;
    font-weight: 560;
  }

  .mobile-agenda-time span {
    color: #8a8d94;
  }

  .mobile-agenda-line {
    width: 4px;
    min-height: 58px;
    border-radius: 999px;
    background: var(--event-color, var(--blue));
  }

  .mobile-agenda-main {
    display: grid;
    min-width: 0;
    gap: 5px;
    border: 0;
    background: transparent;
    text-align: left;
  }

  .mobile-agenda-main strong {
    min-width: 0;
    overflow: hidden;
    color: #111827;
    font-size: 20px;
    font-weight: 680;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-agenda-main span {
    min-width: 0;
    overflow: hidden;
    color: #7a7d85;
    font-size: 16px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-agenda-actions {
    display: none;
  }

  .mobile-agenda-empty {
    padding: 34px 0 46px;
    color: #a1a1aa;
    font-size: 16px;
  }

  .view-appointments .calendar-side {
    display: none;
    order: 2;
    position: static;
    padding: 12px;
  }

  .view-appointments .calendar-shell.mobile-compose-open .calendar-side {
    display: grid;
  }

  .view-appointments .desktop-calendar-tools {
    display: none;
  }

  .view-appointments .compact-panel {
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
  }

  .view-appointments .calendar-shell,
  .view-appointments .calendar-main,
  .view-appointments .calendar-week-row,
  .view-appointments .calendar-month-grid,
  .view-appointments .mobile-agenda-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .view-appointments .mobile-global-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    box-sizing: border-box;
    padding: 6px 12px 6px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(245, 245, 247, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .mobile-global-brand {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    min-width: 0;
  }

  .mobile-global-brand strong {
    overflow: hidden;
    color: var(--text);
    font-size: 16px;
    font-weight: 760;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .view-appointments .calendar-mobile-header {
    top: 48px;
    width: 100%;
    min-width: 0;
  }

  .view-appointments .mobile-global-menu {
    flex: 0 0 auto;
    margin-left: auto;
  }

  .view-appointments .mobile-global-menu > div {
    top: calc(100% + 7px);
    right: 0;
    z-index: 70;
  }

  .nav {
    display: none;
  }

  .sidebar-toggle {
    display: inline-grid;
    place-items: center;
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
  }

  .app-shell.mobile-nav-open .nav {
    display: block;
    padding-bottom: 2px;
  }

  .app-shell.mobile-nav-open .nav-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
  }

  .app-shell.mobile-nav-open .nav-section-label {
    display: block;
    grid-column: 1 / -1;
    margin: 4px 4px 0;
    padding: 3px 0 1px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .app-shell.mobile-nav-open .nav button {
    flex: none;
    width: 100%;
    max-width: none;
    min-height: 34px;
  }

  .table-settings-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-settings-section {
    padding: 11px;
  }

  .table-settings-record-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .table-settings-subhead {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .table-setting-form-fields,
  .table-fill-form-fields {
    grid-template-columns: 1fr;
    grid-template-areas: none;
  }

  .table-fill-form-fields > * {
    grid-area: auto !important;
  }

  .table-rule-value-field {
    grid-column: auto;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
  }

  .filters > .date-preset-field,
  .filters > .field:has(.filter-hint) {
    grid-column: 1 / -1;
  }

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

  .grid-cards,
  .people-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metric,
  .compact-metric {
    min-height: 92px;
    padding: 12px;
  }

  .metric-label {
    font-size: 12px;
    line-height: 1.35;
  }

  .metric-value {
    margin-top: 10px;
    font-size: 27px;
  }
}

@media (max-width: 1100px) {
  .compact-entry-form,
  .lead-entry-form,
  .finance-entry-form {
    max-width: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .compact-entry-form > .field:has([name="customer_no"]),
  .compact-entry-form > .field:has([name="consult_date"]),
    .consultation-entry-form > .field:has([name="consultant"]),
    .consultation-entry-form > .field:has([name="customer_type"]),
    .consultation-entry-form > .field:has([name="consult_status"]),
  .lead-entry-form > .field:has([name="name"]),
  .lead-entry-form > .field:has([name="phone"]),
  .lead-entry-form > .field:has([name="lead_date"]),
  .lead-entry-form > .field:has([name="first_consult_date"]),
  .lead-entry-form > .field:has([name="direction"]) {
    grid-column: span 1;
  }

  .compact-entry-form > .field:has([name="customer_no"]),
  .compact-entry-form > .field.full,
  .compact-entry-form > button,
  .lead-entry-form > .field.full,
  .lead-entry-form > button {
    grid-column: 1 / -1;
  }

  .consultation-entry-form > .field:has([name="payment_method"]) {
    grid-column: 1 / -1;
  }

  .consultation-entry-form .consultation-lookup-preview,
  .consultation-customer-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .consultation-entry-form .consultation-lookup-preview .wide,
  .consultation-customer-preview .wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .section-tabs {
    top: 108px;
    margin: -4px -2px 12px;
    border-radius: 12px;
    padding: 5px;
  }

  .section-tab {
    min-height: 32px;
    padding: 6px 11px;
    font-size: 12px;
  }
}

/* Keep long KPI values inside their cards at every desktop zoom level. */
.metric-value-long {
  font-size: 29px !important;
}

.metric-value-medium {
  font-size: 30px !important;
}

.metric-value-xlong {
  font-size: 24px !important;
}

/* Settings option rows: size the controls around their content instead of the page width. */
.settings-grid {
  justify-items: stretch;
}

.settings-editor-panel,
.settings-detail {
  width: 100%;
  max-width: none;
}

.settings-detail .option-list {
  grid-template-columns: repeat(auto-fit, minmax(540px, 1fr));
  align-items: start;
}

.settings-detail .option-list > .brand-sub,
.settings-detail .option-list > .direction-create-grid,
.settings-detail .option-list > .direction-config-list {
  grid-column: 1 / -1;
}

.option-row {
  grid-template-columns: minmax(110px, 0.72fr) minmax(150px, 1fr) 38px auto auto;
  min-width: 0;
  width: 100%;
}

.option-row-editable {
  grid-template-columns: minmax(220px, 360px) 38px 56px 56px;
  justify-content: start;
}

.option-chip,
.option-name-field,
.option-name-input,
.option-row .brand-sub {
  min-width: 0;
}

.option-chip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.option-name-field {
  width: 100%;
}

.option-name-input {
  width: 100%;
}

.option-row .btn {
  min-width: 56px;
  padding-inline: 10px;
  white-space: nowrap;
}

.direction-config-list {
  min-width: 0;
}

.direction-topic-row {
  min-width: 0;
}

@media (min-width: 721px) {
  .direction-create-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .direction-primary-row {
    grid-template-columns: minmax(0, 1fr) 38px 56px 56px;
    justify-content: start;
  }

  .direction-primary-row .option-name-field {
    width: 100%;
  }

  .direction-topic-row {
    grid-template-columns: 86px minmax(0, 1fr) 66px 66px;
    justify-content: start;
  }
}

@media (max-width: 720px) {
  .settings-section-tabs {
    position: relative;
    top: auto;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .settings-section-tabs::-webkit-scrollbar {
    display: none;
  }

  .settings-section-tabs .section-tab {
    flex: 0 0 auto;
  }

  .settings-detail .option-list {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .direction-config-list {
    grid-template-columns: 1fr;
  }

  .option-row {
    grid-template-columns: minmax(0, 1fr) minmax(130px, 1.1fr) 36px;
    gap: 8px;
    padding: 8px;
  }

  .option-row .option-chip {
    grid-column: 1;
    align-self: end;
  }

  .option-row .option-name-field,
  .option-row > .brand-sub {
    grid-column: 2;
    align-self: end;
  }

  .option-row .color-input {
    grid-column: 3;
    align-self: end;
    width: 36px;
    height: 36px;
  }

  .option-row-editable {
    grid-template-columns: minmax(0, 1fr) 36px;
  }

  .option-row-editable .option-name-field {
    grid-column: 1;
  }

  .option-row-editable .color-input {
    grid-column: 2;
  }

  .option-row-editable button[type="submit"] {
    grid-column: 1;
  }

  .option-row-editable [data-delete-option-category] {
    grid-column: 2;
  }

  .option-row:has([data-delete-option-category]) button[type="submit"] {
    grid-column: 1;
  }

  .option-row button[type="submit"] {
    grid-column: 1 / -1;
  }

  .option-row [data-delete-option-category] {
    grid-column: 2;
  }

  .direction-topic-row {
    grid-template-columns: minmax(0, 1fr) 58px 58px;
  }

  .direction-topic-row .input {
    min-width: 0;
    width: 100%;
  }

  /* Keep editable setting actions in their own row; generic button rules
     must not let the save button span underneath delete. */
  .option-row-editable {
    grid-template-columns: minmax(0, 1fr) 56px;
    grid-template-areas:
      "name color"
      "save delete";
    align-items: end;
  }

  .option-row-editable .option-name-field {
    grid-area: name;
    grid-column: auto;
  }

  .option-row-editable .color-input {
    grid-area: color;
    grid-column: auto;
    justify-self: end;
  }

  .option-row-editable button[type="submit"] {
    grid-area: save;
    grid-column: auto;
    width: 100%;
  }

  .option-row-editable [data-delete-option-category] {
    grid-area: delete;
    grid-column: auto;
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .global-header,
  .record-shell .global-header,
  .app-shell.view-appointments .global-header {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .global-header-actions {
    justify-content: flex-start;
  }
}

/* Shared application navigation */
.app-shell {
  background: #f5f7fb;
}

.sidebar {
  top: 0;
  padding-top: 74px;
  background: #fff;
  overflow-y: auto;
}

.sidebar .brand { display: none; }
.nav button { gap: 10px; }
.nav button svg { width: 17px; height: 17px; flex: none; }
.sidebar-collapsed .nav button::before { content: none; }
.sidebar-collapsed .nav button span { display: none; }

.main,
.record-shell .main {
  padding-top: 80px;
}

.global-header,
.record-shell .global-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 90;
  height: 62px;
  margin: 0;
  padding: 0 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid #e3e9f2;
}

.global-header-info { display: flex; align-items: center; gap: 12px; }
.global-header-info h1,
.record-shell .global-header-info h1 { font-size: 17px; white-space: nowrap; }
.header-brand { font-size: 15px; font-weight: 800; color: #172b4d; white-space: nowrap; }
.header-brand span { margin-left: 10px; color: #73849c; font-size: 11px; font-weight: 500; }
.header-divider { height: 20px; border-left: 1px solid #dbe4f0; }
.header-sidebar-toggle,
.header-icon-button,
.header-profile-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 38px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid #dce5f1;
  border-radius: 7px;
  background: #fff;
  color: #1e4d98;
  cursor: pointer;
}
.header-sidebar-toggle svg,
.header-icon-button svg,
.header-profile-button svg { width: 18px; height: 18px; }
.header-profile-button span { font-size: 12px; font-weight: 700; }
.global-header-actions { flex-wrap: nowrap; }
.mobile-bottom-nav { display: none; }
.mobile-record-list { display: none; }

.customer-tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid #e2e9f3;
  border-radius: 8px;
  background: #fff;
  overflow-x: auto;
}
.customer-tabs button {
  flex: none;
  padding: 8px 16px;
  border: 0;
  border-radius: 5px;
  color: #566780;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}
.customer-tabs button.active { color: #1677ff; background: #eaf3ff; }

.workbench-page,
.more-page { display: grid; gap: 16px; max-width: 1200px; }
.workbench-page { max-width: none; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
.workbench-page > .workbench-section:first-child { grid-column: 1 / -1; }
.workbench-section,
.more-section { padding: 18px; background: #fff; border: 1px solid #e2e9f3; border-radius: 8px; }
.workbench-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.workbench-section-head h2,
.more-section h2 { margin: 0; font-size: 15px; color: #172b4d; }
.workbench-section-head span { color: #71819a; font-size: 12px; }
.workbench-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.workbench-metric { min-height: 94px; padding: 14px; border: 1px solid #dce7f7; border-radius: 6px; background: #f8fbff; text-align: left; color: #24436c; cursor: pointer; }
.workbench-metric span { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.workbench-metric svg { width: 16px; height: 16px; color: #1677ff; }
.workbench-metric strong { display: block; margin-top: 8px; color: #1677ff; font-size: 27px; }
.workbench-metric strong { overflow-wrap: anywhere; }
.workbench-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.workbench-quick button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 64px; border: 1px solid #dce7f7; border-radius: 6px; background: #f8fbff; color: #145dbd; cursor: pointer; font-weight: 700; }
.workbench-quick svg { width: 19px; height: 19px; }
.workbench-links button,
.more-section button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; border: 0; border-bottom: 1px solid #edf1f6; background: #fff; color: #253c5d; text-align: left; cursor: pointer; }
.workbench-links button:last-child,
.more-section button:last-child { border-bottom: 0; }
.workbench-links button span,
.more-section button span { flex: 1; }
.workbench-links svg,
.more-section svg { width: 18px; height: 18px; color: #1677ff; }

.profile-backdrop { position: fixed; inset: 0; z-index: 150; display: flex; justify-content: flex-end; background: rgba(22, 35, 55, .34); }
.profile-panel { width: min(390px, 100%); height: 100%; overflow-y: auto; padding: 20px; background: #fff; box-shadow: -12px 0 36px rgba(22, 35, 55, .14); }
.profile-panel > header { display: flex; align-items: flex-start; justify-content: space-between; }
.profile-panel h2 { margin: 0; font-size: 20px; }
.profile-panel header p { margin: 4px 0 0; color: #71819a; }
.profile-identity { display: flex; align-items: center; gap: 12px; margin: 20px 0; padding: 16px; background: #f5f9ff; border-radius: 7px; }
.profile-identity > span { color: #1677ff; }
.profile-identity svg { width: 34px; height: 34px; }
.profile-identity strong,
.profile-identity small { display: block; }
.profile-identity small { margin-top: 3px; color: #72819a; }
.profile-facts { margin: 0 0 18px; }
.profile-facts > div,
.profile-permissions > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #e9eef5; }
.profile-facts dt { color: #72819a; }
.profile-facts dd { margin: 0; font-weight: 700; }
.profile-sections { display: flex; border-bottom: 1px solid #dfe7f1; }
.profile-sections button { padding: 11px 16px; border: 0; background: #fff; cursor: pointer; }
.profile-sections button.active { color: #1677ff; box-shadow: inset 0 -2px #1677ff; }
.profile-permissions { padding: 10px 0 18px; }
.profile-password-form { display: grid; gap: 12px; padding: 18px 0; }
.profile-password-form label { display: grid; gap: 5px; font-weight: 700; }
.profile-logout { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 40px; margin-top: 14px; border: 1px solid #f4b8bb; border-radius: 7px; background: #fff; color: #c42d37; cursor: pointer; }
.profile-logout svg { width: 17px; height: 17px; }

@media (max-width: 720px) {
  .record-table-panel .smart-table-wrap[data-smart-table-scroll="leads"],
  .record-table-panel .smart-table-wrap[data-smart-table-scroll="consultations"],
  .panel .smart-table-wrap[data-smart-table-scroll="customers"] { display: none; }
  .mobile-record-list { display: grid; gap: 10px; margin-top: 10px; }
  .mobile-record-card { min-width: 0; padding: 12px; border: 1px solid #e4eaf2; border-radius: 8px; background: var(--row-fill, #fff); }
  .mobile-record-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
  .mobile-record-card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
  .mobile-record-card-title strong { font-size: 14px; overflow-wrap: anywhere; }
  .mobile-record-card-status { flex: none; }
  .mobile-record-card-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin-top: 10px; }
  .mobile-record-card-field { min-width: 0; }
  .mobile-record-card-field > span { display: block; margin-bottom: 3px; color: #748299; font-size: 11px; }
  .mobile-record-card-field > div { min-width: 0; color: #2c3a52; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
  .mobile-record-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 10px; padding-top: 9px; border-top: 1px solid #edf1f6; }
  .mobile-record-card-actions .action-group { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .mobile-record-group { display: grid; gap: 8px; }
  .mobile-record-group-title { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 10px; border: 1px solid #dce8f8; border-radius: 7px; background: #f4f8ff; color: #22538d; text-align: left; }
  .mobile-record-group-title span { margin-left: auto; }
  .mobile-record-empty { padding: 20px 12px; color: #748299; text-align: center; }
  .app-shell,
  .app-shell.sidebar-collapsed,
  .app-shell.view-appointments { display: block; min-height: 100dvh; }
  .app-shell .sidebar,
  .app-shell.view-appointments .sidebar { display: none; }
  .app-shell .main,
  .app-shell.record-shell .main,
  .app-shell.view-appointments .main { min-height: 100dvh; padding: 72px 12px 84px; overflow: visible; }
  .app-shell .global-header,
  .app-shell.record-shell .global-header,
  .app-shell.view-appointments .global-header { position: fixed; inset: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; height: 58px; margin: 0; padding: 0 12px; gap: 8px; }
  .global-header-info { gap: 0; }
  .header-sidebar-toggle,
  .header-brand,
  .header-divider,
  .header-profile-button span,
  .module-actions { display: none; }
  .global-header-info h1,
  .record-shell .global-header-info h1 { overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
  .header-icon-button,
  .header-profile-button { width: 36px; min-width: 36px; height: 36px; padding: 0; }
  .mobile-bottom-nav { position: fixed; inset: auto 0 0; z-index: 100; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); height: calc(62px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid #dfe7f1; background: #fff; }
  .mobile-bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: #63748f; font-size: 11px; cursor: pointer; }
  .mobile-bottom-nav button.active { color: #1677ff; font-weight: 800; }
  .mobile-bottom-nav svg { width: 21px; height: 21px; }
  .customer-tabs { width: 100%; box-sizing: border-box; }
  .customer-tabs button { flex: 1; padding: 8px 5px; white-space: nowrap; }
  .workbench-metrics,
  .workbench-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workbench-page { grid-template-columns: minmax(0, 1fr); }
  .workbench-page > .workbench-section:first-child { grid-column: auto; }
  .workbench-section,
  .more-section { padding: 14px; }
  .profile-panel { width: 100%; }
  .view-appointments .calendar-mobile-header { top: 58px; }
  .app-shell.view-appointments .calendar-shell { width: 100%; max-width: 100%; }
}

/* Brand selection and statistics overview. Keep chart series and data values distinct. */
:root {
  --brand: #e07e24;
  --brand-ink: #31200e;
  --brand-soft: #fff0e1;
}

.nav button.active {
  color: #91450d;
  border-color: #f1c59b;
  background: var(--brand-soft);
  box-shadow: inset 3px 0 0 var(--brand);
}
.sidebar-collapsed .nav button.active { box-shadow: inset 0 -3px 0 var(--brand); }
.customer-tabs button.active,
.profile-sections button.active,
.section-tab.active {
  color: #91450d;
  border-color: #f1c59b;
  background: var(--brand-soft);
  box-shadow: inset 0 -2px var(--brand);
}
.month-check-chip.active,
.month-mini-action.active,
.preset-btn.active {
  color: #91450d;
  border-color: #e9b37f;
  background: var(--brand-soft);
  box-shadow: none;
}

.view-dashboard .main { background: #eef5ff; }
.dashboard-page { display: grid; gap: 10px; min-width: 0; }
.dashboard-page .filters {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid #e2ebf8;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}
.dashboard-page .filters .field { min-width: 0; }
.dashboard-page .dashboard-filter-details { display: block; grid-column: 1 / -1; min-width: 0; }
.dashboard-page .dashboard-filter-fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; max-width: 900px; }
.dashboard-page .dashboard-filter-details > summary { display: none; }
.dashboard-page .filters .date-preset-field { grid-column: 1 / -1; min-width: 0; }
.dashboard-page .date-presets { display: flex; justify-content: flex-end; flex-wrap: nowrap; gap: 6px; overflow-x: auto; }
.dashboard-page .dashboard-date-control { position: relative; min-width: 0; }
.dashboard-page .dashboard-date-control input { padding-right: 32px; }
.dashboard-page .dashboard-date-control button { position: absolute; top: 0; right: 2px; display: grid; place-items: center; width: 30px; height: 100%; padding: 0; border: 0; background: transparent; color: #7188ab; cursor: pointer; }
.dashboard-page .dashboard-date-control button svg { width: 15px; height: 15px; }
.dashboard-page .preset-btn { flex: 0 0 auto; min-width: 66px; height: 30px; padding: 4px 10px; border-radius: 6px; }
.dashboard-page .preset-btn.active {
  color: var(--brand-ink);
  border-color: var(--brand);
  background: var(--brand);
  font-weight: 800;
}
@media (min-width: 1600px) {
  .dashboard-page .filters { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .dashboard-page .dashboard-filter-details { grid-column: 1; }
  .dashboard-page .filters .date-preset-field { grid-column: 2; }
}
.dashboard-page .dashboard-config-row {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 1px solid #e2ebf8;
  border-radius: 7px;
  background: #fff;
  box-shadow: none;
}
.dashboard-page .dashboard-config-row > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 9px 12px;
  list-style: none;
  cursor: pointer;
}
.dashboard-page .dashboard-config-row > summary::-webkit-details-marker { display: none; }
.dashboard-page .dashboard-config-row > summary::before { content: "▸"; color: #294a79; font-size: 13px; }
.dashboard-page .dashboard-config-row[open] > summary::before { content: "▾"; }
.dashboard-page .dashboard-config-row > summary span {
  display: flex;
  flex: 1;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px 9px;
  min-width: 0;
}
.dashboard-page .dashboard-config-row > summary strong { font-size: 13px; color: #1c3151; }
.dashboard-page .dashboard-config-row > summary em { color: #70819a; font-size: 11px; font-style: normal; }
.dashboard-page .dashboard-config-row > summary b {
  flex: none;
  padding: 5px 8px;
  border-radius: 5px;
  color: #97500f;
  background: var(--brand-soft);
  font-size: 11px;
}
.dashboard-page .dashboard-metrics-section,
.dashboard-page .dashboard-chart-layout,
.dashboard-page .dashboard-bottom-grid { min-width: 0; }
.dashboard-page .dashboard-metrics-section {
  padding: 12px;
  border: 1px solid #e2ebf8;
  border-radius: 8px;
  background: #fff;
}
.dashboard-page .dashboard-section-title { margin-bottom: 9px; color: #1c3151; font-size: 13px; font-weight: 800; }
.dashboard-page .dashboard-section-title small,
.dashboard-page .chart-card h2 small { color: #8a98ad; font-size: 11px; font-weight: 500; }
.dashboard-page .dashboard-metric-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.dashboard-page .metric {
  min-height: 99px;
  align-content: start;
  padding: 12px;
  border: 1px solid #dce8f8;
  border-radius: 7px;
  background: #fff;
  box-shadow: none;
}
.dashboard-page .metric-label { color: #3a5274; font-size: 12px; }
.dashboard-page .metric-value { margin-top: 7px; text-align: left; font-size: 27px; }
.dashboard-page .metric-comparison { margin-top: 6px; color: #7388a5; font-size: 11px; }
.dashboard-page .metric-comparison.up strong { color: #00875a; }
.dashboard-page .metric-comparison.down strong { color: #d13d55; }
.dashboard-page .dashboard-chart-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(260px, .8fr); gap: 10px; }
.dashboard-page .dashboard-bottom-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dashboard-page .dashboard-direction-card { grid-column: 1 / -1; }
.dashboard-page .chart-card { min-height: 0; min-width: 0; padding: 12px; border-radius: 8px; box-shadow: none; background: #fff; }
.dashboard-page .chart-card h2 { margin-bottom: 9px; font-size: 13px; }
.dashboard-page .dashboard-trend-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.dashboard-page .dashboard-trend-tabs button { min-width: 0; padding: 7px 3px; border: 0; border-radius: 5px; background: #eef4fd; color: #3b5984; font-size: 11px; cursor: pointer; }
.dashboard-page .dashboard-trend-tabs button.active { background: var(--brand); color: var(--brand-ink); font-weight: 800; }
.dashboard-page .dashboard-trend-card .trend-mini-card { min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.dashboard-page .dashboard-trend-card .trend-mini-card h3 { display: none; }
.dashboard-page .dashboard-trend-card .trend-mini-card svg { width: 100%; min-width: 0; height: auto; max-height: 250px; }
.dashboard-page .dashboard-channel-card .donut-wrap { grid-template-columns: 140px minmax(0, 1fr); gap: 10px; }
.dashboard-page .dashboard-channel-card .donut { width: 130px; height: 130px; }
.dashboard-page .dashboard-channel-card .donut::after { inset: 36px; }
.dashboard-page .dashboard-channel-card .legend-item > span { min-width: 0; }
.dashboard-page .dashboard-channel-card .legend-item strong { flex: 0 0 auto; white-space: nowrap; color: #31435b; font-variant-numeric: tabular-nums; }
.dashboard-page .dashboard-channel-card .legend-share { color: #61728b; font-weight: 500; }
.dashboard-page .dashboard-card-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.dashboard-page .dashboard-card-head button { border: 0; background: transparent; color: #aa5414; cursor: pointer; font-size: 11px; }
.dashboard-page .dashboard-ranking-card { overflow-x: hidden; }
.dashboard-page .dashboard-ranking-card table { width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; }
.dashboard-page .dashboard-ranking-card th:nth-child(1) { width: 8%; }
.dashboard-page .dashboard-ranking-card th:nth-child(2) { width: 15%; }
.dashboard-page .dashboard-ranking-card th:nth-child(3) { width: 19%; }
.dashboard-page .dashboard-ranking-card th:nth-child(4) { width: 14%; }
.dashboard-page .dashboard-ranking-card th:nth-child(5) { width: 16%; }
.dashboard-page .dashboard-ranking-card th:nth-child(6) { width: 13%; }
.dashboard-page .dashboard-ranking-card th:nth-child(7) { width: 15%; }
.dashboard-page .dashboard-ranking-card th,
.dashboard-page .dashboard-ranking-card td { overflow: hidden; padding: 7px 2px; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-page .dashboard-ranking-card th { position: static; }
.dashboard-page .dashboard-direction-bars { display: grid; gap: 7px; }
.dashboard-page .dashboard-direction-row { display: grid; grid-template-columns: minmax(65px, .8fr) minmax(45px, 1.2fr) auto; align-items: center; gap: 6px; min-width: 0; font-size: 11px; }
.dashboard-page .dashboard-direction-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-page .dashboard-direction-row strong { font-size: 10px; font-weight: 500; white-space: nowrap; }
.dashboard-page .dashboard-direction-track { height: 8px; border-radius: 4px; background: #edf3fc; overflow: hidden; }
.dashboard-page .dashboard-direction-track i { display: block; height: 100%; border-radius: inherit; background: #6d9df7; }

@media (max-width: 1000px) {
  .dashboard-page .dashboard-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-page .dashboard-chart-layout { grid-template-columns: minmax(0, 1fr); }
  .dashboard-page .dashboard-bottom-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .mobile-bottom-nav button.active { color: #97500f; }
  .dashboard-page .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-page .dashboard-filter-details { display: block; grid-column: 1 / -1; }
  .dashboard-page .dashboard-filter-details > summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    border: 1px solid #dce8f8;
    border-radius: 6px;
    background: #eef4fd;
    color: #245db1;
    font-size: 12px;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
  }
  .dashboard-page .dashboard-filter-details > summary::-webkit-details-marker { display: none; }
  .dashboard-page .dashboard-filter-details > summary svg { width: 15px; height: 15px; }
  .dashboard-page .dashboard-filter-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 10px; }
  .dashboard-page .date-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; overflow: visible; }
  .dashboard-page .preset-btn { min-width: 0; width: 100%; height: 30px; padding: 3px 2px; font-size: 11px; white-space: nowrap; }
  .dashboard-page .dashboard-metric-grid,
  .dashboard-page .dashboard-bottom-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-page .dashboard-bottom-grid .dashboard-direction-card { grid-column: 1 / -1; }
  .dashboard-page .dashboard-chart-layout { grid-template-columns: minmax(0, 1fr); }
  .dashboard-page .dashboard-trend-tabs { overflow-x: auto; display: flex; }
  .dashboard-page .dashboard-trend-tabs button { flex: 0 0 auto; min-width: 72px; }
  .dashboard-page .dashboard-channel-card .donut-wrap { grid-template-columns: 120px minmax(0, 1fr); }
  .dashboard-page .dashboard-channel-card .donut { width: 112px; height: 112px; }
  .dashboard-page .dashboard-channel-card .donut::after { inset: 32px; }
  .dashboard-page .dashboard-channel-card .legend-item { font-size: 11px; gap: 5px; }
  .dashboard-page .dashboard-ranking-card { grid-column: 1 / -1; }
  .dashboard-page .dashboard-config-row > summary em { display: none; }
  .dashboard-page .metric-value { font-size: 24px; }
}

/* Personnel analytics: compact summary, shared dashboard filter and charts. */
.people-analysis-page .people-metric-grid { display:grid; grid-template-columns:repeat(9,minmax(0,1fr)); gap:8px; }
.people-analysis-page .compact-metric { padding:12px; min-height:104px; border:1px solid #e1e9f5; border-radius:10px; box-shadow:none; text-align:left; }
.people-analysis-page .metric-label { display:flex; align-items:center; justify-content:space-between; gap:4px; font-size:12px; }
.people-analysis-page .metric-value { font-size:22px; font-weight:750; line-height:1.35; color:#172c4e; text-align:left; margin:4px 0; overflow-wrap:anywhere; }
.people-metric-icon { display:flex; padding:5px; border-radius:7px; background:#edf4ff; color:#2f7cf6; }
.people-metric-icon svg { width:16px; height:16px; }
.people-analysis-page .metric-comparison { font-size:11px; white-space:normal; }
.people-analysis-page .metric-comparison.up { color:#dc3545; }
.people-analysis-page .metric-comparison.down { color:#159766; }
.people-analysis-note { color:#7b879a; font-size:11px; margin:0 0 9px; line-height:1.6; }
.people-analysis-page .dashboard-chart-layout { margin-top:12px; }
.people-analysis-page .dashboard-trend-tabs { flex-wrap:wrap; }
.people-analysis-page .dashboard-trend-tabs button { min-width:75px; }
.people-analysis-page .people-analysis-section { margin-top:12px; }
@media (max-width:1200px) { .people-analysis-page .people-metric-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media (max-width:720px) {
  .people-analysis-page .people-metric-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
  .people-analysis-page .compact-metric { padding:9px 7px; min-height:94px; }
  .people-analysis-page .metric-value { font-size:19px; }
  .people-analysis-page .metric-label { font-size:11px; }
  .people-metric-icon { padding:3px; }
  .people-metric-icon svg { width:13px; height:13px; }
  .people-analysis-page .metric-comparison { font-size:10px; }
  .people-analysis-page .dashboard-chart-layout { grid-template-columns:minmax(0,1fr); }
  .people-analysis-page .dashboard-trend-tabs button { min-width:0; flex:1 0 26%; }
  .people-analysis-page .people-analysis-note { font-size:10px; }
}

.people-analysis-page { min-width:0; width:100%; max-width:100%; overflow:hidden; }
.people-analysis-page > *, .people-analysis-page .people-analysis-section { min-width:0; max-width:100%; }
.people-analysis-page .table-wrap { max-width:100%; overflow-x:auto; }
.people-analysis-page .metric:nth-child(n) .metric-value { color:#172c4e; }
.people-analysis-page .dashboard-trend-tabs { display:flex; }
.people-analysis-page .dashboard-trend-tabs button { flex:1 1 12%; }
@media (max-width:720px) {
  .people-analysis-page .dashboard-filter-details:not([open]) .dashboard-filter-fields { display:none; }
  .people-analysis-page .dashboard-trend-tabs button { flex:1 0 26%; white-space:nowrap; }
}

/* Appointment summary and detail drawer. */
.calendar-event-copy.calendar-event-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 5px;
  font-size: 12px;
  line-height: 1.5;
}
.calendar-event-summary strong,
.dense-events .calendar-event-summary strong {
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1.5;
}
.calendar-event-summary .calendar-event-customer {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}
.calendar-event-duration { white-space: nowrap; color: #536176; }
.calendar-event-consultant { overflow-wrap: anywhere; color: #536176; }
.appointment-edit-drawer { width: min(500px, 100%); padding: 22px; }
.appointment-edit-drawer .drawer-head h2 { font-size: 20px; }
.appointment-edit-drawer .brand-sub { margin-top: 6px; }
.appointment-identity,
.appointment-customer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.appointment-identity { padding: 0 0 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.appointment-edit-drawer .detail-item { min-width: 0; }
.appointment-edit-drawer .detail-item strong { overflow-wrap: anywhere; }
.appointment-detail-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.appointment-detail-form .appointment-duration-field { grid-column: 1 / -1; }
.appointment-detail-form .textarea { min-height: 88px; }
.appointment-detail-form .drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.appointment-detail-form .drawer-actions .btn { padding: 9px 12px; font-size: 13px; }
.appointment-customer-summary { margin-top: 24px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #f7faff; }
.appointment-customer-summary h3 { margin: 0 0 18px; font-size: 15px; }
.appointment-customer-summary h3 span { margin-left: 8px; font-size: 12px; font-weight: 400; color: #64748b; }
.appointment-customer-summary p { margin: 16px 0 0; font-size: 12px; line-height: 1.6; color: #64748b; }
@media (max-width: 720px) {
  .appointment-edit-drawer { padding: 16px; }
}
.calendar-event-copy.calendar-event-summary { display: block; }
.calendar-event-summary strong { display: inline; }
.calendar-event-progress { white-space: nowrap; }
.calendar-date-mark span { white-space: nowrap; }
.appointment-edit-drawer .detail-item { min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.appointment-customer-summary { padding: 16px; }
.appointment-customer-summary h3 { margin-bottom: 14px; }
.appointment-status-hint { margin: 0; color: #64748b; font-size: 12px; line-height: 1.6; }
.appointment-cancelled-tag { display: inline-block; padding: 0 4px; border-radius: 4px; background: #e5e7eb; color: #526071; font-size: 11px; font-weight: 600; white-space: nowrap; }

/* Desktop appointment workspace: compact controls, readable calendar, docked details. */
@media (min-width: 1101px) {
  .view-appointments .calendar-shell { grid-template-columns: 240px minmax(0, 1fr); gap: 14px; }
  .view-appointments .calendar-side { top: 76px; gap: 10px; max-height: calc(100vh - 92px); overflow-y: auto; scrollbar-width: thin; padding: 1px 3px 8px 1px; }
  .view-appointments .calendar-side > .field,
  .view-appointments .calendar-filter-list,
  .view-appointments .compact-panel { padding: 12px; border-radius: 12px; box-shadow: 0 3px 14px rgba(32, 56, 85, .035); }
  .view-appointments .calendar-side .input,
  .view-appointments .calendar-side .select,
  .view-appointments .calendar-side .custom-select-button { min-width: 0; min-height: 32px; padding: 6px 8px; font-size: 12px; border-radius: 7px; }
  .view-appointments .calendar-side .field label { font-size: 11px; margin-bottom: 4px; }
  .view-appointments .calendar-side .form-grid { gap: 9px; }
  .view-appointments .calendar-side .textarea { min-height: 58px; height: 58px; padding: 8px; font-size: 12px; }
  .view-appointments .calendar-side .appointment-start-control { grid-template-columns: minmax(0, 1fr) 82px; gap: 6px; }
  .view-appointments .calendar-side .duration-control { grid-template-columns: minmax(0, 1fr) 60px; gap: 6px; }
  .view-appointments .calendar-side h2 { font-size: 14px; margin: 0 0 12px; }
  .view-appointments .calendar-filter-title { gap: 4px; font-size: 13px; }
  .view-appointments .calendar-filter-title > span { white-space: nowrap; }
  .view-appointments .calendar-filter-actions { gap: 3px; }
  .view-appointments .calendar-filter-actions .btn { padding: 5px 6px; min-height: 27px; font-size: 11px; border-radius: 6px; white-space: nowrap; }
  .view-appointments .calendar-check { gap: 7px; min-height: 24px; margin: 2px 0; padding: 2px; font-size: 12px; }
  .view-appointments .appointment-lookup-strip { padding: 8px; font-size: 11px; }
  .view-appointments .calendar-main { min-width: 0; border: 1px solid #e6edf5; border-radius: 13px; box-shadow: 0 4px 20px rgba(32, 56, 85, .035); }
  .view-appointments .calendar-toolbar { padding: 12px 14px; gap: 8px; flex-wrap: wrap; background: #fff; }
  .view-appointments .calendar-title-group { gap: 8px; }
  .view-appointments .calendar-title-group h2 { font-size: 17px; white-space: nowrap; }
  .view-appointments .calendar-toolbar .btn { min-height: 30px; padding: 6px 10px; font-size: 12px; border-radius: 8px; }
  .view-appointments .calendar-title-group > [data-calendar-move] { width: 28px; min-height: 28px; padding: 0; border-radius: 50%; }
  .view-appointments .calendar-toolbar .calendar-today-button { color: #0875ec; background: #edf6ff; border-color: #e0efff; }
  .view-appointments .calendar-week-row,
  .view-appointments .calendar-month-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .view-appointments .calendar-week-row { background: #f8fafd; font-size: 11px; }
  .view-appointments .calendar-week-row > div { padding: 8px; }
  .view-appointments .calendar-cell { min-height: clamp(96px, calc((100vh - 205px) / 6), 150px); padding: 6px; border-color: #edf1f6; }
  .view-appointments .calendar-cell.outside { background: #fafbfd; }
  .view-appointments .calendar-cell.today-cell { background: #f4f9ff; box-shadow: inset 0 0 0 1px #83bcff; }
  .view-appointments .calendar-date-mark { gap: 3px; }
  .view-appointments .calendar-date-mark strong { min-width: 22px; height: 22px; font-size: 11px; }
  .view-appointments .calendar-date-mark span { padding: 2px 4px; font-size: 10px; }
  .view-appointments .calendar-add { width: 18px; height: 18px; min-width: 18px; font-size: 14px; }
  .view-appointments .calendar-event { min-height: 33px; gap: 5px; padding: 4px 6px 4px 0; border-radius: 6px; }
  .view-appointments .calendar-event-summary,
  .view-appointments .calendar-event-summary strong { font-size: 11px; line-height: 1.5; }
  .view-appointments .calendar-event.is-selected { outline: 2px solid #4b9bff; outline-offset: 1px; }
}
@media (min-width: 1600px) {
  .view-appointments .calendar-shell.has-appointment-detail { grid-template-columns: 230px minmax(0, 1fr) 350px; }
  .calendar-shell > .calendar-detail-panel { position: sticky; top: 76px; inset-inline: auto; bottom: auto; z-index: 20; display: block; min-width: 0; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .calendar-detail-panel .appointment-edit-drawer { width: 100%; height: auto; max-height: calc(100vh - 92px); margin: 0; padding: 16px; border: 1px solid #e6edf5; border-radius: 13px; background: #fff; box-shadow: 0 4px 20px rgba(32, 56, 85, .035); scrollbar-width: thin; }
  .calendar-detail-panel .drawer-head { margin-bottom: 14px; padding-bottom: 12px; }
  .calendar-detail-panel .drawer-head h2 { font-size: 17px; }
  .calendar-detail-panel .drawer-head .btn { padding: 5px 8px; min-height: 28px; font-size: 12px; }
  .calendar-detail-panel .appointment-identity { gap: 10px; padding-bottom: 14px; margin-bottom: 14px; }
  .calendar-detail-panel .appointment-detail-form { gap: 10px; }
  .calendar-detail-panel .input,
  .calendar-detail-panel .custom-select-button { min-width: 0; min-height: 32px; padding: 6px 8px; font-size: 12px; border-radius: 7px; }
  .calendar-detail-panel .field label { font-size: 11px; }
  .calendar-detail-panel .detail-item strong { font-size: 13px; }
  .calendar-detail-panel .detail-item > span { font-size: 11px; }
  .calendar-detail-panel .appointment-detail-form .textarea { min-height: 66px; height: 66px; font-size: 12px; }
  .calendar-detail-panel .drawer-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .calendar-detail-panel .drawer-actions .btn { padding: 7px 5px; font-size: 12px; min-height: 32px; }
  .calendar-detail-panel .appointment-customer-summary { margin-top: 16px; padding: 12px; }
  .calendar-detail-panel .appointment-customer-grid { gap: 12px; }
  .calendar-detail-panel .appointment-customer-summary h3 { font-size: 13px; }
}
@media (min-width: 1101px) {
  .view-appointments .calendar-event-consultant { display: inline-block; max-width: 100%; vertical-align: bottom; }
  .view-appointments .calendar-side form[data-form="appointment"] > button[type="submit"] { position: sticky; bottom: 0; z-index: 2; min-height: 34px; padding: 7px 10px; font-size: 12px; border-radius: 8px; box-shadow: 0 -4px 12px rgba(255, 255, 255, .9); }
}

/* Analytics visual hierarchy and consistent relative change semantics. */
.dashboard-page .metric-label { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12px; font-weight:600; color:#52647d; }
.dashboard-page .metric:nth-child(n) .metric-value { font-size:24px; line-height:1.3; font-weight:750; color:#1c304c; font-variant-numeric:tabular-nums; letter-spacing:-.4px; margin:5px 0 0; }
.dashboard-page .metric { text-align:left; }
.analytics-metric-icon { flex:0 0 auto; display:grid; place-items:center; width:30px; height:30px; border-radius:9px; border:1px solid currentColor; border-color:color-mix(in srgb,currentColor 12%,transparent); }
.analytics-metric-icon svg { width:19px; height:19px; stroke-width:1.8; }
.analytics-metric-icon.tone-blue { color:#3474d4; background:#edf4ff; }
.analytics-metric-icon.tone-cyan { color:#158697; background:#eaf7f8; }
.analytics-metric-icon.tone-amber { color:#b57b21; background:#fff6e7; }
.analytics-metric-icon.tone-violet { color:#7d5cb8; background:#f4effb; }
.dashboard-page .metric-comparison, .dashboard-page .metric-comparison.up, .dashboard-page .metric-comparison.down { display:flex; align-items:baseline; flex-wrap:wrap; gap:4px; color:#8290a4; font-size:11px; font-weight:400; }
.dashboard-page .metric-comparison strong { color:#8290a4; font-weight:650; }
.dashboard-page .metric-comparison.up strong { color:#d63849; }
.dashboard-page .metric-comparison.down strong { color:#159267; }
.dashboard-page .metric-comparison small { font-size:10px; color:#8290a4; }
.dashboard-page .dashboard-direction-bars { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px 36px; padding-top:12px; }
.dashboard-page .dashboard-direction-row { grid-template-columns:100px minmax(40px,1fr) 92px; gap:12px; font-size:12px; }
.dashboard-page .dashboard-direction-row strong { font-size:12px; font-weight:650; text-align:right; color:#344761; }
.dashboard-page .dashboard-direction-row strong small { font-size:11px; font-weight:400; color:#8290a4; }
.dashboard-page .dashboard-direction-track { height:9px; }
.dashboard-page .dashboard-direction-track i { background:#6594df; }
@media (max-width:1100px) { .dashboard-page .dashboard-direction-bars { grid-template-columns:minmax(0,1fr); } }
@media (max-width:720px) {
 .dashboard-page .metric:nth-child(n) .metric-value { font-size:21px; }
 .people-analysis-page .metric:nth-child(n) .metric-value { font-size:19px; }
 .dashboard-page .metric-label { font-size:11px; gap:4px; }
 .analytics-metric-icon { width:23px; height:23px; border-radius:7px; }
 .analytics-metric-icon svg { width:15px; height:15px; }
 .dashboard-page .metric-comparison { font-size:10px; gap:3px; }
 .dashboard-page .dashboard-direction-row { grid-template-columns:88px minmax(30px,1fr) 82px; gap:8px; font-size:11px; }
 .dashboard-page .dashboard-direction-row strong { font-size:11px; }
}
.appointment-customer-compact { padding: 10px; border: 1px solid #e4ecf6; border-radius: 9px; background: #f7faff; min-width: 0; }
.appointment-customer-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 12px; }
.appointment-customer-facts > div { min-width: 0; }
.appointment-customer-facts span,
.appointment-customer-extra span { display: block; color: #718096; font-size: 10px; line-height: 1.5; }
.appointment-customer-facts strong,
.appointment-customer-extra strong { display: block; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; color: #26364e; }
.appointment-customer-extra { margin-top: 8px; padding-top: 7px; border-top: 1px solid #e4ecf6; }
.appointment-customer-extra summary { cursor: pointer; color: #64748b; font-size: 11px; }
.appointment-customer-extra > div { margin-top: 7px; }

/* Full-width calendar with a shared appointment composer. */
.view-appointments .calendar-shell { grid-template-columns: minmax(0, 1fr); }
.calendar-topbar { grid-column: 1 / -1; display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 14px 16px; border: 1px solid #e6edf5; border-radius: 12px; background: #fff; }
.calendar-top-search { min-width: 0; margin: 0; }
.calendar-top-search label { font-size: 11px; }
.calendar-top-search .input { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.calendar-top-filters { min-width: 0; }
.calendar-top-filters .calendar-filter-title { justify-content: flex-start; gap: 12px; margin-bottom: 6px; font-size: 12px; }
.calendar-filter-chips { display: flex; flex-wrap: wrap; gap: 3px 12px; }
.view-appointments .calendar-filter-chips .calendar-check { min-height: 24px; margin: 0; padding: 2px; white-space: nowrap; font-size: 12px; }
.calendar-create-button { white-space: nowrap; min-height: 36px; padding: 9px 14px; font-size: 13px; }
.appointment-modal-backdrop { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 20px; background: rgba(22, 34, 51, .38); backdrop-filter: blur(3px); }
.appointment-modal { width: min(620px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; background: #fff; border: 1px solid #e3eaf3; border-radius: 16px; padding: 22px; box-shadow: 0 22px 80px rgba(15, 23, 42, .2); }
.appointment-modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid #e6edf5; }
.appointment-modal-head h2 { margin: 0; font-size: 20px; }
.appointment-modal-head .btn { min-height: 30px; padding: 5px 10px; }
.appointment-create-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.appointment-create-form .input,
.appointment-create-form .custom-select-button { min-width: 0; }
.appointment-create-form .appointment-start-control { grid-template-columns: minmax(0, 1fr) 100px; gap: 8px; }
.appointment-create-form .textarea { min-height: 78px; height: 78px; }
.appointment-create-form .appointment-customer-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.appointment-modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 14px; border-top: 1px solid #e6edf5; }
.appointment-modal-actions .btn { min-width: 110px; }
.appointment-modal-error { padding: 10px 12px; margin-bottom: 14px; color: #b42318; background: #fff1f0; border-radius: 8px; font-size: 13px; }
.appointment-success-modal { width: min(360px, 100%); padding: 32px 26px; text-align: center; }
.appointment-success-icon { display: grid; place-items: center; width: 60px; height: 60px; border: 8px solid #e5f8ef; border-radius: 50%; margin: 0 auto 18px; background: #28bc7d; color: #fff; font-size: 28px; }
.appointment-success-modal h2 { font-size: 21px; margin: 0 0 10px; }
.appointment-success-modal p { color: #64748b; font-size: 13px; line-height: 1.6; margin: 0 0 24px; }
.appointment-success-modal .btn { display: block; width: 100%; margin-top: 10px; }
body:has(.appointment-modal-backdrop) { overflow: hidden; }
@media (min-width: 1600px) {
  .view-appointments .calendar-shell.has-appointment-detail { grid-template-columns: minmax(0, 1fr) 350px; }
}
@media (max-width: 1100px) {
  .calendar-topbar { grid-template-columns: minmax(140px, 1fr) auto; gap: 12px; }
  .calendar-top-filters { grid-column: 1 / -1; grid-row: 2; }
  .calendar-create-button { grid-column: 2; grid-row: 1; }
}
@media (max-width: 720px) {
  .view-appointments .calendar-topbar { order: 0; padding: 12px; gap: 8px; }
  .view-appointments .calendar-mobile-header { display: none; }
  .view-appointments .calendar-toolbar { display: flex; flex-wrap: wrap; padding: 12px; gap: 10px; }
  .view-appointments .calendar-toolbar h2 { font-size: 16px; }
  .view-appointments .calendar-toolbar .btn { min-height: 28px; padding: 5px 8px; font-size: 12px; }
  .view-appointments .calendar-title-group { gap: 6px; }
  .appointment-modal-backdrop { padding: 10px; }
  .appointment-modal { padding: 16px; max-height: calc(100dvh - 20px); }
  .appointment-create-form { grid-template-columns: 1fr; }
  .appointment-create-form .appointment-customer-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .appointment-modal-actions .btn { flex: 1; min-width: 0; }
}
.appointment-create-fields { display: contents; border: 0; padding: 0; margin: 0; min-width: 0; }

/* Analytics tables: title-level actions and a lightly tinted header. */
.people-analysis-section > .section-head { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:10px; }
.people-analysis-section > .section-head > div:first-child { display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; min-width:0; }
.people-analysis-section .section-head h2 { margin:0; flex-shrink:0; }
.people-table-actions { display:flex; align-items:center; gap:7px; flex-shrink:0; }
.people-analysis-section .smart-table thead th { background:#edf3fc; border-bottom:1px solid #dbe5f3; color:#405675; }
.people-analysis-section .smart-table thead .th-button { color:inherit; }
.people-table-state { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:11px; color:#718098; margin:0 0 8px; }
@media (max-width:720px) {
 .people-analysis-section > .section-head { flex-wrap:wrap; gap:8px; }
 .people-analysis-section > .section-head > div:first-child { gap:4px; }
 .people-table-actions { margin-left:auto; }
 .people-table-actions .btn { padding:6px 9px; }
}
/* Match analytics shortcut typography to the surrounding labels. */
.dashboard-page .preset-btn { font-family:inherit; font-size:13px; font-weight:500; line-height:20px; letter-spacing:0; }
.dashboard-page .preset-btn.active { font-weight:600; }
@media (max-width:720px) {
 .dashboard-page .preset-btn { font-size:12px; }
}

/* Mobile agenda shares the desktop appointment summary and wraps within the card. */
@media(max-width:900px){
  .mobile-agenda-item{grid-template-columns:4px minmax(0,1fr);gap:12px}
  .mobile-agenda-main .calendar-event-accent{display:none}
  .mobile-agenda-main .calendar-event-summary{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 7px;white-space:normal;overflow:visible;font-size:16px;line-height:1.6}
  .mobile-agenda-main .calendar-event-summary strong{font-size:16px;line-height:1.6;font-weight:650;white-space:normal}
  .mobile-agenda-main .calendar-event-summary span{font-size:16px;line-height:1.6;white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere}
  .mobile-agenda-main .calendar-event-summary .calendar-event-customer{color:#172235;font-weight:650}
  .mobile-agenda-main .calendar-event-summary .calendar-event-progress{white-space:nowrap;color:#172235}
  .mobile-agenda-line{min-height:48px;height:100%}
}
