:root {
  color: #273142;
  background: #f3f5f8;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --ink: #273142;
  --muted: #6a7280;
  --line: #dbe1ea;
  --panel: #ffffff;
  --soft: #f7f9fc;
  --nav: #1f2c3d;
  --nav-2: #26364a;
  --accent: #c49336;
  --accent-2: #0f766e;
  --danger: #b42318;
  --shadow: 0 18px 54px rgba(24, 35, 52, 0.14);
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100vh; }
body { margin: 0; min-width: 320px; background: #f3f5f8; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

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

.login-panel {
  width: min(960px, 100%);
  min-height: 560px;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(11, 24, 44, 0.16);
}

.login-brand {
  display: grid;
  align-content: end;
  gap: 14px;
  padding: 56px;
  color: #f7f9fc;
  background:
    linear-gradient(145deg, rgba(255, 195, 84, 0.16), transparent 38%),
    linear-gradient(160deg, #253246, #182433);
}

.brand-kicker {
  color: #d0d7e4;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-size: 12px;
}

.login-brand h1 { font-size: clamp(34px, 5vw, 54px); letter-spacing: 0; }
.login-brand p { max-width: 420px; color: #cfd7e5; }

.login-form {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 56px 48px;
}

.login-form h2 { font-size: 28px; }
.field, .modal-form label, .filter-field {
  display: grid;
  gap: 8px;
  color: #5d6777;
  font-size: 14px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 147, 54, 0.14);
}

.primary-btn, .secondary-btn, .danger-btn, .ghost-btn, .icon-btn {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.primary-btn { background: #243246; color: #fff; box-shadow: 0 10px 24px rgba(36, 50, 70, 0.18); }
.secondary-btn { background: #eef3f8; color: #26364a; border-color: #d5deea; }
.danger-btn { background: #fff1f0; color: var(--danger); border-color: #ffd3cf; }
.ghost-btn { background: transparent; color: #5b6574; border-color: var(--line); }
.icon-btn { width: 40px; padding: 0; background: #f3f6fa; color: #26364a; border-color: #dce4ee; }
.primary-btn:hover, .secondary-btn:hover, .danger-btn:hover, .ghost-btn:hover, .icon-btn:hover {
  transform: translateY(-1px);
}
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}
button:disabled:hover {
  transform: none;
}
.full-width { width: 100%; }
.hint-text { color: var(--muted); font-size: 14px; }
.error-text { color: var(--danger); min-height: 20px; font-size: 14px; }
.site-filing {
  margin-top: -4px;
  color: #7b8493;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
.site-filing a {
  color: inherit;
  text-decoration: none;
}
.site-filing a:hover,
.site-filing a:focus-visible {
  color: #5b42da;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dashboard-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 254px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: linear-gradient(180deg, var(--nav), #182332);
  color: #eef3f8;
}

.sidebar-inner { display: grid; gap: 18px; padding: 24px 16px; }
.sidebar-header { display: flex; align-items: center; gap: 10px; }
.sidebar-brand {
  flex: 1 1 auto;
  min-height: 64px;
  display: grid;
  align-content: center;
  padding: 0 12px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}
.sidebar-brand span { color: #bfc9d8; font-size: 12px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; }
.sidebar-close { display: none; }

.sidebar-group-title {
  padding: 10px 12px 6px;
  color: #95a3b7;
  font-size: 12px;
}
.sidebar-nav { display: grid; gap: 6px; }
.sidebar-link {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #dbe4ef;
  display: grid;
  grid-template-columns: 12px 1fr;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  text-align: left;
}
.sidebar-link:hover, .sidebar-link.active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav-dot { width: 7px; height: 7px; border-radius: 999px; background: #7b8797; }
.sidebar-link.active .nav-dot { background: #ffc354; }

.main-shell { min-width: 0; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 249, 252, 0.94);
  backdrop-filter: blur(12px);
}
.topbar-main-row { min-width: 0; display: flex; align-items: center; gap: 12px; }
.topbar-title { display: grid; gap: 2px; }
.topbar-title h1 { font-size: 22px; }
.topbar-title span { color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}
.mobile-menu {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.content { min-width: 0; padding: 24px 28px 36px; display: grid; gap: 20px; align-content: start; }
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(30, 42, 60, 0.06);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid #eef2f7;
}
.panel-header h2 { font-size: 18px; }
.panel-actions, .row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.panel-body { padding: 20px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.stat-card {
  min-height: 110px;
  display: grid;
  gap: 8px;
  align-content: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { color: #1f2c3d; font-size: 26px; }

.home-stats-grid { margin-bottom: 16px; }
.home-overview-panel .panel-header { border-bottom: 0; padding-bottom: 8px; }
.home-overview-body {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  padding-top: 8px;
}
.home-overview-side {
  display: grid;
  gap: 12px;
}
.home-overview-tile {
  min-height: 104px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.home-overview-tile strong {
  color: #1f2c3d;
  font-size: 28px;
  line-height: 1;
}
.home-overview-tile span {
  color: var(--muted);
  font-size: 13px;
}
.home-overview-main {
  min-height: 330px;
  display: flex;
  align-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #4b5b70;
  background: #fff;
}

.collection-alert-panel {
  margin-top: 0;
}
.collection-alert-table-wrap {
  max-height: 300px;
  overflow-y: auto;
  border-top: 1px solid #eef2f7;
}
.collection-alert-table-wrap table {
  width: 100%;
  border-collapse: collapse;
}
.collection-alert-table-wrap th,
.collection-alert-table-wrap td {
  padding: 13px 14px;
}
.collection-alert-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.alert-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.alert-badge.info {
  background: #eaf2ff;
  color: #2360b7;
}
.alert-badge.warn {
  background: #fff2cf;
  color: #8a5b00;
}
.alert-badge.danger {
  background: #ffe4e6;
  color: #b42318;
}
.compact-empty {
  min-height: 140px;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
  align-items: end;
  gap: 12px;
}

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-btn {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #526073;
  padding: 8px 12px;
}
.tab-btn.active { background: #243246; color: #fff; border-color: #243246; }

.table-wrap { width: 100%; overflow: auto; border: 1px solid #edf1f6; border-radius: 8px; }
table { width: 100%; min-width: 860px; border-collapse: collapse; background: #fff; }
th, td { padding: 12px 14px; border-bottom: 1px solid #edf1f6; text-align: left; vertical-align: middle; font-size: 14px; }
th { color: #5e6876; background: #f7f9fc; font-weight: 600; }
td { color: #283446; }
tbody tr:hover { background: #fafcff; }
.selected-row,
.selected-row:hover { background: #eef6ff; }
.table-wrap table td:nth-child(2) { background: #f5f8fd; }
.table-wrap table th:nth-child(2) { background: #eef4ff; }
.table-link-button {
  border: 0;
  background: transparent;
  color: #1f5fae;
  font: inherit;
  font-weight: 600;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.table-link-button:hover { text-decoration: underline; }
.license-sales-table table { min-width: 980px; }
.license-detail-row,
.license-detail-row:hover { background: #f8fbff; }
.license-detail-row > td {
  padding: 14px;
  background: #f8fbff !important;
}
.license-detail-box {
  border: 1px solid #dfe8f5;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.license-detail-box h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #1f2d3d;
}
.license-detail-box .table-wrap { border-radius: 6px; }

.realtime-data-panel .panel-body {
  padding: 16px;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
.realtime-data-panel {
  height: calc(100vh - 132px);
  min-height: 560px;
  display: flex;
  flex-direction: column;
}
.realtime-sales-summary {
  margin-bottom: 12px;
}
.realtime-sales-summary.is-dual {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.realtime-sales-summary.is-dual .realtime-sales-card {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
}
.realtime-sales-summary.is-dual .realtime-sales-main strong {
  overflow-wrap: anywhere;
  font-size: clamp(32px, 3vw, 42px);
}
.realtime-sales-summary.is-dual .realtime-sales-metrics {
  min-width: 0;
}
.realtime-sales-card {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  border: 1px solid #d9e5f5;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 24px rgba(31, 44, 61, 0.08);
}
.realtime-sales-main {
  display: grid;
  gap: 8px;
}
.realtime-sales-main span {
  color: #64748b;
  font-size: 15px;
  font-weight: 700;
}
.realtime-sales-main strong {
  color: #172033;
  font-size: 42px;
  line-height: 1;
  letter-spacing: 0;
}
.realtime-sales-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  min-width: 280px;
}
.realtime-sales-metric {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid currentColor;
  background: #fff;
}
.realtime-sales-metric span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}
.realtime-sales-metric strong {
  font-size: 22px;
  line-height: 1.15;
}
.realtime-sales-metric.is-up {
  color: #dc2626;
  background: #fff7f7;
  border-color: #fecaca;
}
.realtime-sales-metric.is-down {
  color: #059669;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.realtime-sales-metric.is-neutral {
  color: #667085;
  background: #f8fafc;
  border-color: #dfe5ee;
}
.realtime-sales-note {
  grid-column: 1 / -1;
  color: #7a8798;
  font-size: 13px;
  margin-top: -6px;
}

@media (max-width: 900px) {
  .realtime-sales-summary.is-dual {
    grid-template-columns: minmax(0, 1fr);
  }
}

.same-time-cell {
  white-space: nowrap;
}

.same-time-cell.is-new {
  color: #dc2626;
  font-weight: 700;
}

.same-time-cell.is-both_zero,
.same-time-cell.is-pending {
  color: #8a94a6;
}

.same-time-cell.is-fallback {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.realtime-filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1.35fr) repeat(4, minmax(140px, 1fr)) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
}
.realtime-filter-bar .secondary-btn {
  min-width: 92px;
}
.realtime-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}
.realtime-table {
  min-width: 1900px;
}
.realtime-table th,
.realtime-table td {
  white-space: nowrap;
  padding: 10px 12px;
  font-size: 13px;
}
.realtime-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 1px 0 #e8edf4;
}
.realtime-table thead th.sorted {
  color: #1d5fd1;
}
.metric-sort-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 18px;
  padding: 0;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
}
.metric-sort-btn:hover,
.metric-sort-btn.active {
  color: #1d5fd1;
}
.metric-sort-icon {
  color: #7a8798;
  font-size: 12px;
  line-height: 1;
}
.metric-sort-btn.active .metric-sort-icon {
  color: #1d5fd1;
}
.realtime-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: #f8fafc;
  border-top: 1px solid #dfe7f1;
  border-bottom: 0;
  color: #1f2c3d;
  font-weight: 700;
  box-shadow: 0 -1px 0 #e8edf4;
}
.realtime-table .realtime-total-row:hover {
  background: #f8fafc;
}
.empty-state {
  min-height: 210px;
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}
.empty-state strong { color: #3b4656; font-size: 18px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf6f4;
  color: #0f766e;
  font-size: 12px;
}
.badge.off { background: #f2f4f7; color: #667085; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 25, 39, 0.46);
}
.modal {
  width: min(720px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}
.shop-modal,
.shop-import-modal {
  width: min(760px, 100%);
}
.user-access-modal {
  width: min(980px, 100%);
  max-height: min(92vh, 900px);
}
.shop-modal .modal-header,
.shop-import-modal .modal-header {
  align-items: flex-start;
}
.shop-modal input[data-shop-org-readonly] {
  background: #f5f7fb;
  color: #4b5568;
  cursor: not-allowed;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid #edf1f6;
}
.modal-form { display: grid; gap: 14px; padding: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  color: #344054;
}
.check-row input { width: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 0 20px 20px; }

.user-role-guide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.user-role-guide-card {
  display: grid;
  gap: 6px;
  min-height: 108px;
  padding: 14px;
  border: 1px solid #e4e7ec;
  border-radius: 9px;
  background: #fff;
}
.user-role-guide-card strong { color: #202939; }
.user-role-guide-card span,
.user-role-guide-card small { color: var(--muted); line-height: 1.45; }
.user-role-guide-card.protected { border-color: #d9d0ff; background: #f8f6ff; }
.user-scope-rule,
.user-scope-preview,
.user-fixed-finance-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #d9e5f5;
  border-radius: 9px;
  color: #344054;
  background: #f7faff;
}
.user-scope-rule { margin-bottom: 14px; }
.user-scope-rule span,
.user-scope-preview span,
.user-fixed-finance-note span { color: #667085; line-height: 1.55; }
.user-scope-preview.global { border-color: #f1d49a; background: #fffaf0; }
.user-fixed-finance-note { border-color: #d9d0ff; background: #f8f6ff; }
.user-permission-editor {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #fbfcfe;
}
.user-permission-editor-head,
.user-permission-section-title,
.user-permission-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.user-permission-editor-head h3,
.user-permission-editor-head p { margin: 0; }
.user-permission-editor-head p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.user-permission-tools span {
  min-width: 54px;
  color: var(--primary);
  font-weight: 700;
  text-align: right;
}
.user-permission-section { display: grid; gap: 9px; }
.user-permission-section + .user-permission-section { padding-top: 14px; border-top: 1px solid #edf1f6; }
.user-permission-section-title .ghost-btn { min-height: 30px; padding: 4px 9px; font-size: 12px; }
.user-access-modal .permission-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.user-access-modal .check-row { background: #fff; }
.user-access-modal .check-row.role-restricted { color: #8a8fa3; background: #f7f7fa; }
.user-access-modal .check-row [data-user-role-restriction] { margin-left: 4px; font-size: 12px; color: #b06b36; }

.user-management-overview .panel-body { display: grid; gap: 16px; }
.user-management-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.user-management-summary > div {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid #e7e2f0;
  border-radius: 11px;
  background: #fbfaff;
}
.user-management-summary span,
.user-management-summary small { color: #81798d; }
.user-management-summary strong { color: #272132; font-size: 22px; }
.user-management-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  padding: 5px;
  border: 1px solid #e8e3f1;
  border-radius: 12px;
  background: #f7f5fb;
}
.user-management-tab {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #625a70;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.user-management-tab small { color: #91899c; }
.user-management-tab:hover { border-color: #ded7ef; background: #fff; }
.user-management-tab.active { border-color: #cfc3fb; color: #5d40dc; background: #fff; box-shadow: 0 5px 14px rgba(82, 58, 173, .08); }
.user-management-content .panel-body { display: grid; gap: 14px; }
.user-management-filter {
  display: grid;
  grid-template-columns: minmax(210px, 1.5fr) repeat(5, minmax(125px, 1fr)) auto;
  align-items: end;
  gap: 10px;
}
.user-management-filter-actions { display: flex; gap: 7px; }
.user-management-filter-count { grid-column: 1 / -1; color: #81798d; font-size: 12px; }
.user-role-chain {
  display: grid;
  gap: 7px;
  padding: 15px;
  border: 1px solid #ded6f7;
  border-radius: 11px;
  background: #f8f6ff;
}
.user-role-chain span { color: #5d40dc; font-size: 16px; font-weight: 700; }
.user-role-chain small { color: #746c80; }

.manager-assignment-cell { display: grid; gap: 4px; min-width: 138px; }
.member-assignment-pending {
  display: inline-flex;
  width: max-content;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid #f1cf86;
  border-radius: 999px;
  color: #8a5b00;
  background: #fff8e7;
  font-size: 11px;
  font-weight: 700;
}
.user-relationships-page { display: grid; gap: 14px; }
.user-relationship-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e7e2f0;
  border-radius: 11px;
  background: #fbfaff;
}
.user-relationship-toolbar label { min-width: min(300px, 100%); }
.user-relationship-toolbar > span { align-self: center; color: #746c80; font-size: 13px; }
.segmented-control { display: inline-flex; padding: 3px; border: 1px solid #ded7ef; border-radius: 9px; background: #f4f1fa; }
.segmented-control button { min-height: 34px; padding: 6px 12px; border: 0; border-radius: 7px; color: #746c80; background: transparent; cursor: pointer; }
.segmented-control button.active { color: #5d40dc; background: #fff; box-shadow: 0 2px 8px rgba(82, 58, 173, .12); }
.user-relationship-tree { display: grid; gap: 12px; }
.user-relation-group {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid #e5e0ee;
  border-radius: 12px;
  background: #fff;
}
.user-relation-group-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #3f384a; }
.user-relation-group-title span { color: #81798d; font-size: 12px; }
.user-relation-node { display: grid; gap: 8px; }
.user-relation-person {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 12px;
  padding: 10px 12px;
  border: 1px solid #e7e2f0;
  border-left: 4px solid #8b70eb;
  border-radius: 9px;
  background: #fff;
}
.user-relation-person > div:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.user-relation-person > small { grid-column: 1; color: #81798d; line-height: 1.5; }
.user-relation-person > .row-actions { grid-column: 2; grid-row: 1 / span 2; justify-content: flex-end; }
.user-relation-node.role-6 > .user-relation-person { border-left-color: #43a38b; }
.user-relation-node.role-3 > .user-relation-person { border-left-color: #6b93d6; }
.user-relation-node.inactive > .user-relation-person { opacity: .68; background: #f8f7fa; }
.user-relation-children { display: grid; gap: 8px; margin-left: 23px; padding-left: 15px; border-left: 2px solid #e8e3f1; }
.user-scope-rule.warning { border-color: #f1cf86; background: #fffaf0; }
.user-operation-modal { width: min(860px, calc(100vw - 32px)); }
.user-operation-impact { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.user-operation-impact > div { display: grid; gap: 4px; padding: 12px; border: 1px solid #e7e2f0; border-radius: 10px; background: #fbfaff; }
.user-operation-impact span, .user-operation-impact small { color: #81798d; }
.user-operation-impact strong { color: #352d43; font-size: 22px; }
.user-subordinate-choice { display: grid; gap: 9px; padding: 13px; border: 1px solid #e1daef; border-radius: 10px; }
.user-subordinate-choice legend { padding: 0 6px; color: #493c61; font-weight: 700; }
.user-subordinate-choice > label { display: flex; align-items: center; gap: 8px; }
.user-subordinate-choice > label input[type="radio"] { width: auto; }
.user-subordinate-choice > label[data-user-subordinate-manager] { display: grid; align-items: stretch; margin-top: 4px; }
.user-operation-boundary { display: grid; gap: 4px; padding: 11px 13px; border: 1px solid #cfe4dc; border-radius: 9px; color: #285e50; background: #f3fbf8; }
.user-operation-boundary span { color: #527b70; line-height: 1.5; }
.user-operation-confirm { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid #f1c5c0; border-radius: 9px; background: #fff7f6; }
.user-operation-confirm input { width: auto; margin-top: 3px; }
.user-operation-confirm span { display: grid; gap: 3px; }
.user-operation-confirm small { color: #8b625e; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 44px));
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid #cce8df;
  border-radius: 10px;
  background: #f1fbf7;
  color: #164a3d;
  box-shadow: var(--shadow);
}
.toast.error { border-color: #ffd3cf; background: #fff1f0; color: #8a2118; }

.result-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}
.result-summary strong { color: var(--primary); font-size: 15px; }
.log-filter-bar {
  display: grid;
  grid-template-columns: 150px 170px minmax(220px, 1fr) auto auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 10px;
}
.logs-list { display: grid; gap: 10px; }
.log-item {
  display: grid;
  grid-template-columns: 170px 90px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
}
.log-copy-btn {
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--primary);
  background: #fff;
  font: inherit;
  cursor: pointer;
}

@media (max-width: 980px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 12;
    width: min(290px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.18s ease;
  }
  .dashboard-layout.nav-open .sidebar { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .realtime-sales-card { grid-template-columns: 1fr; }
  .realtime-sales-metrics { min-width: 0; }
  .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .realtime-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .note-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-role-guide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-access-modal .permission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .login-panel { grid-template-columns: 1fr; min-height: auto; }
  .login-brand, .login-form { padding: 32px 24px; }
  .topbar { padding: 12px 16px; align-items: flex-start; flex-wrap: wrap; }
  .topbar-title { flex: 1 1 100%; min-width: 0; }
  .topbar-title h1 { white-space: nowrap; }
  .topbar-actions { width: 100%; justify-content: flex-start; }
  .content { padding: 18px 14px 28px; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .stats-grid, .filter-bar, .realtime-filter-bar, .note-filter-bar, .form-grid, .permission-grid { grid-template-columns: 1fr; }
  .realtime-sales-card { padding: 18px; }
  .realtime-sales-main strong { font-size: 34px; }
  .realtime-sales-metrics { grid-template-columns: 1fr; }
  .log-filter-bar,
  .log-item { grid-template-columns: 1fr; }
  .user-role-guide,
  .user-access-modal .permission-grid { grid-template-columns: 1fr; }
  .user-permission-editor-head,
  .user-permission-section-title { align-items: flex-start; flex-direction: column; }
  .note-pagination { justify-content: flex-start; flex-wrap: wrap; }
}

/* 2026-07-17 运营组织、分级成员、登录审计与性能交互 */
.auth-loading-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 15%, #f1edff 0, transparent 36%), #f7f8fc;
}

.auth-loading-card {
  width: min(460px, 92vw);
  padding: 38px;
  border: 1px solid #e6e1f5;
  border-radius: 24px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 24px 70px rgba(51, 39, 88, .12);
  text-align: center;
}

.auth-loading-mark {
  display: inline-block;
  width: 54px;
  height: 54px;
  margin-bottom: 18px;
  border: 5px solid #ebe6ff;
  border-top-color: #7255f5;
  border-radius: 50%;
  animation: longgu-auth-spin .8s linear infinite;
}

.auth-loading-card h1 { margin: 6px 0; color: #292337; }
.auth-loading-card p { margin: 0; color: #7b7486; }
.auth-loading-bar { height: 4px; margin-top: 24px; overflow: hidden; border-radius: 999px; background: #eeeaf8; }
.auth-loading-bar i { display: block; width: 40%; height: 100%; border-radius: inherit; background: #7255f5; animation: longgu-auth-bar 1.2s ease-in-out infinite; }
.auth-retry-actions {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
}
.auth-retry-actions button { min-height: 44px; }
@keyframes longgu-auth-spin { to { transform: rotate(360deg); } }
@keyframes longgu-auth-bar { 0% { transform: translateX(-120%); } 100% { transform: translateX(360%); } }

.module-inline-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 18px 12px;
  padding: 10px 12px;
  border: 1px solid #f0c4a5;
  border-radius: 10px;
  color: #9a4c1f;
  background: #fff8f1;
}

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

.member-account-summary > div {
  display: grid;
  gap: 7px;
  min-height: 84px;
  padding: 15px;
  border: 1px solid #ebe7f4;
  border-radius: 12px;
  background: #fbfaff;
}

.member-account-summary span { color: #81798d; font-size: 12px; }
.member-account-summary strong { color: #272132; font-size: 15px; line-height: 1.45; }
.member-first-login, .security-flag {
  display: block;
  width: max-content;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #9b5a18;
  background: #fff1d7;
  font-size: 10px;
}

.member-status, .login-result {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.member-status.active, .login-result.success { color: #176746; background: #e4f7ed; }
.member-status.inactive, .login-result.failed { color: #a33b3b; background: #ffe9e9; }
.login-result.limited { color: #9b5a18; background: #fff0d3; }
.member-table-wrap, .member-shop-table-wrap { max-height: 480px; border: 1px solid #ece8f4; border-radius: 12px; }
.member-table-wrap thead th, .member-shop-table-wrap thead th { position: sticky; top: 0; z-index: 3; background: #f7f5fc; }
.member-table-wrap td small, .member-shop-table-wrap td small, .login-security-table td small { display: block; margin-top: 4px; color: #898293; }

.change-password-modal { width: min(720px, calc(100vw - 32px)); }
.change-password-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.collector-password-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 13px;
  border: 1px solid #f0c78f;
  border-radius: 12px;
  background: #fff9ef;
}
.collector-password-warning input { margin-top: 3px; }
.collector-password-warning span { display: grid; gap: 4px; }
.collector-password-warning small { color: #8c6a3a; line-height: 1.5; }

.operator-shop-modal { width: min(860px, calc(100vw - 32px)); }
.operator-shop-tools { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.operator-shop-tools label { flex: 1; }
.operator-shop-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 48vh; overflow: auto; padding: 2px; }
.operator-shop-list > label { display: flex; align-items: flex-start; gap: 10px; padding: 11px; border: 1px solid #e8e4f0; border-radius: 10px; background: #fff; }
.operator-shop-list > label:has(input:checked) { border-color: #9f8bf8; background: #f6f3ff; }
.operator-shop-list span { display: grid; gap: 3px; }
.operator-shop-list small { color: #867f91; }

.org-directory-manager { padding: 16px; border: 1px solid #e6e0f3; border-radius: 14px; background: #fbfaff; }
.org-directory-head, .org-department-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.org-directory-head > div:first-child, .org-department-title > div:first-child { display: grid; gap: 4px; }
.org-directory-head span, .org-department-title span { color: #81798c; font-size: 12px; }
.org-directory-head > div:last-child, .org-directory-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.org-directory-list { display: grid; gap: 12px; margin-top: 14px; }
.org-department-card { padding: 13px; border: 1px solid #e5e0ef; border-radius: 12px; background: #fff; }
.org-department-card.inactive, .org-group-item.inactive { opacity: .66; background: #f5f3f7; }
.org-group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 11px; }
.org-group-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; border: 1px solid #eeeaf4; border-radius: 10px; }
.org-group-item > div:first-child { display: grid; gap: 3px; }
.user-director-departments { grid-column: 1 / -1; }
.user-department-checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 7px; padding: 10px; border: 1px solid #e6e0f0; border-radius: 10px; }

.login-security-stats .stat-card strong { color: #2c2637; }
.login-security-filters { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.login-security-table { max-height: 620px; border: 1px solid #ece8f3; border-radius: 12px; }
.login-security-table thead th { position: sticky; top: 0; z-index: 3; background: #f7f5fb; }
.login-security-table code { color: #48405a; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.login-security-unusual { background: #fffaf1; }

.finance-ledger-view-tabs { margin-bottom: 14px; }
.finance-group-expense-heading { margin: 22px 0 10px; color: #3f384a; font-size: 15px; }
.finance-group-expense-summary { max-height: 280px; }
.finance-group-expense-details { max-height: 520px; }
.finance-group-expense-summary thead th, .finance-group-expense-details thead th { position: sticky; top: 0; z-index: 2; background: #f7f5fb; }
.finance-group-expense-reversal { background: #faf9fc; color: #746d7d; }
.finance-group-expense-reversal td:nth-child(5) { display: flex; align-items: center; gap: 7px; }
.finance-group-expense-reversal td:nth-child(5) strong { color: #7d718a; }

.performance-table-frame { position: relative; border: 1px solid #e6e1ef; border-radius: 12px; background: #fff; }
.performance-table { max-height: min(68vh, 720px); border: 0; border-radius: 12px 12px 0 0; }
.performance-table table { min-width: max-content; border-collapse: separate; border-spacing: 0; }
.performance-table thead th { position: sticky; top: 0; z-index: 5; min-width: 132px; background: #f7f5fb; }
.performance-table .performance-sticky-name { position: sticky; left: 0; z-index: 4; min-width: 190px; background: #fff; box-shadow: 1px 0 0 #e6e1ef; }
.performance-table thead .performance-sticky-name { z-index: 8; background: #f7f5fb; }
.performance-table .summary-row .performance-sticky-name { background: #f4f0ff; }
.performance-sort-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; font-weight: 700; cursor: pointer; }
.performance-sort-button i { color: #aaa2b8; font-style: normal; }
.performance-sort-button.active i { color: #6f50ed; }
.performance-bottom-scroll { position: sticky; bottom: 0; z-index: 9; height: 18px; overflow-x: auto; overflow-y: hidden; border-top: 1px solid #e7e2ee; background: #fff; }
.performance-bottom-scroll > div { height: 1px; }

@media (max-width: 1200px) {
  .user-management-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .user-management-filter-actions { align-self: end; }
}

@media (max-width: 900px) {
  .member-account-summary, .change-password-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .org-group-grid, .operator-shop-list { grid-template-columns: 1fr; }
  .login-security-filters { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .user-management-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-management-filter-actions { align-self: end; }
  .user-operation-impact { grid-template-columns: repeat(3, minmax(120px, 1fr)); overflow-x: auto; }
}

@media (max-width: 620px) {
  .member-account-summary, .change-password-grid, .login-security-filters { grid-template-columns: 1fr; }
  .org-directory-head, .org-department-title, .operator-shop-tools { align-items: stretch; flex-direction: column; }
  .user-management-summary, .user-management-tabs, .user-management-filter { grid-template-columns: 1fr; }
  .user-relation-person { grid-template-columns: 1fr; }
  .user-relation-person > small, .user-relation-person > .row-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; }
  .user-relation-children { margin-left: 10px; padding-left: 10px; }
  .user-operation-impact { grid-template-columns: 1fr; overflow: visible; }
}

.group-manager {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}
.group-manager-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.group-manager-title span { color: var(--muted); font-size: 13px; }
.group-add { display: flex; gap: 10px; flex-wrap: wrap; }
.group-add input { min-width: 220px; flex: 1; }
.group-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.group-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: #175cd3;
  font-size: 13px;
  border: 1px solid #c7ddff;
}
.group-tag button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #dbeafe;
  color: #175cd3;
  cursor: pointer;
}

.row-select {
  min-width: 110px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 0 8px;
  font-size: 13px;
}

.note-cover-cell { display: grid; gap: 10px; justify-items: start; min-width: 116px; }
.note-cover { width: 86px; height: 86px; object-fit: cover; border-radius: 7px; border: 1px solid #dbe3ef; display: block; background: #f5f7fb; box-shadow: 0 6px 14px rgba(31, 44, 61, 0.08); }
.note-cover-actions { display: flex; gap: 8px; flex-wrap: nowrap; }
.note-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #d5dfec;
  border-radius: 5px;
  background: #fff;
  color: #1f4f8f;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.note-action-btn:hover { border-color: #9db6d6; background: #f6f9fd; }
.note-action-btn.disabled {
  color: #98a2b3;
  border-color: #e4e7ec;
  background: #f8fafc;
  pointer-events: none;
  cursor: not-allowed;
}
.note-cover-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 86px;
  height: 86px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  text-align: center;
}
.mini-link { color: #2563eb; font-size: 12px; white-space: nowrap; }
.note-tabs-panel { padding: 12px; margin-bottom: 12px; }
.note-data-panel .panel-body { display: grid; gap: 12px; }
.note-import-notice {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #f2cf86;
  border-radius: 8px;
  background: #fffaf0;
  color: #7c5200;
}
.note-import-notice strong { color: #654300; }
.note-import-notice span { font-size: 13px; line-height: 1.55; }
.note-scope-notice {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #cfe0ff;
  border-radius: 8px;
  background: #f6f9ff;
  color: #41516d;
}
.note-scope-notice strong { color: #234a85; }
.note-scope-notice span { font-size: 13px; line-height: 1.55; }
.note-meta-pending {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #7357da;
  background: #f1edff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.realtime-note-snapshot {
  display: grid;
  gap: 3px;
  min-width: 164px;
}
.realtime-note-snapshot strong { color: #172033; white-space: nowrap; }
.realtime-note-snapshot span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.realtime-note-snapshot em {
  justify-self: start;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff0d9;
  color: #9a5a00;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}
.note-stats-grid { margin-bottom: 0; }
.note-total-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  white-space: nowrap;
}
.note-filter-scroll {
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
}
.note-filter-bar {
  display: grid;
  grid-template-columns: 280px repeat(6, 140px) 150px 150px 96px;
  align-items: end;
  gap: 10px;
  min-width: 1600px;
}
.note-filter-bar .filter-field {
  min-width: 0;
}
.note-filter-bar .secondary-btn { min-width: 88px; }
.table-sort-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.table-sort-btn.active {
  color: #1d4ed8;
}
.note-loading { margin: 0; }
.note-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}
.table-link { color: #2563eb; font-weight: 600; white-space: nowrap; }

.shop-score-table-frame {
  width: 100%;
  max-width: 100%;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.shop-score-table-wrap {
  max-width: 100%;
  max-height: calc(100vh - 330px);
  min-height: 360px;
  overflow: auto;
  position: relative;
  border: 0;
  border-radius: 0;
  scrollbar-gutter: stable both-edges;
}
.shop-score-table {
  width: max-content;
  min-width: 4300px;
  table-layout: auto;
}
.shop-score-table th,
.shop-score-table td {
  white-space: nowrap;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
  vertical-align: middle;
}
.shop-score-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: center;
  box-shadow: 0 1px 0 #e8edf4;
}
.shop-score-table thead tr:nth-child(2) th {
  top: 40px;
}
.shop-score-table thead tr:first-child th:nth-child(1),
.shop-score-table tbody td:nth-child(1) {
  width: 60px;
  min-width: 60px;
  text-align: center;
}
.shop-score-table thead tr:first-child th:nth-child(2),
.shop-score-table tbody td:nth-child(2) {
  width: 200px;
  min-width: 200px;
  max-width: 200px;
  white-space: normal;
  word-break: keep-all;
}
.shop-score-table thead tr:first-child th:nth-child(3),
.shop-score-table tbody td:nth-child(3) {
  width: 300px;
  min-width: 300px;
  max-width: 300px;
  white-space: normal;
  word-break: keep-all;
}
.shop-score-table thead tr:first-child th:nth-child(1),
.shop-score-table tbody td:nth-child(1),
.shop-score-table thead tr:first-child th:nth-child(2),
.shop-score-table tbody td:nth-child(2),
.shop-score-table thead tr:first-child th:nth-child(3),
.shop-score-table tbody td:nth-child(3) {
  position: sticky;
  background: #fff;
  z-index: 4;
}
.shop-score-table tbody td:nth-child(2) {
  background: #f5f8fd;
}
.shop-score-table thead tr:first-child th:nth-child(2) {
  background: #eef4ff;
}
.shop-score-table thead tr:first-child th:nth-child(1),
.shop-score-table tbody td:nth-child(1) {
  left: 0;
}
.shop-score-table thead tr:first-child th:nth-child(2),
.shop-score-table tbody td:nth-child(2) {
  left: 60px;
}
.shop-score-table thead tr:first-child th:nth-child(3),
.shop-score-table tbody td:nth-child(3) {
  left: 260px;
  box-shadow: 10px 0 18px rgba(27, 39, 56, 0.08);
}
.shop-score-table thead tr:first-child th:nth-child(1),
.shop-score-table thead tr:first-child th:nth-child(2),
.shop-score-table thead tr:first-child th:nth-child(3) {
  z-index: 7;
  background: #eef4ff;
}
.shop-score-table .group-head {
  background: #f0f5fb;
  color: #34445a;
}
.shop-score-table .score-prompt-cell {
  min-width: 190px;
  max-width: 240px;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.shop-score-table .score-level-cell {
  min-width: 72px;
  text-align: center;
}
.shop-score-table .score-percent-cell,
.shop-score-table .score-hours-cell {
  min-width: 112px;
  text-align: right;
}
.content,
.content > *,
.panel,
.panel-body,
.performance-table-frame {
  min-width: 0;
}
.performance-table-frame {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.performance-table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
.performance-table.dragging-scroll {
  cursor: grabbing;
}
.performance-table.dragging-scroll * {
  user-select: none;
}
.performance-table button,
.performance-table input,
.performance-table select,
.performance-table textarea,
.performance-table a {
  cursor: auto;
  user-select: auto;
}
.performance-table table {
  width: 2800px;
  min-width: 100%;
}
.performance-table th,
.performance-table td { white-space: nowrap; }
.performance-table th:first-child,
.performance-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  box-shadow: 1px 0 0 #e8edf4;
}
.performance-table thead th:first-child { background: #f3f6fa; z-index: 2; }
.performance-table .summary-row td {
  background: #f8fafc;
  font-weight: 700;
}
.accounts-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(360px, 0.85fr);
  gap: 16px;
  align-items: start;
}
.sub-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.sub-tab {
  border: 1px solid #d8e0ea;
  background: #fff;
  color: #344256;
  border-radius: 6px;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
}
.sub-tab.active {
  background: #1f2d3d;
  border-color: #1f2d3d;
  color: #fff;
}
.finance-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.finance-form .primary-btn {
  min-height: 42px;
}
.finance-filter-bar {
  align-items: end;
}
.finance-import {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid #e1e7ef;
  border-radius: 6px;
  background: #f8fafc;
}
.finance-import summary {
  cursor: pointer;
  font-weight: 700;
  color: #344256;
}
.finance-import form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.finance-import-tools {
  display: grid;
  grid-template-columns: max-content minmax(360px, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}
.finance-import-tools form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) max-content;
  gap: 10px;
  margin: 0;
}
.finance-import input[type="file"] {
  min-width: 0;
  width: 100%;
}
.finance-import textarea {
  min-height: 96px;
  resize: vertical;
}
@media (max-width: 1100px) {
  .finance-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .accounts-summary-grid { grid-template-columns: 1fr; }
  .home-overview-body { grid-template-columns: 1fr; }
  .home-overview-side { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-overview-main { min-height: 220px; }
}
@media (max-width: 680px) {
  .home-overview-side { grid-template-columns: 1fr; }
  .finance-form { grid-template-columns: 1fr; }
  .finance-import-tools,
  .finance-import-tools form { grid-template-columns: 1fr; }
}

/* 2026-06 UI refresh: visual-only overrides for the admin workspace. */
:root {
  --ink: #151c2f;
  --muted: #65748a;
  --line: #dfe5f2;
  --panel: #ffffff;
  --soft: #f6f8fc;
  --nav: #111827;
  --nav-2: #171225;
  --accent: #6d3df2;
  --accent-2: #0e9f6e;
  --danger: #dc2626;
  --warning: #b7791f;
  --border: #dfe5f2;
  --text: #151c2f;
  --table-head: #f7f9fd;
  --table-pin: #eee8ff;
  --table-pin-strong: #e6dcff;
  --shadow: 0 18px 48px rgba(20, 25, 42, 0.10);
  --soft-shadow: 0 10px 26px rgba(22, 28, 45, 0.07);
}

body {
  background:
    linear-gradient(180deg, #f8f9fd 0%, #eef2f8 100%);
  color: var(--ink);
}

.dashboard-layout {
  grid-template-columns: 216px minmax(0, 1fr);
  background: #f5f7fb;
}

.sidebar {
  background:
    radial-gradient(circle at 12% 0%, rgba(109, 61, 242, 0.22), transparent 28%),
    linear-gradient(180deg, #171225 0%, #111827 58%, #0d1522 100%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}

.sidebar-inner {
  gap: 16px;
  padding: 24px 16px 28px;
}

.sidebar-brand {
  min-height: 72px;
  padding: 2px 8px 12px;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: 0;
}

.sidebar-brand span {
  margin-top: 7px;
  display: inline-block;
  color: #b9c2d6;
  font-size: 11px;
  letter-spacing: 0.26em;
}

.sidebar-group-title {
  padding: 12px 8px 7px;
  color: #8792a8;
  font-size: 12px;
}

.sidebar-nav {
  gap: 5px;
}

.sidebar-link {
  min-height: 40px;
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 0;
  padding: 9px 12px;
  border-radius: 8px;
  color: #d7deeb;
  font-weight: 700;
  letter-spacing: 0;
}

.sidebar-link .nav-dot {
  display: none;
}

.sidebar-link span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-link.active {
  background: linear-gradient(135deg, #6d3df2, #7c3aed);
  color: #fff;
  box-shadow: 0 12px 26px rgba(109, 61, 242, 0.28);
}

.main-shell {
  background:
    linear-gradient(90deg, rgba(109, 61, 242, 0.07), transparent 34%),
    #f5f7fb;
}

.topbar {
  min-height: 68px;
  padding: 14px 26px;
  border-bottom: 1px solid #e8edf6;
  background: rgba(250, 251, 255, 0.92);
}

.topbar-title {
  gap: 3px;
}

.topbar-title h1 {
  color: #151c2f;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
}

.topbar-title span {
  color: #667085;
  font-size: 13px;
}

.user-pill {
  min-height: 36px;
  border-color: #dcd7f4;
  color: #4b5568;
  background: #fff;
  box-shadow: 0 6px 16px rgba(22, 28, 45, 0.05);
}

.content {
  padding: 20px 26px 34px;
  gap: 16px;
}

.panel {
  border-color: #dfe5f2;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--soft-shadow);
  overflow: hidden;
}

.panel-header {
  min-height: 70px;
  padding: 18px 18px;
  border-bottom-color: #eef2f8;
  background: linear-gradient(180deg, #fff 0%, #fbfcff 100%);
}

.panel-header h2 {
  color: #172033;
  font-size: 18px;
  font-weight: 800;
}

.panel-header .hint-text,
.panel-header p,
.panel-header span {
  color: #667085;
}

.panel-body {
  padding: 16px 18px 18px;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.ghost-btn,
.icon-btn,
.tab-btn,
.sub-tab,
.note-action-btn {
  border-radius: 8px;
  font-weight: 700;
}

.primary-btn {
  background: linear-gradient(135deg, #6d3df2, #7c3aed);
  box-shadow: 0 12px 24px rgba(109, 61, 242, 0.20);
}

.secondary-btn {
  background: #eef3f9;
  color: #26364a;
  border-color: #d7dfec;
}

.ghost-btn {
  background: #fff;
  color: #4b5568;
  border-color: #d9e0ed;
}

.tab-btn.active,
.sub-tab.active {
  background: linear-gradient(135deg, #26364a, #172033);
  border-color: #172033;
  color: #fff;
}

.sub-tabs {
  margin-bottom: 12px;
}

input,
select,
textarea {
  min-height: 40px;
  border-color: #d9e0ec;
  border-radius: 8px;
  background: #fff;
  color: #172033;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(109, 61, 242, 0.12);
}

.field,
.modal-form label,
.filter-field {
  color: #65748a;
  font-size: 13px;
  font-weight: 700;
}

.filter-bar,
.realtime-filter-bar,
.note-filter-bar,
.finance-filter-bar {
  padding: 0;
}

.stats-grid {
  gap: 12px;
}

.stat-card {
  min-height: 104px;
  border-color: #dfe5f2;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  box-shadow: var(--soft-shadow);
}

.stat-card span {
  color: #667085;
  font-weight: 700;
}

.stat-card strong {
  color: #172033;
  font-size: 28px;
  letter-spacing: 0;
}

.table-wrap {
  border-color: #e5eaf3;
  border-radius: 8px;
  background: #fff;
  scrollbar-gutter: stable;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  border-bottom-color: #e8edf5;
}

th {
  background: var(--table-head);
  color: #4b5568;
  font-size: 13px;
  font-weight: 800;
}

td {
  color: #253044;
  font-size: 13px;
}

tbody tr:hover {
  background: #fbf9ff;
}

.table-wrap table th:nth-child(2),
.table-wrap table td:nth-child(2) {
  background: var(--table-pin);
}

.table-link,
.table-link-button {
  color: #5b21b6;
  font-weight: 800;
}

.badge {
  min-height: 24px;
  padding: 3px 10px;
  background: #e8faf2;
  color: #047857;
  font-weight: 800;
}

.badge.off {
  background: #eef2f7;
  color: #64748b;
}

.realtime-data-panel {
  height: calc(100vh - 108px);
  min-height: 620px;
}

.realtime-data-panel .panel-body {
  padding: 16px 18px 18px;
}

.realtime-sales-summary {
  margin-bottom: 14px;
}

.realtime-sales-card {
  grid-template-columns: minmax(310px, 1.1fr) minmax(260px, 0.75fr);
  gap: 16px;
  padding: 24px 26px;
  border-color: #ded8f5;
  background:
    linear-gradient(135deg, rgba(109, 61, 242, 0.06), transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  box-shadow: 0 18px 34px rgba(24, 32, 51, 0.08);
}

.realtime-sales-main strong {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 0;
}

.realtime-sales-metric {
  min-height: 70px;
  border-width: 1px;
}

.realtime-sales-metric strong {
  font-size: 24px;
  font-weight: 900;
}

.realtime-filter-bar {
  grid-template-columns: minmax(260px, 1.4fr) repeat(4, minmax(135px, 1fr)) minmax(96px, auto);
  gap: 10px;
}

.realtime-table-wrap {
  border-color: #e5eaf3;
  background: #fff;
}

.realtime-table th,
.realtime-table td {
  padding: 12px 14px;
}

.realtime-table thead th {
  background: #f7f9fd;
}

.realtime-table th:nth-child(1),
.realtime-table td:nth-child(1) {
  width: 58px;
  min-width: 58px;
  text-align: center;
}

.realtime-table th:nth-child(2),
.realtime-table td:nth-child(2) {
  min-width: 220px;
  color: #4c1d95;
  font-weight: 900;
}

.realtime-table tbody tr:nth-child(even) td:not(:nth-child(2)) {
  background: #fcfdff;
}

.realtime-table tfoot td {
  background: #f8fafc;
}

.note-tabs-panel {
  padding: 12px 14px;
  background: #fff;
}

.note-filter-scroll {
  padding-bottom: 2px;
}

.note-filter-bar {
  grid-template-columns: minmax(280px, 1.25fr) repeat(6, minmax(138px, 1fr)) minmax(150px, 0.75fr) minmax(150px, 0.75fr) 100px;
  min-width: 1480px;
  gap: 10px;
}

.note-table-wrap {
  --note-pin-rank: 64px;
  --note-pin-cover: 170px;
  --note-pin-id: 170px;
  --note-pin-title: 280px;
  position: relative;
  width: 100%;
  height: min(720px, max(360px, calc(100dvh - 360px)));
  min-height: 360px;
  max-height: 720px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border-color: #dde3ed;
  border-radius: 10px;
  background: #fff;
}

.note-table-wrap.is-loading {
  cursor: progress;
  box-shadow: inset 0 2px 0 #7257f6;
}

.note-table-wrap tbody {
  transition: opacity 0.14s ease;
}

.note-table-wrap.is-loading tbody {
  opacity: 0.58;
}

.note-table-wrap.is-loading .table-sort-btn {
  cursor: progress;
}

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

.note-table th,
.note-table td {
  min-width: 112px;
  padding: 12px 14px;
  line-height: 1.35;
  vertical-align: middle;
}

.note-table thead th {
  position: sticky;
  top: 0;
  z-index: 6;
  height: 50px;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom: 1px solid #dde3ed;
  color: #525b6e;
  background: #f6f7fb;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.note-table thead th.note-head-anchor {
  color: #4f4670;
  background: #f1edff;
}

.note-table thead th.note-head-meta {
  color: #525b6e;
  background: #f6f7fb;
}

.note-table thead th.note-head-metric {
  color: #425676;
  background: #eef3fb;
}

.note-table thead th.note-head-account {
  color: #5d536b;
  background: #f3f1f8;
}

.note-table thead th[data-note-column="publishTime"],
.note-table thead th[data-note-column="accountName"] {
  border-left: 1px solid #d5dcea;
}

.note-table .table-sort-btn {
  width: auto;
  min-height: 50px;
  gap: 5px;
  white-space: nowrap;
}

.note-table .table-sort-btn:hover:not(:disabled) {
  color: #6045e7;
}

.note-table .table-sort-btn.active,
.note-table .table-sort-btn.is-pending {
  color: #6045e7;
  font-weight: 800;
}

.note-table .note-sort-icon {
  color: #9299aa;
  font-size: 12px;
  font-weight: 700;
}

.note-table .table-sort-btn.active .note-sort-icon,
.note-table .table-sort-btn.is-pending .note-sort-icon {
  color: #6045e7;
}

.note-table thead th.note-head-sort-active {
  box-shadow: inset 0 -2px #7257f6;
}

.note-table tbody td {
  height: 152px;
  border-bottom-color: #e5e9f1;
  background: #fff;
}

.note-table tbody tr:nth-child(even) td {
  background: #fcfdff;
}

.note-table tbody tr:hover td {
  background: #f8f6ff;
}

.note-table .note-table-empty-row td {
  height: 220px;
  background: #fff;
}

.note-table th[data-note-column="rank"],
.note-table td[data-note-column="rank"] {
  width: var(--note-pin-rank);
  min-width: var(--note-pin-rank);
  max-width: var(--note-pin-rank);
  text-align: center;
}

.note-table th[data-note-column="coverImageUrl"],
.note-table td[data-note-column="coverImageUrl"] {
  width: var(--note-pin-cover);
  min-width: var(--note-pin-cover);
  max-width: var(--note-pin-cover);
}

.note-table th[data-note-column="noteId"],
.note-table td[data-note-column="noteId"] {
  width: var(--note-pin-id);
  min-width: var(--note-pin-id);
  max-width: var(--note-pin-id);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-table th[data-note-column="title"],
.note-table td[data-note-column="title"] {
  width: var(--note-pin-title);
  min-width: var(--note-pin-title);
  max-width: var(--note-pin-title);
}

.note-table td[data-note-column="title"] {
  white-space: normal;
}

.note-table th[data-note-column="shopName"],
.note-table td[data-note-column="shopName"] {
  min-width: 160px;
}

.note-table th[data-note-column="publishTime"],
.note-table td[data-note-column="publishTime"],
.note-table th[data-note-column="collectedAt"],
.note-table td[data-note-column="collectedAt"] {
  min-width: 168px;
  white-space: nowrap;
}

.note-table th[data-note-column="dailyLikeIncrement"],
.note-table td[data-note-column="dailyLikeIncrement"],
.note-table th[data-note-column="totalLikes"],
.note-table td[data-note-column="totalLikes"],
.note-table th[data-note-column="notePaymentAmount"],
.note-table td[data-note-column="notePaymentAmount"],
.note-table th[data-note-column="leadLivePaymentAmount"],
.note-table td[data-note-column="leadLivePaymentAmount"],
.note-table th[data-note-column="noteOrderCount"],
.note-table td[data-note-column="noteOrderCount"],
.note-table th[data-note-column="leadLiveOrderCount"],
.note-table td[data-note-column="leadLiveOrderCount"] {
  min-width: 142px;
  white-space: nowrap;
}

.note-table th[data-note-column="leadLivePaymentAmount"],
.note-table td[data-note-column="leadLivePaymentAmount"] {
  min-width: 176px;
}

.note-table th[data-note-column="accountName"],
.note-table td[data-note-column="accountName"] {
  min-width: 142px;
}

.note-table th[data-note-column="accountId"],
.note-table td[data-note-column="accountId"] {
  min-width: 132px;
}

@media (min-width: 1024px) {
  .note-table th.note-sticky-col,
  .note-table td.note-sticky-col:not([colspan]) {
    position: sticky;
  }

  .note-table th.note-sticky-col {
    z-index: 10;
  }

  .note-table td.note-sticky-col:not([colspan]) {
    z-index: 4;
    background: #fcfbff;
  }

  .note-table tbody tr:nth-child(even) td.note-sticky-col:not([colspan]) {
    background: #faf9ff;
  }

  .note-table tbody tr:hover td.note-sticky-col:not([colspan]) {
    background: #f8f6ff;
  }

  .note-table .note-sticky-col-1 {
    left: 0;
  }

  .note-table .note-sticky-col-2 {
    left: var(--note-pin-rank);
  }

  .note-table .note-sticky-col-3 {
    left: calc(var(--note-pin-rank) + var(--note-pin-cover));
  }

  .note-table .note-sticky-col-4 {
    left: calc(var(--note-pin-rank) + var(--note-pin-cover) + var(--note-pin-id));
    border-right: 1px solid #d9d4e9;
    box-shadow: 10px 0 16px -14px rgba(63, 55, 93, 0.3);
  }

  .note-table thead th.note-head-sort-active.note-sticky-col-4 {
    box-shadow: inset 0 -2px #7257f6, 10px 0 16px -14px rgba(63, 55, 93, 0.3);
  }
}

@media (max-width: 1023px) {
  .note-table-wrap {
    height: min(58dvh, 520px);
    min-height: 320px;
  }

  .note-table th.note-sticky-col,
  .note-table td.note-sticky-col {
    left: auto;
  }
}

.note-cover {
  width: 86px;
  height: 86px;
  border-radius: 8px;
}

.note-action-btn {
  border-color: #dbe3ef;
  color: #4c1d95;
  background: #fff;
}

.shop-score-table-frame {
  border-color: #e5eaf3;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.shop-score-table-wrap {
  height: min(650px, calc(100vh - 306px));
  max-height: min(650px, calc(100vh - 306px));
  min-height: 390px;
  overflow-x: scroll;
  overflow-y: auto;
  background: #fff;
}

.shop-score-table {
  min-width: 3900px;
}

.shop-score-table th,
.shop-score-table td {
  padding: 12px 14px;
  line-height: 1.38;
}

.shop-score-table thead th {
  background: #f7f9fd;
  color: #4b5568;
  font-weight: 800;
}

.shop-score-table thead tr:nth-child(2) th {
  top: 43px;
}

.shop-score-table .group-head {
  background: #f4f7fb;
  color: #34445a;
}

.shop-score-table thead tr:first-child th:nth-child(1),
.shop-score-table tbody td:nth-child(1) {
  width: 62px;
  min-width: 62px;
}

.shop-score-table thead tr:first-child th:nth-child(2),
.shop-score-table tbody td:nth-child(2) {
  width: 210px;
  min-width: 210px;
  max-width: 210px;
  color: #4c1d95;
  font-weight: 900;
  background: var(--table-pin);
}

.shop-score-table thead tr:first-child th:nth-child(3),
.shop-score-table tbody td:nth-child(3) {
  width: 310px;
  min-width: 310px;
  max-width: 310px;
  background: #fff;
}

.shop-score-table thead tr:first-child th:nth-child(1),
.shop-score-table tbody td:nth-child(1) {
  left: 0;
}

.shop-score-table thead tr:first-child th:nth-child(2),
.shop-score-table tbody td:nth-child(2) {
  left: 62px;
}

.shop-score-table thead tr:first-child th:nth-child(3),
.shop-score-table tbody td:nth-child(3) {
  left: 272px;
  box-shadow: 12px 0 20px rgba(26, 32, 44, 0.10);
}

.shop-score-table thead tr:first-child th:nth-child(1),
.shop-score-table thead tr:first-child th:nth-child(2),
.shop-score-table thead tr:first-child th:nth-child(3) {
  background: #eef1f8;
}

.shop-score-table .score-prompt-cell {
  min-width: 210px;
  max-width: 260px;
}

.finance-form {
  gap: 12px;
  padding: 0 0 4px;
}

.finance-import {
  border-color: #e2e8f0;
  border-radius: 8px;
  background: #f9fbfe;
}

.finance-import summary {
  color: #26364a;
}

.finance-filter-bar {
  grid-template-columns: repeat(2, minmax(190px, 1fr)) minmax(110px, auto);
}

.finance-filter-bar .secondary-btn {
  min-width: 100px;
}

.finance-withdrawal-batch-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.finance-withdrawal-batch-picker select,
.ui-v2 .finance-withdrawal-batch-picker select {
  width: auto;
  min-width: 132px;
  min-height: 36px;
  padding: 7px 32px 7px 10px;
  font-size: 13px;
}

.finance-withdrawal-batch-picker select:disabled {
  color: #94a3b8;
  background: #f8fafc;
  cursor: not-allowed;
}

@media (max-width: 520px) {
  .finance-withdrawal-batch-picker {
    align-items: stretch;
    flex-direction: column;
  }

  .finance-withdrawal-batch-picker select,
  .ui-v2 .finance-withdrawal-batch-picker select {
    width: 100%;
  }
}

.finance-table-wrap table th:nth-child(1),
.finance-table-wrap table td:nth-child(1) {
  background: var(--table-pin);
  color: #4c1d95;
  font-weight: 900;
}

.finance-table-wrap table th:nth-child(2),
.finance-table-wrap table td:nth-child(2),
.finance-withdrawal-table-wrap table th:nth-child(2),
.finance-withdrawal-table-wrap table td:nth-child(2),
.finance-withdrawal-detail-wrap table th:nth-child(2),
.finance-withdrawal-detail-wrap table td:nth-child(2) {
  background: #fff;
  color: inherit;
  font-weight: inherit;
}

.finance-alert-panel {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin: 0 0 14px;
  padding: 16px 18px;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff7ed 0%, #fffaf5 48%, #ffffff 100%);
  box-shadow: 0 14px 32px rgba(154, 91, 19, 0.10);
}

.finance-alert-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f97316;
  color: #fff;
  font-size: 21px;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(249, 115, 22, 0.24);
}

.finance-alert-content {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.finance-alert-title {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: baseline;
}

.finance-alert-title strong {
  color: #7c2d12;
  font-size: 16px;
}

.finance-alert-title span,
.finance-alert-content p {
  color: #9a3412;
}

.finance-alert-content p {
  margin: 0;
  line-height: 1.6;
}

.finance-alert-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.finance-alert-preview-item,
.finance-alert-more,
.finance-alert-ok,
.finance-alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.2;
}

.finance-alert-preview-item {
  border: 1px solid rgba(249, 115, 22, 0.22);
  background: rgba(255, 255, 255, 0.78);
  color: #7c2d12;
}

.finance-alert-preview-item strong {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-alert-preview-item span,
.finance-alert-more {
  color: #9a3412;
}

.finance-alert-more {
  background: rgba(255, 237, 213, 0.78);
}

.finance-alert-row td {
  background: #fffaf4;
}

.finance-alert-row td:first-child {
  box-shadow: inset 3px 0 0 #f97316;
}

.finance-alert-cell {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

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

.finance-alert-badge {
  width: fit-content;
  background: #ffedd5;
  color: #9a3412;
  font-weight: 800;
}

.finance-alert-cell small {
  color: #9a3412;
  font-weight: 700;
}

.finance-alert-confirm-btn,
.finance-alert-calibrate-btn {
  width: fit-content;
  min-height: 30px;
  padding: 6px 10px;
  border-color: #fed7aa;
  background: #fff;
  color: #9a3412;
}

.finance-alert-confirm-btn:hover,
.finance-alert-calibrate-btn:hover {
  border-color: #fb923c;
  background: #fff7ed;
}

.finance-alert-calibrate-btn {
  border-color: #c7d2fe;
  color: #4c1d95;
  background: #f7f5ff;
}

.finance-alert-calibrate-btn:hover {
  border-color: #8b5cf6;
  background: #f3efff;
}

.finance-alert-ok {
  width: fit-content;
  background: #ecfdf3;
  color: #067647;
  font-weight: 800;
}

.finance-calibration-modal {
  max-width: 720px;
}

.finance-calibration-form {
  gap: 16px;
}

.finance-calibration-current {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid #e7ddff;
  border-radius: 10px;
  background: linear-gradient(135deg, #f7f5ff 0%, #ffffff 100%);
}

.finance-calibration-current span {
  color: #6b7280;
  font-size: 12px;
  font-weight: 800;
}

.finance-calibration-current strong {
  color: #4c1d95;
  font-size: 16px;
}

.finance-calibration-current p {
  margin: 0;
  color: #667085;
  line-height: 1.6;
}

.empty-state {
  color: #667085;
}

.toast {
  border-radius: 8px;
}

@media (max-width: 1200px) {
  .dashboard-layout {
    grid-template-columns: 204px minmax(0, 1fr);
  }

  .content {
    padding: 18px 18px 30px;
  }

  .realtime-sales-card {
    grid-template-columns: 1fr;
  }
}

/* Finance person balance ledger */
.finance-ledger-stats {
  margin-bottom: 16px;
}

.finance-ledger-increase-text,
.finance-ledger-increase,
.finance-ledger-delta.positive {
  color: var(--danger);
}

.finance-ledger-decrease-text,
.finance-ledger-decrease,
.finance-ledger-delta.negative {
  color: #087a52;
}

.finance-ledger-balance.positive {
  color: #087a52;
}

.finance-ledger-negative-text,
.finance-ledger-balance.negative {
  color: var(--danger);
}

.finance-ledger-filter-bar {
  grid-template-columns: minmax(150px, 0.7fr) minmax(260px, 1.6fr) auto;
  margin-bottom: 14px;
}

.finance-ledger-table-wrap table {
  min-width: 1180px;
}

.finance-ledger-table-wrap th,
.finance-ledger-table-wrap td {
  vertical-align: middle;
}

.finance-ledger-table-wrap th:nth-child(1),
.finance-ledger-table-wrap td:nth-child(1) {
  min-width: 140px;
}

.finance-ledger-table-wrap td:nth-child(1),
.finance-ledger-table-wrap td:nth-child(2) {
  background: inherit;
}

.finance-ledger-table-wrap td:nth-child(2),
.finance-ledger-table-wrap td:nth-child(3),
.finance-ledger-table-wrap td:nth-child(4) {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.finance-ledger-table-wrap td:nth-child(8) {
  min-width: 310px;
}

.finance-ledger-debt-badge,
.finance-ledger-status,
.finance-ledger-entry-kind,
.finance-ledger-reversed-mark {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.finance-ledger-debt-badge {
  margin-left: 7px;
  border-color: #ffc9c5;
  background: #fff1f0;
  color: var(--danger);
}

.finance-ledger-status.active {
  border-color: #a9e4c9;
  background: #effcf5;
  color: #087a52;
}

.finance-ledger-status.inactive {
  border-color: #d7dde5;
  background: #f3f5f8;
  color: #6a7280;
}

.finance-ledger-inactive-row {
  color: #7c8491;
  background: #fafbfc;
}

.finance-ledger-last-change small,
.finance-ledger-detail-table td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.finance-ledger-note {
  max-width: 240px;
  white-space: normal;
  word-break: break-word;
}

.finance-ledger-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.finance-ledger-increase-btn,
.finance-ledger-increase-submit {
  border-color: #ffd0cc;
  background: #fff6f5;
  color: #9f2d24;
}

.finance-ledger-decrease-btn,
.finance-ledger-decrease-submit {
  border-color: #a9e4c9;
  background: #effcf5;
  color: #087a52;
}

.finance-ledger-stop-btn {
  color: var(--danger);
}

.finance-ledger-modal {
  width: min(620px, calc(100vw - 32px));
}

.finance-ledger-details-modal {
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}

.finance-ledger-details-modal .accounting-modal-body {
  min-height: 180px;
  overflow: auto;
}

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

.finance-ledger-form-grid label small {
  color: var(--muted);
  font-size: 12px;
}

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

.finance-ledger-wide-field textarea {
  min-height: 82px;
}

.finance-ledger-balance-preview {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 16px;
  border: 1px solid #cfe0f1;
  border-radius: 10px;
  background: #f5f9fd;
  padding: 14px 16px;
}

.finance-ledger-balance-preview span {
  color: var(--muted);
}

.finance-ledger-balance-preview strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.finance-ledger-balance-preview small {
  grid-column: 1 / -1;
  min-height: 17px;
  color: var(--danger);
}

.finance-ledger-balance-preview.negative {
  border-color: #ffc9c5;
  background: #fff5f4;
}

.finance-ledger-balance-preview.negative strong {
  color: var(--danger);
}

.finance-ledger-submit-note {
  border-radius: 8px;
  background: #f7f9fc;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
}

.finance-ledger-form-error:empty {
  display: none;
}

.finance-ledger-detail-table table {
  min-width: 940px;
}

.finance-ledger-detail-table td:nth-child(2),
.finance-ledger-detail-table th:nth-child(2) {
  background: inherit;
}

.finance-ledger-entry-kind {
  border-color: #cfe0f1;
  background: #f2f7fc;
  color: #315470;
}

.finance-ledger-entry-kind.reversal {
  border-color: #ffd6a7;
  background: #fff7e9;
  color: #925d12;
}

.finance-ledger-reversed-mark {
  margin-top: 5px;
  border-color: #d7dde5;
  background: #f3f5f8;
  color: #6a7280;
}

.finance-ledger-load-more {
  display: flex;
  justify-content: center;
  padding-top: 14px;
}

.finance-ledger-all-entry-filter-bar {
  grid-template-columns: minmax(145px, 0.75fr) minmax(145px, 0.75fr) minmax(170px, 0.9fr) minmax(150px, 0.8fr) minmax(240px, 1.4fr) auto;
  margin-bottom: 12px;
}

.finance-ledger-all-entry-filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.finance-ledger-all-entry-filter-actions button {
  min-width: 74px;
}

.finance-ledger-all-entry-result {
  margin: 2px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.finance-ledger-all-entry-result strong {
  color: var(--accent);
  font-size: 15px;
}

.finance-ledger-all-entry-table-wrap table {
  min-width: 1220px;
}

.finance-ledger-all-entry-table-wrap th,
.finance-ledger-all-entry-table-wrap td {
  vertical-align: middle;
}

.finance-ledger-all-entry-table-wrap td:nth-child(4),
.finance-ledger-all-entry-table-wrap td:nth-child(5) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.finance-ledger-all-entry-table-wrap td small,
.finance-ledger-all-entry-person small,
.finance-ledger-all-entry-operator small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.finance-ledger-all-entry-reason {
  min-width: 210px;
  white-space: normal;
  word-break: break-word;
}

.finance-ledger-person-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: #2563eb;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.finance-ledger-person-link:hover {
  text-decoration: underline;
}

.finance-ledger-all-entry-person .finance-ledger-status {
  margin-left: 6px;
}

.finance-ledger-all-entry-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

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

.finance-ledger-reverse-summary span {
  display: grid;
  gap: 5px;
  border: 1px solid #e2e7ee;
  border-radius: 8px;
  background: #fafbfc;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.finance-ledger-reverse-summary strong {
  color: var(--ink);
  font-size: 15px;
}

@media (max-width: 1100px) {
  .finance-ledger-filter-bar,
  .finance-ledger-all-entry-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-ledger-filter-bar .secondary-btn,
  .finance-ledger-all-entry-filter-actions {
    align-self: end;
  }
}

@media (max-width: 680px) {
  .finance-ledger-filter-bar,
  .finance-ledger-all-entry-filter-bar,
  .finance-ledger-form-grid,
  .finance-ledger-reverse-summary {
    grid-template-columns: 1fr;
  }

  .finance-ledger-all-entry-filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-ledger-all-entry-filter-actions button {
    width: 100%;
    min-height: 44px;
  }

  .finance-ledger-all-entry-pagination {
    justify-content: center;
    flex-wrap: wrap;
  }

  .finance-ledger-all-entry-pagination button {
    min-height: 44px;
  }

  .finance-ledger-wide-field {
    grid-column: auto;
  }

  .finance-ledger-modal,
  .finance-ledger-details-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .finance-ledger-modal .modal-form {
    padding: 16px;
  }

  .finance-ledger-row-actions {
    min-width: 270px;
  }
}

@media (max-width: 420px) {
  .finance-ledger-stats {
    grid-template-columns: 1fr;
  }
}

/* 2026-06 global product polish: compact operations workspace. */
:root {
  --ink: #111827;
  --muted: #667085;
  --line: #dce3ef;
  --panel: #ffffff;
  --soft: #f6f8fc;
  --nav: #151827;
  --nav-2: #0f172a;
  --accent: #5b4ce5;
  --accent-2: #0f766e;
  --accent-warm: #c77918;
  --table-head: #f5f7fb;
  --table-pin: #f1edff;
  --table-pin-strong: #e8e1ff;
  --shadow: 0 18px 42px rgba(20, 30, 50, 0.10);
  --soft-shadow: 0 10px 24px rgba(18, 27, 43, 0.07);
}

body {
  background: linear-gradient(180deg, #f7f8fc 0%, #eef2f7 100%);
}

.dashboard-layout {
  grid-template-columns: 224px minmax(0, 1fr);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(91, 76, 229, 0.20), transparent 190px),
    linear-gradient(180deg, #191428 0%, #111827 55%, #0d1522 100%);
}

.sidebar-inner {
  padding: 24px 14px 28px;
}

.sidebar-brand {
  padding: 2px 10px 14px;
  font-size: 21px;
}

.sidebar-group-title {
  padding: 14px 10px 7px;
  color: #9aa4b5;
}

.sidebar-link {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
}

.sidebar-link.active {
  background: linear-gradient(135deg, #5b4ce5 0%, #7c3aed 100%);
  box-shadow: 0 12px 24px rgba(91, 76, 229, 0.28);
}

.main-shell {
  background:
    linear-gradient(90deg, rgba(91, 76, 229, 0.07), transparent 32%),
    linear-gradient(180deg, #f9fafc 0%, #f1f4f9 100%);
}

.topbar {
  min-height: 70px;
  padding: 14px 28px;
  background: rgba(250, 251, 255, 0.94);
  border-bottom-color: #e7ecf5;
}

.topbar-title h1 {
  font-size: 25px;
  font-weight: 900;
}

.content {
  gap: 18px;
  padding: 22px 28px 38px;
}

.panel {
  border-color: #dde5f1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 30px rgba(19, 29, 48, 0.07);
}

.panel-header {
  min-height: 68px;
  padding: 18px 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.panel-header h2 {
  font-size: 19px;
  font-weight: 900;
}

.panel-body {
  padding: 18px 20px 20px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.stat-card {
  position: relative;
  min-height: 104px;
  padding: 18px 20px;
  border-color: #dce3ef;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 252, 255, 0.98));
  box-shadow: 0 12px 26px rgba(19, 29, 48, 0.07);
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, #5b4ce5, #0f766e);
  opacity: 0.88;
}

.stat-card span {
  color: #64748b;
  font-weight: 800;
}

.stat-card strong {
  color: #111827;
  font-size: 29px;
  font-weight: 900;
}

.home-overview-panel {
  overflow: hidden;
}

.home-overview-body {
  display: block;
}

.home-overview-main {
  display: grid;
  gap: 16px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.home-status-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid #dde7f4;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 40%),
    linear-gradient(180deg, #ffffff, #fbfcff);
}

.home-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #cbd5e1;
  box-shadow: 0 0 0 6px rgba(203, 213, 225, 0.24);
}

.home-status-dot.online {
  background: #0f766e;
  box-shadow: 0 0 0 6px rgba(15, 118, 110, 0.13);
}

.home-status-hero strong {
  display: block;
  color: #111827;
  font-size: 18px;
  font-weight: 900;
}

.home-status-hero span {
  color: #64748b;
}

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

.home-overview-tile {
  min-height: 118px;
  display: grid;
  gap: 6px;
  align-content: center;
  padding: 16px 18px;
  border: 1px solid #dde5f1;
  border-radius: 8px;
  background: #ffffff;
}

.home-overview-tile span {
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
}

.home-overview-tile strong {
  color: #111827;
  font-size: 28px;
  font-weight: 900;
}

.home-overview-tile small {
  color: #667085;
}

.home-overview-tile.is-up strong {
  color: #b42318;
}

.home-overview-tile.is-down strong {
  color: #067647;
}

.filter-bar,
.realtime-filter-bar,
.note-filter-bar,
.finance-filter-bar {
  gap: 10px;
  align-items: end;
}

input,
select,
textarea {
  border-color: #d8e0ec;
  background: #ffffff;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.tab-btn,
.sub-tab,
.icon-btn {
  border-radius: 8px;
}

.primary-btn {
  background: linear-gradient(135deg, #5b4ce5, #6d3df2);
}

.secondary-btn {
  background: #edf3fa;
  border-color: #d4deeb;
}

.tab-btn,
.sub-tab {
  background: #ffffff;
  border-color: #d8e0ec;
}

.tab-btn.active,
.sub-tab.active {
  background: linear-gradient(135deg, #172033, #26364a);
}

.table-wrap {
  border-color: #e3e9f3;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

th,
td {
  padding: 12px 14px;
}

tbody tr:nth-child(even) td:not(:nth-child(2)) {
  background: #fcfdff;
}

tbody tr:hover td:not(:nth-child(2)) {
  background: #f8fbff;
}

.collection-alert-panel {
  box-shadow: 0 14px 34px rgba(19, 29, 48, 0.08);
}

.collection-alert-table-wrap table {
  min-width: 100%;
}

.performance-table-frame {
  border-radius: 8px;
}

.performance-table {
  border-radius: 8px;
}

.performance-table th:first-child,
.performance-table td:first-child {
  background: #ffffff;
}

.performance-table .summary-row td {
  background: #f2f6fb;
}

.finance-alert-panel,
.finance-calibration-current {
  border-radius: 8px;
}

@media (max-width: 1280px) {
  .home-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .home-overview-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 16px;
  }
}

/* Finance table polish: keep the shop-name column visually consistent. */
.finance-table-wrap table th:nth-child(1),
.finance-table-wrap table td:nth-child(1) {
  background: #f7f5ff !important;
  color: #4c1d95;
  font-weight: 900;
}

.finance-table-wrap table th:nth-child(1) {
  background: #eee8ff !important;
}

.finance-table-wrap table tbody tr:nth-child(even) td:nth-child(1),
.finance-table-wrap table tbody tr:hover td:nth-child(1) {
  background: #f7f5ff !important;
}

.finance-table-wrap table th:nth-child(2),
.finance-table-wrap table td:nth-child(2) {
  background: #fff !important;
  color: #111827;
  font-weight: 500;
}

.finance-table-wrap table tbody tr:nth-child(even) td:not(:nth-child(1)) {
  background: #fcfdff;
}

.finance-table-wrap table tbody tr:hover td:not(:nth-child(1)) {
  background: #f8fbff;
}

.finance-table-wrap table .finance-alert-row td:nth-child(1) {
  background: #fff7ed !important;
}

.finance-accounting-stats {
  margin-bottom: 18px;
}

.finance-accounting-imports {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.finance-accounting-import-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 220px) auto auto;
  align-items: end;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.finance-accounting-import-card strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.finance-accounting-import-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.finance-accounting-import-card input,
.finance-accounting-import-card select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
}

.finance-accounting-filter {
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 260px) minmax(160px, 220px) auto;
}

.finance-accounting-table {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
  max-height: 560px;
}

.finance-accounting-table table {
  min-width: 980px;
}

.finance-accounting-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3f7fc;
}

.finance-accounting-section-title {
  margin: 18px 0 10px;
  font-size: 15px;
  color: var(--text);
}

.finance-accounting-decision-panel {
  margin: 14px 0;
  padding: 14px;
  border: 2px solid #efb56f;
  border-radius: 10px;
  background: #fffaf2;
}

.finance-accounting-decision-panel .finance-accounting-section-title {
  margin: 0 0 4px;
  color: #7a4514;
}

.finance-accounting-decision-hint {
  margin: 0 0 10px;
  color: #7b644e;
  font-size: 13px;
}

.accounting-aftersale-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  background: #fff0d6;
  color: #8a4d12;
  font-size: 12px;
  font-weight: 700;
}

.accounting-upload-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr)) auto;
  gap: 14px;
  align-items: end;
}

.accounting-upload-grid .field {
  min-width: 0;
}

.accounting-upload-grid input[type="file"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.accounting-upload-submit {
  min-height: 40px;
  white-space: nowrap;
}

.muted-field {
  opacity: 0.72;
}

.muted-field span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.accounting-profit-stats {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.accounting-profit-card {
  border-color: #b9d8c5;
  background: linear-gradient(180deg, #ffffff, #f3fff7);
}

.accounting-count-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 18px;
}

.accounting-count-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.accounting-count-chip strong {
  color: var(--text);
  font-size: 13px;
}

.accounting-count-chip.warn {
  border-color: #f4c98b;
  background: #fff9ee;
}

.accounting-review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
  align-items: start;
}

.accounting-review-main,
.accounting-review-side {
  min-width: 0;
}

.accounting-review-side {
  position: sticky;
  top: 88px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
}

.accounting-review-side h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.accounting-review-side .finance-accounting-table table {
  width: 100%;
  min-width: 300px;
}

.accounting-review-side .finance-accounting-table th,
.accounting-review-side .finance-accounting-table td {
  white-space: nowrap;
}

.accounting-review-side .finance-accounting-table th:first-child,
.accounting-review-side .finance-accounting-table td:first-child {
  min-width: 120px;
  white-space: normal;
}

.accounting-side-section {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 14px;
}

.accounting-side-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.accounting-side-section-head h3,
.accounting-group-editor h3 {
  margin: 0;
  font-size: 15px;
}

.accounting-side-section p {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 10px;
}

.accounting-fixed-fees {
  border: 1px solid #f1cf9f;
  border-radius: 8px;
  background: #fffaf2;
  padding: 12px;
}

.accounting-auto-badge {
  color: #8a5a18;
  font-size: 11px;
  white-space: nowrap;
}

.accounting-fixed-fee-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid #f3dfc1;
}

.accounting-fixed-fee-row span,
.accounting-fixed-fee-row small {
  display: block;
}

.accounting-fixed-fee-row span {
  color: var(--text);
  font-size: 13px;
}

.accounting-fixed-fee-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.accounting-fixed-fee-row strong,
.accounting-fixed-fee-total strong {
  color: #9a5b00;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.accounting-fixed-fee-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid #e9c58f;
  color: var(--text);
  font-size: 13px;
}

.accounting-profit-formula {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed #e9c58f;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.accounting-fixed-fee-cell {
  display: grid;
  gap: 3px;
  min-width: 142px;
  color: var(--text);
  white-space: nowrap;
}

.accounting-fixed-fee-cell small {
  color: var(--muted);
}

.accounting-fixed-fee-cell.legacy span {
  color: var(--muted);
}

.accounting-other-cost-list {
  display: grid;
  gap: 8px;
}

.accounting-other-cost-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.accounting-other-cost-row input,
.accounting-group-editor input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
}

.accounting-confirm-controls {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.accounting-confirm-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.accounting-confirm-controls select {
  min-width: 128px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}

.finance-monthly-scope {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 10px;
}

.finance-monthly-row {
  cursor: pointer;
}

.finance-monthly-row:hover {
  background: #f6f8ff;
}

.finance-monthly-row.recently-confirmed,
.finance-monthly-row.recently-confirmed:hover {
  background: #eefbf7;
  box-shadow: inset 3px 0 0 #0f9f82;
}

.accounting-book-shop {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
}

.accounting-version-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid #d8e0ec;
  border-radius: 999px;
  background: #f7f9fc;
  color: #526174;
  font-size: 12px;
  font-weight: 700;
}

.accounting-group-chip {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #bfd9d3;
  border-radius: 999px;
  background: #f0faf7;
  color: #14715f;
  font-weight: 700;
  cursor: pointer;
}

.accounting-group-chip.ungrouped {
  border-color: #d8e0ec;
  background: #f7f9fc;
  color: #697789;
}

.accounting-group-chip:hover {
  border-color: #8bc8ba;
  background: #e6f6f1;
}

.accounting-confirm-modal {
  width: min(620px, 100%);
}

.accounting-version-modal {
  width: min(1080px, 100%);
}

.accounting-group-modal {
  width: min(560px, 100%);
}

.accounting-modal-body {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.accounting-modal-warning,
.accounting-modal-note {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid #f0d598;
  border-radius: 8px;
  background: #fff9eb;
  color: #6f5320;
  line-height: 1.55;
}

.accounting-modal-warning.danger {
  border-color: #f2b6b1;
  background: #fff5f4;
  color: #8a2c24;
}

.accounting-blocked-modal {
  border: 2px solid #e79a91;
  box-shadow: 0 24px 70px rgba(102, 33, 27, 0.28);
}

.accounting-blocker-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 26px;
}

.accounting-blocker-list li {
  padding: 9px 10px;
  border: 1px solid #eadfdc;
  border-radius: 7px;
  background: #fff;
}

.accounting-blocker-list strong,
.accounting-blocker-list span {
  display: block;
}

.accounting-blocker-list strong {
  margin-bottom: 3px;
  color: #8a2c24;
}

.accounting-blocker-list span {
  color: #665a58;
  line-height: 1.45;
}

.accounting-modal-note {
  border-color: #cfe0f1;
  background: #f5f9fd;
  color: #496075;
}

.accounting-modal-summary,
.accounting-version-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  color: var(--muted);
}

.accounting-modal-summary span {
  display: grid;
  gap: 4px;
  min-width: 160px;
}

.accounting-modal-summary strong {
  color: var(--text);
  font-size: 22px;
}

.accounting-modal-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.accounting-modal-field select {
  width: 100%;
}

.accounting-compare-table table,
.accounting-version-table table {
  min-width: 850px;
}

.accounting-compare-table th:first-child {
  min-width: 120px;
}

.accounting-difference {
  font-weight: 800;
}

.accounting-difference.positive {
  color: #c9362b;
}

.accounting-difference.negative {
  color: #138a68;
}

.accounting-difference.neutral {
  color: var(--muted);
}

.accounting-version-table tr.current-version-row {
  background: #eefbf7;
}

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

.accounting-version-table td small {
  margin-top: 4px;
  color: var(--muted);
  white-space: nowrap;
}

.accounting-version-current,
.accounting-version-expired {
  color: #14715f;
  font-size: 12px;
  font-weight: 700;
}

.accounting-version-expired {
  color: var(--muted);
}

.accounting-version-action {
  display: grid;
  gap: 3px;
  justify-items: start;
  min-width: 120px;
}

.accounting-order-full {
  margin-top: 18px;
}

.accounting-inline-actions {
  display: flex;
  justify-content: flex-end;
  margin: 10px 0 16px;
}

.accounting-inline-actions .secondary-btn {
  min-width: 180px;
}

.accounting-warning-panel,
.accounting-notice-panel,
.accounting-ok-panel {
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.accounting-warning-panel {
  border: 1px solid #f8c58f;
  background: #fff8ed;
}

.accounting-notice-panel {
  border: 1px solid #f1cf9f;
  background: #fffaf2;
}

.accounting-ok-panel {
  border: 1px solid #a7e3c1;
  background: #f0fff6;
}

.accounting-warning-panel strong,
.accounting-notice-panel strong,
.accounting-ok-panel strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.accounting-warning-panel span,
.accounting-notice-panel span,
.accounting-ok-panel span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.accounting-warning-panel td strong {
  margin: 0;
  color: #6f451b;
}

.accounting-warning-panel td small {
  display: block;
  margin-top: 3px;
  color: #9b8068;
  font-size: 10px;
}

.finance-accounting-table.compact {
  max-height: 320px;
}

.accounting-order-preview {
  max-height: 520px;
}

.accounting-order-preview table {
  min-width: 1880px;
}

.accounting-order-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr auto;
  gap: 12px;
  align-items: end;
  margin: 8px 0 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdff;
}

.accounting-order-search label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.accounting-order-search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  padding: 0 10px;
}

.accounting-order-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn {
  min-height: 34px;
  border: 1px solid #d6e2ef;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
}

.chip-btn.active {
  border-color: #243247;
  background: #243247;
  color: #fff;
}

.accounting-order-count {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.accounting-product-cell {
  max-width: 360px;
  white-space: normal;
}

.accounting-tracking-cell {
  max-width: 260px;
  white-space: normal;
  word-break: break-all;
}

.accounting-order-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.tiny-btn {
  min-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.accounting-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge.info {
  background: #eef7ff;
  color: #1f5f9d;
  border-color: #c9e4ff;
}

.badge.fee {
  background: #fff4df;
  color: #8a5511;
  border-color: #f4cc91;
}

.badge.muted {
  background: #f5f7fb;
  color: var(--muted);
  border-color: var(--border);
}

.accounting-source-detail {
  min-width: 110px;
}

.accounting-source-detail summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  height: 32px;
  border: 1px solid #cfe0f1;
  border-radius: 7px;
  background: #f2f7fc;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.accounting-source-detail[open] summary {
  background: #243247;
  border-color: #243247;
  color: #fff;
}

.accounting-source-panel {
  position: static;
  width: 100%;
  max-width: none;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  padding: 12px;
}

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

.accounting-source-head strong {
  display: block;
  margin-bottom: 3px;
}

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

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

.accounting-source-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfdff;
}

.accounting-source-block.ok {
  padding: 12px;
  border-color: #a7e3c1;
  background: #f0fff6;
}

.accounting-source-block h4 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #f5f8fc;
  font-size: 13px;
}

.accounting-source-block.ok h4 {
  padding: 0;
  border: 0;
  background: transparent;
}

.accounting-source-block p {
  margin: 6px 0 0;
  color: var(--muted);
}

.accounting-source-block table {
  width: 100%;
  min-width: 0;
}

.accounting-source-block th,
.accounting-source-block td {
  white-space: normal;
  vertical-align: top;
}

.empty-state.compact {
  min-height: 48px;
  padding: 12px;
  font-size: 13px;
}

.inline-money-input,
.finance-accounting-table select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 0 8px;
}

.badge.warn {
  background: #fff4d8;
  color: #9a5b00;
  border-color: #ffd99a;
}

@media (max-width: 1100px) {
  .finance-accounting-imports {
    grid-template-columns: 1fr;
  }

  .finance-accounting-import-card {
    grid-template-columns: 1fr;
  }

  .accounting-upload-grid,
  .accounting-review-grid {
    grid-template-columns: 1fr;
  }

  .accounting-profit-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .accounting-review-side {
    position: static;
  }
}

@media (max-width: 680px) {
  .accounting-profit-stats {
    grid-template-columns: 1fr;
  }

  .accounting-fixed-fee-row {
    align-items: start;
  }
}

/* Keep ledger semantic colors after the global product-polish overrides above. */
.finance-ledger-stats .finance-ledger-increase-text {
  color: var(--danger);
}

.finance-ledger-stats .finance-ledger-decrease-text {
  color: #087a52;
}

.finance-ledger-stats .finance-ledger-negative-text {
  color: var(--danger);
}

.finance-ledger-increase-btn.primary-btn,
.finance-ledger-increase-submit.primary-btn {
  border-color: #ffd0cc;
  background: #fff6f5;
  color: #9f2d24;
  box-shadow: none;
}

.finance-ledger-decrease-btn.secondary-btn,
.finance-ledger-decrease-submit.primary-btn {
  border-color: #a9e4c9;
  background: #effcf5;
  color: #087a52;
  box-shadow: none;
}

.finance-ledger-stop-btn.ghost-btn {
  color: var(--danger);
}

.finance-ledger-table-wrap tbody tr.finance-ledger-inactive-row td {
  background: #fafbfc;
  color: #7c8491;
}

.finance-ledger-table-wrap tbody tr.finance-ledger-inactive-row td.finance-ledger-balance.negative {
  color: var(--danger);
}

.finance-ledger-reverse-summary .finance-ledger-reverse-negative {
  border-color: #ffc9c5;
  background: #fff5f4;
}

.finance-ledger-reverse-summary .finance-ledger-reverse-negative strong,
.finance-ledger-reverse-warning {
  color: var(--danger);
}

.finance-ledger-reverse-warning {
  font-size: 12px;
  font-weight: 700;
}

/* Finance monthly dashboard and accounting hierarchy */
.finance-monthly-dashboard {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.finance-monthly-dashboard-scope {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.finance-monthly-dashboard-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #dfe5f2;
  border-radius: 8px;
  background: #f8fafd;
}

.finance-monthly-dashboard-breadcrumbs > span {
  flex: 0 0 auto;
  color: #9aa5b5;
  font-size: 16px;
  line-height: 1;
  user-select: none;
}

.finance-monthly-dashboard-crumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  max-width: 100%;
  border: 1px solid #d9e1ec;
  border-radius: 7px;
  padding: 5px 10px;
  background: #fff;
  color: #46556a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.finance-monthly-dashboard-crumb:hover {
  border-color: #9e91ec;
  background: #f4f1ff;
  color: #4c36b7;
}

.finance-monthly-dashboard-crumb:focus-visible {
  outline: 2px solid rgba(91, 76, 229, 0.32);
  outline-offset: 2px;
}

.finance-monthly-dashboard-crumb.active,
.finance-monthly-dashboard-crumb.current,
.finance-monthly-dashboard-crumb[aria-current="page"] {
  border-color: #c9c0fa;
  background: #eeeaff;
  color: #4c36b7;
  cursor: default;
}

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

.finance-monthly-dashboard-grid > .stat-card {
  min-width: 0;
  min-height: 100px;
}

.finance-monthly-dashboard-grid > .stat-card strong {
  font-size: clamp(22px, 2vw, 29px);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.finance-monthly-dashboard-grid > .accounting-profit-card {
  border-color: #9dd5b4;
  background: linear-gradient(180deg, #ffffff 0%, #edfff5 100%);
  box-shadow: 0 12px 28px rgba(14, 125, 84, 0.12);
}

.finance-monthly-dashboard-grid > .accounting-profit-card::before {
  background: linear-gradient(180deg, #16a36f, #087a52);
  opacity: 1;
}

.finance-monthly-dashboard-grid > .accounting-profit-card strong {
  color: #087a52;
}

.finance-monthly-dashboard-counts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.finance-monthly-dashboard-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  max-width: 100%;
  border: 1px solid #dfe5ef;
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.finance-monthly-dashboard-chip strong {
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.finance-monthly-dashboard-chip.warn {
  border-color: #f1c881;
  background: #fff8e8;
  color: #8a5a18;
}

.finance-monthly-dashboard-chip.warn strong {
  color: #a25d00;
}

.finance-hierarchy-filter-bar {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.finance-hierarchy-filter-bar > button,
.finance-hierarchy-filter-bar > .panel-actions {
  align-self: end;
}

.finance-hierarchy-department-select,
.finance-hierarchy-group-select {
  min-width: 0;
}

.finance-hierarchy-affiliation {
  display: grid;
  gap: 3px;
  min-width: 150px;
  white-space: normal;
}

.finance-hierarchy-affiliation-department {
  color: #26364a;
  font-weight: 800;
  line-height: 1.4;
}

.finance-hierarchy-affiliation-group {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.finance-hierarchy-manage-btn {
  border-color: #b9dcd5;
  background: #f0faf7;
  color: #14715f;
}

.finance-hierarchy-manage-btn:hover {
  border-color: #83c4b5;
  background: #e4f6f1;
}

.finance-hierarchy-modal {
  width: min(960px, 100%);
  max-height: min(90vh, 820px);
}

.finance-hierarchy-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
  padding: 20px;
}

.finance-hierarchy-section {
  min-width: 0;
  border: 1px solid #dfe5ef;
  border-radius: 10px;
  background: #fbfcff;
  overflow: hidden;
}

.finance-hierarchy-section > h3,
.finance-hierarchy-section > header,
.finance-hierarchy-section > div:first-child {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid #e5eaf2;
  background: #f5f8fc;
}

.finance-hierarchy-section > h3,
.finance-hierarchy-section > div:first-child h3 {
  color: #26364a;
  font-size: 15px;
}

.finance-hierarchy-section > div:first-child p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.finance-hierarchy-list {
  display: grid;
  gap: 8px;
  max-height: min(48vh, 430px);
  overflow: auto;
  padding: 12px;
  scrollbar-gutter: stable;
}

.finance-hierarchy-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.finance-hierarchy-item:hover,
.finance-hierarchy-item:focus-within {
  border-color: #c8c0ee;
  box-shadow: 0 7px 18px rgba(43, 38, 89, 0.07);
}

.finance-hierarchy-item.inactive {
  background: #f6f7f9;
  color: #7b8491;
}

.finance-hierarchy-item-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.finance-hierarchy-item-main strong,
.finance-hierarchy-item-main span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.finance-hierarchy-item-main small {
  color: var(--muted);
  line-height: 1.4;
}

.finance-hierarchy-item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.finance-hierarchy-item-actions button {
  min-height: 30px;
}

.finance-hierarchy-form,
.finance-hierarchy-inline-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border-top: 1px solid #e5eaf2;
  background: #fff;
}

.finance-hierarchy-form label,
.finance-hierarchy-inline-create label,
.finance-hierarchy-group-picker {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.finance-hierarchy-form input,
.finance-hierarchy-form select,
.finance-hierarchy-inline-create input,
.finance-hierarchy-inline-create select,
.finance-hierarchy-group-picker select {
  min-width: 0;
}

.finance-hierarchy-inline-create {
  margin: 0 12px 12px;
  border: 1px dashed #cfd9e6;
  border-radius: 8px;
  background: #f8fbff;
}

.finance-hierarchy-inline-create[data-finance-hierarchy-department-create] {
  grid-template-columns: minmax(0, 1fr) auto;
}

.finance-hierarchy-inline-create[data-finance-hierarchy-group-create] {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.85fr) auto;
}

.finance-hierarchy-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 22px;
  border: 1px solid #a9e4c9;
  border-radius: 999px;
  padding: 2px 7px;
  background: #effcf5;
  color: #087a52;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.finance-hierarchy-status.inactive,
.finance-hierarchy-item.inactive .finance-hierarchy-status {
  border-color: #d7dde5;
  background: #f1f3f6;
  color: #6a7280;
}

.finance-hierarchy-group-picker {
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.finance-hierarchy-empty {
  min-height: 88px;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 1100px) {
  .finance-monthly-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-hierarchy-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .finance-monthly-dashboard-scope {
    align-items: flex-start;
    flex-direction: column;
  }

  .finance-monthly-dashboard-breadcrumbs {
    width: 100%;
  }

  .finance-monthly-dashboard-crumb {
    flex: 1 1 auto;
  }

  .finance-monthly-dashboard-grid,
  .finance-hierarchy-filter-bar,
  .finance-hierarchy-layout {
    grid-template-columns: 1fr;
  }

  .finance-monthly-dashboard-grid > .stat-card {
    min-height: 88px;
  }

  .finance-monthly-dashboard-counts {
    align-items: stretch;
  }

  .finance-monthly-dashboard-chip {
    flex: 1 1 calc(50% - 4px);
    justify-content: space-between;
  }

  .finance-hierarchy-layout {
    padding: 14px;
  }

  .finance-hierarchy-list {
    max-height: none;
  }

  .finance-hierarchy-item,
  .finance-hierarchy-form,
  .finance-hierarchy-inline-create,
  .finance-hierarchy-inline-create[data-finance-hierarchy-department-create],
  .finance-hierarchy-inline-create[data-finance-hierarchy-group-create],
  .finance-hierarchy-group-picker {
    grid-template-columns: 1fr;
  }

  .finance-hierarchy-item-actions {
    justify-content: flex-start;
  }

  .finance-hierarchy-item-actions button,
  .finance-hierarchy-form > button,
  .finance-hierarchy-inline-create > button {
    flex: 1 1 auto;
    width: 100%;
  }
}

@media (max-width: 420px) {
  .finance-monthly-dashboard-chip {
    flex-basis: 100%;
  }
}

/* UI V2: scoped visual and responsive foundation.
   Keep these overrides at the end until the legacy style layers are retired. */
.ui-v2 {
  --ink: #182033;
  --muted: #6c7485;
  --line: #e3e7f0;
  --panel: #ffffff;
  --soft: #f6f7fb;
  --nav: #48405f;
  --nav-2: #3f3854;
  --accent: #7257f6;
  --accent-2: #0f766e;
  --accent-warm: #b7791f;
  --table-head: #f6f7fb;
  --table-pin: #f3f0ff;
  --table-pin-strong: #eae4ff;
  --shadow: 0 18px 42px rgba(31, 37, 61, 0.10);
  --soft-shadow: 0 8px 24px rgba(31, 37, 61, 0.06);
  --ui-primary: #7257f6;
  --ui-primary-hover: #6045e7;
  --ui-primary-soft: #f1edff;
  --ui-page: #f6f7fb;
  --ui-border: #e3e7f0;
  --ui-text: #182033;
  --ui-sidebar: #48405f;
  --ui-sidebar-deep: #3f3854;
  color: var(--ui-text);
}

body:has(.ui-v2) {
  --ink: #182033;
  --muted: #6c7485;
  --line: #e3e7f0;
  --panel: #ffffff;
  --soft: #f6f7fb;
  --accent: #7257f6;
  --ui-primary: #7257f6;
  --ui-primary-hover: #6045e7;
  --ui-primary-soft: #f1edff;
  --ui-page: #f6f7fb;
  --ui-border: #e3e7f0;
  --ui-text: #182033;
  color: var(--ui-text);
  background: var(--ui-page);
}

.dashboard-layout.ui-v2,
.ui-v2 .dashboard-layout {
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: 224px minmax(0, 1fr);
  background: var(--ui-page);
}

.ui-v2 .main-shell {
  width: 100%;
  min-width: 0;
  background: var(--ui-page);
}

.ui-v2 .sidebar {
  color: #f8f6ff;
  background: linear-gradient(180deg, var(--ui-sidebar) 0%, var(--ui-sidebar-deep) 100%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.10);
}

.ui-v2 .sidebar-brand {
  color: #ffffff;
}

.ui-v2 .sidebar-brand span,
.ui-v2 .sidebar-group-title {
  color: #d1cbdf;
}

.ui-v2 .sidebar-link {
  min-height: 44px;
  color: #f0edf8;
}

.ui-v2 .sidebar-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.10);
}

.ui-v2 .sidebar-link.active {
  color: #ffffff;
  background: var(--ui-primary);
  box-shadow: 0 8px 18px rgba(39, 28, 92, 0.24);
}

.ui-v2 .topbar {
  min-width: 0;
  border-bottom-color: var(--ui-border);
  background: rgba(251, 252, 255, 0.96);
  box-shadow: 0 1px 0 rgba(24, 32, 51, 0.02);
}

.ui-v2 .topbar-title h1,
.ui-v2 .panel-header h2,
.ui-v2 .stat-card strong,
.ui-v2 .home-overview-tile strong,
.ui-v2 .home-status-hero strong {
  color: var(--ui-text);
}

.ui-v2 .topbar-title span,
.ui-v2 .panel-header .hint-text,
.ui-v2 .panel-header p,
.ui-v2 .panel-header span {
  color: var(--muted);
}

.ui-v2 .user-pill {
  min-width: 0;
  border-color: var(--ui-border);
  color: #535c70;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(31, 37, 61, 0.04);
}

.ui-v2 .content,
.ui-v2 .content > *,
.ui-v2 .panel,
.ui-v2 .panel-body,
.ui-v2 .performance-table-frame {
  min-width: 0;
  max-width: 100%;
}

.ui-v2 .panel {
  border-color: var(--ui-border);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--soft-shadow);
}

.ui-v2 .panel-header {
  border-bottom-color: #edf0f5;
  background: #ffffff;
}

.ui-v2 .stat-card {
  border-color: var(--ui-border);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(31, 37, 61, 0.05);
}

.ui-v2 .stat-card::before {
  background: var(--ui-primary);
  opacity: 1;
}

.ui-v2 .stat-card span,
.ui-v2 .home-overview-tile span,
.ui-v2 .home-overview-tile small {
  color: var(--muted);
}

.ui-v2 .stats-grid,
.ui-v2 .home-overview-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ui-v2 .home-overview-tile,
.ui-v2 .home-status-hero,
.ui-v2 .realtime-sales-card {
  border-color: var(--ui-border);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(114, 87, 246, 0.055), transparent 42%),
    #ffffff;
  box-shadow: 0 6px 18px rgba(31, 37, 61, 0.05);
}

.ui-v2 .realtime-sales-card {
  width: 100%;
  max-width: 100%;
}

.ui-v2 .primary-btn:not(.danger-btn):not(.finance-ledger-increase-btn):not(.finance-ledger-increase-submit):not(.finance-ledger-decrease-btn):not(.finance-ledger-decrease-submit),
.ui-v2 .tab-btn.active,
.ui-v2 .sub-tab.active {
  border-color: var(--ui-primary);
  color: #ffffff;
  background: var(--ui-primary);
  box-shadow: 0 8px 18px rgba(114, 87, 246, 0.20);
}

.ui-v2 .primary-btn:not(.danger-btn):not(.finance-ledger-increase-btn):not(.finance-ledger-increase-submit):not(.finance-ledger-decrease-btn):not(.finance-ledger-decrease-submit):hover,
.ui-v2 .tab-btn.active:hover,
.ui-v2 .sub-tab.active:hover {
  border-color: var(--ui-primary-hover);
  background: var(--ui-primary-hover);
}

.ui-v2 .secondary-btn:not(.finance-ledger-decrease-btn):not(.finance-alert-confirm-btn):not(.finance-alert-calibrate-btn) {
  border-color: #dbe1eb;
  color: #344054;
  background: #f3f5f9;
  box-shadow: none;
}

.ui-v2 .secondary-btn:not(.finance-ledger-decrease-btn):not(.finance-alert-confirm-btn):not(.finance-alert-calibrate-btn):hover {
  border-color: #cfc5fb;
  color: var(--ui-primary-hover);
  background: var(--ui-primary-soft);
}

/* Keep the finance reconciliation actions semantically distinct from normal
   secondary buttons. Their legacy rules are followed by a generic secondary
   rule, so V2 needs to restate the final visible colors explicitly. */
.ui-v2 .finance-alert-confirm-btn {
  border-color: #fed7aa;
  color: #9a3412;
  background: #ffffff;
}

.ui-v2 .finance-alert-confirm-btn:hover {
  border-color: #fb923c;
  color: #9a3412;
  background: #fff7ed;
}

.ui-v2 .finance-alert-calibrate-btn {
  border-color: #c7d2fe;
  color: #4c1d95;
  background: #f7f5ff;
}

.ui-v2 .finance-alert-calibrate-btn:hover {
  border-color: #8b5cf6;
  color: #4c1d95;
  background: #f3efff;
}

.ui-v2 .ghost-btn:not(.finance-ledger-stop-btn),
.ui-v2 .tab-btn,
.ui-v2 .sub-tab,
.ui-v2 .icon-btn {
  border-color: var(--ui-border);
  color: #535c70;
  background: #ffffff;
}

.ui-v2 .primary-btn,
.ui-v2 .secondary-btn,
.ui-v2 .danger-btn,
.ui-v2 .ghost-btn,
.ui-v2 .tab-btn,
.ui-v2 .sub-tab,
.ui-v2 .icon-btn {
  min-height: 44px;
  border-radius: 10px;
}

.ui-v2 .icon-btn {
  width: 44px;
}

.ui-v2 input:not([type="checkbox"]):not([type="radio"]),
.ui-v2 select,
.ui-v2 textarea,
body:has(.ui-v2) .modal input:not([type="checkbox"]):not([type="radio"]),
body:has(.ui-v2) .modal select,
body:has(.ui-v2) .modal textarea {
  min-height: 44px;
  border-color: var(--ui-border);
  border-radius: 10px;
  color: var(--ui-text);
  background: #ffffff;
}

.ui-v2 input:not([type="checkbox"]):not([type="radio"]):focus,
.ui-v2 select:focus,
.ui-v2 textarea:focus,
body:has(.ui-v2) .modal input:not([type="checkbox"]):not([type="radio"]):focus,
body:has(.ui-v2) .modal select:focus,
body:has(.ui-v2) .modal textarea:focus {
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 3px rgba(114, 87, 246, 0.14);
}

.ui-v2 textarea,
body:has(.ui-v2) .modal textarea {
  min-height: 96px;
}

.ui-v2 button:focus-visible,
.ui-v2 input:focus-visible,
.ui-v2 select:focus-visible,
.ui-v2 textarea:focus-visible,
body:has(.ui-v2) .modal button:focus-visible,
body:has(.ui-v2) .modal input:focus-visible,
body:has(.ui-v2) .modal select:focus-visible,
body:has(.ui-v2) .modal textarea:focus-visible {
  outline: 3px solid rgba(114, 87, 246, 0.28);
  outline-offset: 2px;
}

.ui-v2 .table-wrap,
.ui-v2 .collection-alert-table-wrap,
.ui-v2 .shop-score-table-wrap,
.ui-v2 .performance-table-frame {
  width: 100%;
  max-width: 100%;
}

.ui-v2 .table-wrap,
.ui-v2 .collection-alert-table-wrap,
.ui-v2 .shop-score-table-wrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: #b8aceb #f2f3f8;
  scrollbar-gutter: stable;
}

.ui-v2 .table-wrap {
  border-color: var(--ui-border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: none;
}

.ui-v2 .performance-table {
  touch-action: auto;
}

.ui-v2 th {
  color: #525b6e;
  background: var(--table-head);
}

.ui-v2 td {
  color: #263044;
}

.ui-v2 tbody tr:hover td:not(:nth-child(2)) {
  background: #faf9ff;
}

.ui-v2 .table-link,
.ui-v2 .table-link-button,
.ui-v2 .metric-sort-btn:hover,
.ui-v2 .metric-sort-btn.active {
  color: var(--ui-primary-hover);
}

.ui-v2 .performance-table .summary-row td {
  background: #f5f2ff;
}

/* Preserve business-semantic colors after the V2 card overrides. */
.ui-v2 .home-overview-tile.is-up strong,
.ui-v2 .finance-ledger-stats .finance-ledger-increase-text,
.ui-v2 .finance-ledger-stats .finance-ledger-negative-text {
  color: var(--danger);
}

.ui-v2 .home-overview-tile.is-down strong,
.ui-v2 .finance-ledger-stats .finance-ledger-decrease-text {
  color: #087a52;
}

.ui-v2 .accounting-profit-card,
.ui-v2 .finance-monthly-dashboard-grid > .accounting-profit-card {
  border-color: #9dd5b4;
  background: linear-gradient(180deg, #ffffff 0%, #edfff5 100%);
  box-shadow: 0 8px 22px rgba(14, 125, 84, 0.10);
}

.ui-v2 .accounting-profit-card::before,
.ui-v2 .finance-monthly-dashboard-grid > .accounting-profit-card::before {
  background: #087a52;
}

.ui-v2 .accounting-profit-card strong,
.ui-v2 .finance-monthly-dashboard-grid > .accounting-profit-card strong {
  color: #087a52;
}

body:has(.ui-v2) .modal-backdrop {
  background: rgba(35, 39, 58, 0.36);
  backdrop-filter: blur(2px);
}

body:has(.ui-v2) .modal {
  max-height: min(88vh, 800px);
  max-height: min(88dvh, 800px);
  border: 1px solid var(--ui-border, #e3e7f0);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(31, 37, 61, 0.18);
}

body:has(.ui-v2) .modal-header {
  border-bottom-color: #edf0f5;
  background: #ffffff;
}

body:has(.ui-v2) .modal-footer {
  background: #ffffff;
}

body:has(.ui-v2) .modal .primary-btn,
body:has(.ui-v2) .modal .secondary-btn,
body:has(.ui-v2) .modal .danger-btn,
body:has(.ui-v2) .modal .ghost-btn,
body:has(.ui-v2) .modal .tab-btn,
body:has(.ui-v2) .modal .sub-tab,
body:has(.ui-v2) .modal .icon-btn {
  min-height: 44px;
  border-radius: 10px;
}

body:has(.ui-v2) .modal .icon-btn {
  width: 44px;
}

body:has(.ui-v2) .modal .primary-btn:not(.danger-btn):not(.finance-ledger-increase-submit):not(.finance-ledger-decrease-submit) {
  border-color: #7257f6;
  color: #ffffff;
  background: #7257f6;
  box-shadow: 0 8px 18px rgba(114, 87, 246, 0.20);
}

body:has(.ui-v2) .modal .primary-btn:not(.danger-btn):not(.finance-ledger-increase-submit):not(.finance-ledger-decrease-submit):hover {
  border-color: #6045e7;
  background: #6045e7;
}

.ui-v2 .primary-btn.danger-btn,
body:has(.ui-v2) .modal .primary-btn.danger-btn {
  border-color: #ffd3cf;
  color: var(--danger);
  background: #fff1f0;
  box-shadow: none;
}

.ui-v2 .primary-btn.danger-btn:hover,
body:has(.ui-v2) .modal .primary-btn.danger-btn:hover {
  border-color: #f4aaa3;
  background: #ffe7e4;
}

body:has(.ui-v2) .toast {
  border-radius: 12px;
}

@media (max-width: 1279px) {
  .dashboard-layout.ui-v2,
  .ui-v2 .dashboard-layout {
    grid-template-columns: 208px minmax(0, 1fr);
  }

  .ui-v2 .content {
    padding: 20px;
  }

  .ui-v2 .stats-grid,
  .ui-v2 .home-overview-grid,
  .ui-v2 .finance-monthly-dashboard-grid,
  .ui-v2 .accounting-profit-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ui-v2 .realtime-sales-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1023px) {
  .dashboard-layout.ui-v2,
  .ui-v2 .dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .ui-v2 .main-shell {
    grid-column: 1 / -1;
  }

  .ui-v2 .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 12;
    width: min(288px, 86vw);
    height: 100vh;
    height: 100dvh;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-105%);
    transition: transform 0.2s ease, visibility 0.2s ease;
    box-shadow: 16px 0 40px rgba(31, 27, 53, 0.22);
  }

  .dashboard-layout.ui-v2.nav-open .sidebar,
  .ui-v2 .dashboard-layout.nav-open .sidebar {
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
  }

  .ui-v2 .sidebar-header {
    align-items: flex-start;
    padding-right: 2px;
  }

  .ui-v2 .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 10px;
    padding: 8px 12px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
  }

  .dashboard-layout.ui-v2::before,
  .ui-v2 .dashboard-layout::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 11;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    background: rgba(35, 39, 58, 0.30);
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .dashboard-layout.ui-v2.nav-open::before,
  .ui-v2 .dashboard-layout.nav-open::before {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  body:has(.dashboard-layout.ui-v2.nav-open),
  body:has(.ui-v2 .dashboard-layout.nav-open) {
    overflow: hidden;
  }

  .ui-v2 .mobile-menu {
    display: inline-flex;
    flex: 0 0 auto;
    border-color: #dcd7f0;
    color: #4f3cc4;
    box-shadow: 0 4px 14px rgba(31, 37, 61, 0.05);
  }

  .ui-v2 .filter-bar,
  .ui-v2 .realtime-filter-bar,
  .ui-v2 .note-filter-bar,
  .ui-v2 .finance-filter-bar,
  .ui-v2 .finance-ledger-filter-bar,
  .ui-v2 .finance-hierarchy-filter-bar,
  .ui-v2 .form-grid,
  .ui-v2 .permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ui-v2 .note-filter-bar {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 767px) {
  .ui-v2 .topbar {
    min-height: auto;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }

  .ui-v2 .topbar-main-row {
    width: 100%;
    align-items: flex-start;
    gap: 10px;
  }

  .ui-v2 .topbar-title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .ui-v2 .topbar-title h1 {
    font-size: 22px;
    white-space: normal;
  }

  .ui-v2 .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
  }

  .ui-v2 .user-pill {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ui-v2 .user-pill > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ui-v2 .content {
    gap: 14px;
    padding: 16px;
  }

  .ui-v2 .panel {
    border-radius: 10px;
  }

  .ui-v2 .panel-header {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .ui-v2 .panel-body {
    padding: 16px;
  }

  .ui-v2 .panel-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .ui-v2 .stats-grid,
  .ui-v2 .home-overview-grid,
  .ui-v2 .home-overview-side,
  .ui-v2 .finance-monthly-dashboard-grid,
  .ui-v2 .accounting-profit-stats,
  .ui-v2 .filter-bar,
  .ui-v2 .realtime-filter-bar,
  .ui-v2 .note-filter-bar,
  .ui-v2 .finance-filter-bar,
  .ui-v2 .finance-ledger-filter-bar,
  .ui-v2 .finance-hierarchy-filter-bar,
  .ui-v2 .form-grid,
  .ui-v2 .permission-grid,
  .ui-v2 .finance-ledger-form-grid,
  .ui-v2 .finance-hierarchy-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .ui-v2 .home-stats-grid,
  .ui-v2 .realtime-sales-summary,
  .ui-v2 .realtime-sales-card {
    width: 100%;
    max-width: 100%;
  }

  .ui-v2 .realtime-sales-card,
  .ui-v2 .realtime-sales-metrics {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }

  .ui-v2 .realtime-sales-card {
    padding: 18px;
  }

  .ui-v2 .realtime-sales-main strong {
    font-size: 36px;
  }

  .ui-v2 .realtime-data-panel {
    height: auto;
    min-height: 0;
  }

  .ui-v2 .tabs {
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .ui-v2 .tabs::-webkit-scrollbar {
    display: none;
  }

  .ui-v2 .tabs > * {
    flex: 0 0 auto;
  }

  .ui-v2 input:not([type="checkbox"]):not([type="radio"]),
  .ui-v2 select,
  .ui-v2 textarea,
  body:has(.ui-v2) .modal input:not([type="checkbox"]):not([type="radio"]),
  body:has(.ui-v2) .modal select,
  body:has(.ui-v2) .modal textarea {
    font-size: 16px;
  }

  .ui-v2 .table-wrap,
  .ui-v2 .collection-alert-table-wrap,
  .ui-v2 .shop-score-table-wrap,
  .ui-v2 .performance-table-frame {
    max-width: 100%;
  }

  body:has(.ui-v2) .modal-backdrop {
    align-items: center;
    padding: 8px;
  }

  body:has(.ui-v2) .modal {
    width: calc(100vw - 16px);
    max-width: none;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 14px;
  }

  body:has(.ui-v2) .modal-header {
    position: sticky;
    top: 0;
    z-index: 3;
    flex: 0 0 auto;
    padding: 16px;
  }

  body:has(.ui-v2) .modal-form,
  body:has(.ui-v2) .accounting-modal-body,
  body:has(.ui-v2) .finance-ledger-details-modal .accounting-modal-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  body:has(.ui-v2) .modal-form {
    padding: 16px;
  }

  body:has(.ui-v2) .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 3;
    flex: 0 0 auto;
    gap: 8px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid #edf0f5;
  }

  body:has(.ui-v2) .modal-footer > button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
  }

  /* Small desktop affordances become full touch targets on phones without
     inflating dense tables on larger screens. */
  .ui-v2 .chip-btn,
  .ui-v2 .note-action-btn {
    min-height: 44px;
  }

  .ui-v2 .group-tag {
    min-height: 44px;
    height: auto;
    padding-right: 4px;
  }

  .ui-v2 .group-tag button {
    width: 44px;
    height: 44px;
    margin: -1px -1px -1px 0;
    background:
      radial-gradient(circle at center, #dbeafe 0 9px, transparent 10px);
  }

  .ui-v2 .finance-ledger-view-tabs {
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .ui-v2 .finance-ledger-view-tabs::-webkit-scrollbar {
    display: none;
  }

  .ui-v2 .finance-ledger-view-tabs > * {
    flex: 0 0 auto;
    min-height: 44px;
  }

  .ui-v2 .finance-ledger-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .ui-v2 .finance-ledger-table-wrap table {
    width: 100%;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .ui-v2 .finance-ledger-table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .ui-v2 .finance-ledger-table-wrap tbody {
    display: grid;
    gap: 12px;
  }

  .ui-v2 .finance-ledger-table-wrap tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
    padding: 14px;
    border: 1px solid #e4e1f1;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(31, 37, 61, 0.05);
  }

  .ui-v2 .finance-ledger-table-wrap tbody tr.finance-ledger-inactive-row {
    background: #fafbfc;
  }

  .ui-v2 .finance-ledger-table-wrap tbody td {
    min-width: 0 !important;
    display: grid;
    align-content: start;
    gap: 5px;
    padding: 9px 0;
    border: 0;
    background: transparent !important;
    overflow-wrap: anywhere;
  }

  .ui-v2 .finance-ledger-table-wrap tbody td::before {
    content: attr(data-label);
    color: #7b8192;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
  }

  .ui-v2 .finance-ledger-name,
  .ui-v2 .finance-ledger-balance {
    padding-top: 0 !important;
  }

  .ui-v2 .finance-ledger-name {
    grid-column: 1;
  }

  .ui-v2 .finance-ledger-name strong {
    font-size: 17px;
  }

  .ui-v2 .finance-ledger-balance {
    grid-column: 2;
    justify-items: end;
    text-align: right;
    font-size: 17px;
    font-weight: 800;
  }

  .ui-v2 .finance-ledger-last-change,
  .ui-v2 .finance-ledger-note,
  .ui-v2 .finance-ledger-actions-cell {
    grid-column: 1 / -1;
  }

  .ui-v2 .finance-ledger-last-change,
  .ui-v2 .finance-ledger-note {
    border-top: 1px solid #f0eef6;
  }

  .ui-v2 .finance-ledger-state {
    align-items: start;
  }

  .ui-v2 .finance-ledger-actions-cell {
    margin-top: 3px;
    border-top: 1px solid #e8e4f3 !important;
    padding-top: 12px !important;
  }

  .ui-v2 .finance-ledger-row-actions {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .ui-v2 .finance-ledger-row-actions button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 6px;
  }

  .ui-v2 .finance-ledger-table-wrap tbody tr.finance-ledger-empty-row {
    display: block;
  }

  .ui-v2 .finance-ledger-table-wrap .finance-ledger-empty-row td {
    display: block;
    padding: 0;
  }

  .ui-v2 .finance-ledger-table-wrap .finance-ledger-empty-row td::before {
    content: none;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap table {
    width: 100%;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap tbody {
    display: grid;
    gap: 12px;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
    padding: 14px;
    border: 1px solid #e4e1f1;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(31, 37, 61, 0.05);
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td {
    min-width: 0 !important;
    display: grid;
    align-content: start;
    gap: 5px;
    padding: 9px 0;
    border: 0;
    background: transparent !important;
    overflow-wrap: anywhere;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td::before {
    content: attr(data-label);
    color: #7b8192;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(2),
  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(6),
  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(7),
  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(8) {
    grid-column: 1 / -1;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(6),
  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(7),
  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(8) {
    border-top: 1px solid #f0eef6;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(4),
  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(5) {
    font-size: 16px;
    font-weight: 800;
  }

  .ui-v2 .finance-ledger-person-link {
    width: fit-content;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 8px 0;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap tbody tr.finance-ledger-all-entry-empty-row {
    display: block;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap .finance-ledger-all-entry-empty-row td {
    display: block;
    padding: 0;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap .finance-ledger-all-entry-empty-row td::before {
    content: none;
  }
}

@media (max-width: 420px) {
  .ui-v2 .content {
    padding: 12px;
  }

  .ui-v2 .stat-card {
    min-height: 96px;
    padding: 16px;
  }

  .ui-v2 .stat-card strong {
    font-size: 27px;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap tbody tr {
    grid-template-columns: 1fr;
  }

  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td,
  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(2),
  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(4),
  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(5),
  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(6),
  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(7),
  .ui-v2 .finance-ledger-all-entry-table-wrap tbody td:nth-child(8) {
    grid-column: 1;
    white-space: normal;
  }

  .auth-retry-actions {
    flex-direction: column;
  }
}

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

/* Real mobile navigation backdrop: clickable and keyboard discoverable. */
.ui-v2 .nav-backdrop {
  display: none;
}

@media (max-width: 1023px) {
  .dashboard-layout.ui-v2::before,
  .ui-v2 .dashboard-layout::before {
    display: none;
  }

  .dashboard-layout.ui-v2.nav-open .nav-backdrop,
  .ui-v2 .dashboard-layout.nav-open .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0 0 0 min(288px, 86vw);
    z-index: 11;
    width: auto;
    height: 100%;
    border: 0;
    padding: 0;
    background: rgba(35, 39, 58, 0.30);
    cursor: pointer;
  }
}

/* UI V2 operating dashboard and reusable historical trend chart. */
.ui-v2 .home-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.ui-v2 .home-kpi-card {
  min-width: 0;
  min-height: 138px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(43, 48, 77, 0.055);
}

.ui-v2 .home-kpi-card.is-primary {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(135deg, #8069fa 0%, #7257f6 52%, #6045e7 100%);
  box-shadow: 0 18px 34px rgba(114, 87, 246, 0.22);
}

.ui-v2 .home-kpi-label {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #697184;
  font-size: 14px;
  font-weight: 650;
}

.ui-v2 .home-kpi-card.is-primary .home-kpi-label,
.ui-v2 .home-kpi-card.is-primary small {
  color: rgba(255, 255, 255, 0.82);
}

.ui-v2 .home-kpi-card > strong {
  min-width: 0;
  overflow: hidden;
  color: #20283a;
  font-size: clamp(26px, 2.1vw, 38px);
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-v2 .home-kpi-card.is-primary > strong {
  color: #ffffff;
}

.ui-v2 .home-kpi-card small {
  min-height: 20px;
  color: #8a91a1;
  font-size: 13px;
  line-height: 1.5;
}

.ui-v2 .home-kpi-card.is-up small {
  color: rgba(224, 255, 242, 0.92);
}

.ui-v2 .home-kpi-card.is-down small {
  color: #ffe4e8;
}

.ui-v2 .home-live-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: #bfffe3;
  box-shadow: 0 0 0 5px rgba(191, 255, 227, 0.13);
}

.ui-v2 .home-dashboard-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(280px, 0.78fr);
  align-items: stretch;
  gap: 16px;
}

.ui-v2 .home-dashboard-grid > .panel {
  min-width: 0;
  margin: 0;
}

.ui-v2 .trend-panel-header {
  align-items: center;
}

.ui-v2 .trend-range-tabs,
.ui-v2 .trend-metric-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ui-v2 .trend-range-tabs {
  padding: 4px;
  border: 1px solid #e6e3f8;
  border-radius: 12px;
  background: #f7f5ff;
}

.ui-v2 .trend-range-tabs .chip-btn {
  min-width: 52px;
  min-height: 34px;
  padding: 6px 11px;
  border: 0;
  border-radius: 9px;
  color: #6f7384;
  background: transparent;
  box-shadow: none;
}

.ui-v2 .trend-range-tabs .chip-btn.active {
  color: #5c42d9;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(73, 58, 145, 0.12);
}

.ui-v2 .trend-metric-tabs {
  margin: 0 22px;
  border-bottom: 1px solid #eceef5;
}

.ui-v2 .trend-metric-tab {
  min-height: 44px;
  padding: 0 4px;
  margin-right: 18px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: #747b8d;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.ui-v2 .trend-metric-tab.active {
  color: var(--ui-primary);
  border-bottom-color: var(--ui-primary);
}

.ui-v2 .trend-panel-body {
  min-width: 0;
  min-height: 280px;
  padding-top: 12px;
}

.ui-v2 .trend-panel-body.is-loading {
  opacity: 0.72;
}

.ui-v2 .trend-chart-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 2px;
}

.ui-v2 .trend-chart-summary > span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #faf9ff;
}

.ui-v2 .trend-chart-summary small {
  overflow: hidden;
  color: #8b91a2;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-v2 .trend-chart-summary strong {
  overflow: hidden;
  color: #272e40;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-v2 .trend-chart-canvas {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.ui-v2 .trend-panel .trend-chart-summary,
.ui-v2 .trend-panel .trend-chart-canvas {
  width: 100%;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.ui-v2 .trend-chart-canvas svg {
  width: 100%;
  min-width: 0;
  height: auto;
  display: block;
  overflow: visible;
}

.ui-v2 .trend-grid-line line {
  stroke: #ebeef5;
  stroke-width: 1;
}

.ui-v2 .trend-grid-line text,
.ui-v2 .trend-x-label {
  fill: #9097a8;
  font-size: 12px;
}

.ui-v2 .trend-line {
  fill: none;
  stroke: #7257f6;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 5px 6px rgba(114, 87, 246, 0.18));
}

.ui-v2 .trend-point {
  fill: #ffffff;
  stroke: #7257f6;
  stroke-width: 2.5;
}

.ui-v2 .trend-point:hover {
  r: 5.5;
}

.ui-v2 .trend-chart-empty {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border: 1px dashed #ded9f6;
  border-radius: 14px;
  color: #81889a;
  background: #fbfaff;
  text-align: center;
}

.ui-v2 .trend-chart-empty.is-error,
.ui-v2 .trend-inline-error {
  color: #9c4a20;
  border-color: #f0d4bc;
  background: #fff8f1;
}

.ui-v2 .trend-inline-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid #f0d4bc;
  border-radius: 10px;
  font-size: 13px;
}

.ui-v2 .trend-inline-error button {
  min-height: 32px;
  padding: 4px 10px;
  border: 0;
  color: #6847d9;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.ui-v2 .collection-health-card .panel-header {
  align-items: flex-start;
}

.ui-v2 .health-status {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  color: #287257;
  background: #e9f8f1;
  font-size: 12px;
  font-weight: 700;
}

.ui-v2 .health-status.is-warning {
  color: #9b5a11;
  background: #fff4df;
}

.ui-v2 .collection-health-body {
  min-height: 392px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
}

.ui-v2 .health-ring {
  width: 178px;
  height: 178px;
  position: relative;
  align-self: center;
}

.ui-v2 .health-ring svg {
  width: 100%;
  height: 100%;
  display: block;
  transform: rotate(-90deg);
}

.ui-v2 .health-ring circle {
  fill: none;
  stroke-width: 10;
}

.ui-v2 .health-ring-track {
  stroke: #efedf8;
}

.ui-v2 .health-ring-value {
  stroke: #7257f6;
  stroke-linecap: round;
  transition: stroke-dasharray 0.35s ease;
}

.ui-v2 .health-ring > div {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
}

.ui-v2 .health-ring strong {
  color: #2a3042;
  font-size: 31px;
  letter-spacing: -0.04em;
}

.ui-v2 .health-ring span {
  color: #858c9d;
  font-size: 12px;
}

.ui-v2 .health-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ui-v2 .health-metrics > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px;
  border: 1px solid #eceef4;
  border-radius: 12px;
  background: #fafbfe;
}

.ui-v2 .health-metrics span,
.ui-v2 .health-metrics small {
  overflow: hidden;
  color: #858c9d;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-v2 .health-metrics strong {
  color: #272e40;
  font-size: 24px;
}

.ui-v2 .health-metrics strong.is-warning {
  color: #c66b19;
}

.ui-v2 .health-update {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #eceef4;
}

.ui-v2 .health-update > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ui-v2 .health-update strong {
  color: #374055;
  font-size: 13px;
}

.ui-v2 .health-update small {
  overflow: hidden;
  color: #8b91a1;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-v2 .performance-trend-block {
  min-width: 0;
  margin: 14px 0;
  padding: 16px;
  border: 1px solid #e7e3f7;
  border-radius: 14px;
  background: #ffffff;
}

.ui-v2 .performance-trend-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.ui-v2 .performance-trend-block .trend-chart-summary,
.ui-v2 .performance-trend-block .trend-chart-canvas {
  width: 100%;
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}

.ui-v2 .performance-trend-heading > div:first-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ui-v2 .performance-trend-heading strong {
  color: #2b3245;
  font-size: 16px;
}

.ui-v2 .performance-trend-heading span {
  color: #8a91a1;
  font-size: 12px;
}

@media (max-width: 1279px) {
  .ui-v2 .home-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ui-v2 .home-dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ui-v2 .collection-health-body {
    min-height: 0;
    display: grid;
    grid-template-columns: 178px minmax(0, 1fr);
    align-items: center;
  }

  .ui-v2 .health-update {
    grid-column: 1 / -1;
  }
}

@media (max-width: 767px) {
  .ui-v2 .home-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .ui-v2 .home-kpi-card {
    min-height: 112px;
    padding: 16px;
    border-radius: 12px;
  }

  .ui-v2 .home-kpi-card.is-primary {
    grid-column: 1 / -1;
    min-height: 132px;
  }

  .ui-v2 .home-kpi-card:not(.is-primary):last-child {
    grid-column: 1 / -1;
  }

  .ui-v2 .home-kpi-card > strong {
    font-size: clamp(23px, 7.5vw, 32px);
  }

  .ui-v2 .trend-panel-header,
  .ui-v2 .performance-trend-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .ui-v2 .trend-range-tabs {
    max-width: 100%;
    overflow-x: auto;
  }

  .ui-v2 .trend-metric-tabs {
    margin: 0 16px;
    overflow-x: auto;
  }

  .ui-v2 .trend-metric-tab {
    flex: 0 0 auto;
    margin-right: 12px;
  }

  .ui-v2 .trend-panel-body {
    min-height: 260px;
    padding-top: 10px;
  }

  .ui-v2 .trend-chart-summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .ui-v2 .trend-chart-summary > span {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .ui-v2 .trend-chart-canvas {
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .ui-v2 .trend-chart-canvas svg {
    width: 620px;
    max-width: none;
  }

  .ui-v2 .collection-health-body {
    display: flex;
    min-height: 0;
  }

  .ui-v2 .health-ring {
    width: 156px;
    height: 156px;
  }

  .ui-v2 .health-update {
    width: 100%;
  }

  .ui-v2 .performance-trend-block {
    margin: 14px 0;
    padding: 14px;
  }
}

@media (max-width: 420px) {
  .ui-v2 .home-kpi-card:not(.is-primary) small {
    display: none;
  }

  .ui-v2 .home-kpi-card:not(.is-primary) {
    min-height: 96px;
  }

  .ui-v2 .home-kpi-card:not(.is-primary) > strong {
    font-size: 22px;
  }
}

@media (max-width: 480px) {
  .ui-v2 .home-kpi-card:not(.is-primary) > strong {
    font-size: 22px;
  }
}

/* UI V2 table usability, result context, rankings, and runtime log controls. */
.ui-v2 .result-summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0;
  padding: 8px 12px;
  border: 1px solid #e8e5f7;
  border-radius: 10px;
  color: #7b8192;
  background: #faf9ff;
  font-size: 13px;
}

.ui-v2 .result-summary strong {
  color: #5f46d9;
  font-size: 16px;
}

.ui-v2 .sidebar {
  scrollbar-width: none;
}

.ui-v2 .sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.ui-v2 .realtime-table th:nth-child(1),
.ui-v2 .realtime-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #ffffff;
}

.ui-v2 .realtime-table th:nth-child(2),
.ui-v2 .realtime-table td:nth-child(2) {
  position: sticky;
  left: 58px;
  z-index: 2;
  background: #fbfaff;
  box-shadow: 1px 0 0 #e8e5f3;
}

.ui-v2 .realtime-table thead th:nth-child(1),
.ui-v2 .realtime-table thead th:nth-child(2) {
  z-index: 6;
  background: #f4f1ff;
}

.ui-v2 .realtime-table tfoot td:nth-child(1),
.ui-v2 .realtime-table tfoot td:nth-child(2) {
  z-index: 5;
  background: #f5f2ff;
}

.ui-v2 .performance-table th:first-child,
.ui-v2 .performance-table td:first-child {
  width: 180px;
  min-width: 180px;
  max-width: 180px;
}

.ui-v2 .performance-table th:nth-child(2),
.ui-v2 .performance-table td:nth-child(2) {
  position: sticky;
  left: 180px;
  z-index: 2;
  min-width: 136px;
  background: #fbfaff;
  box-shadow: 1px 0 0 #e8e5f3;
}

.ui-v2 .performance-table thead th:first-child,
.ui-v2 .performance-table thead th:nth-child(2) {
  z-index: 5;
  background: #f4f1ff;
}

.ui-v2 .performance-table .summary-row td:first-child,
.ui-v2 .performance-table .summary-row td:nth-child(2) {
  background: #eee9ff;
}

.ui-v2 .ranking-bars {
  margin: 14px 0 16px;
  padding: 16px;
  border: 1px solid #e7e3f7;
  border-radius: 14px;
  background: #ffffff;
}

.ui-v2 .ranking-bars-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.ui-v2 .ranking-bars-heading strong {
  color: #293146;
  font-size: 15px;
}

.ui-v2 .ranking-bars-heading span {
  color: #8a91a2;
  font-size: 12px;
}

.ui-v2 .ranking-bars-list {
  display: grid;
  gap: 9px;
}

.ui-v2 .ranking-bar-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(120px, 210px) minmax(150px, 1fr) 108px;
  align-items: center;
  gap: 10px;
  color: #626a7d;
  font-size: 12px;
}

.ui-v2 .ranking-bar-rank {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #674bdc;
  background: #f0edff;
  font-weight: 800;
}

.ui-v2 .ranking-bar-name {
  overflow: hidden;
  color: #394157;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-v2 .ranking-bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #efedf8;
}

.ui-v2 .ranking-bar-track i {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #8a73fb, #7257f6);
}

.ui-v2 .ranking-bar-row > strong {
  color: #363e53;
  text-align: right;
}

.ui-v2 .log-filter-bar {
  display: grid;
  grid-template-columns: 150px 170px minmax(240px, 1fr) auto auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 10px;
}

.ui-v2 .log-item {
  grid-template-columns: 170px 76px minmax(0, 1fr) auto;
  align-items: center;
  border-color: #eceef5;
  border-radius: 10px;
}

.ui-v2 .log-item.log-level-error {
  border-color: #f1c9cf;
  background: #fff7f8;
}

.ui-v2 .log-item.log-level-warn {
  border-color: #f0dfbd;
  background: #fffbf2;
}

.ui-v2 .log-level-error .log-level-badge {
  color: #ad2f42;
  border-color: #efc3cb;
  background: #fff0f2;
}

.ui-v2 .log-level-warn .log-level-badge {
  color: #9a621a;
  border-color: #ecd8ae;
  background: #fff6e5;
}

.ui-v2 .log-copy-btn {
  min-width: 58px;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid #ddd8f3;
  border-radius: 8px;
  color: #654bd7;
  background: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 900px) {
  .ui-v2 .log-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ui-v2 .log-keyword-field {
    grid-column: 1 / -1;
  }

  .ui-v2 .ranking-bar-row {
    grid-template-columns: 30px minmax(100px, 160px) minmax(100px, 1fr) 98px;
  }
}

@media (max-width: 620px) {
  .ui-v2 .realtime-table th:nth-child(1),
  .ui-v2 .realtime-table td:nth-child(1) {
    width: 46px;
    min-width: 46px;
  }

  .ui-v2 .realtime-table th:nth-child(2),
  .ui-v2 .realtime-table td:nth-child(2) {
    left: 46px;
    min-width: 140px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ui-v2 .performance-table th:first-child,
  .ui-v2 .performance-table td:first-child {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ui-v2 .performance-table th:nth-child(2),
  .ui-v2 .performance-table td:nth-child(2) {
    left: 120px;
    min-width: 96px;
    max-width: 96px;
  }

  .ui-v2 .result-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .ui-v2 .ranking-bars {
    padding: 14px;
  }

  .ui-v2 .ranking-bars-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .ui-v2 .ranking-bar-row {
    grid-template-columns: 28px minmax(0, 1fr) 92px;
  }

  .ui-v2 .ranking-bar-track {
    grid-column: 2 / -1;
    grid-row: 2;
  }

  .ui-v2 .ranking-bar-row > strong {
    grid-column: 3;
    grid-row: 1;
  }

  .ui-v2 .log-filter-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .ui-v2 .log-keyword-field {
    grid-column: auto;
  }

  .ui-v2 .log-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .ui-v2 .log-item > span:nth-child(3) {
    grid-column: 1 / -1;
  }
}

/* Accounting source trace, batch completion and group-level monthly costs */
.finance-accounting-source-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 10px 0 16px;
  padding: 10px 12px;
  border: 1px solid #e2def0;
  border-radius: 12px;
  background: #fbfaff;
}

.finance-accounting-source-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.finance-accounting-source-item span {
  color: #756e83;
  font-size: 12px;
}

.finance-accounting-source-item strong {
  min-width: 0;
  overflow: hidden;
  color: #332c42;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-batch-clear-completed {
  white-space: nowrap;
}

.accounting-success-backdrop {
  background: rgba(34, 26, 58, 0.58);
}

.accounting-success-modal {
  width: min(680px, calc(100vw - 28px));
  border: 1px solid #9dddbd;
  box-shadow: 0 28px 80px rgba(30, 92, 62, 0.28);
}

.accounting-success-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: 50%;
  place-items: center;
  background: #ddf7e9;
  color: #15834e;
  font-size: 32px;
  font-weight: 800;
}

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

.accounting-success-summary span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid #e5e1ec;
  border-radius: 10px;
  color: #746d80;
  background: #fcfbfd;
}

.accounting-success-summary strong {
  min-width: 0;
  overflow: hidden;
  color: #30293e;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-success-summary .profit {
  grid-column: 1 / -1;
  border-color: #a6dfc2;
  background: #effaf4;
}

.accounting-success-summary .profit strong {
  color: #087a44;
  font-size: 20px;
}

.finance-monthly-scope-panel {
  margin-bottom: 18px;
}

.finance-monthly-scope-filters {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  margin-bottom: 14px;
}

.finance-monthly-group-tabs-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid #ece9f4;
}

.finance-monthly-group-tabs-row > span {
  color: #6f687b;
  font-size: 13px;
  font-weight: 800;
}

.finance-monthly-group-tabs {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 2px 7px;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}

.finance-monthly-group-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid #ded9eb;
  border-radius: 999px;
  background: #fff;
  color: #554d62;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}

.finance-monthly-group-tab:hover,
.finance-monthly-group-tab:focus-visible {
  border-color: #9d8fe0;
  background: #f7f4ff;
  color: #5138bc;
}

.finance-monthly-group-tab.active {
  border-color: #7558db;
  background: #7357d8;
  color: #fff;
  box-shadow: 0 6px 16px rgba(101, 73, 201, 0.18);
}

.finance-monthly-group-tab.inactive:not(.active) {
  border-style: dashed;
  color: #8a8394;
  background: #faf9fc;
}

.finance-monthly-group-tab small {
  font-size: 11px;
  opacity: 0.78;
}

.finance-group-cost-summary-panel {
  margin: 16px 0;
  border-color: #d8d0f5;
}

.finance-group-cost-summary-panel.readonly {
  border-color: #ddd9e5;
  background: #fcfbfd;
}

.finance-group-cost-summary-body {
  display: grid;
  gap: 12px;
}

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

.finance-group-cost-summary-grid span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #e3def1;
  border-radius: 10px;
  background: #fbfaff;
  color: #736b80;
  font-size: 13px;
}

.finance-group-cost-summary-grid strong {
  color: #392f4e;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.finance-group-cost-draft-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.finance-group-cost-draft-summary span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid #e3def1;
  border-radius: 10px;
  color: #736b80;
  background: #fbfaff;
  font-size: 12px;
}

.finance-group-cost-draft-summary strong {
  color: #392f4e;
  font-size: 17px;
}

.finance-group-cost-table table {
  min-width: 920px;
}

.finance-group-cost-table th:first-child,
.finance-group-cost-table td:first-child {
  width: 132px;
}

.finance-group-cost-table th:nth-child(2),
.finance-group-cost-table td:nth-child(2) {
  width: 180px;
}

.finance-group-cost-table th:nth-child(4),
.finance-group-cost-table td:nth-child(4) {
  width: 170px;
}

.finance-group-cost-table th:last-child,
.finance-group-cost-table td:last-child {
  width: 158px;
}

.finance-group-cost-table input,
.finance-group-cost-table select {
  width: 100%;
  min-width: 0;
}

.finance-group-cost-table tr.confirmed td {
  background: #fcfbff;
}

.finance-group-cost-table tr.editing td {
  background: #fffdf5;
}

.finance-group-cost-table input:disabled,
.finance-group-cost-table select:disabled {
  border-color: transparent;
  background: transparent;
  color: #3e374b;
  opacity: 1;
  cursor: default;
}

.finance-group-cost-operation-time {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f1edff;
  color: #6549c9;
  font-size: 12px;
  white-space: nowrap;
}

.finance-group-cost-operation-time.pending {
  background: #fff3d8;
  color: #9a6200;
}

.finance-group-cost-line-actions,
.finance-hierarchy-order-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.finance-group-cost-line-actions button {
  min-width: 58px;
}

.finance-group-cost-readonly-label {
  color: #867e91;
  font-size: 12px;
}

.finance-group-cost-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.finance-group-cost-actions > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.finance-group-cost-pending-hint {
  display: inline-flex;
  align-items: center;
  color: #9a6200;
  font-size: 12px;
}

.finance-group-cost-hint {
  margin: 12px 0 0;
}

.finance-group-cost-version-modal {
  width: min(1120px, calc(100vw - 28px));
}

.finance-group-cost-editor-modal,
.finance-group-cost-details-modal {
  position: relative;
  width: min(1120px, calc(100vw - 28px));
  max-height: min(90vh, 840px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.finance-group-cost-editor-modal > form {
  min-height: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.finance-group-cost-editor-body,
.finance-group-cost-details-modal > .accounting-modal-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.finance-group-cost-editor-modal .modal-footer,
.finance-group-cost-details-modal .modal-footer {
  flex: 0 0 auto;
  padding-top: 16px;
  border-top: 1px solid #edf0f5;
}

.finance-group-cost-detail-tabs {
  display: flex;
  gap: 8px;
  padding: 4px;
  border-radius: 10px;
  background: #f3f1f8;
}

.finance-group-cost-detail-tabs button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 7px 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6d6579;
  font-weight: 800;
  cursor: pointer;
}

.finance-group-cost-detail-tabs button.active {
  background: #fff;
  color: #553bc1;
  box-shadow: 0 2px 8px rgba(54, 43, 82, 0.10);
}

.finance-group-cost-detail-pane {
  display: grid;
  gap: 14px;
}

.finance-group-cost-detail-table table {
  min-width: 720px;
}

.finance-group-cost-detail-table th:nth-child(1),
.finance-group-cost-detail-table td:nth-child(1) {
  width: 130px;
}

.finance-group-cost-detail-table th:nth-child(2),
.finance-group-cost-detail-table td:nth-child(2) {
  width: 150px;
}

.finance-group-cost-detail-table th:nth-child(4),
.finance-group-cost-detail-table td:nth-child(4) {
  width: 180px;
}

.finance-group-cost-discard-confirm {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(38, 32, 51, 0.52);
  backdrop-filter: blur(2px);
}

.finance-group-cost-discard-confirm > div {
  width: min(440px, 100%);
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid #e4dfee;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 22px 54px rgba(30, 25, 43, 0.24);
}

.finance-group-cost-discard-confirm strong {
  color: #30283d;
  font-size: 19px;
}

.finance-group-cost-discard-confirm span {
  color: #746c80;
  line-height: 1.6;
}

.finance-group-cost-discard-confirm > div > div {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.finance-group-cost-editor-modal .accounting-modal-warning button {
  justify-self: start;
  margin-top: 6px;
}

.finance-group-cost-version-modal td small {
  display: block;
  max-width: 260px;
  overflow: hidden;
  color: #7a7285;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-group-cost-version-details summary {
  color: #6549c9;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.finance-group-cost-version-details > div {
  display: grid;
  gap: 6px;
  min-width: 420px;
  margin-top: 8px;
}

.finance-group-cost-version-details span {
  display: grid;
  grid-template-columns: 42px 132px 90px minmax(140px, 1fr);
  gap: 8px;
  align-items: center;
  color: #625a6e;
  font-size: 12px;
}

.finance-group-cost-version-details b,
.finance-group-cost-version-details em,
.finance-group-cost-version-details i {
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-group-cost-version-details em {
  color: #332b42;
  font-weight: 700;
}

.finance-hierarchy-order-actions {
  padding-right: 2px;
  border-right: 1px solid #e2ddef;
}

.finance-hierarchy-order-actions button {
  width: 32px;
  min-width: 32px;
  padding-inline: 0;
  color: #6549c9;
  font-size: 16px;
}

/* 月度账利润卡沿用财务紫色系，不使用盈亏方向色。 */
.finance-monthly-dashboard-grid > .accounting-profit-card,
.ui-v2 .finance-monthly-dashboard-grid > .accounting-profit-card {
  border-color: #d4cbf3;
  background: linear-gradient(180deg, #ffffff 0%, #f6f2ff 100%);
  box-shadow: 0 8px 22px rgba(101, 73, 201, 0.10);
}

.finance-monthly-dashboard-grid > .accounting-profit-card::before,
.ui-v2 .finance-monthly-dashboard-grid > .accounting-profit-card::before {
  background: #7357d8;
}

.finance-monthly-dashboard-grid > .accounting-profit-card strong,
.ui-v2 .finance-monthly-dashboard-grid > .accounting-profit-card strong {
  color: #392f4e;
}

@media (max-width: 720px) {
  .finance-accounting-source-strip,
  .accounting-success-summary,
  .finance-group-cost-draft-summary,
  .finance-group-cost-summary-grid,
  .finance-monthly-scope-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .finance-monthly-group-tabs-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .finance-monthly-group-tabs {
    margin-inline: -2px;
  }

  .finance-group-cost-summary-grid span {
    align-items: flex-start;
    flex-direction: column;
  }

  .accounting-success-summary .profit {
    grid-column: auto;
  }

  .finance-group-cost-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .finance-group-cost-actions > button {
    width: 100%;
  }

  .finance-group-cost-editor-modal,
  .finance-group-cost-details-modal {
    width: calc(100vw - 16px);
  }

  .finance-group-cost-discard-confirm > div > div {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Batch monthly accounting workflow */
.finance-batch-start-grid,
.finance-batch-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.finance-batch-start-card,
.finance-batch-upload-lane {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid #ded9f2;
  border-radius: 14px;
  background: #fff;
}

.finance-batch-start-card.muted {
  border-style: dashed;
  background: #fbfaff;
}

.finance-batch-start-card > strong {
  color: #30285d;
  font-size: 18px;
}

.finance-batch-start-card p,
.finance-batch-lane-head p {
  margin: 0;
  color: #756f87;
  line-height: 1.55;
}

.finance-batch-start-card label {
  display: grid;
  gap: 7px;
  color: #5b5570;
  font-weight: 700;
}

.finance-batch-start-card input,
.finance-batch-expense-picker select {
  min-height: 40px;
  border: 1px solid #dcd7eb;
  border-radius: 9px;
  padding: 8px 10px;
  background: #fff;
  color: #302b43;
  font: inherit;
}

.finance-batch-upload-grid {
  margin: 16px 0;
}

.finance-batch-upload-lane.required {
  border-top: 3px solid #7561df;
}

.finance-batch-upload-lane.optional {
  border-top: 3px solid #b8b0d4;
}

.finance-batch-lane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.finance-batch-lane-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: #30285d;
  font-size: 17px;
}

.finance-batch-lane-head h3 em {
  border-radius: 999px;
  padding: 3px 7px;
  background: #eeeafd;
  color: #654bd7;
  font-size: 11px;
  font-style: normal;
}

.finance-batch-lane-head h3 em.optional {
  background: #f1eff5;
  color: #746e80;
}

.finance-batch-lane-head > strong {
  flex: none;
  color: #654bd7;
}

.finance-batch-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.finance-batch-upload-actions label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.finance-batch-upload-actions label.disabled {
  opacity: .48;
  cursor: not-allowed;
}

.finance-batch-upload-actions input[type="file"] {
  display: none;
}

.finance-batch-file-list {
  display: grid;
  gap: 7px;
  max-height: 230px;
  overflow: auto;
}

.finance-batch-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 10px;
  padding: 9px 10px;
  border: 1px solid #e5e1ef;
  border-radius: 9px;
  background: #faf9fd;
}

.finance-batch-file > div {
  min-width: 0;
}

.finance-batch-file strong,
.finance-batch-file small {
  display: block;
}

.finance-batch-file strong {
  overflow: hidden;
  color: #3a344e;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-batch-file small,
.finance-batch-empty-file {
  color: #817b91;
  font-size: 12px;
}

.finance-batch-file > span {
  color: #615a76;
  font-size: 12px;
  font-weight: 700;
}

.finance-batch-file.progress {
  border-color: #cfc7f5;
  background: #f7f5ff;
}

.finance-batch-file.danger {
  border-color: #efc4cc;
  background: #fff5f6;
}

.finance-batch-file-error {
  grid-column: 1 / -1;
  color: #ad2f42 !important;
}

.finance-batch-empty-file {
  padding: 12px;
  border: 1px dashed #ded9e8;
  border-radius: 9px;
  text-align: center;
}

.finance-batch-status {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 25px;
  border: 1px solid #ddd8e9;
  border-radius: 999px;
  padding: 3px 9px;
  background: #f6f4f9;
  color: #686173;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.finance-batch-status.success {
  border-color: #bce0cf;
  background: #effaf4;
  color: #23764e;
}

.finance-batch-status.warning {
  border-color: #ead7aa;
  background: #fff8e9;
  color: #92601b;
}

.finance-batch-status.danger {
  border-color: #edc0c8;
  background: #fff1f3;
  color: #ad2f42;
}

.finance-batch-status.progress {
  border-color: #ccc4f3;
  background: #f2efff;
  color: #654bd7;
}

.finance-batch-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.finance-batch-summary span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #e1ddec;
  border-radius: 9px;
  padding: 8px 11px;
  background: #faf9fc;
  color: #6b657a;
}

.finance-batch-summary strong {
  color: #30285d;
  font-size: 16px;
}

.finance-batch-summary .success {
  border-color: #c1e1d1;
  background: #f1faf5;
}

.finance-batch-table table {
  min-width: 1540px;
}

.finance-batch-table td {
  vertical-align: top;
}

.finance-batch-shop-name,
.finance-batch-source,
.finance-batch-issues,
.finance-batch-expense-picker {
  display: grid;
  gap: 5px;
}

.finance-batch-shop-name {
  min-width: 170px;
}

.finance-batch-source {
  min-width: 180px;
  max-width: 260px;
}

.finance-batch-shop-name small,
.finance-batch-source small,
.finance-batch-issues span {
  color: #7d768d;
  font-size: 12px;
  line-height: 1.45;
}

.finance-batch-issues {
  min-width: 190px;
}

.finance-batch-issues span:not(.ok) {
  color: #9a621a;
}

.finance-batch-issues .ok,
.finance-batch-booked,
.finance-batch-expense-none {
  color: #24764f;
  font-size: 12px;
  font-weight: 700;
}

.finance-batch-expense-picker {
  min-width: 230px;
}

.finance-batch-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 150px;
}

.finance-batch-expense-picker small {
  color: #7d768d;
  font-size: 11px;
  line-height: 1.4;
}

.finance-batch-source-match,
.finance-batch-expense-match {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #d8d1f1;
  border-radius: 9px;
  background: #f8f6ff;
}

.finance-batch-source-match.confirmed,
.finance-batch-expense-match.confirmed {
  border-color: #bce0cf;
  background: #f1faf5;
}

.finance-batch-source-match.warning {
  border-color: #ead7aa;
  background: #fff8e9;
}

.finance-batch-source-match strong,
.finance-batch-expense-match strong {
  overflow-wrap: anywhere;
  color: #3a344e;
  line-height: 1.35;
}

.finance-batch-source-badge,
.finance-batch-expense-badge {
  display: inline-flex;
  width: max-content;
  border-radius: 999px;
  padding: 2px 7px;
  background: #eae5ff;
  color: #654bd7;
  font-size: 11px;
  font-weight: 800;
}

.finance-batch-source-match.confirmed .finance-batch-source-badge,
.finance-batch-expense-match.confirmed .finance-batch-expense-badge {
  background: #dff3e8;
  color: #23764e;
}

.finance-batch-source-match.warning .finance-batch-source-badge {
  background: #f7e7bd;
  color: #8a5918;
}

.finance-batch-source-match small {
  color: #7d768d;
  font-size: 11px;
  line-height: 1.4;
}

.finance-batch-source-match.missing {
  border-style: dashed;
  border-color: #ddd6e9;
  background: #fbfafc;
}

.finance-batch-source-match.missing .finance-batch-source-badge {
  background: #f0edf4;
  color: #746e80;
}

.finance-batch-expense-choice {
  display: grid;
  gap: 4px;
  color: #756f87;
  font-size: 11px;
}

.finance-batch-expense-candidates > strong,
.finance-batch-expense-missing > strong {
  color: #514a64;
  font-size: 12px;
}

.finance-batch-expense-missing {
  padding: 8px;
  border: 1px dashed #ddd6e9;
  border-radius: 9px;
  background: #fbfafc;
}

.finance-batch-purchase-missing > button,
.finance-batch-purchase-candidates > button {
  justify-self: start;
  margin-top: 3px;
}

.finance-batch-review-context {
  margin-bottom: 16px;
  border-color: #cfc7f5;
  background: #fbfaff;
}

.finance-batch-name-modal {
  width: min(660px, calc(100vw - 28px));
}

.finance-batch-name-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.finance-batch-name-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid #ded9eb;
  border-radius: 10px;
  cursor: pointer;
}

.finance-batch-name-choice:has(input:checked) {
  border-color: #8d7be4;
  background: #f6f3ff;
}

.finance-batch-name-choice span,
.finance-batch-name-choice small {
  display: block;
}

.finance-batch-name-choice small {
  margin-top: 4px;
  color: #777083;
}

@media (max-width: 980px) {
  .finance-batch-start-grid,
  .finance-batch-upload-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .finance-batch-start-card,
  .finance-batch-upload-lane {
    padding: 15px;
  }

  .finance-batch-lane-head,
  .finance-batch-upload-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .finance-batch-upload-actions label {
    width: 100%;
  }
}

/* Versioned, permission-gated client downloads. */
.software-release-panel .panel-body,
.software-release-modal-body {
  display: grid;
  gap: 16px;
}

.software-release-modal {
  width: min(860px, calc(100vw - 32px));
  max-height: min(82vh, 760px);
}

.software-release-modal-body {
  overflow: auto;
  padding: 20px;
}

.software-product-intro {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #ded9ef;
  border-radius: 12px;
  background: #faf9ff;
}

.software-product-intro strong {
  color: #29233b;
  font-size: 16px;
}

.software-product-intro span {
  color: #726b80;
  font-size: 13px;
}

.software-release-list {
  display: grid;
  gap: 12px;
}

.software-release-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid #e1ddea;
  border-radius: 12px;
  background: #fff;
}

.software-release-card.is-current {
  border-color: #bcaef4;
  background: linear-gradient(135deg, #fbfaff 0%, #f7f4ff 100%);
  box-shadow: 0 8px 22px rgba(104, 76, 210, 0.08);
}

.software-release-main {
  min-width: 0;
}

.software-release-title,
.software-release-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.software-release-title strong {
  color: #272236;
  font-size: 15px;
}

.software-version-badge,
.software-current-badge,
.software-history-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.software-version-badge {
  color: #6248bf;
  background: #eee9ff;
}

.software-current-badge {
  color: #196a4d;
  background: #e5f7ef;
}

.software-history-badge {
  color: #6d6877;
  background: #f0eef3;
}

.software-release-meta {
  margin-top: 9px;
  color: #777082;
  font-size: 12px;
}

.software-release-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 8px;
  color: #bbb4c5;
}

.software-release-main p {
  margin: 9px 0 5px;
  color: #4e485a;
  font-size: 13px;
  line-height: 1.55;
}

.software-release-main small {
  display: block;
  max-width: 640px;
  overflow: hidden;
  color: #898293;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.software-download-btn {
  flex: 0 0 auto;
  min-width: 112px;
}

.software-release-error button {
  margin-top: 8px;
}

@media (max-width: 680px) {
  .software-release-card,
  .software-product-intro {
    align-items: stretch;
    flex-direction: column;
  }

  .software-download-btn {
    width: 100%;
  }

  .software-release-meta span::after {
    display: none;
  }
}

/* UI V2 20260718.09: selected mobile-first shell and visual unification.
   Business controls, permissions and route bindings remain in app.js. */
.ui-v2 .brand-mark {
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
  background: #ffffff;
}

.ui-v2 .topbar-brand,
.ui-v2 .mobile-bottom-nav,
.ui-v2 .home-kpi-icon,
.ui-v2 .home-kpi-card.is-mobile-only {
  display: none;
}

.ui-v2 .home-kpi-card {
  position: relative;
}

.ui-v2 .topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 68px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
}

.ui-v2 .topbar-title {
  min-width: 0;
}

.ui-v2 .topbar-title h1 {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.ui-v2 .topbar-actions {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
}

.ui-v2 .account-menu {
  position: relative;
  min-width: 0;
}

.ui-v2 .account-menu summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 4px 5px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #2a3042;
  background: transparent;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.ui-v2 .account-menu summary::-webkit-details-marker {
  display: none;
}

.ui-v2 .account-menu summary:hover,
.ui-v2 .account-menu[open] summary {
  border-color: #e4e0f6;
  background: #f7f5ff;
}

.ui-v2 .account-avatar {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(145deg, #7257f6, #5136df);
  box-shadow: 0 7px 16px rgba(96, 69, 231, 0.22);
  font-size: 16px;
  font-weight: 800;
}

.ui-v2 .account-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-v2 .account-popover {
  width: 220px;
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid #e3e0f0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 20px 48px rgba(42, 35, 76, 0.18);
}

.ui-v2 .account-meta {
  min-width: 0;
  display: grid;
  gap: 3px;
  margin-bottom: 2px;
  padding: 8px 9px 11px;
  border-bottom: 1px solid #ece9f5;
}

.ui-v2 .account-meta strong,
.ui-v2 .account-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-v2 .account-meta span {
  color: #858c9d;
  font-size: 12px;
}

.ui-v2 .account-popover button {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  padding: 9px 11px;
  color: #394056;
  background: transparent;
  text-align: left;
}

.ui-v2 .account-popover button:hover {
  color: #5c42d9;
  background: #f4f1ff;
}

.ui-v2 .account-popover [data-action="logout"] {
  color: #a23a46;
}

.ui-v2 .sidebar-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px;
  color: #232a3d;
  font-size: 16px;
}

.ui-v2 .sidebar-brand .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.ui-v2 .sidebar-brand span {
  color: #8a91a1;
  font-size: 10px;
}

.ui-v2 .sidebar {
  color: #30384d;
  border-right: 1px solid #e8e6ef;
  background: #ffffff;
  box-shadow: none;
}

.ui-v2 .sidebar-inner {
  gap: 10px;
  padding: 18px 12px;
}

.ui-v2 .sidebar-group-title {
  padding: 13px 11px 5px;
  color: #959bad;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.ui-v2 .sidebar-nav {
  gap: 4px;
}

.ui-v2 .sidebar-link {
  min-height: 42px;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border-radius: 9px;
  color: #50596d;
  padding: 9px 12px;
}

.ui-v2 .sidebar-link .nav-dot {
  display: none;
}

.ui-v2 .sidebar-link:hover {
  color: #4f3cc4;
  background: #f7f5ff;
}

.ui-v2 .sidebar-link.active {
  color: #5b42da;
  background: #f1edff;
  box-shadow: inset 3px 0 0 #7257f6;
}

.login-page.ui-v2,
.auth-loading-page.ui-v2 {
  background:
    radial-gradient(circle at 8% 10%, rgba(114, 87, 246, 0.13), transparent 32%),
    radial-gradient(circle at 94% 92%, rgba(141, 119, 255, 0.10), transparent 30%),
    #f8f8fc;
}

.login-page.ui-v2 .login-panel {
  border-color: #e4e1ef;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(52, 43, 92, 0.15);
}

.login-page.ui-v2 .login-brand {
  align-content: center;
  color: #ffffff;
  background:
    radial-gradient(circle at 14% 16%, rgba(255, 255, 255, 0.22), transparent 31%),
    linear-gradient(145deg, #7d64f8 0%, #674ce9 48%, #5136da 100%);
}

.login-page.ui-v2 .login-brand-heading {
  display: flex;
  align-items: center;
  gap: 16px;
}

.login-page.ui-v2 .login-brand-heading .brand-mark {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  box-shadow: 0 14px 28px rgba(47, 31, 128, 0.20);
}

.login-page.ui-v2 .login-brand .brand-kicker,
.login-page.ui-v2 .login-brand p {
  color: rgba(255, 255, 255, 0.82);
}

.login-page.ui-v2 .login-brand h1 {
  color: #ffffff;
  font-size: clamp(34px, 4.2vw, 48px);
  white-space: nowrap;
}

.login-page.ui-v2 .login-form {
  background: #ffffff;
}

@media (min-width: 1024px) {
  .dashboard-layout.ui-v2 {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  .ui-v2 .sidebar {
    position: sticky;
  }

  .ui-v2 .sidebar-header {
    min-height: 56px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eeecf4;
  }
}

@media (max-width: 1023px) {
  .dashboard-layout.ui-v2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .ui-v2 .main-shell {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .ui-v2 .topbar {
    z-index: 9;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 66px;
    padding: 8px 14px;
  }

  .ui-v2 .topbar-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    justify-self: start;
  }

  .ui-v2 .topbar-brand .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .ui-v2 .topbar-brand > div {
    min-width: 0;
    display: grid;
    gap: 1px;
  }

  .ui-v2 .topbar-brand strong,
  .ui-v2 .topbar-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ui-v2 .topbar-brand strong {
    color: #222a3e;
    font-size: 14px;
    letter-spacing: -0.03em;
  }

  .ui-v2 .topbar-brand span {
    color: #9298a8;
    font-size: 8px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .ui-v2 .topbar-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
  }

  .ui-v2 .topbar-title h1 {
    font-size: 18px;
    white-space: nowrap;
  }

  .ui-v2 .topbar-title span {
    display: none;
  }

  .ui-v2 .topbar-actions {
    width: auto;
    margin-left: auto;
  }

  .ui-v2 .account-menu summary {
    max-width: 122px;
    min-height: 42px;
    padding: 3px 7px 3px 3px;
  }

  .ui-v2 .account-avatar {
    width: 36px;
    height: 36px;
  }

  .ui-v2 .account-name {
    max-width: 66px;
    font-size: 13px;
  }

  .ui-v2 .account-popover {
    position: fixed;
    top: 62px;
    right: 12px;
    width: min(240px, calc(100vw - 24px));
  }

  .ui-v2 .sidebar {
    z-index: 12;
    width: min(312px, 88vw);
    color: #30384d;
    background: #ffffff;
    box-shadow: 18px 0 48px rgba(42, 35, 76, 0.20);
  }

  .ui-v2 .sidebar-header {
    position: sticky;
    top: 0;
    z-index: 2;
    align-items: center;
    padding: 2px 0 12px;
    border-bottom: 1px solid #eeecf4;
    background: #ffffff;
  }

  .ui-v2 .sidebar-close {
    min-width: 58px;
    min-height: 40px;
    border-color: #dcd6fa;
    border-radius: 999px;
    color: #5a42d6;
    background: #f3f0ff;
  }

  .dashboard-layout.ui-v2.nav-open .nav-backdrop {
    inset: 0 0 0 min(312px, 88vw);
    background: rgba(31, 27, 48, 0.34);
    backdrop-filter: blur(2px);
  }

  .ui-v2 .mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    min-height: calc(66px + env(safe-area-inset-bottom));
    display: flex;
    align-items: stretch;
    padding: 5px max(8px, env(safe-area-inset-left)) max(5px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
    border-top: 1px solid rgba(224, 222, 234, 0.92);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -10px 28px rgba(49, 43, 75, 0.08);
    backdrop-filter: blur(18px);
  }

  .ui-v2 .mobile-bottom-link {
    min-width: 0;
    min-height: 56px;
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    border: 0;
    border-radius: 10px;
    padding: 4px 2px;
    color: #677084;
    background: transparent;
    font-size: 11px;
    font-weight: 650;
  }

  .ui-v2 .mobile-bottom-link img {
    width: 23px;
    height: 23px;
    display: block;
  }

  .ui-v2 .mobile-bottom-link.active {
    color: #5b42df;
    background: #f8f6ff;
  }

  .ui-v2 .mobile-bottom-link.active img {
    filter: brightness(0) saturate(100%) invert(35%) sepia(82%) saturate(2698%) hue-rotate(240deg) brightness(88%) contrast(101%);
  }
}

@media (max-width: 767px) {
  .ui-v2 .content {
    gap: 16px;
    padding: 16px 14px 22px;
  }

  .ui-v2 .panel {
    border-radius: 16px;
  }

  .ui-v2 .home-kpi-grid {
    grid-template-columns: minmax(0, 1.45fr) repeat(3, minmax(0, 1fr));
    gap: 0;
  }

  .ui-v2 .home-kpi-card.is-mobile-only {
    display: flex;
  }

  .ui-v2 .home-kpi-card.is-primary {
    grid-column: 1 / -1;
    min-height: 148px;
    margin-bottom: 16px;
    padding: 21px 20px;
    border-radius: 18px;
    background:
      radial-gradient(circle at 78% 16%, rgba(255, 255, 255, 0.18), transparent 28%),
      linear-gradient(135deg, #7459f7 0%, #5f43ed 52%, #4d33d9 100%);
    box-shadow: 0 16px 30px rgba(94, 65, 226, 0.22);
  }

  .ui-v2 .home-kpi-card.is-primary .home-kpi-label {
    justify-content: flex-start;
  }

  .ui-v2 .home-kpi-card.is-primary > strong {
    padding-right: 54px;
    font-size: clamp(30px, 9.3vw, 43px);
  }

  .ui-v2 .home-kpi-card.is-primary small {
    max-width: 100%;
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
  }

  .ui-v2 .home-kpi-card:not(.is-primary) {
    grid-column: auto;
    min-height: 114px;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    padding: 8px 4px;
    border: 0;
    border-left: 1px solid #e7e5ef;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    text-align: center;
  }

  .ui-v2 .home-kpi-card:not(.is-primary):last-child {
    grid-column: auto;
  }

  .ui-v2 .home-kpi-card:nth-child(2) {
    border-left: 0;
  }

  .ui-v2 .home-kpi-card:not(.is-primary) .home-kpi-label {
    width: 100%;
    display: block;
    overflow: hidden;
    color: #596176;
    font-size: clamp(10px, 2.8vw, 13px);
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ui-v2 .home-kpi-card:not(.is-primary) > strong {
    width: 100%;
    overflow: hidden;
    font-size: clamp(16px, 5vw, 22px);
    letter-spacing: -0.035em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ui-v2 .home-kpi-card.is-mobile-only {
    padding-inline: 0;
  }

  .ui-v2 .home-kpi-card.is-mobile-only > strong {
    font-size: clamp(11px, 3.6vw, 15px);
    letter-spacing: -0.04em;
  }

  .ui-v2 .home-kpi-card:nth-child(2) > strong {
    font-size: clamp(11px, 3.45vw, 16px);
  }

  .ui-v2 .home-kpi-card:not(.is-primary) small {
    display: none;
  }

  .ui-v2 .home-kpi-icon {
    width: 27px;
    height: 27px;
    display: block;
    margin-top: auto;
    filter: brightness(0) saturate(100%) invert(35%) sepia(82%) saturate(2698%) hue-rotate(240deg) brightness(88%) contrast(101%);
  }

  .ui-v2 .home-kpi-card.is-primary .home-kpi-icon {
    width: 30px;
    height: 30px;
    position: absolute;
    top: 20px;
    right: 20px;
    margin: 0;
    padding: 9px;
    box-sizing: content-box;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.16);
    filter: brightness(0) invert(1);
  }

  .ui-v2 .trend-panel-header,
  .ui-v2 .performance-trend-heading {
    gap: 15px;
    padding: 20px 16px 12px;
    border-bottom: 0;
  }

  .ui-v2 .trend-panel-header .hint-text {
    margin-top: 5px;
    line-height: 1.55;
  }

  .ui-v2 .trend-range-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
    padding: 4px;
  }

  .ui-v2 .trend-range-tabs .chip-btn {
    width: 100%;
    min-width: 0;
  }

  .ui-v2 .trend-metric-tabs {
    margin: 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .ui-v2 .trend-metric-tabs::-webkit-scrollbar {
    display: none;
  }

  .ui-v2 .trend-panel-body {
    min-height: 0;
    padding: 10px 16px 18px;
  }

  .ui-v2 .trend-chart-summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    margin-bottom: 12px;
  }

  .ui-v2 .trend-chart-summary > span {
    min-height: 48px;
    padding: 10px 12px;
    background: #faf9ff;
  }

  .ui-v2 .trend-chart-summary strong {
    font-size: 14px;
  }

  .ui-v2 .trend-chart-canvas {
    overflow: hidden;
  }

  .ui-v2 .trend-chart-canvas svg,
  .ui-v2 .trend-chart-canvas svg.is-compact {
    width: 100%;
    max-width: 340px;
    height: auto;
    margin-right: auto;
    margin-left: auto;
    overflow: visible;
  }

  .ui-v2 [data-software-catalog-open="collector"] {
    display: none !important;
  }

  .login-page.ui-v2 {
    place-items: start center;
    padding: max(24px, env(safe-area-inset-top)) 16px 24px;
  }

  .login-page.ui-v2 .login-panel {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    border-radius: 20px;
  }

  .login-page.ui-v2 .login-brand {
    min-height: 178px;
    align-content: center;
    gap: 11px;
    padding: 28px 24px;
  }

  .login-page.ui-v2 .login-brand-heading {
    gap: 12px;
  }

  .login-page.ui-v2 .login-brand-heading .brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 14px;
  }

  .login-page.ui-v2 .login-brand h1 {
    font-size: clamp(27px, 8vw, 36px);
  }

  .login-page.ui-v2 .login-form {
    gap: 16px;
    padding: 26px 22px 28px;
  }

  .login-page.ui-v2 .login-form h2 {
    font-size: 24px;
  }
}

@media (max-width: 360px) {
  .ui-v2 .topbar {
    gap: 7px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .ui-v2 .topbar-brand strong {
    font-size: 12px;
  }

  .ui-v2 .topbar-brand span,
  .ui-v2 .account-name {
    display: none;
  }

  .ui-v2 .account-menu summary {
    padding-right: 3px;
  }

  .ui-v2 .topbar-brand {
    gap: 5px;
  }

  .ui-v2 .topbar-brand .brand-mark {
    width: 32px;
    height: 32px;
  }

  .ui-v2 .home-kpi-card.is-primary {
    padding-right: 17px;
    padding-left: 17px;
  }

  .ui-v2 .home-kpi-card.is-primary > strong {
    font-size: 29px;
  }
}

/* 2026-07-24 笔记数据与单店实时详情 */
.realtime-row-actions {
  min-width: 176px;
  flex-wrap: nowrap;
}

.realtime-row-actions .secondary-btn {
  min-height: 34px;
  padding: 6px 10px;
  white-space: nowrap;
}

.shop-insight-modal {
  width: min(1160px, calc(100vw - 36px));
  max-height: min(92vh, 920px);
  max-height: min(92dvh, 920px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.shop-insight-modal .modal-header {
  flex: 0 0 auto;
  align-items: flex-start;
}

.shop-insight-modal .modal-header h2 {
  margin-bottom: 5px;
}

.shop-insight-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

.shop-insight-loading,
.recommendation-empty {
  min-height: 130px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px dashed #dcd7ef;
  border-radius: 12px;
  color: #777f90;
  background: #faf9ff;
  text-align: center;
}

.shop-insight-error {
  margin: 0;
  padding: 14px;
  border: 1px solid #f0c7ce;
  border-radius: 10px;
  background: #fff6f7;
}

.recommendation-section + .recommendation-section {
  margin-top: 26px;
}

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

.recommendation-section-heading h3,
.recommendation-section-heading p {
  margin: 0;
}

.recommendation-section-heading h3 {
  color: #293146;
  font-size: 18px;
}

.recommendation-section-heading p {
  margin-top: 4px;
  color: #7b8292;
  font-size: 13px;
}

.recommendation-section-heading > span {
  flex: 0 0 auto;
  color: #6650d8;
  font-size: 13px;
  font-weight: 800;
}

.recommendation-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.recommendation-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e5e2f1;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(43, 48, 74, 0.06);
}

.recommendation-cover {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f3f3f7;
}

.recommendation-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.recommendation-cover-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #969cab;
  font-size: 13px;
}

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

.recommendation-card-heading {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.recommendation-card-heading .badge {
  width: max-content;
}

.recommendation-card-heading strong {
  min-width: 0;
  min-height: 42px;
  overflow: hidden;
  color: #293146;
  line-height: 1.5;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

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

.recommendation-metrics > div {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border-radius: 9px;
  background: #f8f7fc;
}

.recommendation-metrics dt {
  color: #818797;
  font-size: 11px;
}

.recommendation-metrics dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: #343b4f;
  font-size: 13px;
  font-weight: 800;
}

.recommendation-original-link {
  width: max-content;
}

.note-file-status-table {
  min-width: 980px;
}

.note-file-status-table th:nth-child(1),
.note-file-status-table td:nth-child(1) {
  min-width: 170px;
}

.note-file-status-table th:nth-child(4),
.note-file-status-table td:nth-child(4),
.note-file-status-table th:nth-child(5),
.note-file-status-table td:nth-child(5) {
  min-width: 230px;
}

.note-file-task {
  display: grid;
  gap: 6px;
}

.note-file-task strong {
  width: max-content;
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 999px;
  color: #5f6678;
  background: #f1f3f7;
  font-size: 12px;
  line-height: 1.4;
}

.note-file-task span {
  color: #747c8d;
  font-size: 12px;
  line-height: 1.5;
}

.note-file-task.is-success strong {
  color: #087a52;
  background: #e9f9f1;
}

.note-file-task.is-running strong {
  color: #1d4ed8;
  background: #eaf1ff;
}

.note-file-task.is-error strong {
  color: #b42318;
  background: #fff0ef;
}

.note-file-task.is-pending strong,
.note-file-task.is-missing strong {
  color: #7357da;
  background: #f1edff;
}

.shop-trend-modal {
  width: min(900px, calc(100vw - 36px));
  max-height: min(92vh, 760px);
  max-height: min(92dvh, 760px);
}

.shop-trend-modal .modal-header {
  padding: 20px 22px 14px;
}

.shop-trend-modal .modal-header h2 {
  color: #1e293b;
  font-size: 22px;
}

.shop-trend-close {
  min-width: 88px;
}

.shop-trend-body {
  display: grid;
  gap: 14px;
  padding: 14px 22px 22px;
}

.shop-trend-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.shop-trend-summary-grid > div {
  min-width: 0;
  min-height: 92px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border: 1px solid #dfe6f0;
  border-radius: 10px;
  background: #ffffff;
}

.shop-trend-summary-grid span {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.shop-trend-summary-grid strong {
  color: #344054;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.shop-trend-legend {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 8px;
  color: #344054;
  background: #eef3ff;
  font-size: 13px;
}

.shop-trend-legend i {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #2563eb;
}

.shop-trend-body .trend-chart-canvas {
  position: relative;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 12px 8px 4px;
  border: 1px solid #e3e8f1;
  border-radius: 10px;
  background: #fbfcff;
  -webkit-overflow-scrolling: touch;
}

.shop-trend-body .trend-chart-canvas svg {
  width: 100%;
  min-width: 0;
  height: auto;
  display: block;
  overflow: visible;
}

.shop-trend-body .trend-grid-line line {
  stroke: #e8edf5;
}

.shop-trend-body .trend-grid-line text,
.shop-trend-body .trend-x-label {
  fill: #8a94a6;
  font-size: 12px;
}

.shop-trend-body .trend-line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shop-trend-body .trend-point {
  fill: #ffffff;
  stroke: #2563eb;
  stroke-width: 2.5;
  cursor: pointer;
  transition: r 120ms ease, fill 120ms ease;
}

.shop-trend-body .trend-point:hover,
.shop-trend-body .trend-point:focus,
.shop-trend-body .trend-point.is-active {
  r: 6.5;
  fill: #2563eb;
  outline: none;
}

.trend-hover-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 156px;
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid #e3e8f1;
  border-radius: 9px;
  color: #344054;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(31, 41, 55, 0.16);
  pointer-events: none;
}

.trend-hover-tooltip[hidden] {
  display: none;
}

.trend-hover-tooltip strong {
  color: #667085;
  font-size: 13px;
}

.trend-hover-tooltip span {
  color: #667085;
  font-size: 12px;
}

.trend-hover-tooltip b {
  color: #1d2939;
  font-size: 15px;
}

.note-data-panel .table-wrap,
.note-file-status-panel .table-wrap,
.realtime-table-wrap {
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 767px) {
  .shop-insight-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .shop-insight-modal .modal-header {
    padding: 14px;
  }

  .shop-insight-modal .modal-header h2 {
    font-size: 18px;
  }

  .shop-insight-body {
    padding: 14px;
  }

  .shop-trend-modal {
    width: calc(100vw - 16px);
  }

  .shop-trend-modal .modal-header {
    align-items: center;
  }

  .shop-trend-close {
    min-width: 68px;
    min-height: 38px;
    padding: 7px 12px;
  }

  .shop-trend-body {
    gap: 12px;
    padding: 12px;
  }

  .shop-trend-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .shop-trend-summary-grid > div {
    min-height: 88px;
    padding: 11px;
  }

  .shop-trend-summary-grid strong {
    font-size: 13px;
  }

  .shop-trend-body .trend-chart-canvas {
    padding: 8px 3px 2px;
  }

  .recommendation-section + .recommendation-section {
    margin-top: 22px;
  }

  .recommendation-section-heading {
    align-items: flex-start;
  }

  .recommendation-section-heading p {
    line-height: 1.5;
  }

  .recommendation-card-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .recommendation-card {
    width: 100%;
  }

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

  .realtime-row-actions {
    min-width: 168px;
  }
}

@media (max-width: 380px) {
  .recommendation-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Feedback mailbox */
.sidebar-feedback-badge {
  min-width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0 6px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.sidebar-feedback-badge[hidden] {
  display: none;
}

.feedback-page {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(460px, 1.22fr);
  gap: 20px;
  align-items: start;
}

.feedback-page.is-admin {
  grid-template-columns: minmax(0, 1fr);
}

.feedback-compose-panel,
.feedback-inbox-panel,
.feedback-admin-banner {
  min-width: 0;
}

.feedback-compose-form {
  display: grid;
  gap: 16px;
}

.feedback-compose-form .field,
.feedback-reply-form .field {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.feedback-compose-form .field small,
.feedback-reply-form .field small {
  color: #98a2b3;
  font-size: 12px;
  font-weight: 500;
}

.feedback-compose-form textarea,
.feedback-reply-form textarea {
  resize: vertical;
  line-height: 1.65;
}

.feedback-upload-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

.feedback-upload-field > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.feedback-upload-field strong {
  color: #344054;
  font-size: 13px;
}

.feedback-upload-field span {
  color: #667085;
  font-size: 12px;
  line-height: 1.5;
}

.feedback-upload-field.compact {
  padding: 10px 12px;
}

.feedback-file-button {
  flex: 0 0 auto;
  cursor: pointer;
}

.feedback-file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.feedback-image-empty {
  margin: 0;
  color: #98a2b3;
  font-size: 12px;
}

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

.feedback-image-preview {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  background: #fff;
}

.feedback-image-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f2f4f7;
}

.feedback-image-preview figcaption {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px;
}

.feedback-image-preview figcaption span {
  overflow: hidden;
  color: #344054;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-image-preview figcaption small {
  color: #98a2b3;
  font-size: 11px;
}

.feedback-image-preview > button {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  width: 27px;
  height: 27px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.76);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.feedback-compose-footer,
.feedback-reply-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feedback-compose-footer > span,
.feedback-reply-footer > span {
  color: #667085;
  font-size: 12px;
}

.feedback-privacy-note {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f4f0ff;
  color: #5f4b8b;
}

.feedback-privacy-note strong {
  font-size: 13px;
}

.feedback-privacy-note span {
  font-size: 12px;
  line-height: 1.55;
}

.feedback-inbox-body {
  display: grid;
  gap: 14px;
}

.feedback-filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px;
  border-radius: 11px;
  background: #f2f4f7;
  scrollbar-width: none;
}

.feedback-filter-tabs::-webkit-scrollbar {
  display: none;
}

.feedback-filter-tabs button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #667085;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.feedback-filter-tabs button.active {
  background: #fff;
  color: #6941c6;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1);
}

.feedback-ticket-list {
  display: grid;
  gap: 9px;
}

.feedback-ticket-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  width: 100%;
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.feedback-ticket-card:hover {
  border-color: #b9a5ef;
  box-shadow: 0 8px 22px rgba(83, 56, 145, 0.1);
  transform: translateY(-1px);
}

.feedback-ticket-card.unread {
  border-color: #c7b7f4;
  background: #fbfaff;
}

.feedback-ticket-unread {
  position: absolute;
  top: 17px;
  left: 7px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #7f56d9;
}

.feedback-ticket-unread[hidden] {
  display: none;
}

.feedback-ticket-main,
.feedback-ticket-side {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.feedback-ticket-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.feedback-ticket-heading strong {
  overflow: hidden;
  color: #1d2939;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  color: #667085;
  font-size: 12px;
}

.feedback-ticket-side {
  align-content: center;
  color: #667085;
  font-size: 12px;
  text-align: right;
}

.feedback-ticket-side time {
  color: #98a2b3;
}

.feedback-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.feedback-status.pending {
  background: #fff4e5;
  color: #b54708;
}

.feedback-status.replied {
  background: #ecfdf3;
  color: #027a48;
}

.feedback-status.closed {
  background: #f2f4f7;
  color: #667085;
}

.feedback-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 4px;
  color: #667085;
  font-size: 12px;
}

.feedback-inline-error {
  padding: 9px 11px;
  border: 1px solid #fecdca;
  border-radius: 9px;
  background: #fef3f2;
  color: #b42318;
  font-size: 12px;
}

.feedback-admin-banner .panel-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: linear-gradient(120deg, #f5f2ff 0%, #fff 72%);
}

.feedback-admin-banner .panel-body > div {
  display: flex;
  align-items: center;
  gap: 13px;
}

.feedback-admin-banner .panel-body > span {
  flex: 0 0 auto;
  color: #6941c6;
  font-size: 13px;
  font-weight: 800;
}

.feedback-admin-banner strong {
  color: #1d2939;
  font-size: 16px;
}

.feedback-admin-banner p {
  margin: 4px 0 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.5;
}

.feedback-admin-mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: #7f56d9;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.feedback-detail-modal {
  display: flex;
  flex-direction: column;
  width: min(920px, calc(100vw - 32px));
  max-width: 920px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}

.feedback-detail-modal .modal-header {
  flex: 0 0 auto;
}

.feedback-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.feedback-detail-body {
  min-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 20px 22px;
}

.feedback-detail-content {
  display: grid;
  gap: 18px;
}

.feedback-detail-loading {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: #667085;
}

.feedback-detail-loading > span,
.feedback-stored-image.loading > span {
  width: 26px;
  height: 26px;
  border: 3px solid #e4e7ec;
  border-top-color: #7f56d9;
  border-radius: 50%;
  animation: feedback-spin 0.8s linear infinite;
}

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

.feedback-ticket-summary {
  display: grid;
  gap: 9px;
  padding: 15px 16px;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  background: #f9fafb;
}

.feedback-ticket-summary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #6941c6;
  font-size: 12px;
  font-weight: 800;
}

.feedback-ticket-summary h3 {
  margin: 0;
  color: #1d2939;
  font-size: 18px;
  line-height: 1.45;
}

.feedback-ticket-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  color: #667085;
  font-size: 12px;
}

.feedback-message-timeline {
  display: grid;
  gap: 12px;
}

.feedback-message {
  display: grid;
  gap: 10px;
  width: min(86%, 720px);
  padding: 13px 15px;
  border: 1px solid #e4e7ec;
  border-radius: 14px;
  background: #fff;
}

.feedback-message.admin {
  justify-self: end;
  border-color: #d9cef7;
  background: #f7f4ff;
}

.feedback-message.employee {
  justify-self: start;
  background: #f8fafc;
}

.feedback-message header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 9px;
}

.feedback-message header strong {
  color: #344054;
  font-size: 13px;
}

.feedback-message header span {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(127, 86, 217, 0.1);
  color: #6941c6;
  font-size: 10px;
  font-weight: 700;
}

.feedback-message header time {
  margin-left: auto;
  color: #98a2b3;
  font-size: 11px;
}

.feedback-message-body {
  color: #344054;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.feedback-stored-image {
  position: relative;
  display: grid;
  min-height: 112px;
  overflow: hidden;
  place-items: center;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #fff;
  color: #667085;
  text-decoration: none;
}

.feedback-stored-image img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.feedback-stored-image > img + span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 10px;
}

.feedback-stored-image.loading,
.feedback-stored-image.error {
  align-content: center;
  gap: 8px;
  padding: 12px;
  border-style: dashed;
  font-size: 12px;
  text-align: center;
}

.feedback-stored-image.error {
  border-color: #fecdca;
  background: #fef3f2;
  color: #b42318;
  cursor: pointer;
}

.feedback-closed-notice {
  display: grid;
  gap: 3px;
  padding: 11px 13px;
  border-radius: 10px;
  background: #f2f4f7;
  color: #475467;
}

.feedback-closed-notice strong {
  font-size: 13px;
}

.feedback-closed-notice span {
  font-size: 12px;
}

.feedback-reply-form {
  display: grid;
  gap: 13px;
  padding-top: 17px;
  border-top: 1px solid #e4e7ec;
}

@media (max-width: 1100px) {
  .feedback-page {
    grid-template-columns: minmax(280px, 0.85fr) minmax(390px, 1.15fr);
  }

  .feedback-ticket-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .feedback-ticket-side {
    display: flex;
    justify-content: space-between;
    text-align: left;
  }
}

@media (max-width: 820px) {
  .feedback-page {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 767px) {
  .feedback-upload-field,
  .feedback-compose-footer,
  .feedback-reply-footer,
  .feedback-admin-banner .panel-body {
    align-items: stretch;
    flex-direction: column;
  }

  .feedback-file-button,
  .feedback-compose-footer .primary-btn,
  .feedback-reply-footer .primary-btn {
    width: 100%;
    justify-content: center;
  }

  .feedback-image-preview-grid,
  .feedback-stored-image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feedback-detail-modal {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .feedback-detail-modal .modal-header {
    align-items: flex-start;
  }

  .feedback-modal-actions {
    flex-wrap: wrap;
  }

  .feedback-detail-body {
    padding: 14px;
  }

  .feedback-message {
    width: 94%;
  }

  .feedback-message header time {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 420px) {
  .feedback-image-preview-grid,
  .feedback-stored-image-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .feedback-ticket-side {
    display: grid;
  }

  .feedback-pagination {
    gap: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .feedback-ticket-card {
    transition: none;
  }

  .feedback-detail-loading > span,
  .feedback-stored-image.loading > span {
    animation-duration: 1.6s;
  }
}
.shop-import-result {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fff7f7;
}

.shop-import-result > div:first-child {
  display: grid;
  gap: 4px;
  color: #991b1b;
}

.shop-import-result > div:first-child span {
  color: #7f1d1d;
  font-size: 13px;
}

.shop-import-failure-table {
  max-height: 280px;
  background: #fff;
}

.shop-import-failure-table table {
  min-width: 620px;
}

.shop-import-failure-table td:first-child,
.shop-import-failure-table th:first-child {
  width: 110px;
  white-space: nowrap;
}

.shop-import-failure-table td:last-child {
  color: #b91c1c;
}

/* Collector identities and shop shards */
.collector-admin-page {
  display: grid;
  gap: 16px;
}

.collector-stats {
  margin-bottom: 0;
}

.collector-unassigned-stat {
  border-color: #fecaca;
  background: #fff8f7;
}

.collector-unassigned-stat strong {
  color: #b42318;
}

.collector-safety-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid #fdb022;
  border-radius: 12px;
  background: #fffaeb;
  color: #7a2e0e;
}

.collector-safety-notice strong {
  flex: 0 0 auto;
  font-size: 14px;
}

.collector-safety-notice span {
  font-size: 13px;
  line-height: 1.6;
}

.collector-admin-details {
  margin-bottom: 16px;
  border: 1px solid #d9d6fe;
  border-radius: 12px;
  background: #fbfaff;
}

.collector-admin-details > summary {
  padding: 13px 15px;
  color: #5146a5;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.collector-principal-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  padding: 0 15px 15px;
}

.collector-principal-form fieldset {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid #e4e1f5;
  border-radius: 10px;
  background: #fff;
}

.collector-config-form {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #d9d6fe;
  border-radius: 12px;
  background: #fbfaff;
}

.collector-config-heading {
  display: grid;
  align-content: center;
  gap: 4px;
}

.collector-config-heading span {
  color: #667085;
  font-size: 12px;
}

.collector-principal-form legend {
  padding: 0 6px;
  color: #514b6b;
  font-size: 13px;
  font-weight: 700;
}

.collector-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 9px 14px;
}

.collector-check-grid label,
.collector-confirm-check {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #475467;
  font-size: 13px;
}

.collector-form-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.collector-principal-table table {
  min-width: 980px;
}

.collector-row-actions {
  display: flex;
  gap: 7px;
  white-space: nowrap;
}

.collector-inline-secret-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(220px, 0.8fr) auto auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 13px;
  border: 1px solid #fdb022;
  border-radius: 12px;
  background: #fffaeb;
}

.collector-inline-secret-form > div:first-child {
  display: grid;
  gap: 4px;
  align-self: center;
}

.collector-inline-secret-form > div:first-child span {
  color: #667085;
  font-size: 12px;
}

.collector-filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto auto;
  align-items: end;
  margin-bottom: 14px;
}

.collector-batch-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 12px;
  padding: 11px 12px;
  border: 1px solid #e4e1f5;
  border-radius: 11px;
  background: #f9f8ff;
}

.collector-batch-bar > span {
  margin-right: auto;
  color: #475467;
  font-size: 13px;
}

.collector-batch-bar select {
  min-width: 210px;
}

.collector-plan-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #a6f4c5;
  border-radius: 11px;
  background: #ecfdf3;
}

.collector-plan-preview > div {
  display: grid;
  flex: 1;
  gap: 3px;
  min-width: 0;
}

.collector-plan-preview span {
  color: #067647;
  font-size: 12px;
  line-height: 1.5;
}

.collector-shop-table table {
  min-width: 860px;
}

.collector-shop-table th:first-child,
.collector-shop-table td:first-child {
  width: 44px;
  text-align: center;
}

.collector-shop-table td:nth-child(2) {
  display: grid;
  gap: 3px;
}

.collector-shop-table td:nth-child(2) small {
  color: #98a2b3;
  font-size: 11px;
}

.collector-unassigned-row {
  background: #fff9f7;
}

.collector-unassigned-label {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fee4e2;
  color: #b42318;
  font-size: 12px;
  font-weight: 700;
}

.collector-filter-result {
  margin: 9px 0 0;
  color: #667085;
  font-size: 12px;
}

.collector-load-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #b42318;
}

.collector-migration-panel {
  border-color: #fecaca;
}

.collector-migration-counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.collector-migration-counts > span {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 10px;
  background: #f9fafb;
}

.collector-migration-counts small {
  color: #667085;
}

.collector-migration-counts strong {
  color: #344054;
  font-size: 18px;
}

.collector-migration-principals,
.collector-migration-checks {
  display: grid;
  gap: 7px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.collector-migration-principals li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #f9fafb;
  color: #475467;
  font-size: 13px;
}

.collector-migration-checks li {
  position: relative;
  padding-left: 21px;
  color: #067647;
  font-size: 13px;
}

.collector-migration-checks li::before {
  position: absolute;
  left: 3px;
  content: "✓";
  font-weight: 800;
}

.collector-migration-checks li.warn {
  color: #b54708;
}

.collector-migration-checks li.warn::before {
  content: "!";
}

.collector-migration-form {
  display: grid;
  gap: 13px;
  padding-top: 14px;
  border-top: 1px solid #e4e7ec;
}

.collector-migration-passwords {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.collector-confirm-check {
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 9px;
  background: #fff4ed;
  color: #9c2a10;
  line-height: 1.5;
}

.collector-migration-complete {
  padding: 12px;
  border-radius: 10px;
  background: #ecfdf3;
  color: #067647;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .collector-filter-bar {
    grid-template-columns: repeat(2, minmax(180px, 1fr)) auto auto;
  }

  .collector-migration-passwords,
  .collector-migration-counts {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .collector-inline-secret-form {
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  }

  .collector-inline-secret-form > button:last-of-type {
    grid-column: 3;
  }
}

@media (max-width: 767px) {
  .collector-safety-notice,
  .collector-plan-preview,
  .collector-migration-principals li {
    align-items: stretch;
    flex-direction: column;
  }

  .collector-principal-form,
  .collector-filter-bar,
  .collector-inline-secret-form,
  .collector-migration-passwords,
  .collector-migration-counts {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .collector-inline-secret-form > button:last-of-type {
    grid-column: auto;
  }

  .collector-batch-bar {
    align-items: stretch;
  }

  .collector-batch-bar > span {
    width: 100%;
  }

  .collector-batch-bar select,
  .collector-batch-bar button,
  .collector-plan-preview button {
    width: 100%;
  }

  .collector-load-error,
  .collector-form-footer {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .collector-check-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
