:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #6b7280;
  --ok: #059669;
  --fail: #dc2626;
  --border: #e5e7eb;
  --sidebar: #b8cce4;
  --sidebar-panel: #ffffff;
  --sidebar-border: #9eb8d4;
  --sidebar-text: #3d4654;
  --sidebar-muted: #6b7585;
  --sidebar-hover: rgba(38, 126, 240, 0.08);
  --sidebar-active: #1a6fe0;
  --sidebar-active-soft: rgba(38, 126, 240, 0.12);
  --sidebar-active-bg: rgba(38, 126, 240, 0.16);
  --primary: #267ef0;
  --touch-min: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

/* ????????? TAB ?????????? vh ? dvh??????? */
html.app-shell,
body.app-shell {
  height: 100vh;
  max-height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body.no-scroll {
  overflow: hidden;
}

a {
  color: var(--primary);
}

img,
table {
  max-width: 100%;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
}

.panel h2,
.panel h3 {
  word-break: break-word;
}

.hint {
  color: var(--muted);
  line-height: 1.6;
  word-break: break-word;
}

/* ???/??????? max-height???????????????
   overflow ?? visible??? sticky ????????????? */
.table-scroll {
  width: 100%;
  overflow: visible;
  max-height: none;
  margin-top: 16px;
}

.data-table {
  width: 100%;
  min-width: 280px;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--panel);
  box-shadow: 0 1px 0 var(--border);
}

.data-table tfoot th {
  position: sticky;
  bottom: 0;
  z-index: 7;
  background: #f8fafc;
  box-shadow: 0 -1px 0 var(--border);
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.data-table tbody tr:hover td {
  background: #eef4ff;
}

.data-table tbody tr.is-search-target td {
  background: #fff8e6;
  box-shadow: inset 0 0 0 2px #f59e0b;
}

.path-cell {
  word-break: break-all;
  white-space: normal;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.tag.ok {
  background: #d1fae5;
  color: var(--ok);
}

.tag.fail {
  background: #fee2e2;
  color: var(--fail);
}

code {
  font-size: 13px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  min-height: var(--touch-min);
  font-size: 16px;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.icon-menu {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  position: relative;
}

.icon-menu::before,
.icon-menu::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: currentColor;
}

.icon-menu::before {
  top: -6px;
}

.icon-menu::after {
  top: 6px;
}

.alert {
  padding: 10px 12px;
  border-radius: 6px;
  margin: 12px 0;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
}

.alert-ok {
  background: #d1fae5;
  color: #065f46;
}

/* ??? */
.settings-page {
  max-width: 820px;
}

.settings-page-wide {
  max-width: min(1280px, 100%);
}

.permissions-page .settings-card {
  padding: 20px 24px 24px;
}

.perm-user-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 16px;
}

.perm-user-filter-input {
  flex: 1 1 220px;
  max-width: 360px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
}

.perm-user-filter-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.perm-user-filter-meta {
  margin-left: auto;
  white-space: nowrap;
}

.perm-user-scroll {
  margin-top: 0;
}

.perm-user-table {
  min-width: 960px;
}

.perm-user-table th,
.perm-user-table td {
  white-space: nowrap;
  vertical-align: middle;
}

.perm-user-table .col-summary {
  min-width: 22rem;
}

.perm-user-table .col-actions {
  width: 1%;
}

.perm-user-empty {
  margin: 8px 0 0;
}

.page-intro {
  margin-bottom: 20px;
}

.page-intro-title {
  margin: 0 0 6px;
  font-size: clamp(20px, 4vw, 24px);
  font-weight: 600;
}

.page-intro-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.info-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  font-size: 14px;
}

.info-banner-label {
  color: #0369a1;
  font-weight: 600;
}

.info-banner-value {
  color: var(--text);
}

.info-banner-note {
  color: var(--muted);
  font-size: 13px;
  width: 100%;
}

.info-banner-note code {
  background: rgba(255, 255, 255, 0.7);
  padding: 2px 6px;
  border-radius: 4px;
}

.settings-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.settings-card-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.settings-card-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
}

.settings-card-head p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-span-2 {
  grid-column: 1 / -1;
}

.field-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.settings-form input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 16px;
  min-height: 44px;
  background: #fafafa;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.settings-form input[type="checkbox"],
.settings-form input[type="radio"] {
  width: 1rem;
  height: 1rem;
  min-height: unset;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.settings-form input:not([type="checkbox"]):not([type="radio"]):focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.settings-form select,
.form-select {
  width: 100%;
  max-width: 480px;
  padding: 11px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 16px;
  min-height: 44px;
  background: #fafafa;
}

.settings-form select:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}

.perm-home-card {
  margin-bottom: 20px;
  padding: 16px 18px;
}

.perm-home-card .hint {
  margin-top: 10px;
  margin-bottom: 0;
}

.db-path-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.db-path-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.db-path-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.db-path-name {
  font-size: 14px;
  font-weight: 500;
}

.db-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.db-tag-core,
.db-tag-core.db-tag {
  background: #ede9fe;
  color: #5b21b6;
}

.db-tag-ps {
  background: #dbeafe;
  color: #1d4ed8;
}

.db-tag-hr {
  background: #d1fae5;
  color: #047857;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 4px 0 8px;
}

.settings-actions .btn-primary {
  min-width: 160px;
}

.settings-actions .btn-ghost {
  min-width: 120px;
}

.result-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.result-card {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fafafa;
}

