:root {
      --bg: #f6f8f7;
      --bg-soft: #eef2f0;
      --card: #ffffff;
      --card-2: #fcfdfc;
      --border: #e2e8e4;
      --text: #2a3432;
      --muted: #6f7f7a;
      --primary: #5d8a8a;
      --primary-2: #4a7373;
      --accent: #c4a574;
      --accent-soft: rgba(196, 165, 116, 0.14);
      --success: #3d8f6e;
      --warning: #c2853a;
      --danger: #c45c5c;
      --shadow: 0 12px 36px rgba(42, 52, 50, 0.07);
      --shadow-soft: 0 2px 14px rgba(42, 52, 50, 0.05);
      --radius-lg: 16px;
      --radius-md: 12px;
      --radius-sm: 8px;
      --ease: cubic-bezier(0.22, 1, 0.36, 1);
      --layout-x: 0;
    }
    * { box-sizing: border-box; margin: 0; padding: 0; }
    body {
      font-family: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
      background:
        radial-gradient(900px 280px at 8% -8%, rgba(93, 138, 138, 0.09), transparent 72%),
        radial-gradient(760px 240px at 92% -6%, rgba(196, 165, 116, 0.1), transparent 70%),
        linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 120px);
      color: var(--text);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      -webkit-font-smoothing: antialiased;
    }
    .header {
      position: sticky;
      top: 0;
      z-index: 30;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      background: rgba(255, 255, 255, 0.88);
      border-bottom: 1px solid var(--border);
      padding: 0;
      box-shadow: 0 6px 24px rgba(42, 52, 50, 0.06);
    }
    .header-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
      flex-wrap: wrap;
      padding: 0.65rem 0 0.5rem;
    }
    .header-brand {
      display: flex;
      align-items: center;
      gap: 0.55rem;
      flex-wrap: wrap;
      min-width: 0;
    }
    .header-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      flex-wrap: wrap;
      gap: 0.45rem;
      flex: 1;
      min-width: 0;
    }
    .header-shared-tag {
      font-size: 0.72rem;
      color: var(--success);
      background: rgba(61, 143, 110, 0.1);
      border: 1px solid rgba(61, 143, 110, 0.22);
      padding: 0.12rem 0.45rem;
      border-radius: 999px;
    }
    .header-nav-wrap {
      padding: 0 0 0.55rem;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thin;
    }
    .header h1 {
      font-size: 1.12rem;
      font-weight: 700;
      color: var(--primary-2);
      letter-spacing: 0.04em;
    }
    .announcement-wrap { position: relative; flex-shrink: 0; }
    .btn-announcement {
      position: relative;
      padding: 0.42rem 0.8rem;
      font-size: 0.82rem;
      border-radius: 999px;
      border: 1px solid #fdba74;
      background: linear-gradient(180deg, #fff8f0 0%, #ffedd5 100%);
      color: #9a3412;
      cursor: pointer;
      font-weight: 700;
      font-family: inherit;
    }
    .btn-announcement:hover { border-color: #f97316; background: #fff7ed; }
    .announcement-badge {
      position: absolute;
      top: -7px;
      right: -6px;
      min-width: 18px;
      height: 18px;
      padding: 0 5px;
      font-size: 0.65rem;
      line-height: 18px;
      text-align: center;
      background: var(--danger);
      color: #fff;
      border-radius: 999px;
      font-weight: 700;
    }
    .announcement-dropdown {
      display: none;
      position: absolute;
      right: 0;
      top: calc(100% + 8px);
      width: min(520px, calc(100vw - 2rem));
      max-height: min(420px, 75vh);
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      box-shadow: var(--shadow);
      z-index: 120;
      overflow: hidden;
      flex-direction: column;
    }
    .announcement-dropdown.show { display: flex; }
    .announcement-dropdown-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      padding: 0.65rem 0.85rem;
      border-bottom: 1px solid var(--border);
      background: linear-gradient(180deg, #fffdfb 0%, #fff7ed 100%);
    }
    .announcement-dropdown-title { font-size: 0.88rem; font-weight: 800; color: #9a3412; }
    .announcement-table-wrap { overflow: auto; max-height: 300px; }
    .announcement-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
    .announcement-table th,
    .announcement-table td { border: 1px solid var(--border); padding: 0.38rem 0.5rem; text-align: left; white-space: nowrap; }
    .announcement-table td.announcement-stages-cell {
      white-space: normal;
      max-width: min(320px, 42vw);
      font-size: 0.72rem;
      line-height: 1.4;
      vertical-align: top;
    }
    .announcement-table th { background: #f1f5f9; color: #64748b; font-weight: 700; position: sticky; top: 0; z-index: 1; }
    .announcement-empty { margin: 0; padding: 1.1rem; text-align: center; color: var(--muted); font-size: 0.85rem; display: none; }
    .announcement-empty.show { display: block; }
    .share-board-wrap { position: relative; flex-shrink: 0; }
    .btn-share-board {
      position: relative;
      padding: 0.42rem 0.8rem;
      font-size: 0.82rem;
      border-radius: 999px;
      border: 1px solid #a7f3d0;
      background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
      color: #065f46;
      cursor: pointer;
      font-weight: 700;
      font-family: inherit;
    }
    .btn-share-board:hover { border-color: #34d399; background: #ecfdf5; }
    .share-board-badge {
      position: absolute;
      top: -7px;
      right: -6px;
      min-width: 18px;
      height: 18px;
      padding: 0 5px;
      font-size: 0.65rem;
      line-height: 18px;
      text-align: center;
      background: var(--danger);
      color: #fff;
      border-radius: 999px;
      font-weight: 700;
    }
    .share-board-dropdown {
      display: none;
      position: absolute;
      right: 0;
      top: calc(100% + 8px);
      width: min(520px, calc(100vw - 2rem));
      max-height: min(420px, 75vh);
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 12px;
      box-shadow: var(--shadow);
      z-index: 120;
      overflow: hidden;
      flex-direction: column;
    }
    .share-board-dropdown.show { display: flex; }
    .share-board-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      padding: 0.65rem 0.85rem;
      border-bottom: 1px solid var(--border);
      background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
    }
    .share-board-title { font-size: 0.88rem; font-weight: 800; color: #166534; }
    .share-board-input { padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--border); background: #fcfffe; }
    .share-board-input textarea {
      width: 100%;
      min-height: 70px;
      resize: vertical;
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 0.48rem 0.58rem;
      font-family: inherit;
      font-size: 0.82rem;
      color: var(--text);
      background: #fff;
    }
    .share-board-input-actions { margin-top: 0.45rem; display: flex; justify-content: flex-end; }
    .share-board-list { overflow: auto; max-height: 250px; }
    .share-board-item {
      border-bottom: 1px solid #ecf3fb;
      padding: 0.55rem 0.8rem;
      display: flex;
      gap: 0.55rem;
      align-items: flex-start;
      justify-content: space-between;
    }
    .share-board-item-main { min-width: 0; }
    .share-board-item-text { font-size: 0.82rem; color: var(--text); white-space: pre-wrap; word-break: break-word; }
    .share-board-item-meta { margin-top: 0.25rem; font-size: 0.72rem; color: var(--muted); }
    .share-board-item-history { margin-top: 0.35rem; font-size: 0.72rem; color: #475569; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 0.35rem 0.45rem; display: none; white-space: pre-wrap; }
    .share-board-item-history.show { display: block; }
    .share-board-item-actions { display: flex; gap: 0.3rem; flex-wrap: wrap; justify-content: flex-end; }
    .share-board-empty { margin: 0; padding: 1rem; text-align: center; color: var(--muted); font-size: 0.84rem; display: none; }
    .share-board-empty.show { display: block; }
    .share-info-bar {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      padding: 0.34rem 0.62rem;
      border: 1px solid rgba(93, 138, 138, 0.22);
      border-radius: 999px;
      background: linear-gradient(180deg, #f8fbfb 0%, #eef5f3 100%);
      color: var(--primary-2);
      font-size: 0.75rem;
      white-space: nowrap;
      flex-shrink: 0;
    }
    .share-info-bar .dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #64748b;
      display: inline-block;
      box-shadow: 0 0 0 2px rgba(100,116,139,0.2);
    }
    .share-info-bar.is-shared .dot {
      background: #16a34a;
      box-shadow: 0 0 0 2px rgba(22,163,74,0.22);
    }
    .share-info-bar.is-local .dot {
      background: #d97706;
      box-shadow: 0 0 0 2px rgba(217,119,6,0.22);
    }
    .nav {
      display: flex;
      gap: 0.35rem;
      flex-wrap: nowrap;
      align-items: center;
      min-width: min-content;
      padding-bottom: 0.15rem;
    }
    .nav-divider {
      width: 1px;
      height: 1.35rem;
      background: var(--border);
      margin: 0 0.15rem;
      flex-shrink: 0;
    }
    .nav-btn {
      padding: 0.42rem 0.85rem;
      background: transparent;
      border: 1px solid transparent;
      color: var(--muted);
      border-radius: 999px;
      cursor: pointer;
      font-size: 0.84rem;
      font-weight: 500;
      white-space: nowrap;
      transition: color 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
    }
    .nav-btn:hover {
      background: rgba(93, 138, 138, 0.08);
      border-color: rgba(93, 138, 138, 0.15);
      color: var(--text);
    }
    .nav-btn.active {
      background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
      border-color: transparent;
      color: #fff;
      box-shadow: 0 6px 16px rgba(74, 115, 115, 0.28);
    }
    .nav-btn--featured {
      border-color: rgba(196, 165, 116, 0.45);
      background: linear-gradient(135deg, rgba(196, 165, 116, 0.12) 0%, rgba(93, 138, 138, 0.08) 100%);
      color: var(--primary-2);
      font-weight: 600;
    }
    .nav-btn--featured:hover {
      border-color: rgba(196, 165, 116, 0.65);
      background: linear-gradient(135deg, rgba(196, 165, 116, 0.2) 0%, rgba(93, 138, 138, 0.12) 100%);
      box-shadow: 0 4px 12px rgba(196, 165, 116, 0.18);
    }
    .nav-btn--featured.active {
      background: linear-gradient(135deg, var(--accent) 0%, #b89562 55%, var(--primary) 100%);
      color: #fff;
      border-color: transparent;
      box-shadow: 0 6px 18px rgba(196, 165, 116, 0.35);
    }
    .nav-action-btn { flex-shrink: 0; }
    .main {
      flex: 1;
      width: 100%;
      max-width: none;
      margin: 0;
      padding: 0.75rem 0 0.95rem;
      box-sizing: border-box;
    }
    .page { display: none; }
    .page.active { display: block; }
    .card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 1rem clamp(0.85rem, 1.2vw, 1.1rem);
      margin-bottom: 0.85rem;
      box-shadow: var(--shadow-soft);
      width: 100%;
      box-sizing: border-box;
      transition: box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
    }
    .card:hover { box-shadow: var(--shadow); border-color: #d5ddd8; }
    .card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      flex-wrap: wrap;
      margin-bottom: 0.85rem;
      padding-bottom: 0.55rem;
      border-bottom: 1px solid var(--border);
    }
    .card-head .card-title { margin-bottom: 0; }
    .card-title {
      font-size: 0.95rem;
      margin: 0 0 0.85rem;
      color: var(--text);
      font-weight: 600;
      letter-spacing: 0.06em;
      display: flex;
      align-items: center;
      gap: 0.45rem;
    }
    .card-title::before {
      content: '';
      width: 3px;
      height: 0.95rem;
      border-radius: 2px;
      background: linear-gradient(180deg, var(--accent) 0%, var(--primary) 100%);
      flex-shrink: 0;
    }
    .dashboard-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
      gap: 0.7rem;
    }
    .stat-box {
      background: linear-gradient(165deg, #ffffff 0%, #f8faf9 100%);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 0.85rem 0.9rem;
      text-align: left;
      display: flex;
      flex-direction: column;
      gap: 0.3rem;
      transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
    }
    .stat-box:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-soft);
      border-color: #d0dbd6;
    }
    .stat-box .num { font-size: 1.5rem; font-weight: 700; color: var(--primary-2); line-height: 1.15; font-variant-numeric: tabular-nums; }
    .stat-box .label { font-size: 0.76rem; color: var(--muted); line-height: 1.35; }
    .dashboard-pending-scroll {
      max-height: min(320px, 50vh);
      overflow-y: auto;
      overflow-x: auto;
      border: 1px solid var(--border);
      border-radius: 8px;
      -webkit-overflow-scrolling: touch;
      margin-bottom: 0.5rem;
    }
    .dashboard-pending-scroll table { margin: 0; }
    .dashboard-pending-scroll th {
      position: sticky;
      top: 0;
      z-index: 1;
      background: linear-gradient(180deg, #f7fbff 0%, #eef4fc 100%);
      vertical-align: top;
    }
    #page-factories .factories-table-scroll {
      overflow: auto;
      max-height: calc(100dvh - 14rem);
      -webkit-overflow-scrolling: touch;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: linear-gradient(180deg, #fcfdfc 0%, #f8faf9 100%);
    }
    #page-factories .factories-table-scroll table { margin: 0; }
    #page-factories .factories-table-scroll th {
      position: sticky;
      top: 0;
      z-index: 2;
      background: linear-gradient(180deg, rgba(247, 251, 255, 0.96) 0%, rgba(238, 244, 252, 0.94) 100%);
      box-shadow: 0 1px 0 var(--border);
      vertical-align: top;
    }
    #page-factories .factories-table-scroll tbody tr:nth-child(even) {
      background: rgba(246, 248, 247, 0.65);
    }
    #page-factories .factories-table-scroll tbody tr:hover {
      background: rgba(93, 138, 138, 0.06);
    }
    #page-factories .factories-table-scroll tfoot td {
      position: sticky;
      bottom: 0;
      z-index: 1;
      background: linear-gradient(180deg, #f4f8f6 0%, #eaf0ed 100%);
      border-top: 2px solid var(--primary);
      font-weight: 700;
      font-variant-numeric: tabular-nums;
      box-shadow: 0 -2px 8px rgba(42, 52, 50, 0.06);
    }
    #page-factories .factories-foot-label {
      text-align: right;
      color: var(--primary-2);
      letter-spacing: 0.06em;
    }
    #page-factories #factories-foot-live-balance,
    #page-factories #factories-foot-capacity-std {
      color: var(--primary-2);
      font-size: 0.95rem;
    }
    html[data-theme="dark"] #page-factories .factories-table-scroll {
      background: linear-gradient(180deg, #1e293b 0%, #172033 100%);
    }
    html[data-theme="dark"] #page-factories .factories-table-scroll th {
      background: rgba(51, 65, 85, 0.95);
      color: #e2e8f0;
      box-shadow: 0 1px 0 #475569;
    }
    html[data-theme="dark"] #page-factories .factories-table-scroll tbody tr:nth-child(even) {
      background: rgba(30, 41, 59, 0.5);
    }
    html[data-theme="dark"] #page-factories .factories-table-scroll tfoot td {
      background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
      color: #e2e8f0;
      border-top-color: var(--primary);
    }
    html[data-theme="dark"] #page-factories .factories-foot-label {
      color: #94a3b8;
    }
    #page-factorydb .factorydb-table-scroll {
      position: relative;
      overflow: auto;
      max-height: calc(100dvh - 13rem);
      -webkit-overflow-scrolling: touch;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: linear-gradient(180deg, #fcfdfc 0%, #f8faf9 100%);
    }
    #page-factorydb .factorydb-watermark {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
      z-index: 0;
      overflow: hidden;
    }
    #page-factorydb .factorydb-watermark__inner {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.55rem;
      transform: rotate(-14deg);
      user-select: none;
    }
    #page-factorydb .factorydb-watermark__row {
      display: flex;
      align-items: center;
      gap: 0.65rem;
    }
    #page-factorydb .factorydb-watermark__text {
      font-size: clamp(3.2rem, 9vw, 6.5rem);
      font-weight: 800;
      letter-spacing: 0.38em;
      text-indent: 0.38em;
      line-height: 1;
      background: linear-gradient(135deg, rgba(93, 138, 138, 0.09) 0%, rgba(196, 165, 116, 0.13) 48%, rgba(74, 115, 115, 0.08) 100%);
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
      text-shadow: none;
      filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.6));
    }
    #page-factorydb .factorydb-watermark__orn {
      display: inline-block;
      width: clamp(2.5rem, 8vw, 5rem);
      height: 1px;
      background: linear-gradient(90deg, transparent 0%, rgba(196, 165, 116, 0.22) 50%, transparent 100%);
      flex-shrink: 0;
    }
    #page-factorydb .factorydb-watermark__orn--l {
      background: linear-gradient(90deg, transparent 0%, rgba(93, 138, 138, 0.2) 100%);
    }
    #page-factorydb .factorydb-watermark__orn--r {
      background: linear-gradient(90deg, rgba(196, 165, 116, 0.2) 0%, transparent 100%);
    }
    #page-factorydb .factorydb-watermark__sub {
      font-size: clamp(0.68rem, 1.6vw, 0.82rem);
      font-weight: 600;
      letter-spacing: 0.42em;
      text-indent: 0.42em;
      color: rgba(93, 138, 138, 0.14);
    }
    #page-factorydb .factorydb-watermark__inner {
      position: relative;
    }
    #page-factorydb .factorydb-watermark__inner::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: clamp(14rem, 36vw, 22rem);
      height: clamp(14rem, 36vw, 22rem);
      border-radius: 50%;
      border: 1px solid rgba(196, 165, 116, 0.1);
      box-shadow: inset 0 0 0 1px rgba(93, 138, 138, 0.06);
      pointer-events: none;
    }
    #page-factorydb .factorydb-table-scroll table {
      position: relative;
      z-index: 1;
      margin: 0;
      background: transparent;
    }
    #page-factorydb .factorydb-table-scroll th {
      position: sticky;
      top: 0;
      z-index: 2;
      background: linear-gradient(180deg, rgba(247, 251, 255, 0.93) 0%, rgba(238, 244, 252, 0.9) 100%);
      box-shadow: 0 1px 0 var(--border);
      vertical-align: top;
    }
    #page-factorydb .factorydb-table-scroll tbody tr {
      background: rgba(255, 255, 255, 0.78);
    }
    #page-factorydb .factorydb-table-scroll tbody tr:nth-child(even) {
      background: rgba(251, 253, 255, 0.72);
    }
    #page-factorydb .factorydb-table-scroll tbody tr:hover {
      background: rgba(93, 138, 138, 0.08);
    }
    html[data-theme="dark"] #page-factorydb .factorydb-table-scroll {
      background: linear-gradient(180deg, #1e293b 0%, #172033 100%);
    }
    html[data-theme="dark"] #page-factorydb .factorydb-watermark__text {
      background: linear-gradient(135deg, rgba(107, 163, 163, 0.1) 0%, rgba(212, 184, 150, 0.12) 50%, rgba(107, 163, 163, 0.08) 100%);
      -webkit-background-clip: text;
      background-clip: text;
    }
    html[data-theme="dark"] #page-factorydb .factorydb-watermark__sub { color: rgba(212, 184, 150, 0.12); }
    html[data-theme="dark"] #page-factorydb .factorydb-watermark__inner::before {
      border-color: rgba(212, 184, 150, 0.08);
      box-shadow: inset 0 0 0 1px rgba(107, 163, 163, 0.06);
    }
    html[data-theme="dark"] #page-factorydb .factorydb-table-scroll th {
      background: rgba(51, 65, 85, 0.92);
      color: #e2e8f0;
      box-shadow: 0 1px 0 #475569;
    }
    html[data-theme="dark"] #page-factorydb .factorydb-table-scroll tbody tr {
      background: rgba(30, 41, 59, 0.78);
    }
    html[data-theme="dark"] #page-factorydb .factorydb-table-scroll tbody tr:nth-child(even) {
      background: rgba(30, 41, 59, 0.65);
    }
    #page-factorydb .factorydb-table-scroll th .prod-col-filter {
      display: block;
      width: 100%;
      min-width: 4.5rem;
      margin-top: 0.35rem;
      font-size: 0.72rem;
      padding: 0.22rem 0.35rem;
      box-sizing: border-box;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 4px;
      color: var(--text);
      font-weight: 400;
    }
    html[data-theme="dark"] .dashboard-pending-scroll th {
      background: #334155;
      color: #e2e8f0;
    }
    .dashboard-pending-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 0.5rem;
    }
    .dashboard-pending-filters { display: flex; gap: 0.4rem; }
    .dashboard-plan-completion-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.5rem;
      margin-bottom: 0.75rem;
      padding-bottom: 0.55rem;
      border-bottom: 1px solid var(--border);
    }
    .dashboard-plan-completion-head.card-head { margin-bottom: 0.65rem; }
    .dashboard-plan-completion-filters {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      flex-wrap: wrap;
    }
    .dashboard-plan-date-label {
      font-size: 0.78rem;
      color: var(--muted);
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
    }
    .dashboard-plan-date-label input[type="date"] {
      background: var(--bg);
      border: 1px solid var(--border);
      color: var(--text);
      padding: 0.28rem 0.45rem;
      border-radius: 4px;
      font-size: 0.78rem;
    }
    .dashboard-plan-completion-hint {
      font-size: 0.78rem;
      color: var(--muted);
      margin: 0.5rem 0 0;
      line-height: 1.55;
    }
    .dashboard-plan-completion-details {
      margin: 0 0 0.85rem;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: var(--bg-soft);
      overflow: hidden;
    }
    .dashboard-plan-completion-details summary {
      cursor: pointer;
      padding: 0.5rem 0.7rem;
      font-size: 0.78rem;
      font-weight: 600;
      color: var(--primary-2);
      list-style: none;
      user-select: none;
      transition: background 0.2s var(--ease);
    }
    .dashboard-plan-completion-details summary::-webkit-details-marker { display: none; }
    .dashboard-plan-completion-details summary::before { content: '▸ '; color: var(--accent); }
    .dashboard-plan-completion-details[open] summary::before { content: '▾ '; }
    .dashboard-plan-completion-details summary:hover { background: rgba(93, 138, 138, 0.06); }
    .dashboard-plan-completion-details .dashboard-plan-completion-hint {
      padding: 0 0.7rem 0.65rem;
      margin-top: 0;
    }
    .dashboard-plan-stage-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 0.75rem;
      margin-bottom: 0.85rem;
    }
    .dashboard-plan-stage-card {
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 0.85rem 0.95rem;
      background: linear-gradient(165deg, #fff 0%, #f9fbfb 100%);
      transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
    }
    .dashboard-plan-stage-card:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-soft);
    }
    .dashboard-plan-stage-card .stage-title { font-size: 0.82rem; font-weight: 700; color: var(--text); margin-bottom: 0.35rem; }
    .dashboard-plan-stage-card .rate { font-size: 1.65rem; font-weight: 800; line-height: 1.15; margin-bottom: 0.25rem; }
    .dashboard-plan-stage-card.rate-ok .rate { color: #0f766e; }
    .dashboard-plan-stage-card.rate-warn .rate { color: #b45309; }
    .dashboard-plan-stage-card.rate-danger .rate { color: #dc2626; }
    .dashboard-plan-stage-card .stage-sub { font-size: 0.72rem; color: var(--muted); margin-bottom: 0.35rem; }
    .dashboard-plan-stage-card .stage-meta { font-size: 0.72rem; color: var(--muted); line-height: 1.45; }
    .dashboard-plan-detail-head { font-size: 0.82rem; font-weight: 700; color: #5c718a; margin: 0.5rem 0 0.45rem; }
    .dashboard-plan-detail-title { font-size: 0.8rem; font-weight: 700; color: var(--text); margin: 0.65rem 0 0.35rem; }
    .dashboard-plan-all-ok { font-size: 0.78rem; color: var(--muted); margin: 0; }
    .stat-box.stat-box-rate-ok .num { color: #0f766e; }
    .stat-box.stat-box-rate-warn .num { color: #b45309; }
    .stat-box.stat-box-rate-danger .num { color: #dc2626; }
    .page-dashboard .card--dashboard {
      background: linear-gradient(165deg, #ffffff 0%, #fafcfb 100%);
      border-color: #dde5e1;
    }
    .page-dashboard .dashboard-grid {
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 0.65rem;
    }
    @media (max-width: 1280px) {
      .page-dashboard .dashboard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
    @media (max-width: 720px) {
      .page-dashboard .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }
    .stat-box {
      flex-direction: row;
      align-items: center;
      gap: 0.65rem;
    }
    .stat-box__icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 2.15rem;
      height: 2.15rem;
      border-radius: 10px;
      font-size: 0.78rem;
      font-weight: 700;
      color: var(--primary-2);
      background: rgba(93, 138, 138, 0.1);
      border: 1px solid rgba(93, 138, 138, 0.14);
      flex-shrink: 0;
    }
    .stat-box__body { min-width: 0; }
    .stat-box .num.num--pct { font-size: 1.65rem; font-weight: 800; letter-spacing: -0.02em; }
    .stat-box--hero {
      grid-column: span 2;
      padding: 1rem 1.05rem;
      background: linear-gradient(135deg, rgba(93, 138, 138, 0.08) 0%, rgba(196, 165, 116, 0.1) 100%);
      border-color: rgba(93, 138, 138, 0.22);
      box-shadow: 0 8px 24px rgba(74, 115, 115, 0.1);
    }
    .stat-box--hero .stat-box__icon {
      width: 2.5rem;
      height: 2.5rem;
      font-size: 0.85rem;
      color: #fff;
      background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
      border: none;
      box-shadow: 0 4px 12px rgba(74, 115, 115, 0.25);
    }
    @media (max-width: 1280px) {
      .stat-box--hero { grid-column: span 3; }
    }
    @media (max-width: 720px) {
      .stat-box--hero { grid-column: span 2; }
    }
    .kpi-item__main {
      display: flex;
      align-items: center;
      gap: 0.7rem;
    }
    .kpi-item__icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 2.35rem;
      height: 2.35rem;
      border-radius: 12px;
      font-size: 0.82rem;
      font-weight: 700;
      flex-shrink: 0;
      color: #fff;
      background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
      box-shadow: 0 4px 12px rgba(74, 115, 115, 0.22);
    }
    .kpi-item--done .kpi-item__icon {
      background: linear-gradient(135deg, #4a9d7a 0%, var(--success) 100%);
      box-shadow: 0 4px 12px rgba(61, 143, 110, 0.25);
    }
    .kpi-item--pending .kpi-item__icon {
      background: linear-gradient(135deg, #d4a05a 0%, var(--warning) 100%);
      box-shadow: 0 4px 12px rgba(194, 133, 58, 0.25);
    }
    .kpi-item--plan::before { background: linear-gradient(180deg, var(--accent) 0%, var(--primary) 100%); }
    .kpi-item--done::before { background: linear-gradient(180deg, #8fd4b0 0%, var(--success) 100%); }
    .kpi-item--pending::before { background: linear-gradient(180deg, #e8c07a 0%, var(--warning) 100%); }
    .kpi-item__text { min-width: 0; }
    .kpi-item__hint {
      margin-top: 0.45rem;
      padding-top: 0.4rem;
      border-top: 1px dashed rgba(93, 138, 138, 0.18);
      font-size: 0.68rem;
      color: var(--muted);
      letter-spacing: 0.02em;
    }
    .kpi-item .value { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; }
    .dashboard-plan-stage-card .dash-stage-top {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      margin-bottom: 0.65rem;
    }
    .dash-stage-info { min-width: 0; flex: 1; }
    .dash-stage-ring-wrap {
      position: relative;
      width: 4.25rem;
      height: 4.25rem;
      flex-shrink: 0;
    }
    .dash-stage-ring {
      width: 100%;
      height: 100%;
      border-radius: 50%;
      --ring-track: #e8eeec;
      --ring-color: var(--primary);
      background: conic-gradient(var(--ring-color) calc(var(--pct, 0) * 1%), var(--ring-track) 0);
      box-shadow: inset 0 0 0 1px rgba(93, 138, 138, 0.08);
    }
    .dash-stage-ring-wrap.rate-ok { --ring-color: #0f766e; }
    .dash-stage-ring-wrap.rate-warn { --ring-color: #b45309; }
    .dash-stage-ring-wrap.rate-danger { --ring-color: #dc2626; }
    .dash-stage-ring-val {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.88rem;
      font-weight: 800;
      color: var(--text);
      font-variant-numeric: tabular-nums;
    }
    .dash-stage-ring-wrap::after {
      content: '';
      position: absolute;
      inset: 7px;
      border-radius: 50%;
      background: #fff;
      pointer-events: none;
    }
    .dash-stage-ring-wrap .dash-stage-ring-val { z-index: 1; }
    .dashboard-plan-stage-card.rate-ok { border-color: rgba(15, 118, 110, 0.22); }
    .dashboard-plan-stage-card.rate-warn { border-color: rgba(180, 83, 9, 0.22); }
    .dashboard-plan-stage-card.rate-danger { border-color: rgba(220, 38, 38, 0.2); }
    .dash-mini-bar { margin-bottom: 0.55rem; }
    .dash-mini-bar__track {
      height: 6px;
      border-radius: 999px;
      background: #e8eeec;
      overflow: hidden;
      margin-bottom: 0.3rem;
    }
    .dash-mini-bar__fill {
      height: 100%;
      border-radius: inherit;
      background: linear-gradient(90deg, var(--primary) 0%, var(--primary-2) 100%);
      transition: width 0.45s var(--ease);
    }
    .dash-mini-bar--rate-ok .dash-mini-bar__fill { background: linear-gradient(90deg, #14b8a6 0%, #0f766e 100%); }
    .dash-mini-bar--rate-warn .dash-mini-bar__fill { background: linear-gradient(90deg, #f59e0b 0%, #b45309 100%); }
    .dash-mini-bar--rate-danger .dash-mini-bar__fill { background: linear-gradient(90deg, #f87171 0%, #dc2626 100%); }
    .dash-mini-bar__txt { font-size: 0.7rem; color: var(--muted); }
    .dash-stage-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 0.35rem;
    }
    .dash-tag {
      display: inline-flex;
      align-items: center;
      padding: 0.15rem 0.45rem;
      border-radius: 999px;
      font-size: 0.68rem;
      font-weight: 600;
      color: var(--primary-2);
      background: rgba(93, 138, 138, 0.1);
      border: 1px solid rgba(93, 138, 138, 0.14);
    }
    .dash-tag--warn {
      color: #9a3412;
      background: rgba(194, 133, 58, 0.12);
      border-color: rgba(194, 133, 58, 0.22);
    }
    .dash-tag--muted {
      color: var(--muted);
      background: rgba(111, 127, 122, 0.08);
      border-color: rgba(111, 127, 122, 0.14);
      font-weight: 500;
    }
    .dashboard-detail-block {
      margin-top: 0.75rem;
      padding: 0.65rem 0.75rem 0.5rem;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: linear-gradient(180deg, #fafcfb 0%, #fff 100%);
    }
    .dashboard-plan-detail-title {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      margin: 0 0 0.45rem;
    }
    .dash-detail-badge {
      display: inline-flex;
      align-items: center;
      padding: 0.12rem 0.45rem;
      border-radius: 999px;
      font-size: 0.68rem;
      font-weight: 700;
      color: #9a3412;
      background: rgba(220, 38, 38, 0.08);
      border: 1px solid rgba(220, 38, 38, 0.16);
    }
    .dashboard-table-pro {
      border: none;
      border-radius: var(--radius-sm);
      background: #fff;
    }
    .dashboard-table-pro table { border-collapse: separate; border-spacing: 0; }
    .dashboard-table-pro th {
      background: linear-gradient(180deg, #f4f8f6 0%, #eaf0ed 100%) !important;
      font-size: 0.74rem;
      font-weight: 700;
      color: #4a5c57;
      padding: 0.55rem 0.65rem;
      border-bottom: 1px solid var(--border);
    }
    .dashboard-table-pro td {
      padding: 0.5rem 0.65rem;
      font-size: 0.76rem;
      border-bottom: 1px solid #eef2f0;
      vertical-align: middle;
    }
    .dashboard-table-pro tbody tr:nth-child(even) { background: rgba(246, 248, 247, 0.65); }
    .dashboard-table-pro tbody tr:hover { background: rgba(93, 138, 138, 0.06); }
    .dashboard-table-pro tr.row-alert {
      background: #fff !important;
      box-shadow: inset 4px 0 0 var(--danger);
    }
    .dashboard-table-pro tr.row-alert td { color: var(--text); }
    .dashboard-table-pro tr.row-alert td:last-child {
      color: #9a4a4a;
      font-weight: 600;
    }
    .order-pool-hint { font-size: 0.78rem; color: var(--muted); margin: 0 0 0.85rem; line-height: 1.45; }
    .order-pool-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 1rem;
      align-items: start;
    }
    @media (max-width: 1100px) {
      .order-pool-grid { grid-template-columns: 1fr; }
    }
    .order-pool-panel {
      border: 1px solid var(--border);
      border-radius: 10px;
      overflow: hidden;
      background: var(--bg);
      min-height: 120px;
    }
    .order-pool-panel-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0.55rem 0.75rem;
      background: var(--bg-soft);
      border-bottom: 1px solid var(--border);
      font-weight: 800;
      font-size: 0.88rem;
      color: var(--text);
    }
    .order-pool-panel-head .order-pool-count {
      font-size: 0.78rem;
      font-weight: 700;
      color: var(--muted);
    }
    .order-pool-scroll {
      overflow: auto;
      max-height: min(62vh, 520px);
      -webkit-overflow-scrolling: touch;
    }
    .order-pool-scroll table { margin: 0; font-size: 0.8rem; }
    .order-pool-scroll th { white-space: nowrap; position: sticky; top: 0; z-index: 1; background: #f1f5f9; vertical-align: bottom; }
    html[data-theme="dark"] .order-pool-scroll th { background: #334155; color: #e2e8f0; }
    .order-pool-scroll .orderpool-col-filter { width: 100%; box-sizing: border-box; margin-top: 4px; font-size: 0.74rem; padding: 0.25rem 0.35rem; }
    .duebreakdown-scroll {
      overflow: auto;
      max-height: calc(100dvh - 13rem);
      border: 1px solid var(--border);
      border-radius: 8px;
      -webkit-overflow-scrolling: touch;
    }
    .duebreakdown-scroll table { margin: 0; font-size: 0.8rem; }
    .duebreakdown-scroll th {
      white-space: nowrap;
      position: sticky;
      top: 0;
      z-index: 1;
      background: linear-gradient(180deg, #f7fbff 0%, #eef4fc 100%);
      vertical-align: top;
    }
    html[data-theme="dark"] .duebreakdown-scroll th { background: #334155; color: #e2e8f0; }
    tr.duebreakdown-row { cursor: pointer; }
    tr.duebreakdown-row:hover { background: rgba(59, 130, 246, 0.06); }
    html[data-theme="dark"] tr.duebreakdown-row:hover { background: rgba(59, 130, 246, 0.12); }
    tr.row-duebreakdown-warn { background: #fffbeb !important; }
    tr.row-duebreakdown-warn td { color: #92400e; }
    html[data-theme="dark"] tr.row-duebreakdown-warn { background: rgba(217, 119, 6, 0.15) !important; }
    html[data-theme="dark"] tr.row-duebreakdown-warn td { color: #fcd34d; }
    tr.orderpool-row { cursor: pointer; }
    tr.orderpool-row:hover { background: rgba(59, 130, 246, 0.06); }
    html[data-theme="dark"] tr.orderpool-row:hover { background: rgba(59, 130, 246, 0.12); }
    table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.84rem;
    }
    .table-scroll {
      overflow-x: auto;
      overflow-y: hidden;
      scrollbar-gutter: stable both-edges;
      -webkit-overflow-scrolling: touch;
      padding-bottom: 8px;
      overscroll-behavior-x: contain;
    }
    .table-scroll.force-scroll-x {
      overflow-x: scroll;
      scrollbar-width: auto;
    }
    /* 生产计划：隐藏系统横向滚动条，改用下方自定义条（不受 Win/Chrome 覆盖式影响） */
    #production-table-wrap.production-hscroll-native-hidden {
      scrollbar-gutter: stable;
      /* 保留右侧纵向滚动条，横向由自定义条接管 */
      overflow-y: auto;
      max-height: calc(100dvh - 11.5rem);
      scrollbar-width: thin;
      padding-bottom: 0;
    }
    #production-table-wrap.production-hscroll-native-hidden::-webkit-scrollbar {
      width: 10px;
      height: 0;
    }
    #production-table-wrap.production-hscroll-native-hidden::-webkit-scrollbar-thumb {
      background: #b5c4d6;
      border-radius: 8px;
    }
    #production-table-wrap.production-hscroll-native-hidden::-webkit-scrollbar-track {
      background: #edf2f8;
    }
    .production-scroll-shell {
      width: 100%;
    }
    .production-hscroll-top {
      margin-bottom: 6px;
    }
    .production-hscroll {
      height: 14px;
      user-select: none;
      -webkit-user-select: none;
    }
    .production-hscroll-track {
      position: relative;
      height: 14px;
      border-radius: 7px;
      background: #d5e2f0;
      box-shadow: inset 0 0 0 1px rgba(120, 140, 170, 0.22);
      cursor: pointer;
    }
    .production-hscroll-thumb {
      position: absolute;
      top: 0;
      left: 0;
      height: 100%;
      min-width: 48px;
      border-radius: 7px;
      background: #9eb2cc;
      border: 2px solid #d5e2f0;
      box-sizing: border-box;
      cursor: grab;
      opacity: 0.5;
      transition: opacity 0.18s ease, background 0.18s ease;
    }
    .production-scroll-shell:hover .production-hscroll-thumb {
      opacity: 0.92;
      background: #7a92b0;
    }
    .production-hscroll-thumb:hover {
      opacity: 1;
      background: #6a849e;
    }
    .production-hscroll-thumb:active {
      cursor: grabbing;
    }
    .production-table { min-width: 2280px; }
    .prod-stack { line-height: 1.35; }
    .prod-stack-sub { font-size: 0.76rem; color: var(--muted); margin-top: 3px; }
    th, td {
      border: 1px solid var(--border);
      padding: 0.45rem 0.55rem;
      text-align: left;
      white-space: nowrap;
    }
    th {
      background: linear-gradient(180deg, #fafcfb 0%, #f1f5f3 100%);
      color: var(--muted);
      font-weight: 600;
      font-size: 0.8rem;
      vertical-align: top;
    }
    tbody tr { transition: background 0.15s var(--ease); }
    tbody tr:hover { background: rgba(93, 138, 138, 0.05); }
    .btn:focus-visible,
    .nav-btn:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible {
      outline: 2px solid rgba(93, 138, 138, 0.45);
      outline-offset: 2px;
    }
    #production-table-wrap th {
      position: sticky;
      top: 0;
      z-index: 2;
    }
    .prod-th-line1 { display: flex; align-items: center; justify-content: space-between; gap: 0.25rem; }
    .prod-th-line1 > span:first-child { flex: 1; min-width: 0; }
    .prod-th-actions {
      display: inline-flex;
      align-items: center;
      gap: 0.2rem;
      flex-shrink: 0;
    }
    .prod-filter-btn {
      flex-shrink: 0; font-size: 0.62rem; padding: 0.08rem 0.32rem; border-radius: 4px;
      border: 1px solid var(--border); background: #fff; cursor: pointer; color: #64748b;
      font-family: inherit; line-height: 1.2;
    }
    .prod-filter-btn:hover { background: #eef4fc; color: var(--text); border-color: #94a3b8; }
    .prod-filter-btn.active,
    .factorydb-sort-th-btn.active {
      background: rgba(93, 138, 138, 0.12);
      color: var(--primary-2);
      border-color: rgba(93, 138, 138, 0.35);
      font-weight: 700;
    }
    .prod-col-filter {
      display: block; width: 100%; max-width: 100%; margin-top: 0.35rem; font-size: 0.72rem;
      padding: 0.22rem 0.35rem; box-sizing: border-box; background: var(--bg);
      border: 1px solid var(--border); border-radius: 4px; color: var(--text);
    }
    .prod-col-filter::placeholder {
      color: #94a3b8;
      opacity: 0.75;
      font-size: 0.68rem;
    }
    html[data-theme="dark"] .prod-col-filter::placeholder {
      color: #64748b;
      opacity: 0.9;
    }
    .production-table tfoot td {
      background: linear-gradient(180deg, #f0f7ff 0%, #e8f2fc 100%);
      font-weight: 700; color: #0f172a; border-top: 2px solid #3b82f6;
    }
    .prod-foot-label { text-align: right !important; color: #475569; }
    #page-outsource table tfoot td {
      background: linear-gradient(180deg, #f0f7ff 0%, #e8f2fc 100%);
      font-weight: 700;
      color: #0f172a;
      border-top: 2px solid #3b82f6;
    }
    #page-outsource .outsource-foot-label { text-align: right !important; color: #475569; font-weight: 700; }
    #page-receive table tfoot td {
      background: linear-gradient(180deg, #f0f7ff 0%, #e8f2fc 100%);
      font-weight: 700;
      color: #0f172a;
      border-top: 2px solid #3b82f6;
    }
    #page-receive .receive-foot-label { text-align: right !important; color: #475569; font-weight: 700; }
    #page-receive td.receive-progress-cell {
      min-width: 5.5rem;
      padding: 0.35rem 0.4rem !important;
      vertical-align: middle;
    }
    #page-receive .receive-milestone-wrap { min-width: 4.8rem; }
    #page-receive .receive-progress-empty { color: var(--muted); font-size: 0.76rem; }
    #page-receive .receive-milestone-done { color: #16a34a; }
    #btn-receive-sort-progress.active { border-color: #16a34a; color: #15803d; font-weight: 700; }
    #page-products .product-analytics-card { margin-bottom: 1rem; }
    #page-products .product-analytics-head {
      display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem;
    }
    #page-products .product-analytics-toolbar {
      display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
    }
    #page-products .product-analytics-ctl {
      font-size: 0.78rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.35rem;
    }
    #page-products .product-analytics-ctl select {
      background: var(--bg); border: 1px solid var(--border); color: var(--text);
      padding: 0.25rem 0.4rem; border-radius: 4px; font-size: 0.78rem;
    }
    #page-products .product-analytics-ctl--multi select {
      min-width: 7.5rem; max-width: 11rem; min-height: 4.8rem; vertical-align: middle;
    }
    #page-products .product-analytics-vs { color: var(--muted); font-size: 0.76rem; }
    #page-products .product-analytics-note { font-size: 0.78rem; color: var(--muted); line-height: 1.45; margin-bottom: 0.5rem; }
    #page-products .product-analytics-metric-defs {
      display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 0.75rem;
      margin-bottom: 0.75rem; font-size: 0.76rem; line-height: 1.45;
    }
    @media (max-width: 720px) {
      #page-products .product-analytics-metric-defs { grid-template-columns: 1fr; }
    }
    #page-products .product-analytics-metric-def {
      border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.65rem;
      background: var(--card);
    }
    #page-products .product-analytics-metric-def__tag {
      display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 0.12rem 0.45rem;
      border-radius: 4px; margin-bottom: 0.25rem;
    }
    #page-products .product-analytics-metric-def__tag--count {
      color: #1d4ed8; background: #dbeafe;
    }
    #page-products .product-analytics-metric-def__tag--qty {
      color: #b45309; background: #fef3c7;
    }
    [data-theme="dark"] #page-products .product-analytics-metric-def__tag--count {
      color: #93c5fd; background: #1e3a5f;
    }
    [data-theme="dark"] #page-products .product-analytics-metric-def__tag--qty {
      color: #fcd34d; background: #422006;
    }
    #page-products .product-analytics-metric-def__body {
      margin: 0; color: var(--muted);
    }
    #page-products .product-analytics-metric-def__body strong { color: var(--text); font-weight: 600; }
    #page-products .product-analytics-metric-def__body code {
      font-size: 0.7rem; background: var(--bg); padding: 0 0.2rem; border-radius: 3px;
    }
    #page-products .product-analytics-table .th-metric-hint {
      display: inline-flex; align-items: center; justify-content: center;
      width: 0.95rem; height: 0.95rem; margin-left: 0.15rem; border-radius: 50%;
      font-size: 0.62rem; font-weight: 700; color: var(--muted);
      border: 1px solid var(--border); cursor: help; vertical-align: middle;
    }
    #page-products .product-analytics-summary {
      display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-bottom: 0.75rem;
      font-size: 0.8rem;
    }
    #page-products .product-analytics-kpi { display: flex; gap: 0.35rem; align-items: baseline; }
    #page-products .product-analytics-kpi .k { color: var(--muted); }
    #page-products .product-analytics-kpi .v { font-weight: 600; color: var(--text); }
    #page-products .product-analytics-kpi em { font-style: normal; color: var(--muted); font-weight: 400; font-size: 0.74rem; }
    #page-products .product-analytics-charts-row {
      display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; margin-bottom: 0.75rem;
    }
    #page-products .product-analytics-canvas-box {
      flex: 1 1 280px; max-width: 420px; min-height: 260px; position: relative;
      border: 1px solid var(--border); border-radius: 8px; padding: 0.45rem 0.5rem 0.35rem;
      background: var(--card);
    }
    #page-products .product-analytics-canvas-box--wide {
      flex: 1 1 420px; max-width: none; min-width: 300px;
    }
    #page-products .product-analytics-chart-title {
      margin: 0 0 0.35rem; font-size: 0.78rem; color: var(--muted); font-weight: 600;
    }
    #chart-product-trend { width: 100%; height: 280px; }
    #chart-product-code-freq { width: 100%; height: 260px; }
    #page-products .product-predict-card { margin-top: 1rem; }
    #chart-product-predict-h2 { width: 100%; height: 280px; }
    #chart-product-predict-month { width: 100%; height: 260px; }
    #page-products .product-predict-insights {
      margin: 0.25rem 0 0; padding-left: 1.15rem; font-size: 0.82rem; line-height: 1.55; color: var(--text);
    }
    #page-products .product-predict-insights li { margin: 0.22rem 0; }
    #page-products .predict-tag {
      display: inline-block; font-size: 0.72rem; padding: 0.05rem 0.35rem; border-radius: 4px;
      background: rgba(14, 165, 233, 0.12); color: #0369a1; margin-left: 0.25rem;
    }
    #modal-product-library-help .modal-product-library-help {
      max-width: 920px; width: min(96vw, 920px); max-height: 90vh;
      display: flex; flex-direction: column; overflow: hidden;
    }
    #modal-product-library-help .product-help-header { margin-bottom: 0.65rem; flex-shrink: 0; }
    #modal-product-library-help .product-help-header h3 { margin-bottom: 0.2rem; }
    #modal-product-library-help .product-help-sub {
      margin: 0; font-size: 0.78rem; color: var(--muted); line-height: 1.45;
    }
    #modal-product-library-help .product-help-layout {
      display: flex; gap: 0.75rem; flex: 1 1 auto; min-height: 0; overflow: hidden;
    }
    #modal-product-library-help .product-help-nav {
      flex: 0 0 7.5rem; display: flex; flex-direction: column; gap: 0.25rem;
      border-right: 1px solid var(--border); padding-right: 0.65rem; overflow-y: auto;
    }
    #modal-product-library-help .product-help-nav-btn {
      text-align: left; border: 1px solid transparent; background: transparent;
      color: var(--text); padding: 0.35rem 0.5rem; border-radius: 6px;
      font-size: 0.8rem; cursor: pointer;
    }
    #modal-product-library-help .product-help-nav-btn:hover {
      background: rgba(59, 130, 246, 0.08); border-color: var(--border);
    }
    #modal-product-library-help .product-help-nav-btn.active {
      background: rgba(59, 130, 246, 0.14); border-color: rgba(59, 130, 246, 0.35);
      color: var(--primary); font-weight: 600;
    }
    #modal-product-library-help .product-help-panels {
      flex: 1 1 auto; overflow-y: auto; min-height: 0; padding-right: 0.25rem;
    }
    #modal-product-library-help .product-help-panel { display: none; }
    #modal-product-library-help .product-help-panel.active { display: block; }
    #modal-product-library-help .product-help-panel h4 {
      margin: 0.85rem 0 0.4rem; font-size: 0.88rem; color: var(--primary);
    }
    #modal-product-library-help .product-help-panel h4:first-child { margin-top: 0; }
    #modal-product-library-help .product-help-p,
    #modal-product-library-help .product-help-note {
      margin: 0.35rem 0; font-size: 0.8rem; line-height: 1.55; color: var(--text);
    }
    #modal-product-library-help .product-help-note {
      padding: 0.45rem 0.55rem; border-radius: 6px;
      background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.25);
    }
    #modal-product-library-help .product-help-insight {
      font-size: 0.8rem; line-height: 1.6; color: var(--text);
      padding: 0.65rem 0.75rem; margin: 0.5rem 0 0.75rem;
      background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
      max-height: 42vh; overflow-y: auto;
    }
    #modal-product-library-help .product-help-insight p { margin: 0.45rem 0; }
    #modal-product-library-help .product-help-insight-summary {
      margin-top: 0.65rem; padding-top: 0.5rem; border-top: 1px dashed var(--border);
      color: #1d4ed8;
    }
    [data-theme="dark"] #modal-product-library-help .product-help-insight-summary { color: #93c5fd; }
    #modal-product-library-help .product-help-table .num { text-align: right; }
    #modal-product-library-help .product-help-ul,
    #modal-product-library-help .product-help-ol {
      margin: 0.35rem 0 0.5rem; padding-left: 1.2rem; font-size: 0.8rem; line-height: 1.55;
    }
    #modal-product-library-help .product-help-pre {
      margin: 0.35rem 0; padding: 0.5rem 0.6rem; font-size: 0.72rem; line-height: 1.45;
      background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
      overflow-x: auto; white-space: pre; color: var(--muted);
    }
    #modal-product-library-help .product-help-table {
      width: 100%; border-collapse: collapse; font-size: 0.78rem; margin: 0.35rem 0 0.65rem;
    }
    #modal-product-library-help .product-help-table th,
    #modal-product-library-help .product-help-table td {
      border: 1px solid var(--border); padding: 0.3rem 0.45rem; text-align: left; vertical-align: top;
    }
    #modal-product-library-help .product-help-table th {
      background: #f1f5f9; color: #64748b; font-weight: 600; white-space: nowrap;
    }
    #modal-product-library-help .product-help-loading {
      color: var(--muted); font-size: 0.82rem; padding: 1rem 0;
    }
    #modal-product-library-help .product-help-export-actions {
      flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end;
    }
    #modal-product-library-help code {
      font-size: 0.76rem; background: rgba(15, 23, 42, 0.06); padding: 0.05rem 0.25rem; border-radius: 3px;
    }
    @media (max-width: 720px) {
      #modal-product-library-help .product-help-layout { flex-direction: column; }
      #modal-product-library-help .product-help-nav {
        flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; border-right: none;
        border-bottom: 1px solid var(--border); padding: 0 0 0.5rem;
      }
    }
    #page-products .product-analytics-loading {
      padding: 1rem 0.5rem; color: var(--muted); font-size: 0.82rem;
    }
    #page-products .product-analytics-subtitle {
      margin: 0 0 0.4rem; font-size: 0.8rem; color: var(--muted); font-weight: 600;
    }
    #page-products .product-analytics-table-wrap { overflow-x: auto; max-height: 320px; margin-bottom: 0.75rem; }
    #page-products .product-analytics-table-wrap--period { max-height: 280px; }
    #page-products .cmp-up { color: #059669; font-weight: 600; }
    #page-products .cmp-down { color: #dc2626; font-weight: 600; }
    #page-products .cmp-flat { color: var(--muted); }
    #page-products .product-analytics-total-row { font-weight: 700; background: rgba(59, 130, 246, 0.06); }
    #page-products .product-analytics-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
    #page-products .product-analytics-table th,
    #page-products .product-analytics-table td { border: 1px solid var(--border); padding: 0.35rem 0.5rem; text-align: center; }
    #page-products .product-analytics-table th { background: #f1f5f9; color: #64748b; }
    #page-products .product-analytics-table td.num { text-align: center; font-variant-numeric: tabular-nums; }
    #page-forecast .market-insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-bottom: 0.8rem; }
    #page-forecast .market-chart-box { border: 1px solid var(--border); border-radius: 10px; padding: 0.45rem; background: var(--card); }
    #page-forecast .market-chart-box h4 { margin: 0 0 0.4rem; font-size: 0.82rem; color: var(--muted); }
    #page-forecast .market-chart { width: 100%; height: 260px; }
    #page-forecast .market-hero-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; margin: 0.5rem 0 0.75rem; }
    #page-forecast .market-hero-card { border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 0.6rem; background: var(--bg); box-shadow: var(--shadow-soft); }
    #page-forecast .market-hero-rank { font-size: 0.74rem; color: var(--muted); margin-bottom: 0.22rem; }
    #page-forecast .market-hero-name { font-size: 0.86rem; font-weight: 700; color: var(--text); margin-bottom: 0.25rem; }
    #page-forecast .market-hero-confidence { font-size: 0.8rem; color: #0f766e; margin-bottom: 0.2rem; font-variant-numeric: tabular-nums; }
    #page-forecast .market-hero-reason { font-size: 0.76rem; color: var(--muted); line-height: 1.5; }
    #page-forecast .market-snapshot-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin-bottom: 0.65rem; }
    #page-forecast .market-snapshot-table th,
    #page-forecast .market-snapshot-table td { border: 1px solid var(--border); padding: 0.3rem 0.42rem; text-align: center; }
    #page-forecast .market-snapshot-table th { background: #f1f5f9; color: #64748b; font-weight: 700; }
    #page-forecast .market-trend-list { margin: 0; padding-left: 1.15rem; color: var(--text); font-size: 0.82rem; line-height: 1.55; }
    #page-forecast .market-trend-list li { margin: 0.22rem 0; }
    #page-forecast .market-hero-title { margin: 0.7rem 0 0.3rem; font-size: 0.82rem; color: var(--muted); font-weight: 700; }
    #page-forecast .market-hero-list { margin: 0; padding-left: 1.15rem; color: var(--text); font-size: 0.82rem; line-height: 1.55; }
    #page-forecast .market-hero-list li { margin: 0.22rem 0; }
    #page-forecast .market-source-meta { font-size: 0.76rem; color: var(--muted); line-height: 1.55; margin-bottom: 0.55rem; }
    #page-forecast .market-source-meta a { color: var(--primary-2); text-decoration: none; }
    #page-forecast .market-source-meta a:hover { text-decoration: underline; }
    @media (max-width: 980px) {
      #page-forecast .market-insight-grid { grid-template-columns: 1fr; }
      #page-forecast .market-hero-cards { grid-template-columns: 1fr; }
    }
    tbody tr:nth-child(even) { background: #fbfdff; }
    tr:hover { background: rgba(93, 138, 138, 0.06); }
    .row-alert {
      background: #fff !important;
      box-shadow: inset 4px 0 0 var(--danger);
    }
    .row-alert td { color: var(--text); }
    .row-alert td:last-child { color: #9a4a4a; font-weight: 600; }
    .production-table tbody tr[data-id] { cursor: pointer; }
    .production-table tbody tr.row-production-fabric-cut-adjust {
      background: #ffe4e4 !important;
      box-shadow: inset 3px 0 0 #dc2626;
    }
    .production-table tbody tr.row-production-fabric-cut-adjust td {
      color: #991b1b;
    }
    .production-table tbody tr.row-production-outsource-due {
      background: #fef9c3 !important;
      box-shadow: inset 3px 0 0 #eab308;
    }
    .production-table tbody tr.row-production-outsource-due td {
      color: #713f12;
    }
    .production-table tbody tr.row-production-selected {
      background: #dcfce7 !important;
      box-shadow: inset 3px 0 0 #16a34a;
    }
    .production-table tbody tr.row-production-selected td {
      color: #14532d;
    }
    .production-table tbody tr.row-production-selected.row-production-fabric-cut-adjust {
      background: #bbf7d0 !important;
      box-shadow: inset 3px 0 0 #16a34a;
    }
    .production-table tbody tr.row-production-selected.row-production-fabric-cut-adjust td {
      color: #14532d;
    }
    .production-table tbody tr.row-production-selected.row-production-outsource-due {
      background: #dcfce7 !important;
      box-shadow: inset 3px 0 0 #16a34a;
    }
    .production-table tbody tr.row-production-selected.row-production-outsource-due td {
      color: #14532d;
    }
    html[data-theme="dark"] .production-table tbody tr.row-production-selected {
      background: rgba(22, 163, 74, 0.22) !important;
      box-shadow: inset 3px 0 0 #4ade80;
    }
    html[data-theme="dark"] .production-table tbody tr.row-production-selected td {
      color: #bbf7d0;
    }
    #prod-foot-selected-sum { color: #15803d; font-weight: 800; }
    html[data-theme="dark"] #prod-foot-selected-sum { color: #4ade80; }
    .table-num-cell,
    .production-table td.prod-qty-cell {
      cursor: ns-resize;
      user-select: none;
      font-variant-numeric: tabular-nums;
      font-weight: 700;
    }
    .table-num-cell-dragging,
    .production-table td.table-num-cell-dragging {
      background: rgba(22, 163, 74, 0.2) !important;
      box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.45);
    }
    html[data-theme="dark"] .table-num-cell-dragging,
    html[data-theme="dark"] .production-table td.table-num-cell-dragging {
      background: rgba(74, 222, 128, 0.18) !important;
      box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.4);
    }
    #page-outsource tr.row-table-num-selected td,
    #page-receive tr.row-table-num-selected td {
      background: rgba(34, 197, 94, 0.1);
    }
    html[data-theme="dark"] #page-outsource tr.row-table-num-selected td,
    html[data-theme="dark"] #page-receive tr.row-table-num-selected td {
      background: rgba(74, 222, 128, 0.1);
    }
    #outsource-foot-selected-sum,
    #receive-foot-selected-sum { color: #15803d; font-weight: 800; }
    html[data-theme="dark"] #outsource-foot-selected-sum,
    html[data-theme="dark"] #receive-foot-selected-sum { color: #4ade80; }
    .production-table td.prod-milestone-cell {
      min-width: 5.5rem;
      padding: 0.35rem 0.4rem !important;
      vertical-align: middle;
    }
    .prod-milestone-wrap {
      display: flex;
      align-items: center;
      gap: 0.35rem;
      min-width: 4.8rem;
    }
    .prod-milestone-progress {
      display: flex;
      flex: 1;
      min-width: 2.8rem;
      height: 10px;
      border-radius: 3px;
      overflow: hidden;
      background: #e2e8f0;
      gap: 2px;
      padding: 1px;
      box-sizing: border-box;
    }
    .prod-milestone-seg {
      flex: 1;
      border-radius: 2px;
      background: #cbd5e1;
      transition: background 0.15s ease;
    }
    .prod-milestone-seg.ontime {
      background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
    }
    .prod-milestone-seg.late {
      background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
    }
    .prod-milestone-pct {
      font-size: 0.72rem;
      font-weight: 700;
      color: #64748b;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
      min-width: 2rem;
      text-align: right;
    }
    .production-table tbody tr.row-production-selected .prod-milestone-pct {
      color: #15803d;
    }
    html[data-theme="dark"] .prod-milestone-progress {
      background: #334155;
    }
    html[data-theme="dark"] .prod-milestone-seg {
      background: #475569;
    }
    html[data-theme="dark"] .prod-milestone-seg.ontime {
      background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
    }
    html[data-theme="dark"] .prod-milestone-seg.late {
      background: linear-gradient(180deg, #fca5a5 0%, #ef4444 100%);
    }
    html[data-theme="dark"] .prod-milestone-pct {
      color: #94a3b8;
    }
    html[data-theme="dark"] .production-table tbody tr.row-production-selected .prod-milestone-pct {
      color: #4ade80;
    }
    .cell-on-time-green { background: #ecfdf5; color: #166534; font-weight: 700; }
    .cell-over-time-red { background: #fef2f2; color: #b91c1c; font-weight: 700; }
    .btn {
      padding: 0.4rem 0.76rem;
      border-radius: 10px;
      border: none;
      cursor: pointer;
      font-size: 0.8rem;
      transition: all 0.2s ease;
    }
    .btn-primary {
      background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
      color: #fff;
      box-shadow: 0 6px 14px rgba(74, 115, 115, 0.28);
    }
    .btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 8px 18px rgba(74, 115, 115, 0.32); }
    .btn-primary:active { transform: translateY(0); }
    .btn-secondary {
      background: #fff;
      color: var(--text);
      border: 1px solid var(--border);
      box-shadow: var(--shadow-soft);
    }
    .btn-secondary:hover {
      background: var(--bg-soft);
      border-color: #cdd8d3;
      transform: translateY(-1px);
    }
    .btn-danger { background: var(--danger); color: #fff; }
    .btn-danger:hover { filter: brightness(1.1); }
    .btn-sm { padding: 0.24rem 0.5rem; font-size: 0.76rem; }
    .form-row { margin-bottom: 0.75rem; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
    .form-row label { min-width: 80px; color: var(--muted); }
    .form-row input, .form-row select {
      background: #fff;
      border: 1px solid var(--border);
      color: var(--text);
      padding: 0.4rem 0.6rem;
      border-radius: 8px;
      min-width: 140px;
      transition: all 0.2s ease;
    }
    .form-row input:focus, .form-row select:focus {
      outline: none;
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(79, 157, 255, 0.2);
    }
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(15, 26, 41, 0.36);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 100;
    }
    .modal-overlay.show { display: flex; }
    .modal {
      background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 1.35rem;
      max-width: 520px;
      width: 90%;
      max-height: 90vh;
      overflow-y: auto;
      box-shadow: 0 20px 46px rgba(17, 33, 54, 0.26);
    }
    .kpi-strip {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 0.75rem;
      margin-bottom: 0.85rem;
    }
    @media (max-width: 720px) {
      .kpi-strip { grid-template-columns: 1fr; }
    }
    .kpi-item {
      background: linear-gradient(165deg, #ffffff 0%, #f8faf9 100%);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 0.75rem 0.9rem;
      box-shadow: var(--shadow-soft);
      position: relative;
      overflow: hidden;
      transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
    }
    .kpi-item::before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: 4px;
      background: linear-gradient(180deg, var(--accent) 0%, var(--primary) 100%);
    }
    .kpi-item.warning::before { background: linear-gradient(180deg, #e8c07a 0%, var(--warning) 100%); }
    .kpi-item.danger::before { background: linear-gradient(180deg, #e8a0a0 0%, var(--danger) 100%); }
    .kpi-item.success::before { background: linear-gradient(180deg, #8fd4b0 0%, var(--success) 100%); }
    .kpi-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
    .kpi-item .label { font-size: 0.74rem; color: var(--muted); letter-spacing: 0.02em; }
    .kpi-item .value { font-size: 1.45rem; font-weight: 700; color: var(--text); margin-top: 0.25rem; font-variant-numeric: tabular-nums; }
    .modal h3 { margin-bottom: 1rem; color: var(--primary); }
    .modal-actions { margin-top: 1.25rem; display: flex; gap: 0.5rem; justify-content: flex-end; }
    .badge {
      display: inline-block;
      padding: 0.2rem 0.5rem;
      border-radius: 4px;
      font-size: 0.75rem;
    }
    .badge-draft { background: var(--muted); color: var(--bg); }
    .badge-sent { background: var(--warning); color: #000; }
    .badge-done { background: var(--success); color: #fff; }
    .badge-fail { background: var(--danger); color: #fff; }
    .date-range-wrap { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
    .date-range-wrap input[type="date"] { min-width: 120px; }
    .date-range-wrap .range-sep { color: var(--muted); font-size: 0.85rem; }
    .time-adjusted-hint { color: var(--warning); font-size: 0.8rem; margin-top: 0.25rem; display: none; }
    .time-adjusted-hint.show { display: inline-block; }
    #toast-time-updated,
    #toast-share-note {
      position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
      background: var(--card); border: 1px solid var(--primary);
      color: var(--primary); padding: 0.5rem 1rem; border-radius: 8px;
      font-size: 0.9rem; z-index: 200; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
      opacity: 0; transition: opacity 0.2s;
      max-width: min(420px, 92vw);
      text-align: center;
      white-space: pre-line;
      line-height: 1.45;
    }
    #toast-share-note.toast-share-persistent {
      cursor: pointer;
    }
    #toast-time-updated.show,
    #toast-share-note.show { opacity: 1; }
    #login-gate {
      z-index: 500;
      background:
        radial-gradient(circle at 20% 20%, rgba(59,130,246,0.18), transparent 42%),
        radial-gradient(circle at 80% 85%, rgba(14,165,233,0.15), transparent 46%),
        rgba(15,23,42,0.52);
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
    }
    #login-gate .modal {
      max-width: 460px;
      border-radius: 20px;
      padding: 1.35rem 1.35rem 1.2rem;
      border: 1px solid rgba(148,163,184,0.28);
      background: rgba(255,255,255,0.92);
      box-shadow: 0 14px 40px rgba(15,23,42,0.18);
    }
    #login-gate .modal h3 {
      margin: 0 0 0.45rem;
      font-size: 1.28rem;
      font-weight: 700;
      letter-spacing: 0.01em;
      color: #0f172a;
    }
    #login-gate .modal > p {
      margin: 0 0 1rem !important;
      color: #64748b !important;
      font-size: 0.88rem !important;
      line-height: 1.55;
    }
    #login-gate .form-row input {
      height: 42px;
      border-radius: 10px;
      transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    }
    #login-gate .form-row input:focus {
      border-color: rgba(59,130,246,0.62);
      box-shadow: 0 0 0 3px rgba(59,130,246,0.16);
      background-color: #fff;
      outline: none;
    }
    #login-err {
      display: none;
      margin-top: 0.35rem !important;
      margin-bottom: 0.15rem;
      padding: 0.45rem 0.6rem;
      border-radius: 8px;
      background: rgba(239,68,68,0.1);
      color: #dc2626 !important;
    }
    #login-err.has-text { display: block; }
    #login-gate .modal-actions {
      display: grid !important;
      grid-template-columns: 1fr 1fr;
      gap: 0.65rem;
      justify-content: initial !important;
    }
    #login-gate .modal-actions .btn {
      width: 100%;
      min-height: 40px;
    }
    #modal-batch-production .modal,
    #modal-batch-add-production .modal { max-width: 680px; overflow: hidden; display: flex; flex-direction: column; }
    #modal-batch-add-production .modal { max-width: 720px; }
    #modal-batch-production .batch-prod-scroll { overflow-y: auto; flex: 1; max-height: calc(90vh - 220px); padding-right: 6px; }
    .batch-prod-hint { font-size: 0.8rem; color: var(--muted); margin: 0 0 0.65rem; line-height: 1.45; }
    #batch-prod-match-info { font-size: 0.82rem; color: var(--text); margin-bottom: 0.75rem; padding: 0.5rem 0.65rem; background: #f1f5f9; border-radius: 8px; border: 1px solid var(--border); }
    #batch-prod-match-info .batch-prod-match-summary { margin: 0 0 0.5rem; }
    #batch-prod-match-info .batch-prod-match-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
    #batch-prod-match-info .batch-prod-match-table th,
    #batch-prod-match-info .batch-prod-match-table td { border: 1px solid var(--border); padding: 0.35rem 0.45rem; text-align: left; }
    #batch-prod-match-info .batch-prod-match-table th { background: #e2e8f0; color: #475569; font-weight: 700; }
    #batch-prod-match-info .batch-prod-match-table td.batch-prod-cb-cell { text-align: center; width: 3.2rem; vertical-align: middle; }
    #batch-prod-match-info .batch-prod-match-actions { margin: 0.5rem 0 0; display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center; }
    #batch-prod-match-info .batch-prod-match-table-wrap,
    #batch-add-production-list .batch-prod-match-table-wrap { max-height: min(50vh, 280px); overflow: auto; margin-bottom: 0.25rem; }
    #batch-add-production-list.batch-prod-match-info { display: block; }
    #batch-add-production-list .batch-add-row-exists { background: #fff7ed; }
    #batch-add-production-list .batch-add-tag-exists { font-size: 0.72rem; color: #c2410c; margin-left: 0.35rem; }
    #login-gate .modal { position: relative; overflow: visible; }
    .login-lion {
      position: absolute;
      top: -30px;
      left: 50%;
      transform: translateX(-50%);
      width: 64px;
      height: 64px;
      border-radius: 999px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: radial-gradient(circle at 35% 30%, #ffe7a7 0%, #ffd27a 58%, #f59e0b 100%);
      border: 2px solid #f59e0b;
      box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35);
      font-size: 2.1rem;
      line-height: 1;
      animation: lion-float 2.4s ease-in-out infinite;
      pointer-events: none;
      z-index: 2;
    }
    .login-lion::after {
      content: '';
      position: absolute;
      right: 8px;
      bottom: 8px;
      width: 9px;
      height: 9px;
      border-radius: 999px;
      background: #92400e;
      transform-origin: -14px center;
      animation: lion-tail 1.15s ease-in-out infinite alternate;
      opacity: 0.75;
    }
    @keyframes lion-float {
      0%, 100% { transform: translateX(-50%) translateY(0); }
      50% { transform: translateX(-50%) translateY(-8px); }
    }
    @keyframes lion-tail {
      0% { transform: rotate(-8deg); }
      100% { transform: rotate(16deg); }
    }
    .btn-theme-fab {
      position: absolute;
      top: 0.75rem;
      right: 0.75rem;
      width: 2.35rem;
      height: 2.35rem;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: var(--card);
      cursor: pointer;
      font-size: 1.1rem;
      line-height: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: var(--shadow-soft);
      transition: transform 0.15s ease, background 0.15s ease;
      font-family: inherit;
      padding: 0;
    }
    .btn-theme-fab:hover { transform: scale(1.06); background: var(--bg-soft); }
    .btn-theme-fab .theme-icon { pointer-events: none; }
    .login-brand { text-align: center; margin-bottom: 1rem; padding-top: 0.15rem; padding-right: 2.5rem; }
    .login-brand-text {
      margin: 0 0 0.62rem;
      font-size: 1.75rem;
      font-weight: 700;
      letter-spacing: 0.02em;
      color: #1f2937;
      line-height: 1.1;
    }
    .login-welcome {
      margin: 0 0 0.28rem;
      font-size: 1.06rem;
      font-weight: 700;
      color: #0f172a;
      letter-spacing: 0.02em;
    }
    .login-welcome-en {
      margin: 0;
      font-size: 0.8rem;
      color: #64748b;
      letter-spacing: 0.04em;
    }
    html[data-theme="dark"] {
      --bg: #0f172a;
      --bg-soft: #1e293b;
      --card: #1e293b;
      --card-2: #172033;
      --border: #334155;
      --text: #e2e8f0;
      --muted: #94a3b8;
      --shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
      --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.28);
    }
    html[data-theme="dark"] {
      --primary: #6ba3a3;
      --primary-2: #8ec4c4;
      --accent: #d4b896;
    }
    html[data-theme="dark"] body {
      background:
        radial-gradient(900px 280px at 8% -8%, rgba(107, 163, 163, 0.12), transparent 72%),
        radial-gradient(760px 240px at 92% -6%, rgba(212, 184, 150, 0.08), transparent 70%),
        var(--bg);
    }
    html[data-theme="dark"] .header {
      background: rgba(15, 23, 42, 0.94);
      border-bottom-color: var(--border);
      box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
    }
    html[data-theme="dark"] .header h1 { color: #a8d4d4; }
    html[data-theme="dark"] .nav-btn--featured {
      border-color: rgba(212, 184, 150, 0.35);
      background: rgba(212, 184, 150, 0.1);
      color: #d4b896;
    }
    html[data-theme="dark"] .nav-btn--featured.active {
      background: linear-gradient(135deg, #d4b896 0%, #6ba3a3 100%);
      color: #0f172a;
    }
    html[data-theme="dark"] .page-dashboard .card--dashboard {
      background: linear-gradient(165deg, #1e293b 0%, #172033 100%);
    }
    html[data-theme="dark"] .dash-stage-ring-wrap::after { background: #1e293b; }
    html[data-theme="dark"] .dash-stage-ring { --ring-track: #334155; }
    html[data-theme="dark"] .dashboard-detail-block { background: linear-gradient(180deg, #1e293b 0%, #172033 100%); }
    html[data-theme="dark"] .dashboard-table-pro th {
      background: linear-gradient(180deg, #334155 0%, #1e293b 100%) !important;
      color: #cbd5e1;
    }
    html[data-theme="dark"] .dashboard-table-pro td { border-bottom-color: #334155; }
    html[data-theme="dark"] .dashboard-table-pro tbody tr:nth-child(even) { background: rgba(30, 41, 59, 0.5); }
    html[data-theme="dark"] .nav-btn:hover { background: rgba(107, 163, 163, 0.12); color: #e2e8f0; }
    html[data-theme="dark"] .card:hover { border-color: #475569; }
    html[data-theme="dark"] .kpi-item,
    html[data-theme="dark"] .stat-box,
    html[data-theme="dark"] .dashboard-plan-stage-card {
      background: linear-gradient(165deg, #1e293b 0%, #172033 100%);
    }
    html[data-theme="dark"] .dashboard-plan-completion-details {
      background: rgba(30, 41, 59, 0.6);
      border-color: var(--border);
    }
    html[data-theme="dark"] .card-title { color: #94a3b8; }
    html[data-theme="dark"] .stat-box {
      background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    }
    html[data-theme="dark"] th {
      background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
      color: #cbd5e1;
    }
    html[data-theme="dark"] tbody tr:nth-child(even) { background: rgba(30, 41, 59, 0.5); }
    html[data-theme="dark"] tr:hover { background: rgba(107, 163, 163, 0.14); }
    html[data-theme="dark"] .production-table tbody tr.row-production-fabric-cut-adjust {
      background: rgba(127, 29, 29, 0.35) !important;
      box-shadow: inset 3px 0 0 #f87171;
    }
    html[data-theme="dark"] .production-table tbody tr.row-production-fabric-cut-adjust td {
      color: #fecaca;
    }
    html[data-theme="dark"] .production-table tbody tr.row-production-outsource-due {
      background: rgba(234, 179, 8, 0.18) !important;
      box-shadow: inset 3px 0 0 #facc15;
    }
    html[data-theme="dark"] .production-table tbody tr.row-production-outsource-due td {
      color: #fde68a;
    }
    html[data-theme="dark"] .production-table tfoot td,
    html[data-theme="dark"] #page-outsource table tfoot td,
    html[data-theme="dark"] #page-receive table tfoot td {
      background: linear-gradient(180deg, #1e3a5f 0%, #1e293b 100%);
      color: #e2e8f0;
      border-top-color: #3b82f6;
    }
    html[data-theme="dark"] .prod-foot-label,
    html[data-theme="dark"] #page-outsource .outsource-foot-label,
    html[data-theme="dark"] #page-receive .receive-foot-label { color: #94a3b8; }
    html[data-theme="dark"] #page-receive .receive-milestone-done { color: #4ade80; }
    html[data-theme="dark"] .prod-filter-btn {
      background: #1e293b;
      color: #94a3b8;
      border-color: var(--border);
    }
    html[data-theme="dark"] .prod-filter-btn:hover {
      background: #334155;
      color: #e2e8f0;
      border-color: #64748b;
    }
    html[data-theme="dark"] #page-products .product-analytics-table th {
      background: #334155;
      color: #cbd5e1;
    }
    html[data-theme="dark"] #modal-product-library-help .product-help-table th {
      background: #334155;
      color: #cbd5e1;
    }
    html[data-theme="dark"] #modal-product-library-help code {
      background: rgba(148, 163, 184, 0.15);
    }
    html[data-theme="dark"] #page-forecast .market-snapshot-table th {
      background: #334155;
      color: #cbd5e1;
    }
    html[data-theme="dark"] .announcement-table th { background: #334155; color: #cbd5e1; }
    html[data-theme="dark"] #batch-prod-match-info .batch-prod-match-table th {
      background: #334155;
      color: #cbd5e1;
    }
    html[data-theme="dark"] #batch-prod-match-info {
      background: #1e293b;
      border-color: var(--border);
    }
    html[data-theme="dark"] .production-hscroll-track {
      background: #334155;
      box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
    }
    html[data-theme="dark"] .production-hscroll-thumb {
      background: #64748b;
      border-color: #475569;
    }
    html[data-theme="dark"] .btn-announcement {
      border-color: #b45309;
      background: linear-gradient(180deg, #422006 0%, #451a03 100%);
      color: #fdba74;
    }
    html[data-theme="dark"] #login-gate {
      background:
        radial-gradient(circle at 20% 20%, rgba(59,130,246,0.28), transparent 42%),
        radial-gradient(circle at 80% 85%, rgba(14,165,233,0.22), transparent 46%),
        rgba(2, 6, 23, 0.82);
    }
    html[data-theme="dark"] #login-gate .modal {
      background: rgba(30, 41, 59, 0.97);
      border-color: rgba(148, 163, 184, 0.25);
      box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
    }
    html[data-theme="dark"] #login-gate .modal h3,
    html[data-theme="dark"] #login-gate .login-title { color: #f1f5f9; }
    html[data-theme="dark"] #login-gate .modal > p,
    html[data-theme="dark"] #login-gate .login-subtitle { color: #94a3b8 !important; }
    html[data-theme="dark"] #login-gate .form-row input {
      background: #0f172a;
      border-color: #475569;
      color: #e2e8f0;
    }
    html[data-theme="dark"] #login-gate .form-row input:focus {
      background: #0f172a;
      border-color: rgba(59, 130, 246, 0.75);
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
    }
    html[data-theme="dark"] .login-brand-text { color: #f1f5f9; }
    html[data-theme="dark"] .login-welcome { color: #f1f5f9; }
    html[data-theme="dark"] .login-welcome-en { color: #94a3b8; }
    html[data-theme="dark"] .btn-theme-fab {
      background: #1e293b;
      border-color: #475569;
      color: #e2e8f0;
    }
    html[data-theme="dark"] .btn-theme-fab:hover { background: #334155; }