.result-card.result-ok {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.result-card.result-fail {
  border-color: #fecaca;
  background: #fef2f2;
}

.result-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.result-card .path-cell {
  display: block;
  font-size: 12px;
  word-break: break-all;
  margin-bottom: 6px;
}

.result-msg {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.nav-group-divider {
  display: none;
}

.nav-group-label {
  display: none;
}

.nav-item-system .nav-phase {
  display: none;
}

.breadcrumb {
  margin: 0 0 8px;
  font-size: 13px;
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.settings-hub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.settings-hub-card {
  display: block;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.settings-hub-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.settings-hub-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--primary);
}

.settings-hub-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.tag-admin {
  background: #fef3c7;
  color: #92400e;
}

.perm-matrix th,
.perm-matrix td {
  text-align: center;
  vertical-align: middle;
}

.perm-module-col {
  text-align: left !important;
  min-width: 120px;
}

.perm-action-col {
  width: 56px;
  min-width: 52px;
}

.perm-col-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}

.perm-col-toggle {
  margin: 0;
}

.perm-col-all {
  cursor: pointer;
  accent-color: var(--primary);
}

.perm-module-phase {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.perm-module-name {
  font-weight: 500;
  font-size: 14px;
}

.perm-check {
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.perm-check input {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.form-readonly input:not([type="submit"]) {
  background: #f3f4f6;
  color: var(--muted);
  pointer-events: none;
}

.cell-actions {
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .settings-card {
    padding: 16px;
  }

  .settings-actions {
    position: sticky;
    bottom: 0;
    background: var(--bg);
    padding: 12px 0 calc(12px + var(--safe-bottom));
    margin: 0 -4px;
  }

  .settings-actions .btn {
    flex: 1 1 calc(50% - 6px);
  }

  .perm-matrix {
    min-width: 520px;
  }
}

/* ? settings-form ?? */
.settings-form fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.settings-form legend {
  display: none;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.form-actions .btn {
  flex: 1;
  min-width: 140px;
}

@media (max-width: 480px) {
  .form-actions .btn {
    flex: 1 1 100%;
  }
}

/* ??? */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right))
    calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
}

.login-wrap {
  width: 100%;
  max-width: 420px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: clamp(20px, 5vw, 22px);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.login-form input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  min-height: var(--touch-min);
}

.login-form .btn-primary {
  width: 100%;
}

.login-foot {
  margin-top: 16px;
  font-size: 12px;
}

/* ????? ? ?? */
.app-layout {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

body.app-shell .app-layout {
  height: 100vh;
  max-height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body.app-shell .sidebar {
  /* ?? min-height:100vh??? flex ??????????????? */
  min-height: 0;
  height: auto;
  align-self: stretch;
  overflow: hidden;
}

body.app-shell .app-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-backdrop {
  display: none;
}

.sidebar-backdrop[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.sidebar {
  width: 240px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: var(--sidebar-text);
  flex-shrink: 0;
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 2px 0 12px rgba(30, 64, 110, 0.08);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  background: rgba(255, 255, 255, 0.28);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  background: linear-gradient(135deg, #267ef0 0%, #1a5fd4 100%);
  box-shadow: 0 2px 6px rgba(38, 126, 240, 0.28);
}

.sidebar-brand-text {
  font-weight: 600;
  line-height: 1.3;
  font-size: 14px;
  color: var(--sidebar-active);
  white-space: normal;
  overflow: visible;
}

.sidebar-env-badge {
  flex-shrink: 0;
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 4px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.sidebar-env-badge.is-prod {
  background: #fef3c7;
  color: #b45309;
}

.dev-instance-warn {
  margin: 0 12px 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 13px;
  line-height: 1.45;
}

.dev-instance-warn a {
  color: #b45309;
  font-weight: 600;
}

.btn-sidebar-close {
  display: none;
  color: var(--sidebar-muted);
  font-size: 28px;
  line-height: 1;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin: 10px;
  padding: 10px 8px 16px;
  gap: 4px;
  border-radius: 12px;
  background: var(--sidebar-panel);
  border: 1px solid var(--sidebar-border);
  box-shadow: 0 2px 10px rgba(30, 64, 110, 0.1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ?????????????? */
.nav-top-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 40px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  touch-action: manipulation;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-top-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-active);
}

.nav-top-item.is-active {
  color: var(--sidebar-active);
  font-weight: 600;
}

.nav-top-item.is-active .nav-top-label {
  color: var(--sidebar-active);
}

.nav-top-item.is-soon .nav-top-label {
  color: var(--sidebar-muted);
}

.nav-top-label {
  flex: 1;
  min-width: 0;
}

/* ??????????? */
.nav-group {
  margin-bottom: 2px;
}

.nav-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  min-height: 40px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-group-head:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-active);
}

.nav-group.is-open > .nav-group-head,
.nav-group:has(.nav-sub-item.is-active) > .nav-group-head {
  color: var(--sidebar-active);
  font-weight: 600;
}

.nav-group-title {
  flex: 1;
  min-width: 0;
  font-weight: 500;
}

.nav-group.is-open > .nav-group-head .nav-group-title,
.nav-group:has(.nav-sub-item.is-active) > .nav-group-head .nav-group-title {
  color: var(--sidebar-active);
}

.nav-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.45;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.18s ease;
}

.nav-group.is-open .nav-chevron {
  transform: rotate(180deg);
}

.nav-group-body {
  display: none;
  margin: 4px 0 6px;
  padding: 4px;
  border-radius: 10px;
  background: #f3f7fc;
  border: 1px solid #d6e3f0;
}

.nav-group.is-open .nav-group-body {
  display: block;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px 9px 36px;
  margin: 2px 0;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.4;
  touch-action: manipulation;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-sub-item:hover {
  background: var(--sidebar-active-soft);
  color: var(--sidebar-active);
}

.nav-sub-item.is-active {
  color: var(--sidebar-active);
  font-weight: 600;
  background: var(--sidebar-active-bg);
  box-shadow: inset 3px 0 0 var(--sidebar-active);
}

.nav-sub-label {
  flex: 1;
  min-width: 0;
}

.nav-tag {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--sidebar-muted);
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 6px;
  border-radius: 4px;
}

.nav-tag-new {
  color: #fff;
  background: #e53935;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 10px;
  padding: 2px 6px;
}

/* ???? */
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: currentColor;
  opacity: 0.72;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.nav-top-item.is-active .nav-icon {
  color: var(--sidebar-active);
  opacity: 1;
}

.nav-group.is-open > .nav-group-head .nav-icon,
.nav-group:has(.nav-sub-item.is-active) > .nav-group-head .nav-icon {
  color: var(--sidebar-active);
  opacity: 1;
}

.nav-group:has(.nav-sub-item.is-active) .nav-group-head {
  color: var(--sidebar-active);
}

.nav-group:has(.nav-sub-item.is-active) .nav-icon {
  color: var(--sidebar-active);
  opacity: 1;
}

.nav-icon-home {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M4 10.5L12 4l8 6.5V20a1 1 0 01-1 1h-5v-6H10v6H5a1 1 0 01-1-1v-9.5z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M4 10.5L12 4l8 6.5V20a1 1 0 01-1 1h-5v-6H10v6H5a1 1 0 01-1-1v-9.5z'/%3E%3C/svg%3E");
}

.nav-icon-ai_assistant {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M21 15a4 4 0 01-4 4H8l-5 3V7a4 4 0 014-4h10a4 4 0 014 4z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M21 15a4 4 0 01-4 4H8l-5 3V7a4 4 0 014-4h10a4 4 0 014 4z'/%3E%3C/svg%3E");
}

.nav-icon-system {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E");
}

/* ??????????????? [class*=] ????????????? */
.nav-icon-dash_executive {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 3v9l6.5 3.7'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 3v9l6.5 3.7'/%3E%3C/svg%3E");
}

.nav-icon-dash_sales {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M3 17l6-6 4 4 7-7'/%3E%3Cpath d='M14 8h6v6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M3 17l6-6 4 4 7-7'/%3E%3Cpath d='M14 8h6v6'/%3E%3C/svg%3E");
}

.nav-icon-dash_finance {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M12 3v18'/%3E%3Cpath d='M17 7H9.5a3.5 3.5 0 100 7H14a3.5 3.5 0 110 7H6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M12 3v18'/%3E%3Cpath d='M17 7H9.5a3.5 3.5 0 100 7H14a3.5 3.5 0 110 7H6'/%3E%3C/svg%3E");
}

.nav-icon-dash_production {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M3 21h18M5 21V7l7-4 7 4v14M9 21v-6h6v6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M3 21h18M5 21V7l7-4 7 4v14M9 21v-6h6v6'/%3E%3C/svg%3E");
}

.nav-icon-dash_pmc {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18M8 14h2M8 18h6M14 14h4'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18M8 14h2M8 18h6M14 14h4'/%3E%3C/svg%3E");
}

.nav-icon-dash_purchase {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M6 6h15l-1.5 9H7.5L6 6zM6 6L5 3H2M9 21a1 1 0 100-2 1 1 0 000 2zM18 21a1 1 0 100-2 1 1 0 000 2z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M6 6h15l-1.5 9H7.5L6 6zM6 6L5 3H2M9 21a1 1 0 100-2 1 1 0 000 2zM18 21a1 1 0 100-2 1 1 0 000 2z'/%3E%3C/svg%3E");
}

.nav-icon-dash_inventory {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M4 7l8-4 8 4-8 4-8-4zM4 12l8 4 8-4M4 17l8 4 8-4'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M4 7l8-4 8 4-8 4-8-4zM4 12l8 4 8-4M4 17l8 4 8-4'/%3E%3C/svg%3E");
}

.nav-icon-dash_quality {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M12 3l7 4v6c0 4-3 7-7 8-4-1-7-4-7-8V7l7-4zM9 12l2 2 4-4'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M12 3l7 4v6c0 4-3 7-7 8-4-1-7-4-7-8V7l7-4zM9 12l2 2 4-4'/%3E%3C/svg%3E");
}

.nav-icon-dash_equipment {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z'/%3E%3C/svg%3E");
}

.nav-icon-dash_hr {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M17 21v-2a4 4 0 00-4-4H7a4 4 0 00-4 4v2M13 7a4 4 0 11-8 0 4 4 0 018 0zM23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M17 21v-2a4 4 0 00-4-4H7a4 4 0 00-4 4v2M13 7a4 4 0 11-8 0 4 4 0 018 0zM23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75'/%3E%3C/svg%3E");
}

/* ????????? subnav ??????? */
.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px;
  min-height: var(--touch-min);
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 15px;
  touch-action: manipulation;
}

.nav-item:hover {
  background: var(--sidebar-hover);
}

.nav-item.active {
  color: var(--sidebar-active);
  background: rgba(38, 126, 240, 0.08);
  font-weight: 500;
}

.nav-item.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.nav-label {
  flex: 1;
  min-width: 0;
}

.nav-phase {
  font-size: 11px;
  opacity: 0.75;
  flex-shrink: 0;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + var(--safe-top));
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

body.app-shell .app-topbar {
  position: relative;
  top: auto;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.btn-menu {
  display: none;
}

.page-heading {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  flex-shrink: 0;
}

.company-switch-form {
  margin: 0;
}

.company-select {
  max-width: 160px;
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text);
}

.company-label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.user-name-full {
  display: inline;
}

.user-name-short {
  display: none;
}

.user-job-title {
  color: var(--muted);
  font-weight: normal;
  font-size: 0.92em;
}

.logout-form {
  margin: 0;
}

.app-content {
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.app-tab-strip {
  padding: 6px 12px 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: visible;
  position: relative;
  z-index: 11;
}

.app-tab-strip-scroll {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.app-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: #f3f4f6;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.3;
  color: var(--muted);
  flex-shrink: 0;
  touch-action: manipulation;
}

.app-tab.is-active {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  position: relative;
  z-index: 1;
  margin-bottom: -1px;
  padding-bottom: 8px;
}

.app-tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.app-tab-close {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  line-height: 16px;
  text-align: center;
  border-radius: 4px;
  font-size: 14px;
  color: var(--muted);
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.app-tab-tip {
  position: fixed;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 6px;
  background: #1f2937;
  color: #fff;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.app-tab-tip[hidden] {
  display: none !important;
}

.app-tab-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text);
}

.app-tab-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

/* ??? = TAB ??????????????? */
.app-tab-panel {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.app-tab-panel.is-active {
  display: flex;
  flex-direction: column;
}

.app-tab-panel .app-content,
.app-tab-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.app-tab-inner {
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
}

.app-tab-frame {
  width: 100%;
  flex: 1;
  min-height: 0;
  border: 0;
  display: block;
  background: var(--bg);
}

.app-embed-root {
  min-height: 100%;
  background: var(--bg);
}

body.app-embed {
  background: var(--bg);
}

/* iframe ????????????????? TAB ? */
body.app-embed .sidebar,
body.app-embed .app-topbar,
body.app-embed .app-tab-strip,
body.app-embed #global-page-loader {
  display: none !important;
}

body.app-embed .app-layout {
  display: block;
}

body.app-embed .app-main {
  display: block;
}

body.app-embed .app-tab-body {
  display: block;
}

.app-content.is-embed {
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
}

.placeholder-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.placeholder-head h2 {
  margin: 0;
  font-size: clamp(18px, 4.5vw, 22px);
}

.phase-badge {
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
}

/* ?? / ??? */
@media (max-width: 768px) {
  /* ??????????? overflow ??? WebView???/Safari????????? */
  html.app-shell,
  body.app-shell {
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body.app-shell.no-scroll,
  body.app-shell.is-global-loading {
    overflow: hidden !important;
  }

  body.app-shell .app-layout {
    height: auto !important;
    max-height: none !important;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  body.app-shell .app-main,
  body.app-shell .app-tab-body,
  body.app-shell .app-tab-panel,
  body.app-shell .app-tab-panel.is-active {
    height: auto !important;
    max-height: none !important;
    min-height: 0;
    overflow: visible !important;
    flex: 1 1 auto;
  }

  body.app-shell .app-tab-panel .app-content,
  body.app-shell .app-tab-inner {
    overflow: visible !important;
    flex: none;
    min-height: 0;
  }

  .panel {
    padding: 16px;
  }

  .btn-menu {
    display: inline-flex;
    flex-shrink: 0;
  }

  .btn-sidebar-close {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: none !important;
    pointer-events: none !important;
  }

  .app-layout.sidebar-open .sidebar-backdrop:not([hidden]),
  .sidebar-backdrop:not([hidden]) {
    display: block !important;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 90;
    pointer-events: auto !important;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    z-index: 100;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    padding-bottom: var(--safe-bottom);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: none; /* ??????????? */
    visibility: hidden;
  }

  .app-layout.sidebar-open .sidebar {
    transform: translateX(0);
    pointer-events: auto;
    visibility: visible;
  }

  .sidebar-nav {
    margin: 8px;
    margin-bottom: calc(8px + var(--safe-bottom));
  }

  .app-topbar {
    flex-wrap: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  body.app-shell .app-topbar {
    position: sticky;
    top: 0;
  }

  .user-name-full {
    display: none;
  }

  .user-name-short {
    display: inline;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .data-table th,
  .data-table td {
    padding: 12px 10px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .app-content {
    padding: 12px;
    padding-bottom: calc(12px + var(--safe-bottom));
  }

  .page-heading {
    font-size: 16px;
  }

  .user-bar .btn-sm {
    min-height: var(--touch-min);
  }
}

/* ?? */
.dashboard-page .page-intro {
  margin-bottom: 20px;
}

.dashboard-page .page-intro-title {
  margin: 0 0 6px;
  font-size: 22px;
}

.dashboard-page .page-intro-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.inv-paper-page .kpi-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.inv-paper-page .kpi-value {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.kpi-card-warn {
  border-color: #fecaca;
  background: #fff7f7;
}

.kpi-card-good {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

/* —— 总体情况看板 —— */
.exec-page {
  --exec-ink: #0f172a;
  --exec-soft: #f1f5f9;
  --exec-line: rgba(15, 23, 42, 0.08);
  --exec-blue: #267ef0;
  --exec-teal: #0d9488;
  --exec-amber: #d97706;
  --exec-rose: #e11d48;
  --exec-violet: #6366f1;
  --exec-pink: #db2777;
}

.exec-shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.exec-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-radius: 16px;
  color: #fff;
  background:
    radial-gradient(ellipse 80% 120% at 100% 0%, rgba(255, 255, 255, 0.18), transparent 55%),
    linear-gradient(135deg, #1e3a5f 0%, #267ef0 52%, #38bdf8 100%);
  box-shadow: 0 10px 28px rgba(30, 58, 95, 0.22);
}

.exec-hero-eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.78;
}

.exec-hero-title {
  margin: 0 0 8px;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.exec-hero-desc {
  margin: 0;
  max-width: 42rem;
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.9;
}

.exec-hero-meta {
  flex: 0 0 auto;
  min-width: 132px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  text-align: right;
}

.exec-hero-date-label {
  display: block;
  font-size: 12px;
  opacity: 0.8;
}

.exec-hero-date {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.exec-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.exec-block-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--exec-ink);
}

.exec-block-hint {
  font-size: 12px;
  color: var(--muted);
}

.exec-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.exec-kpi {
  position: relative;
  overflow: hidden;
  padding: 16px 16px 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--exec-line);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.exec-kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--exec-blue), #38bdf8);
}

.exec-kpi.is-warn {
  background: #fff7f7;
  border-color: #fecaca;
}

.exec-kpi.is-warn::before {
  background: linear-gradient(180deg, #f43f5e, #fb7185);
}

.exec-kpi-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.exec-kpi-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--exec-ink);
  font-variant-numeric: tabular-nums;
}

.exec-kpi-sub {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.exec-charts-row {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 16px;
}

.exec-panel {
  background: var(--panel);
  border: 1px solid var(--exec-line);
  border-radius: 16px;
  padding: 18px 20px 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.exec-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.exec-panel-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--exec-ink);
}

.exec-panel-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.exec-legend {
  margin: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.exec-day-chart,
.exec-month-chart {
  height: 220px;
}

.exec-day-chart .gbar,
.exec-month-chart .gbar {
  width: 10px;
  border-radius: 4px 4px 0 0;
}

.exec-day-chart .grouped-bar-stack,
.exec-month-chart .grouped-bar-stack {
  max-width: 42px;
  gap: 3px;
}

.grouped-bar-col.is-current .grouped-bar-label {
  color: var(--exec-blue);
  font-weight: 700;
}

.grouped-bar-col.is-current .grouped-bar-stack {
  outline: 2px solid rgba(38, 126, 240, 0.18);
  outline-offset: 4px;
  border-radius: 6px;
}

.grouped-bar-total {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.exec-mix-block + .exec-mix-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--exec-line);
}

.exec-mix-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}

.exec-mix-caption strong {
  color: var(--exec-ink);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.exec-mix-bar {
  height: 14px;
  border-radius: 999px;
}

.exec-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.exec-section-card {
  background: var(--panel);
  border: 1px solid var(--exec-line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  border-top: 3px solid var(--exec-blue);
}

.exec-section-card.is-sales { border-top-color: #3b82f6; }
.exec-section-card.is-finance { border-top-color: #d97706; }
.exec-section-card.is-pmc { border-top-color: #0d9488; }
.exec-section-card.is-quality { border-top-color: #7c3aed; }
.exec-section-card.is-equipment { border-top-color: #64748b; }
.exec-section-card.is-hr { border-top-color: #db2777; }

.exec-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.exec-section-title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.exec-section-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.exec-section-card.is-sales .exec-section-dot { color: #3b82f6; }
.exec-section-card.is-finance .exec-section-dot { color: #d97706; }
.exec-section-card.is-pmc .exec-section-dot { color: #0d9488; }
.exec-section-card.is-quality .exec-section-dot { color: #7c3aed; }
.exec-section-card.is-equipment .exec-section-dot { color: #64748b; }
.exec-section-card.is-hr .exec-section-dot { color: #db2777; }

.exec-section-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.exec-section-link:hover {
  color: var(--exec-blue);
}

.exec-section-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.exec-section-metric {
  background: var(--exec-soft);
  border-radius: 10px;
  padding: 10px 11px;
}

.exec-section-metric.is-warn {
  background: #fff1f2;
}

.exec-metric-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.exec-metric-value {
  display: block;
  margin-top: 3px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--exec-ink);
}

.exec-metric-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.exec-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.exec-module-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--exec-line);
  border-radius: 14px;
  padding: 16px 18px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.exec-module-card:hover {
  transform: translateY(-2px);
  border-color: rgba(38, 126, 240, 0.35);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.exec-module-card.is-soon {
  opacity: 0.65;
}

.exec-module-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.exec-module-icon-wrap {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(38, 126, 240, 0.1);
}

.exec-module-icon-wrap .nav-icon {
  width: 20px;
  height: 20px;
  color: var(--exec-blue);
  opacity: 1;
}

.exec-module-titles {
  flex: 1 1 auto;
  min-width: 0;
}

.exec-module-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--exec-ink);
}

.exec-module-desc {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.exec-module-go {
  flex: 0 0 auto;
  align-self: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--exec-soft);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.exec-module-card:hover .exec-module-go {
  background: rgba(38, 126, 240, 0.12);
  color: var(--exec-blue);
}

.exec-module-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.exec-module-metric {
  background: var(--exec-soft);
  border-radius: 10px;
  padding: 8px 10px;
}

.exec-module-metric.is-warn {
  background: #fff1f2;
}

@media (max-width: 960px) {
  .exec-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .exec-hero-meta {
    text-align: left;
    width: fit-content;
  }

  .exec-charts-row {
    grid-template-columns: 1fr;
  }
}

.kpi-value-sm {
  font-size: 18px;
}

.kpi-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.kpi-card-compact {
  padding: 12px 14px;
}

.kpi-mom.is-up {
  color: #059669;
}

.kpi-mom.is-down {
  color: #dc2626;
}

.kpi-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.kpi-unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 2px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

a.finance-kpi-jump {
  color: var(--primary, #2563eb);
  text-decoration: none;
  font-weight: 500;
}

a.finance-kpi-jump:hover {
  text-decoration: underline;
}

.kpi-card-warn a.finance-kpi-jump {
  color: #b45309;
}

button.kpi-card-clickable {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

button.kpi-card-clickable:hover,
button.kpi-card-clickable:focus-visible {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
  outline: none;
}

/* 纸头看板（原纸仓页签） */
.inv-paper-page .inv-stub-kpi-grid,
.inv-paper-stub-page .inv-stub-kpi-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.inv-paper-tabs {
  margin-bottom: 12px;
}

.inv-linger-mat-links {
  margin: 0 0 14px;
}

.inv-finish-page .inv-finish-kpi-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* 纸板车间看板 */
.prod-board-page .prod-board-kpi-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.prod-board-filter-bar {
  margin-bottom: 16px;
}

.prod-board-line-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.prod-board-line-card {
  margin: 0;
  padding: 16px;
}

.prod-board-line-head {
  margin-bottom: 12px;
}

.prod-board-line-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.prod-board-line-name {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.prod-board-line-kpis {
  margin-bottom: 0;
}

.prod-board-glue-note {
  margin: -4px 0 12px;
}

.prod-board-chart-panel {
  margin-bottom: 8px;
}

.prod-board-eff-chart {
  margin-top: 4px;
}

.prod-board-line-yield { stroke: #059669; }
.prod-board-line-paper { stroke: #2563eb; }
.prod-board-line-speed { stroke: #d97706; }

.prod-board-point-yield { stroke: #059669; }
.prod-board-point-paper { stroke: #2563eb; }
.prod-board-point-speed { stroke: #d97706; }

.legend-prod-yield { background: #059669; }
.legend-prod-paper { background: #2563eb; }
.legend-prod-speed { background: #d97706; }

.prod-carton-page .prod-board-kpi-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.prod-board-day-table td.is-warn,
.prod-carton-page .data-table td.is-warn {
  color: #b45309;
  font-weight: 600;
}

/* 人事 · 人员情况看板 */
.hr-staff-page .hr-staff-kpi-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.hr-staff-filter-bar {
  margin-bottom: 16px;
}

.hr-staff-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.hr-staff-lists > .panel {
  margin: 0;
}

.hr-staff-dept-table td.is-warn {
  color: #b45309;
  font-weight: 600;
}

@media (max-width: 960px) {
  .hr-staff-lists {
    grid-template-columns: 1fr;
  }
}

.inv-finish-page .overdue-filter-input,
.inv-age-filter-bar .overdue-filter-input,
.inv-stub-filter-bar .overdue-filter-input {
  min-width: 12rem;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: inherit;
  font: inherit;
}

.inv-ship-group-row.is-open {
  background: rgba(37, 99, 235, 0.06);
}

a.kpi-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

a.kpi-card-link:hover,
a.kpi-card-link:focus-visible {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
  outline: none;
}

a.kpi-card-link.is-active {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16);
}

.inv-stub-ok {
  color: #15803d;
}

.inv-stub-bad,
.inv-stub-count-bad {
  color: #dc2626;
  font-weight: 600;
}

.inv-stub-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.inv-stub-badge-ok {
  background: #dcfce7;
  color: #166534;
}

.inv-stub-badge-bad {
  background: #fee2e2;
  color: #991b1b;
}

.inv-stub-row-bad {
  background: rgba(254, 226, 226, 0.35);
}

.inv-stub-row-bad:hover {
  background: rgba(254, 226, 226, 0.55);
}

.inv-stub-filter-bar .overdue-filter-input,
.inv-age-filter-bar .overdue-filter-input {
  min-width: 12rem;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: inherit;
  font: inherit;
}

.inv-stub-settings-bar,
.inv-age-settings-bar {
  margin-bottom: 8px;
}

.inv-paper-page .inv-age-kpi-grid,
.inv-finish-page .inv-age-kpi-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.inv-age-bucket-grid {
  margin-top: 8px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.inv-age-bucket-aged {
  border-color: #fca5a5;
  background: rgba(254, 226, 226, 0.35);
}

.inv-age-table .empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}

.inv-age-outer-scroll {
  overflow-x: auto;
}

.inv-stub-group-row.is-open {
  background: rgba(37, 99, 235, 0.06);
}

.inv-stub-detail-row > td {
  padding: 0;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.inv-stub-detail-wrap {
  padding: 10px 12px 14px;
  overflow-x: auto;
}

.inv-stub-bar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.inv-stub-bar-table th,
.inv-stub-bar-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  position: static;
  background: transparent;
  box-shadow: none;
}

.inv-stub-bar-table thead th {
  position: static;
  z-index: auto;
  font-weight: 600;
  color: var(--muted);
  background: #f1f5f9;
  box-shadow: none;
}

.inv-stub-bar-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.inv-stub-table .empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}

.inv-stub-outer-scroll {
  overflow-x: auto;
}

.inv-assist-day-row {
  cursor: pointer;
}

.inv-assist-day-row:hover {
  background: rgba(37, 99, 235, 0.06);
}

.inv-assist-detail-host {
  margin-top: 8px;
  margin-bottom: 24px;
}

.inv-assist-detail-placeholder {
  padding: 12px 4px;
}

.inv-assist-detail-head {
  margin-bottom: 8px;
}

.inv-assist-detail-compact {
  margin: 0;
  box-shadow: none;
  border: 1px solid var(--border);
}

.inv-assist-bar-chart {
  height: 248px;
  min-height: 248px;
  gap: 4px;
  padding-top: 22px;
  overflow: visible;
}

.inv-assist-bar-col {
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 1px 0;
  transition: background 0.15s ease;
  height: 100%;
  overflow: visible;
}

.inv-assist-bar-col:hover,
.inv-assist-bar-col:focus-visible,
.inv-assist-bar-col.is-open,
.inv-assist-bar-col.is-current {
  background: rgba(37, 99, 235, 0.06);
  outline: none;
}

.inv-assist-bar-stack {
  max-width: 56px;
  gap: 5px;
  width: 100%;
  overflow: visible;
}

.inv-assist-gbar-wrap {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
}

.inv-assist-gbar-wrap .gbar {
  width: 14px;
  position: relative;
  overflow: visible;
}

.inv-paper-bar-stack {
  max-width: 56px;
}

.inv-paper-bar-chart .inv-assist-gbar-wrap .gbar {
  width: 14px;
}

.inv-paper-bar-label-wreturn {
  color: #1d4ed8;
}

.inv-paper-bar-label-consume {
  color: #be185d;
}

.gbar-consume {
  background: #ec4899;
}

.legend-consume {
  background: #ec4899;
}

.inv-assist-bar-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

.inv-assist-bar-label-in {
  color: #059669;
}

.inv-assist-bar-label-out {
  color: #d97706;
}

.inv-assist-unit-note {
  margin-left: auto;
  color: var(--muted);
}

.inv-assist-range-presets {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.inv-assist-range-presets .btn {
  min-width: 3.2rem;
}

.inv-assist-day-row {
  cursor: pointer;
}

.inv-assist-day-row:hover,
.inv-assist-day-row.is-open {
  background: rgba(37, 99, 235, 0.06);
}

.pur-paper-width-row {
  cursor: pointer;
}

.pur-paper-width-row:hover,
.pur-paper-width-row.is-open {
  background: rgba(37, 99, 235, 0.06);
}

.pur-paper-width-row:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: -2px;
}

.inv-assist-day-action {
  width: 4.5rem;
  text-align: center;
  color: var(--primary, #2563eb);
  font-size: 0.85rem;
}

.inv-assist-day-detail-cell {
  padding: 0 !important;
  background: #f8fafc;
}

.inv-assist-day-detail-wrap {
  padding: 10px 12px 14px;
}

.inv-assist-day-detail-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.inv-assist-day-kind.is-active {
  background: var(--primary, #2563eb);
  color: #fff;
  border-color: var(--primary, #2563eb);
}

.inv-assist-inline-host .inv-assist-detail-panel {
  margin-bottom: 0;
}

.dashboard-panel {
  margin-bottom: 16px;
}

.dashboard-panel h3 {
  margin-top: 0;
}

.data-table .num {
  text-align: right;
  white-space: nowrap;
}

.cell-muted {
  color: var(--muted);
  font-size: 12px;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.alert-ok {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.alert-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.drift-prompt-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin: 0 0 16px;
}

.drift-prompt-text {
  flex: 1 1 240px;
  font-weight: 600;
}

.drift-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.drift-prompt-form {
  margin: 0;
}

.drift-probe-hint {
  flex: 1 1 100%;
  font-size: 12px;
  opacity: 0.85;
}

.credit-snapshot-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin: 0 0 18px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.4;
  color: #0c4a6e;
  background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
  border: 1px solid #7dd3fc;
  border-left: 4px solid #0284c7;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.12);
}

.credit-snapshot-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: #0284c7;
  border-radius: 6px;
  white-space: nowrap;
}

.credit-snapshot-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.credit-snapshot-label {
  font-size: 13px;
  font-weight: 500;
  color: #0369a1;
}

.credit-snapshot-item strong {
  font-size: 15px;
  font-weight: 700;
  color: #0c4a6e;
}

.credit-snapshot-refresh {
  margin-left: auto;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #0284c7;
  text-decoration: none;
  background: #fff;
  border: 1px solid #38bdf8;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.credit-snapshot-refresh:hover {
  color: #0369a1;
  background: #f0f9ff;
  border-color: #0284c7;
}

.snapshot-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px 24px;
  margin: 0 0 20px;
}

.snapshot-meta-grid dt {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}

.snapshot-meta-grid dd {
  margin: 0;
  font-weight: 600;
}

.schedule-form-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.field-check-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.schedule-time-input {
  width: auto;
  min-width: 7.5rem;
  max-width: 9rem;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  min-height: 40px;
  background: #fff;
}

.schedule-time-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.settings-actions {
  margin-top: 8px;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.panel-header-row h3 {
  margin: 0;
}

.panel-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-header-actions .btn.is-active,
.credit-toolbar .btn.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  text-decoration: none;
}

.panel-header-actions .btn.is-active:hover,
.credit-toolbar .btn.is-active:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

.panel-footer-hint {
  margin: 12px 0 0;
}

.overdue-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.overdue-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#overdue-remind-form.is-remind-disabled .overdue-remind-only {
  display: none !important;
}

.penalty-period-finance-hint {
  display: inline-block;
  margin-left: 0.35em;
  color: var(--muted);
}

.penalty-period-remind-toolbar {
  margin-bottom: 12px;
}

.penalty-period-remind-toolbar .overdue-remind-check-all {
  margin-left: 4px;
  font-size: 0.9rem;
}

.overdue-remind-indicator {
  margin-left: 4px;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline;
}

.aged-detail-cell {
  padding: 0 !important;
  background: var(--surface-2, #f8fafc);
}

.aged-detail-wrap {
  position: relative;
}

.aged-detail-host {
  padding: 12px 14px;
}

.sales-aged-inventory-page .aged-customer-row {
  scroll-margin-top: 8px;
}

.sales-aged-inventory-page .aged-customer-row.is-aged-open > td {
  background: #eff6ff;
}

.sales-aged-inventory-page .aged-detail-sticky-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 14px;
  background: #dbeafe;
  border-bottom: 1px solid #93c5fd;
}

.sales-aged-inventory-page .aged-detail-sticky-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-size: 15px;
}

.sales-aged-inventory-page .aged-detail-sticky-title strong {
  font-weight: 700;
  color: #1e3a8a;
}

/* JS ?????????????????????? sticky ?? */
.aged-float-pin {
  position: fixed;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.aged-float-pin[hidden] {
  display: none !important;
}

.aged-float-pin-block {
  pointer-events: auto;
  background: var(--panel, #fff);
}

.aged-float-pin-block[hidden] {
  display: none !important;
}

.aged-float-pin-outer {
  border-bottom: 1px solid var(--border);
}

.aged-float-pin-cust {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 14px;
  background: #dbeafe;
  border-bottom: 1px solid #93c5fd;
}

.aged-float-pin-inner {
  border-bottom: 1px solid var(--border);
}

.aged-float-pin-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

.aged-float-pin-table {
  width: max-content;
  min-width: 100%;
  max-width: none;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.aged-float-pin-table thead th {
  position: static !important;
  top: auto !important;
  background: var(--panel, #fff);
  box-shadow: none;
}

.aged-detail-inline-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.aged-detail-section + .aged-detail-section {
  margin-top: 16px;
}

.aged-detail-section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.aged-detail-section .table-scroll {
  margin-top: 0;
}

/* ?? / ?????????????? */
.aged-detail-toggle {
  margin-top: 4px;
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
  font-weight: 600;
}

.aged-detail-toggle:hover {
  background: #1d4ed8;
  border-color: #1e40af;
  color: #fff;
}

.aged-detail-toggle[aria-expanded="true"] {
  background: #0f766e;
  border-color: #0d9488;
  color: #fff;
}

.aged-detail-toggle[aria-expanded="true"]:hover {
  background: #0d9488;
  border-color: #0f766e;
  color: #fff;
}

.overdue-remind-worker-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
}

.overdue-remind-worker-select {
  min-width: 160px;
}

.overdue-remind-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.penalty-customer-detail-table .overdue-aging-cell {
  min-width: 12rem;
  max-width: 22rem;
}

.overdue-remind-hint-only[hidden] {
  display: none !important;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.pagination-info {
  font-size: 14px;
  color: var(--muted);
}

.pagination-actions {
  display: flex;
  gap: 8px;
}

.table-pagination-bar .pagination {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.overdue-table .col-check {
  width: 40px;
  text-align: center;
}

.row-reminded {
  background: #fafafa;
}

.overdue-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 12px;
  padding: 12px 16px;
}

.overdue-filter-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.overdue-filter-select-period {
  min-width: 132px;
}

.penalty-month-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.penalty-month-quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.penalty-month-btn.is-active {
  border-color: var(--accent, #2563eb);
  background: #eff6ff;
  color: var(--accent, #2563eb);
  font-weight: 600;
}

.overdue-filter-label {
  font-size: 14px;
  color: var(--muted, #6b7280);
}

.overdue-filter-select {
  min-width: 160px;
  padding: 6px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  background: #fff;
}

.overdue-filter-select-sm {
  min-width: 96px;
}

.overdue-penalty-config-panel {
  margin-bottom: 12px;
  padding: 10px 16px;
}

.overdue-penalty-settings-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.overdue-penalty-settings-inline .overdue-penalty-title {
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

.overdue-penalty-fields-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0;
  flex: 1 1 auto;
}

.overdue-penalty-inline-hint {
  margin: 0;
  flex: 1 1 auto;
}

.overdue-penalty-results-panel {
  margin-bottom: 12px;
  padding: 12px 16px 16px;
}

.overdue-filter-bar-inset {
  margin-bottom: 0;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  margin-top: 0;
}

.overdue-results-title {
  flex: 1 1 100%;
  margin-bottom: 4px;
}

.overdue-penalty-results-panel .penalty-period-panel {
  margin-top: 12px;
  margin-bottom: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.overdue-penalty-panel-inner {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 1.15fr);
  gap: 16px 24px;
  align-items: start;
  margin-bottom: 12px;
}

.overdue-penalty-desc-col .overdue-penalty-hint:last-child {
  margin-bottom: 0;
}

.overdue-penalty-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px 24px;
}

.overdue-penalty-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}

.overdue-penalty-hint {
  margin: 0 0 10px;
}

.overdue-penalty-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.overdue-penalty-input {
  width: 88px;
  padding: 6px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  background: #fff;
}

.penalty-period-panel {
  margin: 16px 0 12px;
  padding: 14px 16px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--panel-bg, #fafafa);
}

.penalty-period-panel.penalty-period-loading {
  opacity: 0.98;
}

.penalty-period-summary .page-loading.penalty-period-loading-card {
  min-height: 0;
  padding: 8px 0 4px;
}

.penalty-period-summary .page-loading-card {
  width: 100%;
  padding: 16px 12px;
  box-shadow: none;
  border: 1px dashed var(--border, #d1d5db);
  background: #fff;
}

.penalty-period-summary .page-loading-hint {
  margin-bottom: 0;
}

.penalty-period-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.penalty-period-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.penalty-period-months {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.penalty-period-month-btn {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  color: inherit;
  background: #fff;
}

.penalty-period-month-btn:hover {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}

.penalty-period-month-btn.is-active {
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  color: #fff;
}

.penalty-period-month-btn.is-pending {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

.penalty-period-summary {
  margin-bottom: 10px;
  font-size: 14px;
}

.penalty-period-settled-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 12px;
  background: #dcfce7;
  color: #166534;
}

.penalty-worker-detail-cell {
  padding: 8px 12px 12px !important;
  background: #fff;
}

.penalty-worker-table-host,
.penalty-worker-detail-host {
  width: 100%;
  overflow: visible;
  max-height: none;
  margin-top: 16px;
}

.penalty-worker-detail-host {
  margin-top: 0;
}

.penalty-worker-table-host .data-table thead th,
.penalty-customer-detail-table thead th {
  position: static;
  top: auto;
  z-index: auto;
  box-shadow: none;
}

.penalty-customer-detail-table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

.penalty-period-table th,
.penalty-period-table td {
  text-align: center;
  vertical-align: middle;
}

.penalty-period-table .num {
  text-align: center;
}

.penalty-period-table .overdue-aging-cell {
  text-align: center;
}

.penalty-period-table .aging-details {
  display: inline-block;
  text-align: center;
}

.penalty-period-table .aging-summary {
  justify-content: center;
}

.penalty-period-meta {
  margin-bottom: 0;
}

.data-table-compact th,
.data-table-compact td {
  font-size: 13px;
  padding: 6px 8px;
}

.overdue-aging-list .aging-month {
  font-weight: 600;
  margin-right: 4px;
}

.overdue-aging-list .aging-pay {
  display: block;
  margin-top: 2px;
}

.aging-mode-tag {
  font-size: 12px;
  margin-left: 4px;
}

.overdue-aging-cell {
  min-width: 200px;
  max-width: 320px;
  font-size: 13px;
  vertical-align: top;
}

.csv-download-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.38);
}

.csv-download-overlay[hidden] {
  display: none !important;
}

.ads-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
}

.ads-modal-overlay[hidden] {
  display: none !important;
}

.ads-modal-card {
  width: min(420px, 100%);
  padding: 22px 22px 18px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.22);
  text-align: center;
}

.ads-modal-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 14px;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: page-loading-spin 0.75s linear infinite;
}

.ads-modal-card.is-done .ads-modal-spinner,
.ads-modal-card.is-error .ads-modal-spinner {
  display: none;
}

.ads-modal-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 650;
  color: #0f172a;
}

.ads-modal-msg {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.55;
  color: #475569;
}

.ads-modal-card.is-done .ads-modal-msg {
  color: #166534;
}

.ads-modal-card.is-error .ads-modal-msg {
  color: #991b1b;
}

.ads-modal-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.ads-modal-actions[hidden] {
  display: none !important;
}

.csv-download-card {
  width: min(420px, 100%);
  padding: 18px 20px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

.csv-download-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
}

.csv-download-progress {
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.csv-download-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  transition: width 0.18s ease;
}

.csv-download-meta {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted, #6b7280);
}

.csv-export-status {
  font-size: 13px;
}

.aging-details {
  min-width: 0;
}

.aging-details summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  padding: 2px 0;
}

.aging-details summary::-webkit-details-marker {
  display: none;
}

.aging-summary-amt,
.aging-penalty-amt {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.aging-penalty-amt {
  color: #b45309;
}

.aging-summary-label,
.aging-expand-hint {
  color: var(--muted, #6b7280);
  font-size: 12px;
}

.aging-expand-hint {
  margin-left: 2px;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

.aging-details:not([open]) .aging-expand-hint::after {
  content: "?? ?";
}

.aging-details[open] .aging-expand-hint::after {
  content: "?? ?";
}

.overdue-aging-list .aging-penalty {
  font-size: 12px;
  color: #b45309;
  font-variant-numeric: tabular-nums;
}

.overdue-aging-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.overdue-aging-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 3px 0;
  border-bottom: 1px dashed var(--border);
}

.overdue-aging-list li:last-child {
  border-bottom: none;
}

.overdue-aging-list .aging-days {
  font-weight: 600;
  color: #b45309;
  white-space: nowrap;
}

.overdue-aging-list .aging-amt {
  font-variant-numeric: tabular-nums;
}

.overdue-aging-list .aging-due {
  font-size: 12px;
}

.tag-muted {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.payterm-ref {
  margin-top: 16px;
  padding: 14px 16px;
}

.payterm-ref summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}

.payterm-invalid-label,
.payterm-invalid-hint {
  color: #b45309;
  font-weight: 500;
}

.row-payterm-invalid {
  background: #fffbeb;
}

.row-payterm-invalid:hover {
  background: #fef3c7;
}

.data-table-compact th,
.data-table-compact td {
  padding: 8px 10px;
  font-size: 13px;
}

.nav-phase-muted {
  opacity: 0.65;
}

.nav-item-soon .nav-label {
  opacity: 0.9;
}

/* ??????? ? ?? .nav-group ????????????? */
.nav-module-group {
  margin-bottom: 0;
}

.nav-module-group.nav-module-open .nav-sub {
  display: block;
}

.nav-item-module.nav-module-current {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.nav-item-sub.active {
  color: var(--sidebar-active);
  background: rgba(38, 126, 240, 0.08);
}

.nav-sub {
  padding-left: 0;
  border-left: none;
  margin: 0;
}

.nav-item-sub {
  padding-left: 40px;
  min-height: 40px;
}

.sales-orders-page .cell-spec {
  max-width: 16rem;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  font-size: 13px;
}

.sales-orders-page .cell-alert {
  min-width: 11rem;
  white-space: normal;
  font-size: 12px;
  line-height: 1.35;
}

.sales-orders-page .order-alert {
  margin: 2px 0;
}

.sales-orders-page .order-alert-warn {
  color: #b45309;
}

.sales-orders-page .order-alert-danger {
  color: #b91c1c;
  font-weight: 600;
}

.sales-orders-page .order-view-links {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 2px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--border, #e5e7eb);
}

.sales-orders-page .order-view-link {
  font-size: 13px;
  color: #1d4ed8;
  text-decoration: none;
  white-space: nowrap;
}

.sales-orders-page .order-view-link:hover {
  text-decoration: underline;
}

.sales-orders-page .order-view-link.is-active {
  color: #0f172a;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid #2563eb;
}

.sales-orders-page .order-notify-settings,
.settings-page .order-notify-settings {
  margin-bottom: 12px;
  padding: 14px 16px;
}

.sales-orders-page .order-notify-settings-title,
.settings-page .order-notify-settings-title {
  margin: 0 0 4px;
  font-size: 15px;
}

.sales-orders-page .order-notify-settings-desc,
.settings-page .order-notify-settings-desc {
  margin: 0 0 12px;
}

.sales-orders-page .order-notify-grid,
.settings-page .order-notify-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px 18px;
  margin-bottom: 12px;
}

.sales-orders-page .order-notify-block,
.settings-page .order-notify-block {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
}

.sales-orders-page .order-notify-block legend,
.settings-page .order-notify-block legend {
  padding: 0 4px;
  font-size: 13px;
  font-weight: 600;
}

.sales-orders-page .order-notify-row,
.settings-page .order-notify-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 8px 0;
  font-size: 13px;
}

.sales-orders-page .order-notify-check,
.settings-page .order-notify-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 10px;
  font-size: 13px;
}

.sales-orders-page .order-notify-multi,
.settings-page .order-notify-multi {
  display: block;
  width: 100%;
  min-height: 6.5rem;
  margin-top: 4px;
}

.sales-orders-page .order-notify-actions,
.settings-page .order-notify-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.sales-orders-page tr.row-overdue td {
  background: #fff7f5;
}

.sales-orders-page tr.row-urgent td {
  box-shadow: inset 3px 0 0 #dc2626;
}

.sales-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--sidebar-panel);
  border: 1px solid var(--sidebar-border);
  box-shadow: 0 1px 6px rgba(30, 64, 110, 0.06);
}

.sales-subnav-item {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-min);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: #f3f7fc;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.sales-subnav-item.active {
  border-color: var(--sidebar-active);
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--sidebar-active);
}

.module-page .page-intro {
  margin-top: 0;
}

.rule-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.rule-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #f9fafb;
}

.rule-card-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.supervise-rule-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
}

.supervise-rule-tab {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.supervise-rule-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.supervise-rule-tab.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.flow-list {
  margin: 0 0 12px;
  padding-left: 20px;
  line-height: 1.8;
}

.supervise-progress-cell {
  min-width: 160px;
  max-width: 280px;
  font-size: 13px;
  vertical-align: top;
}

.supervise-action-list {
  margin: 0;
  padding-left: 16px;
  line-height: 1.55;
}

.supervise-action-list li {
  margin-bottom: 6px;
}

tr.row-promise-overdue td {
  background: #fff7ed;
}

.supervise-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.supervise-stat-block {
  min-width: 0;
}

.supervise-stat-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.overdue-remind-panel {
  margin-bottom: 16px;
}

.overdue-remind-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.overdue-remind-kpi {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2, #fafafa);
}

.overdue-remind-kpi-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.overdue-remind-kpi-value {
  font-size: 20px;
  font-weight: 700;
}

.overdue-remind-kpi-value.text-fail {
  color: #c2410c;
}

.overdue-remind-progress-hint {
  margin-bottom: 12px;
}

.overdue-remind-violation-grid {
  margin-bottom: 12px;
}

.overdue-remind-pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.data-table-compact th,
.data-table-compact td {
  padding: 6px 8px;
  font-size: 13px;
}

/* ?????? */
.dash-section {
  margin-bottom: 20px;
}

.dash-section-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}

.dash-charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.dash-charts-grid.is-finance-charts {
  grid-template-columns: 1fr 1fr;
}

.finance-balance-banner {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  background: var(--panel);
}

.finance-balance-banner.is-good {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.finance-balance-banner.is-warn {
  border-color: #fde68a;
  background: #fffbeb;
}

.finance-balance-banner.is-bad {
  border-color: #fecaca;
  background: #fff7f7;
}

.finance-balance-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.finance-balance-label {
  font-size: 13px;
  color: var(--muted);
}

.finance-balance-status {
  font-size: 18px;
  font-weight: 700;
}

.finance-balance-meta {
  font-size: 13px;
  color: var(--muted);
}

.finance-balance-summary {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text);
}

.finance-trend-eval {
  text-align: right;
  font-size: 13px;
  white-space: nowrap;
}

.finance-trend-eval-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.finance-trend-eval.is-good strong { color: #059669; }
.finance-trend-eval.is-warn strong { color: #d97706; }
.finance-trend-eval.is-bad strong { color: #dc2626; }

.finance-line-chart {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 8px;
}

.finance-chart-grid {
  stroke: var(--border);
  stroke-width: 1;
}

.finance-chart-zero {
  stroke: #94a3b8;
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.finance-line {
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.finance-line-sales { stroke: #10b981; }
.finance-line-payment { stroke: #f59e0b; }
.finance-line-balance { stroke: #6366f1; }

.finance-chart-point {
  fill: #fff;
  stroke-width: 2;
  cursor: default;
}

.finance-chart-point-sales { stroke: #10b981; }
.finance-chart-point-payment { stroke: #f59e0b; }
.finance-chart-point-balance.is-positive { stroke: #ef4444; fill: #fef2f2; }
.finance-chart-point-balance.is-negative { stroke: #059669; fill: #ecfdf5; }

.finance-chart-point.is-current {
  stroke-width: 3;
  transform: scale(1.15);
  transform-box: fill-box;
  transform-origin: center;
}

.finance-chart-xlabel {
  fill: var(--muted);
  font-size: 11px;
}

.finance-chart-xlabel.is-current {
  fill: var(--text);
  font-weight: 700;
}

.finance-trend-summary {
  margin-top: 10px;
}

.legend-balance-pos { background: #ef4444; }
.legend-balance-neg { background: #059669; }

.finance-row-eval {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.finance-row-eval.is-good { background: #dcfce7; color: #166534; }
.finance-row-eval.is-warn { background: #fef3c7; color: #92400e; }
.finance-row-eval.is-bad { background: #fee2e2; color: #991b1b; }
.finance-row-eval.is-neutral { background: #f3f4f6; color: var(--muted); }

.data-table tr.is-current-row {
  background: #eff6ff;
}

.cell-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 600;
}

.dash-tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-desc {
  margin: -4px 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.bar-chart-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-order { background: #3b82f6; }
.legend-delivery { background: #10b981; }
.legend-payment { background: #f59e0b; }
.legend-board { background: #6366f1; }
.legend-carton { background: #ec4899; }

.grouped-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding: 8px 4px 0;
  border-bottom: 1px solid var(--border);
  overflow: visible;
}

.grouped-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  height: 100%;
  overflow: visible;
}

.grouped-bar-stack {
  flex: 1;
  width: 100%;
  max-width: 36px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  overflow: visible;
}

.gbar {
  width: 8px;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  transition: height 0.2s ease, filter 0.15s ease;
  position: relative;
  cursor: default;
}

.gbar:hover,
.gbar:focus-visible {
  filter: brightness(1.08);
  z-index: 2;
}

.gbar[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 6px;
  background: #1f2937;
  color: #fff;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, visibility 0.12s ease;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.gbar[data-tip]::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 2px);
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1f2937;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, visibility 0.12s ease;
  z-index: 20;
}

.gbar:hover::after,
.gbar:hover::before,
.gbar:focus-visible::after,
.gbar:focus-visible::before {
  opacity: 1;
  visibility: visible;
}

.gbar-order { background: #3b82f6; }
.gbar-delivery { background: #10b981; }
.gbar-payment { background: #f59e0b; }
.gbar-board { background: #6366f1; }
.gbar-carton { background: #ec4899; }


.grouped-bar-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  white-space: nowrap;
}

.mix-chart {
  margin-top: 8px;
}

.mix-bar,
.mix-kpi-bar {
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background: #f3f4f6;
}

.mix-seg {
  height: 100%;
  min-width: 2px;
}

.mix-board { background: #6366f1; }
.mix-carton { background: #ec4899; }

.mix-labels {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
}

.mix-kpi-row {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.mix-kpi-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.mix-kpi-val {
  font-size: 14px;
  font-weight: 600;
  margin-top: 6px;
}

@media (max-width: 900px) {
  .dash-charts-grid,
  .dash-tables-grid {
    grid-template-columns: 1fr;
  }

  .grouped-bar-chart {
    height: 140px;
    overflow-x: auto;
  }

  .grouped-bar-col {
    min-width: 28px;
  }
}

/* ?? ?????? ?? */
.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 32px 16px;
}

.page-loading-compact {
  min-height: 220px;
}

.page-loading-overlay {
  min-height: auto;
  padding: 0;
}

.page-loading-card {
  width: min(440px, 100%);
  text-align: center;
  padding: 28px 24px 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.page-loading-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: page-loading-spin 0.75s linear infinite;
}

.page-loading-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.page-loading-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.page-loading-pct {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.page-loading-elapsed {
  color: var(--muted);
}

.page-loading-progress {
  height: 8px;
  margin: 0 0 14px;
  overflow: hidden;
  background: #eef2f7;
  border-radius: 999px;
}

.page-loading-progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #60a5fa, #2563eb);
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width 0.35s ease-out;
  animation: page-loading-bar-shine 1.8s linear infinite;
}

.page-loading-msg {
  margin: 0 0 14px;
  min-height: 1.5em;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.page-loading-msg.is-changing {
  animation: page-loading-msg-pulse 0.45s ease;
}

.page-loading-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.page-loading-steps li {
  position: relative;
  padding: 4px 10px 4px 22px;
  font-size: 12px;
  color: var(--muted);
  background: #f3f4f6;
  border-radius: 999px;
  transition: background 0.25s ease, color 0.25s ease;
}

.page-loading-steps li::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: #d1d5db;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.page-loading-steps li.is-active {
  color: var(--primary);
  background: #eff6ff;
  font-weight: 600;
}

.page-loading-steps li.is-active::before {
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  animation: page-loading-step-pulse 1.2s ease-in-out infinite;
}

.page-loading-steps li.is-done {
  color: var(--ok);
}

.page-loading-steps li.is-done::before {
  background: var(--ok);
}

.page-loading-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.global-page-loader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(244, 246, 248, 0.88);
  backdrop-filter: blur(3px);
}

.global-page-loader[hidden] {
  display: none !important;
}

.async-content-host {
  min-height: 360px;
}

.async-content-host.content-loaded {
  animation: content-fade-in 0.28s ease;
}

@keyframes content-fade-in {
  from {
    opacity: 0.4;
  }
  to {
    opacity: 1;
  }
}

body.is-global-loading {
  overflow: hidden;
}

@keyframes page-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes page-loading-bar-shine {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

@keyframes page-loading-msg-pulse {
  0% {
    opacity: 0.35;
    transform: translateY(2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes page-loading-step-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}

@keyframes page-loading-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.wecom-mapping-table input[type="text"],
.wecom-mapping-table input[type="number"] {
  width: 100%;
  min-width: 72px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

/* ?????????????????? */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.wecom-mapping-table .field-input-sm {
  max-width: 120px;
}

.wecom-mapping-table td.cell-check {
  text-align: center;
  width: 48px;
}

.wecom-status-table {
  margin-bottom: 16px;
}

.wecom-status-table th[scope="row"] {
  width: 120px;
  white-space: nowrap;
  font-weight: 500;
  color: #64748b;
  background: #f8fafc;
  vertical-align: top;
}

.wecom-status-table td {
  vertical-align: top;
}

.wecom-status-hint {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.wecom-code {
  display: inline-block;
  max-width: 100%;
  word-break: break-all;
  font-size: 13px;
}

.wecom-mapping-scroll {
  overflow: visible;
  max-height: none;
}

.wecom-worker-ac {
  position: relative;
}

.worker-id-cell {
  min-width: 140px;
}

.wecom-worker-ac .wecom-employee-results {
  position: absolute;
  z-index: 30;
  left: 0;
  min-width: 260px;
  right: auto;
  top: calc(100% + 4px);
  margin: 0;
  padding: 4px 0;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface-elevated, #fff);
  border: 1px solid var(--border, #d8dee6);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.wecom-worker-ac .wecom-employee-results[hidden] {
  display: none !important;
}

.wecom-worker-ac .wecom-employee-results:not([hidden]) {
  display: block;
}

.wecom-employee-pick {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.wecom-employee-pick:hover,
.wecom-employee-pick:focus-visible {
  background: var(--row-hover, #f3f6fa);
  outline: none;
}

.wecom-employee-pick-name {
  font-weight: 500;
}

.wecom-employee-pick-meta {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  white-space: nowrap;
}

.wecom-employee-results-empty {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-muted, #64748b);
}

.wecom-mapping-table {
  min-width: 720px;
}

.settings-page .wecom-mapping-table th {
  white-space: nowrap;
  font-size: 13px;
}

.settings-page .settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* ?????????????? ???? */
.data-table-wide {
  min-width: 880px;
}

/* ???????????????????????? */
.aged-detail-table th:not(.col-product-name),
.aged-detail-table td:not(.col-product-name) {
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
}

.aged-detail-table th.col-product-name,
.aged-detail-table td.col-product-name {
  text-align: left;
  white-space: normal;
  word-break: break-word;
  min-width: 10rem;
  max-width: 22rem;
  vertical-align: top;
}

.aged-detail-table tr.aged-detail-subtotal td {
  background: #f1f5f9;
  font-weight: 600;
  border-top: 1px solid var(--border);
  border-bottom: 2px solid #94a3b8;
  vertical-align: middle;
}

.aged-detail-table tr.aged-detail-subtotal td.col-product-name {
  text-align: left;
  font-weight: 700;
}

.aged-detail-table tr.aged-detail-line.is-group-tail td {
  border-bottom-color: transparent;
}

.aged-detail-table tbody tr.aged-detail-subtotal:hover td {
  background: #e2e8f0;
}

.table-scroll-hint {
  margin-top: 8px;
  font-size: 13px;
}

.mobile-only {
  display: none;
}

/* ?? ??????? ?? */
@media (max-width: 768px) {
  .app-main {
    width: 100%;
  }

  /* ????????????? app-tab-panel ? overflow??????? */
  .app-content {
    max-width: 100%;
  }

  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    max-width: 100%;
  }

  .data-table-wide {
    min-width: 720px;
  }

  .mobile-only {
    display: inline;
  }

  .app-tab-strip {
    padding: 4px 8px 0;
  }

  .app-tab {
    max-width: 42vw;
    padding: 6px 8px;
    font-size: 12px;
    min-height: 36px;
  }

  .app-tab-close {
    width: 22px;
    height: 22px;
    line-height: 20px;
  }

  .page-heading {
    font-size: 15px;
  }

  .sales-subnav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    margin-bottom: 16px;
    padding-bottom: 8px;
  }

  .sales-subnav::-webkit-scrollbar {
    display: none;
  }

  .sales-subnav-item {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: var(--touch-min);
    display: inline-flex;
    align-items: center;
  }

  .module-page .page-intro-title {
    font-size: clamp(18px, 5vw, 22px);
  }

  .module-page .page-intro-desc {
    font-size: 14px;
  }

  .dashboard-page .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overdue-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .overdue-toolbar-left,
  .overdue-toolbar-right {
    width: 100%;
    justify-content: flex-start;
  }

  .overdue-toolbar-left .btn,
  .overdue-toolbar-right .btn {
    flex: 1 1 auto;
    min-width: calc(50% - 4px);
  }

  .overdue-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .overdue-filter-label {
    margin-top: 4px;
  }

  .overdue-filter-bar > .btn {
    width: 100%;
  }

  .overdue-filter-bar-actions {
    margin-left: 0;
    width: 100%;
  }

  .overdue-penalty-settings-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .penalty-month-filter {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .penalty-month-quick {
    width: 100%;
  }

  .overdue-filter-select {
    width: 100%;
    min-width: 0;
    min-height: var(--touch-min);
    font-size: 16px;
  }

  .company-select {
    max-width: 100px;
    min-height: 36px;
    font-size: 16px;
  }

  .supervise-stats-grid {
    grid-template-columns: 1fr;
  }

  .login-form input,
  .m-input,
  .m-textarea,
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="search"],
  input[type="time"],
  select,
  textarea {
    font-size: 16px; /* ?? iOS ?????? */
  }

  .panel-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .panel-header-row .btn {
    width: 100%;
    justify-content: center;
  }

  .sales-orders-page .order-view-links {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    padding-bottom: 4px;
  }

  .sales-orders-page .order-view-link {
    flex: 0 0 auto;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .sales-orders-page .order-notify-grid,
  .settings-page .order-notify-grid {
    grid-template-columns: 1fr;
  }

  .sales-orders-page .order-notify-actions,
  .settings-page .order-notify-actions {
    flex-wrap: wrap;
  }

  .sales-orders-page .order-notify-actions .btn,
  .settings-page .order-notify-actions .btn {
    flex: 1 1 auto;
    min-width: calc(50% - 4px);
  }

  .cell-spec {
    word-break: break-word;
    white-space: normal;
    max-width: 14rem;
  }
}

@media (max-width: 480px) {
  .dashboard-page .kpi-grid {
    grid-template-columns: 1fr;
  }

  .user-bar {
    gap: 6px;
  }

  .company-label {
    display: none;
  }

  .logout-form .btn {
    padding-left: 10px;
    padding-right: 10px;
  }

  .overdue-toolbar-left .btn {
    flex: 1 1 100%;
  }

  .pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination-actions {
    width: 100%;
    justify-content: space-between;
  }

  .pagination-actions .btn {
    flex: 1;
  }

  .data-table-wide {
    min-width: 640px;
  }

  .app-tab {
    max-width: 48vw;
  }
}

/* ?? M4 ???????? ?? */
.credit-new-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.credit-new-page > .panel {
  margin: 0;
}

.credit-new-pick-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
}

.credit-new-pick-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 10px;
  flex: 1 1 16rem;
  min-width: 0;
}

.credit-new-label {
  display: block;
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.credit-new-pick-form .credit-new-label {
  margin: 0;
  align-self: center;
}

.credit-new-select,
.credit-new-input,
.credit-new-textarea {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.credit-new-select {
  flex: 1 1 18rem;
  min-width: 12rem;
  max-width: 36rem;
}

.credit-new-select:focus,
.credit-new-input:focus,
.credit-new-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(38, 126, 240, 0.15);
}

.credit-new-empty-hint {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 13px;
}

.credit-new-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 14px;
}

.credit-new-section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.credit-new-section-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.credit-new-status-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.credit-status-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 20px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.credit-status-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.credit-status-name {
  font-size: 17px;
  font-weight: 650;
}

.credit-status-no {
  font-size: 13px;
  color: var(--muted);
}

.credit-status-meta-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 13px;
  color: var(--text);
}

.credit-status-meta-items em {
  margin-right: 6px;
  font-style: normal;
  color: var(--muted);
}

.credit-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 10px;
}

.credit-metric {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfc;
  min-width: 0;
}

.credit-metric-accent {
  background: rgba(38, 126, 240, 0.06);
  border-color: rgba(38, 126, 240, 0.28);
}

.credit-metric-danger {
  background: rgba(220, 38, 38, 0.05);
  border-color: rgba(220, 38, 38, 0.28);
}

.credit-metric-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
}

.credit-metric-value {
  display: block;
  font-size: 18px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  word-break: break-all;
}

.credit-metric-danger .credit-metric-value {
  color: var(--fail);
}

.credit-metric-accent .credit-metric-value {
  color: var(--primary);
}

.credit-metric-sub {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.credit-metric-sub.is-warn {
  color: #b45309;
}

.credit-status-months {
  margin-top: 16px;
}

.credit-status-months-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.credit-status-months-hint {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.credit-status-months .table-scroll {
  max-width: 36rem;
}

.credit-status-months .data-table {
  width: auto;
  min-width: 0;
  table-layout: fixed;
}

.credit-status-months .data-table th:nth-child(1),
.credit-status-months .data-table td:nth-child(1) {
  width: 5.2rem;
}

.credit-status-months .data-table th:nth-child(n+2),
.credit-status-months .data-table td:nth-child(n+2) {
  width: 5.8rem;
}

.credit-new-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}

.credit-new-field-full {
  grid-column: 1 / -1;
}

.credit-new-input {
  width: 100%;
  max-width: 16rem;
}

.credit-new-textarea {
  width: 100%;
  min-height: 6rem;
  resize: vertical;
  line-height: 1.45;
}

.credit-new-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.credit-new-hint-muted {
  opacity: 0.92;
}

.credit-new-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
  .credit-new-fields {
    grid-template-columns: 1fr;
  }

  .credit-new-input {
    max-width: none;
  }

  .credit-new-pick-row {
    align-items: stretch;
  }

  .credit-new-pick-form {
    flex-direction: column;
    align-items: stretch;
  }

  .credit-new-select {
    max-width: none;
  }

  .credit-new-pick-row > .btn {
    align-self: flex-start;
  }
}


/* ?????????? */
.supervise-report-section-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.print-report-head {
  display: none;
}

.print-report-head h1 {
  margin: 0 0 6px;
  font-size: 20px;
}

@media print {
  .no-print,
  .sidebar,
  .app-topbar,
  .sales-subnav,
  #global-page-loader,
  .sidebar-backdrop {
    display: none !important;
  }

  .print-only,
  .print-report-head {
    display: block !important;
  }

  body.app-shell .app-layout,
  body.app-shell .app-main,
  .app-content {
    display: block !important;
    overflow: visible !important;
    height: auto !important;
    min-height: 0 !important;
  }

  .supervise-report-page .panel {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .supervise-report-detail {
    font-size: 11px;
  }

  .table-scroll {
    overflow: visible !important;
  }
}

/* —— 智能助手 —— */
.assistant-page {
  max-width: 880px;
}

.assistant-shell {
  display: flex;
  flex-direction: column;
  min-height: min(70vh, 640px);
  padding: 0;
  overflow: hidden;
}

.assistant-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  background: #fff;
}

.assistant-history-meta {
  font-size: 12px;
  color: var(--muted, #6b7280);
}

.assistant-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 40%);
}

.assistant-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: min(92%, 640px);
}

.assistant-msg.is-user {
  align-self: flex-end;
  align-items: flex-end;
}

.assistant-msg.is-assistant,
.assistant-msg.is-error,
.assistant-msg.is-thinking {
  align-self: flex-start;
  align-items: flex-start;
}

.assistant-msg.is-system {
  align-self: center;
  align-items: center;
}

.assistant-bubble {
  max-width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.assistant-bubble.is-system {
  align-self: center;
  background: #eef2ff;
  color: #3730a3;
  font-size: 13px;
}

.assistant-bubble.is-user {
  align-self: flex-end;
  background: #267ef0;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.assistant-bubble.is-assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.assistant-bubble.is-error {
  align-self: flex-start;
  background: #fff7f7;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.assistant-bubble.is-thinking {
  align-self: flex-start;
  color: var(--muted);
  border: 1px dashed var(--border);
  background: #fff;
}

.assistant-tools {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--muted);
}

.assistant-composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.assistant-input {
  width: 100%;
  resize: vertical;
  min-height: 64px;
  max-height: 180px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  line-height: 1.45;
}

.assistant-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(38, 126, 240, 0.15);
}

.assistant-composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.assistant-bubble-meta {
  display: block;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted, #6b7280);
  opacity: 0.9;
}

.assistant-msg.is-user .assistant-bubble-meta {
  text-align: right;
}

.assistant-modal[hidden] {
  display: none !important;
}

.assistant-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.assistant-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.assistant-modal-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 20px 18px 16px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.2);
}

.assistant-modal-title {
  margin: 0 0 8px;
  font-size: 16px;
}

.assistant-modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0 10px;
  font-size: 13px;
}

.assistant-modal-field .input {
  padding: 8px 10px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
}

.assistant-modal-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}

.assistant-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}
